<template>
	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
		<cus-header title='配置网络' :backAlert="true"></cus-header>
		<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/e6540154-b4da-4ddd-ab9b-8f219d5c18a6.png"></image>
		<template v-if="type=='jpw'">
			<p>网络配置成功，快去体验吧~</p>
			<div class="zt_btn" @tap="goBack">返回首页</div>
		</template>
		<template v-else>
			<p>网络配置成功</p>
			<p class="tip">请扫描设备或说明书上的二维码<br>点击下方扫码绑定设备</p>
			<div class="zt_btn" @tap="scanDevice">扫码绑定设备</div>
		</template>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				type:''
			}
		},
		onLoad(option) {
			this.type = option.pwtype||'';	
		},
		methods:{
			scanDevice(){
				let that = this;
				uni.scanCode({
					success: (res) => {
						try{
							let result = JSON.parse(res.result);
							if(res.errMsg==='scanCode:ok'){
								uni.navigateTo({
									url:'/pagesMy/scanResult?scanParams='+JSON.stringify(result)
								})
							}
						}catch(e){
							that.$showModal('扫码失败，请检查设备二维码。')
						}
					}
				})
			},
			goBack(){
				uni.reLaunch({
					url:'/pages/home'
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.page{
		background: #FFFFFF;
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 0 70rpx;
		
		image{
			width: 213rpx;
			height: 163rpx;
			margin-top: 198rpx;
		}
		p{
			font-family: PingFang-SC, PingFang-SC;
			font-weight: bold;
			font-size: 40rpx;
			color: #111111;
			line-height: 40rpx;
			text-align: center;
			margin-top: 54rpx;
			&.tip{
				font-weight: 400;
				font-size: 28rpx;
				color: #7C8592;
				line-height: 42rpx;
				text-align: center;
				margin-top: 40rpx;
			}
		}
		.zt_btn{
			margin-top: 193rpx;
		}
		.qx_btn{
			margin-top: 60rpx;
		}
	}
</style>