<template>
	<view class="page">
		<u-navbar  :is-back='false' title="工作台" :border-bottom="false" :background="bgc" title-color='#2E4975' title-size='36'
			height='45'></u-navbar>
			
		<view class="cont_box">
			<view class="top">
				<image src="https://lxnapi.ccttiot.com/bike/img/static/uMlgu6j9jnDqP1ZFL7xj" mode=""></image>
				应用入口
			</view>
			<view class="app_box">
				<view class="cont" @click="topage(0)">
					<image src="https://lxnapi.ccttiot.com/bike/img/static/unnmUkUif2eWNKFq9fdg" mode=""></image>
					<view class="text">
						运营数据
					</view>
				</view>
				<view class="cont"  @click="topage(1)">
					<image src="https://lxnapi.ccttiot.com/bike/img/static/upJFJIIZ4hbSEuchNQi3" mode=""></image>
					<view class="text">
						收入对账
					</view>
				</view>
				<view class="cont"  @click="topage(2)">
					<image src="https://lxnapi.ccttiot.com/bike/img/static/uNfRjhtxYmMPKaX4DqTS" mode=""></image>
					<view class="text">
						设备管理
					</view>
				</view>
				<view class="cont"  @click="topage(3)">
					<image src="https://lxnapi.ccttiot.com/bike/img/static/ugC3s7fvhckzJN9vqsHa" mode=""></image>
					<view class="text">
						用户管理
					</view>
				</view>
				<view class="cont" @click="topage(4)">
					<image src="https://lxnapi.ccttiot.com/bike/img/static/uM4rBBaXc7b3TmsqQTvz" mode=""></image>
					<view class="text">
						用户页面
					</view>
				</view>
				<view class="cont" @click="topage(5)">
					<image src="https://lxnapi.ccttiot.com/bike/img/static/uM4rBBaXc7b3TmsqQTvz" mode=""></image>
					<view class="text">
						车辆绑定
					</view>
				</view>
			</view>
		</view>
		
		<tab-bar :indexs='0' style=""></tab-bar>
	</view>
</template>

<script>
	export default {
		data() { 
			return {
				bgc: {
					backgroundColor: "#FFFFFF",
				},
				sn:''
			
			}
		},
		onShow() {
			this.$store.dispatch('userInfo', this.$u).then(() => {

				// 执行其他操作...
			});
		
		},
		computed: {
			userId() {
				return this.$store.getters.userId;
			},
		},
		methods: {
			topage(num){
				if(num==0){
					uni.navigateTo({
						url:'/pages_admin/worke/worke_Operation'
					})
				}else if(num==1){
					uni.navigateTo({
						url:'/pages_admin/worke/worke_income'
					})
				}else if(num==2){
					uni.navigateTo({
						url:'/pages_admin/worke/woke_deviceMgmt'
					})
				}else if(num==3){
					uni.navigateTo({
						url:'/pages_admin/worke/worke_user'
					})
				}else if(num==4){
					uni.navigateTo({
						url:'/pages/index/index'
					})
				}else if(num==5){
					uni.navigateTo({
						url:'/pages/bind_sn'
					})
					// uni.scanCode({
					// 	onlyFromCamera: true,
					// 	scanType: ['qrCode'],
					// 	success: res => {
					
					// 		let sn = null;
					// 		let queryParams = res.result.split('?')[1];
					// 		if (queryParams) {
					// 			let params = queryParams.split('&');
					// 			params.forEach(param => {
					// 				let [key, value] = param.split('=');
					// 				if (key === 'sn') {
					// 					sn = value;
					// 				}
					// 			});
					// 		}
							
					// 		this.sn = sn
					// 		console.log(res.result);
					// 		if (this.sn != '') {
								
					// 		}
					
					// 	},
					// 	fail: err => {
					// 		console.error('扫描失败:', err);
					// 		uni.showToast({
					// 			title: '扫描失败',
					// 			icon: 'none'
					// 		});
					// 	}
					// });
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #FFFFFF;
	}

	.page {
		width: 750rpx;

		.cont_box{
			padding: 46rpx 50rpx;
			margin: 68rpx auto;
			width: 680rpx;
			height: 498rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 4rpx 22rpx 0rpx rgba(0,0,0,0.07);
			border-radius: 24rpx 24rpx 24rpx 24rpx;
			.top{
				width: 100%;
				display: flex;
				flex-wrap: nowrap;
				align-items: center;
				image{
					margin-right: 16rpx;
					width: 32rpx;
					height: 32rpx;
				}
				font-weight: 500;
				font-size: 32rpx;
				color: #3D3D3D;
				
			}
			.app_box{
				display: flex;
				flex-wrap: wrap;
				.cont:nth-child(4n) {
				    margin-right: 0;
				}
				.cont{
					margin-right: 60rpx;
					margin-top: 70rpx;
					width: 96rpx;
					display: flex;
					flex-wrap: wrap;
					justify-content: center;
					image{
						width: 54rpx;
						height: 52rpx;
					}
					.text{
						margin-top: 14rpx;
						font-weight: 400;
						font-size: 24rpx;
						color: #3D3D3D;
					}
				}
			}
		}
	}
</style>