<template>
	<van-nav-bar
	  title="智慧“和顺”"
	  left-text="民宗干事"
	  left-arrow
	  @click-left="onClickLeft"
	/>

	<van-image
		width="100%"
		height="10rem"
		fit="cover"
		src="https://img1.baidu.com/it/u=2086445453,3056906789&fm=253&fmt=auto&app=138&f=GIF?w=1378&h=400"
		/>

	<div class="tabtitlelay">
		<div class="tabtitle1"></div>
		<div class="tabtitle">我的待办</div>
		<div class="tabtitle2">（</div>
		<div class="tabtitle3">15</div>
		<div class="tabtitle4">）</div>
		<van-icon name="ellipsis" class="tabtitle5" @click="goToBeDone"/>
	</div>

	<div class="flexll">
		<div class="ffl2">
			<div class="textRegular">待处理</div>
			<div class="textRed">{{con1}}</div>
		</div>
		<div class="verticalLine"></div>
		<div class="ffl2">
			<div class="textRegular">已处理</div>
			<div class="textBlue">8</div>
		</div>
	</div>
	<div class="hLine"></div>

	<div class="tabtitlelay">
		<div class="tabtitle1"></div>
		<div class="tabtitle">场所管理</div>
	</div>

	<van-grid :border="false">
		<van-grid-item icon="photo-o" to="/placeRegister" text="场所登记" @click="getsome2" />
		<van-grid-item icon="photo-o" to="/placePerson" text="场所人员信息" @click="getsome3" />
		<van-grid-item icon="photo-o" text="牌位管理" />
	</van-grid>

	<div class="hLine"></div>

	<div class="tabtitlelay">
		<div class="tabtitle1"></div>
		<div class="tabtitle">活动管理</div>
	</div>

	<van-grid :border="false" >
		<van-grid-item icon="photo-o" to="/placeActivityList" text="场所活动" />
		<van-grid-item icon="photo-o" to="/selfMeetingList" text="私设聚会点" />
		<van-grid-item icon="photo-o" to="/abnormalCrowd" text="信教群众异常" />
		<van-grid-item icon="photo-o" text="场所检查" />
		<van-grid-item icon="photo-o" text="安防设施异常" />
		<van-grid-item icon="photo-o" text="负责人会议" />
		<van-grid-item icon="photo-o" to="/setting" text="其他" />
	</van-grid>
</template>

<script>
import tool from "@/tool";

	export default {
		data() {
			return{
                title:'民宗干事',
				username:"",
				sms:"",
				password:"",
				password2:"",
				con1:"0",
			}
		},

		created(){
			let id=this.$route.query.id;
			this.getSome();
			this.TokenLogin();


		},

		methods:{
			//跳转
    
    goToBeDone(){
      this.$router.push("/toBeDone")
    },

			onClickLeft(){
				history.back();
			},



			async TokenLogin(){

				let that=this;

				//SDK中 getToken() 方法获取免登token
				// window.xm.getToken().then(async function(token){
				// 	console.log(token);

				// 	const inputForm ={
				// 	'token': token
				// 	}
				// 	var res = await this.$API.yin.TokenLogin.get(inputForm);

				// })


				const inputForm ={
					'token': "ssssssss"
				}
				var res = await this.$API.yin.TokenLogin.get(inputForm);
				console.log(res);

				//this.$store.commit('setUser',data);


				// if (res.type == 1) {
				// 	this.$router.replace({
				// 		path: "/main",
				// 	});
				// } else {
				// 	Toast.fail(res.message);
				// }

			},


			getSome(){


			},

			async getsome2(){

				let that=this;

				//SDK中 getToken() 方法获取免登token
				window.xm.getToken().then(function(token){
					console.log(token);

					that.con1="哈哈"+token;
					window.xm.showToast({
						message:that.con1
					})

				})

				const inputForm ={
					'iamRequestId': '120010',
					'iamRemoteUser': 'admin12022',
					'iamRemotePwd': ''
				  }
				// login(inputForm).then(({data}) => {
				// 	this.$store.commit('setUser',data);
			   	// })

				//var res = await this.$API.yin.TokenLogin.post(inputForm);
				var res = await this.$API.yin.SchemaService.post(inputForm);

                if (res.type == 1) {
                    this.$router.replace({
                        path: "/main",
                    });
                } else {
                    Toast.fail(res.message);
                }

			},

			async getsome3(){
				console.log("11");

				var datas = {
					username: "admin",
            	};
				var res = await this.$API.my.OrderDetails.get(datas);
				this.con1=res;
                console.log(res);
			},


			//用户数据同步测试用(用户保存)
			async getUser1(){
				const inputForm ={
					'iamRequestId': '120010',
					'iamRemoteUser': 'admin',
					'iamRemotePwd': '11',
					'loginName': 'yzt2',
					'name': '同步用户2',
					'password': '111',
					'idcard': '320911199010000002',
					'email': '818166662@qq.com',
					'phone': '88868882',
					'mobile': '1829999992',
					'loginFlag': '1',
					'photo': '',
					'sign': '个性签名2',
				  }
				var res = await this.$API.yin.UserCreateService.post(inputForm);

                console.log(res);
			},
			//(用户更新)
			async getUser2(){
				const inputForm ={
					'iamRequestId': '120010',
					'iamRemoteUser': 'admin',
					'iamRemotePwd': '11',
					'uid': '1639158103696228354',
					'loginName': 'yzt222',
					'name': '11',
					// 'password': '',
					// 'idcard': '',
					// 'email': '',
					// 'phone': '',
					// 'mobile': '',
					// 'loginFlag': '',
					// 'photo': '',
					// 'sign': '',
				  }
				var res = await this.$API.yin.UserUpdateService.post(inputForm);
				console.log(res);

			},
			//(用户删除)
			async getUser3(){
				const inputForm ={
					'iamRequestId': '120010',
					'iamRemoteUser': 'admin',
					'iamRemotePwd': '111',
					'uid': '1639158103696228354',
				  }
				var res = await this.$API.yin.UserDeleteService.post(inputForm);
                console.log(res);

			},

		},

	};
</script>

<style>

</style>
