<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>慧科</title>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge">
		<link rel="shortcut icon" href="images/logo/logo.png" type="image/x-icon">
		<!--公共页面样式-->
		<link rel="stylesheet" type="text/css" href="css/common/common.css">
		<!-- 引入 layui.css -->
		<link href="layui/css/layui.css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="css/common/site.css">
		<link rel="stylesheet" type="text/css" href="css/swiper/swiper-bundle.min.css">
		<!-- 加载Viewer.js样式表 -->
		<link rel="stylesheet" href="css/viewer.min.css" />
	</head>
	<body>
		<div id="app">
			<common-nav @emit="changeTab"></common-nav>
			<common-home @emit="changeTab" v-if="tabFlag == 0"></common-home>
			<common-about v-if="tabFlag == 1"></common-about>
			<common-product @emit="changeTab" v-if="tabFlag == 2"></common-product>
			<common-product-list @emit="changeTab" v-if="tabFlag == 8"></common-product-list>
			<common-product-desc @emit="changeTab" v-if="tabFlag == 9"></common-product-desc>
			<common-news @emit="changeTab" v-if="tabFlag == 3"></common-news>
			<common-news-desc @emit="changeTab" v-if="tabFlag == 10"></common-news-desc>
			<common-produce @emit="changeTab" v-if="tabFlag == 4"></common-produce>
			<common-produce-desc @emit="changeTab" v-if="tabFlag == 11"></common-produce-desc>
			<common-service v-if="tabFlag == 5"></common-service>
			<common-contact v-if="tabFlag == 6"></common-contact>
			<common-desc v-if="tabFlag == 12"></common-desc>
			<common-footer></common-footer>
		</div>
		<script type="text/javascript" src="js/jquery-2.2.3.min.js"></script>
		<script type="text/javascript" src="js/http-vue-loader.js"></script>
		<script type="text/javascript" src="js/axios.min.js"></script>
		<script type="text/javascript" src="js/swiper/swiper-bundle.min.js"></script>
		<script type="text/javascript" src="js/vue.min.js"></script>
		<script type="text/javascript" src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=emOvPJWe7OYMzqsJpMA67pjOwy2YItUe"></script>
		<!-- 加载Viewer.js脚本 -->
		<script type="text/javascript" src="js/viewer.min.js"></script>
		<!-- 引入 layui.js -->
		<script type="text/javascript" src="layui/layui.js"></script>
		<script type="text/javascript">
			// 使用httpVueLoader --- 组件的全局注册和局部注册
			Vue.use(httpVueLoader);
			// 接口地址
			// Vue.prototype.commonApiUrl = "http://localhost:8086"
			Vue.prototype.commonApiUrl = "https://www.herb-key.com/prod-api"
			Vue.prototype.$bus = new Vue() // 安装全局事件总线
			new Vue({
				el: '#app',
				data: function () {
					return {
						tabFlag: 0
					}
				},
				components: {
					// 将组建加入组建库
					'common-nav': 'url:./common/nav.vue',
					'common-about': 'url:./common/about.vue',
					'common-home': 'url:./common/home.vue',
					'common-footer': 'url:./common/footer.vue',
					'common-product': 'url:./common/product.vue',
					'common-product-list': 'url:./common/productList.vue',
					'common-product-desc': 'url:./common/productDesc.vue',
					'common-news': 'url:./common/news.vue',
					'common-news-desc': 'url:./common/newsDesc.vue',
					'common-produce': 'url:./common/produce.vue',
					'common-produce-desc': 'url:./common/produceDesc.vue',
					'common-service': 'url:./common/service.vue',
					'common-contact': 'url:./common/contact.vue',
					'common-desc': 'url:./common/commonDesc.vue'
				},
				mounted(){
				},
				methods: {
					// tab切换
					changeTab(data){
						var navSonOptionsIndex = data.navSonOptionsIndex
						if(navSonOptionsIndex !== undefined && navSonOptionsIndex !== null){
							localStorage.setItem("nav_page_params", navSonOptionsIndex)
						}
						// 数据类型
						if(data.dataType == 0){
							// 关于慧科
							if(data.parentIndex == 1){
								if(navSonOptionsIndex == 1 || navSonOptionsIndex == 2 || navSonOptionsIndex == 3){
									var indexFlag = navSonOptionsIndex == 1 ? 0 : navSonOptionsIndex == 2 ? 1 : navSonOptionsIndex == 3 ? 2 : -1
									localStorage.setItem("hk_common_desc_flag", indexFlag)
									this.tabFlag = 12
									this.$bus.$emit('huike_common_desc')
									return
								}
							} else if(data.parentIndex == 4){ // 慧科生产
								if(navSonOptionsIndex === 0 || navSonOptionsIndex == 1 || navSonOptionsIndex == 2){
									var indexFlag = navSonOptionsIndex === 0 ? 3 : navSonOptionsIndex == 1 ? 4 : navSonOptionsIndex == 2 ? 5 : -1
									localStorage.setItem("hk_common_desc_flag", indexFlag)
									this.tabFlag = 12
									this.$bus.$emit('huike_common_desc')
									return
								}
							}
							this.tabFlag = data.parentIndex
						}
						if(this.tabFlag == 1){
							this.$bus.$emit('huike_about')
						} else if(this.tabFlag == 2){
							this.$bus.$emit('huike_product')
						} else if(this.tabFlag == 3){
							this.$bus.$emit('huike_news')
						} else if(this.tabFlag == 4){
							this.$bus.$emit('huike_produce')
						} else if(this.tabFlag == 5){
							this.$bus.$emit('huike_service')
						} else if(this.tabFlag == 6){
							this.$bus.$emit('huike_contact')
						}
						this.scrollTop()
					},
					// 滚动条置顶
					scrollTop(){
						window.scroll(0, 0);
					}
				}
			})
		</script>
	</body>
</html>
