<template>
	<view>
		<view class="content">
			<view style="padding-top: 150rpx;">
				<text class="cuIcon-roundcheckfill" :class="success?'text-success':'text-error'"
					style="font-size: 150rpx;"></text>
			</view>
			<view class="tips">
				<text class="title" v-text="success?'授权成功':'授权失败'"></text>
				<text class="desc" v-text="success?'点击确认继续助力':response.message"></text>
			</view>
			<view class="cu-btn btn radius line-gray" @click.stop="confirm">
				确认
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				response: {},
				success: false
			}
		},
		onLoad(options) {
			this.response = JSON.parse(decodeURIComponent(options.response))
			console.log(this.response);
			if (this.response.resultCode == '0000') {
				this.success = true
			} else {
				this.success = false
			}
		},
		methods: {
			confirm() {
				let productId=this.$cache.get('productId')
				if (!productId) {
					uni.switchTab({
						url:"../index/home"
					})
					return
				}
				let params={
					id:productId,
					authResult:JSON.stringify(this.response)
				}
				uni.reLaunch({
					url:"/pages/activity/activityDetail"+this.$u.queryParams(params),
					success: () => {
						this.$cache.remove('productId')
					}
				})
			},
		}
	}
</script>

<style>
	page {
		background-color: #FFFFFF;

	}
</style>
<style lang="scss" scoped>
	.text-success {
		color: #19be6b;
	}

	.text-error {
		color: #de5454;
	}

	.content {
		display: flex;
		flex-direction: column;
		display: flex;
		justify-content: center;
		align-items: center;

		image {
			width: 150rpx;
			height: 150rpx;
		}

		.tips {
			margin-top: 20rpx;
			display: flex;
			flex-direction: column;
			text-align: center;

			.title {
				font-size: 36rpx;
			}

			.desc {
				margin-top: 20rpx;
				font-size: 28rpx;
				color: #969696;
			}
		}

		.btn {
			margin-top: 40rpx;
			width: 50%;
			padding: 42rpx;
		}
	}
</style>
