<template>
	<view class="content">
		<view class="hg100"></view>
		<navigator class="item flex-center" url="../enabling/enabling">
			{{save_url?save_url:`请选择${$test.$test}内容`}}
		</navigator>
		<view class="hg300"></view>
		<button @click="submit" class="login-btn flex-center">保存</button>
    	<view class="tip">温馨提示：小程序{{$test.$test}}仅限于平台提供的小程序使用，如有疑问请联系客服。</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				$test: this.$test.$test,
				save_url: "",
				id: "",
			}
		},

		onLoad() {
			this.set_isxcx();
		},
		methods: {
			set_isxcx() {
				this.request({
					url: "user/set_isxcx",
					data: {
						token: uni.getStorageSync("token"),
					},
				}).then(res => {
					console.log(res, "res")
					if (res.code === '200') {
						this.save_url = res.data.qrurl;
					}
				});
			},
			submit(e) {
				this.request({
					url: "user/save_isxcx",
					data: {
						token: uni.getStorageSync("token"),
						id: this.id
					},
				}).then(res => {
					console.log(res, "user/gzhurl");
					if (res.code == 200) {
						uni.showToast({
							title: "保存成功",
							icon: 'none'
						})
						setTimeout((res) => {
							uni.navigateBack({
								delta: 1
							})
						}, 2000)
					}
				}).catch((res) => {
					console.log("message", res)
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				});
			}
		},
	}
</script>

<style>
	.tip {
		text-align: center;
		font-size: 28rpx;
		color: #999999;
	}

	.hg100 {
		height: 200rpx;
	}

	.hg300 {
		height: 300rpx;
	}

	.item {
		width: 600rpx;
		margin: 0 auto;
		background: #FFFFFF;
		box-shadow: 0px 0px 10rpx rgba(168, 168, 168, 0.16);
		opacity: 1;
		border-radius: 4rpx;
		min-height: 100rpx;
		padding: 20rpx;
		word-wrap: break-word;
		word-break: break-all;
	}

	.login-btn {
		width: 630rpx;
		height: 90rpx;
		background: linear-gradient(132deg, rgb(64, 158, 255) 0%, rgb(64, 158, 255) 100%);
		box-shadow: 0px 2rpx 12rpx rgb(64, 158, 255);
		opacity: 1;
		border-radius: 45rpx;
		margin: 0 auto;
		color: #FFFFFF;
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		opacity: 1;
	}
	
	.tip {
		text-align: center;
		font-size: 26rpx;
		color: #999999;
		padding: 50rpx 0;
		width: 600rpx;
		margin: 0 auto;
	}
	
</style>
