<template>
	<div>
		<common @asynCallBack="asynCallBack"></common>
		<top-header :pageTitle="pageTitle" :leftShow="false"></top-header>

		<div class="mui-content margin60">
			<div class="vongi-choose">
				<h1>选择行业</h1>
				<h5>“小鹏管家”是智慧物业、智慧园区、智慧养老的云管家，是智慧生活的守护神。管家服务于访客、园区（包括小区、居家+机构养老、企事业单位、厂区）人员及管理者。主要功能包括出入管理、健康监管、考勤打卡、物业管理、安全监管、访客管理以及在线缴费等。</h5>
				<ul class="mui-table-view">
					<li class="mui-table-view-cell mui-media vongi-choose-yq">
						<a @click="toPage('business')" class="mui-navigate-right">
							<img class="mui-media-object mui-pull-left" src="~$project/assets/img/icon02.png">
							<div class="mui-media-body">
								工厂园区
								<p class='mui-ellipsis'>适用于办公楼、工厂、工业园等场所</p>
							</div>
						</a>
					</li>
					<li class="mui-table-view-cell mui-media vongi-choose-zz kfz">
						<a class="mui-navigate-right">
							<img class="mui-media-object mui-pull-left" src="~$project/assets/img/icon17.png">
							<div class="mui-media-body">
								社区住宅
								<p class='mui-ellipsis'>适用于社区、小区、公寓等场所</p>
							</div>
						</a>
					</li>
					<li class="mui-table-view-cell mui-media vongi-choose-yl kfz">
						<a class="mui-navigate-right">
							<img class="mui-media-object mui-pull-left" src="~$project/assets/img/icon46.png">
							<div class="mui-media-body">
								机构、居家养老
								<p class='mui-ellipsis'>适用于养老院、居家养老等场所</p>
							</div>
						</a>
					</li>
				</ul>
			</div>
		</div>
		<div class="fyy-footer kfz">
			<div class="bindfyy-btn"><button type="submit" class="mui-btn mui-btn-outlined">我是访客</button></div>
		</div>
	</div>
</template>

<script>
	import Common from '$project/components/Common.vue'
	import Loading from '$project/components/Loading.vue'
	import TopHeader from '$project/components/TopHeader.vue'
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	import * as types from '$project/store/mutation-types'
	export default {
		name: 'Home',
		components: {
			Common,
			Loading,
			TopHeader
		},
		data() {
			return {
				pageTitle: '选择行业',

				visterScene: {
					project: '',
					role: ''
				}
			}
		},
		created() {
			if (this.vister_scene) {
				this.visterScene = this.vister_scene;
			}
		},
		methods: {
			//页面跳转
			toPage(project) {
				this.visterScene.project = project;
				this.set_vister_scene(this.visterScene);
				this.$router.push({
					name: 'Role',
					query: {
						project: project
					}
				})
			},
			//确认
			sure() {
				this.set_vister_scene(this.visterScene);
				if (this.visterScene.project == 'business') {
					if (this.visterScene.role == '1') {
						window.location.href = "../" + this.visterScene.project + '/#/master';
					} else if (this.visterScene.role == '2') {
						window.location.href = "../" + this.visterScene.project + '/#/houseKeeper/admin';
					} else if (this.visterScene.role == '3') {
						window.location.href = "../" + this.visterScene.project + '/#/houseKeeper/control';
					} else {
						mui.toast('请选择角色');
					}
				} else {
					mui.toast('未开放场景');
				}
			},
			asynCallBack() {
				//如果场景是存在的则直接跳转
				if (this.vister_scene && !this.$route.query.exchange && this.vister_scene.project && this.vister_scene.role) {
					this.sure();
				}
			},
			...mapMutations({
				set_vister_scene: types.SET_VISTER_SCENE,
			})
		},
		mounted() {},
		destroyed() {

		},
		computed: {
			...mapGetters({
				openId: 'wx_openid',
				token: 'token',
				person_data: 'person_data',
				company_data: 'company_data',
				vister_scene: 'vister_scene',
			})
		}
	}
</script>

<style src="$project/assets/css/iconfont.css"></style>
<style scoped src="$project/assets/css/xpwyfyy.css"></style>
<style scoped>
</style>
