<template>
</template>

<script>
	export default {
		onShow() {
			// console.log(1)
			let that = this;
			wx.showModal({
				title: '温馨提示',
				content: '即将进入新的小程序',
				showCancel: true, //是否显示取消按钮
				cancelText: "取消", //默认是“取消”
				cancelColor: '#000000', //取消文字的颜色
				confirmText: "确定", //默认是“确定”
				confirmColor: '#ff7514', //确定文字的颜色
				success: function(res) {
					if (res.cancel) {
						//点击取消，wx.navigateBack
						uni.switchTab({
							url: '/pages/shouye/index'
						})
					} else {
						that.toNewMp()
						// 使用wx.navigateToMiniProgram跳转到小程序
					}
				},
				fail: function(res) {
					//接口调用失败的回调函数，wx.navigateBack
				},
				complete: function(res) {
					//接口调用结束的回调函数（调用成功、失败都会执行）
				},
			})
		},
		methods: {
			toNewMp() {
				uni.navigateToMiniProgram({
					appId: uni.getStorageSync('jump_appid'), // 此为生活缴费appid
					path: 'pages/my/index?token=' + uni.getStorageSync('token'), // 此为生活缴费首页路径
					envVersion: "release",
					extraData: {
						'token': uni.getStorageSync('token')
					},
					success: res => {
						// 打开成功
						console.log("打开成功", res);
					},
					fail: err => {
						console.log(err, '取消了');
						uni.switchTab({
							url: '/pages/shouye/index'
						})
					}
				})
			},
		}
	}
</script>

<style>
</style>
