<template>
	<div>
		<!-- <a  @click="login">云版本</a>
		<a href="http://xpgj.xiaoxinda.com/xpgj/xsy/home/#/user/login?project=business">湖北新生源生物专版</a> -->
		<header class="mui-bar mui-bar-nav">
				<h1 class="mui-title">欢迎使用小鹏管家</h1>
			</header>
			<div class="mui-content von-xzbb">
				<ul class="mui-table-view mui-grid-view mui-grid-9">
					<li class="mui-table-view-cell mui-media mui-col-xs-6">
						<a @click="login">
							<div class="mui-pull-left von-xzbb-logo"><img src="~$project/assets/img/logo_xiaopengguanjia.png" /></div>
							<span class="mui-pull-left von-xzbb-tit">云版本</span>
						</a>
					</li>
					<li class="mui-table-view-cell mui-media mui-col-xs-6" v-for="(item,i) in list" :key="i">
						<a @click="loginUrl(item)">
							<div class="mui-pull-left von-xzbb-logo"><img :src="'https://xpgj.xiaoxinda.com/xpgj/prod/logo/'+item.logo" /></div>
							<span class="mui-pull-left von-xzbb-tit">{{item.name}}</span>
						</a>
					</li>
				</ul>
			</div>
	</div>
</template>

<script>
	export default {
		name: 'Home',
		components: {
		
		},
		
		data() {
			return {
				list:[
					{
						name:"新生源版",
						path1:"http://xpgj.xiaoxinda.com/xpgj/xsy/#/",
						path2:"http://xpgj.xiaoxinda.com/xpgj/xsy-test/#/",
						path1login:"http://xpgj.xiaoxinda.com/xpgj/xsy/#/",
						path2login:"http://xpgj.xiaoxinda.com/xpgj/xsy-test/#/",
						login:"user/login",
						main:"master",
						key:"xpgj_xsy_token",
						logo:'logo_xsy01.jpg'
						
					},
					{
						name:"华中山鹰",
						path1:"https://xpgj.xiaoxinda.com/xpgj/prod/home/#/",
						path2:"https://xpgj.xiaoxinda.com/xpgj/test/home/#/",
						
						path1login:"https://xpgj.xiaoxinda.com/xpgj/prod/business/#/",
						path2login:"https://xpgj.xiaoxinda.com/xpgj/test/business/#/",
						
						login:"user/login?sceneId=1&companyId=dc6dcd4c-cea2-41ed-93e1-10b8adf4bd54&companyName=山鹰华中纸业有限公司",
						main:"master",
						key:"xpgj_token",
						logo:'logo_hzsy.png'
						
					}
				]
			}
		},
		created() {},
		methods: {
			loginUrl(item){
				if (process.env.VUE_APP_NODE_NAME == 'production') {
					window.location.href = item.path1+item.login;//正式版本
				}else{
					window.location.href = item.path2+item.login; //测试版本
				}
			},
			login(){
				this.$router.push({
										name: 'UserLogin',
										query: {
											project:"business"
										}
									})
			},
			asynCallBack() {
				//登录状态判断
				
			},
		},
		mounted() {
			for(var i in this.list){
				var obj=this.list[i];
				var key=window.localStorage.getItem(obj.key);
				if(key){
					if (process.env.VUE_APP_NODE_NAME == 'production') {
						window.location.href = obj.path1login+obj.main;//正式版本
					}else{
						window.location.href = obj.path2login+obj.main; //测试版本
					}
				}
			}
            document.body.style.backgroundColor = '#fff';
        },
        destroyed() {
           document.body.style.backgroundColor = '';
         },
		
	}
</script>

<style scoped src="$project/assets/css/xpgj.css"></style>
<style src="$project/assets/css/iconfont.css"></style>
<style>
	.mui-bar{
		box-shadow: initial;
	}
	.mui-bar-nav ~ .von-xzbb.mui-content{
		padding-top:60px;
		background:0
	}
</style>
