<template>
	<view class="content">
		<view class="button-view" @click="saoCodeButton()">扫码</view>
		<view class="button-view" @click="goPage('pages_basics')">基础分包</view>
		<view class="button-view" @click="goPage('pages_student')">员工端分包</view>
		<view class="button-view" @click="goPage('pages_manage')">管理端分包</view>
		<view class="button-view" @click="goPage('pages_safetyCheck')">安全检查分包</view>
		<view class="button-view" @click="goPage('mqtt')">mqtt测试</view>
		<view class="button-view" @click="goPage('video')">video测试</view>
	</view>
</template>

<script>
	import { scanCode } from '@/utils/scanTheCode'
	export default {
		data() {
			return {
				textData:'',
			}
		},
		onLoad(option) {
		},
		mounted(){
			// 写入测试数据
			uni.setStorageSync('mqttUrl',"labcontrol.nwafu.edu.cn/mqtt")
			uni.setStorageSync('mqttUser',"mqtt")
			uni.setStorageSync('mqttPassword',"mqtt@zd1883")
			uni.setStorageSync('cameraExtranetAgent',"https://labcontrol.nwafu.edu.cn/stream/#/")
			uni.setStorageSync('token',"7f75ce2f-ab85-4f91-8583-48f784fb7944")
		},
		methods: {
			//分包跳转
			goPage(type){
				if(type == 'pages_basics'){
					uni.navigateTo({
						url: "/pages_basics/views/demo/index",
					});
				}else if(type == 'pages_student'){
					uni.navigateTo({
						url: "/pages_student/views/demo/index",
					});
				}else if(type == 'pages_manage'){
					uni.navigateTo({
						url: "/pages_manage/views/demo/index",
					});
				}else if(type == 'pages_safetyCheck'){
					uni.navigateTo({
						url: "/pages_safetyCheck/views/demo/index",
					});
				}else if(type == 'mqtt'){
					uni.navigateTo({
						url: "/pages/views/demo/mqttDemo",
					});
				}else if(type == 'video'){
					let obj = {
						type:4,
						subId:'101093843117597435',
					}
					uni.navigateTo({
						url: "/pages/views/videoPlayer?item="+encodeURIComponent(JSON.stringify(obj))
					});
				}
			},
			//扫码按钮
			saoCodeButton(){
				scanCode();
			},
		}
	}
</script>

<style lang="stylus" scoped>
	@import '@/api/request/imagesUrl.styl';
	.content{
		height:100%;
		width:100%;
		// background: url($imagesUrl+'commonality/doors-icon.png') no-repeat center 0px;
		.button-view{
			width:200rpx;
			line-height:40rpx;
			text-align: center;
			margin:20rpx 0 0 20rpx;
			background-color: #0183FA;
			color:#fff;
		}
	}
</style>
