<template>
	<view class="flex">
		<image src="../../static/new_index/top.png" mode="widthFix" style="width: 642rpx;margin-top: 76rpx;"></image>
		<image src="../../static/new_index/bottom.png" mode="widthFix" style="width: 310rpx;margin-top: 116rpx;">
		</image>
		<view class="title">{{ type == 1? list[0].title : list[1].title }}</view>
		<view class="tip">{{ type == 1? list[0].tip : list[1].tip }}</view>
		<view class="login_out flexC" @tap="logout">退出绑定</view>
	</view>
</template>

<script>
	import {
		_API_Logout
	} from '@/apis/verify.js'
	export default {
		data() {
			return {
				type: '',
				list: [{
					title: '您长时间未登录被冻结，请联系客服',
					tip: '温馨提示：您已被冻结，暂不能使用系统！如有疑问请及时联系客服'
				}, {
					title: '您的账号已被系统删除',
					tip: '温馨提示：您已被删除，暂不能使用系统！如有疑问请及时联系客服'
				}]
			}
		},
		onLoad(option) {
			this.type = option.type
		},
		methods: {
			// 退出登录
			logout() {
				uni.showLoading({
					mask: true
				})
				_API_Logout().then(() => {
					if (this.$store.state.app.token) {
						this.$store.commit('app/LOGOUT')
						// window.history.replaceState({}, '', '/api/gzh/#/pages/login-reg/login-reg')
						// location.reload()
						this.toWxchatLogin("/pages/login-reg/login-reg", null)
					} else {
						this.$store.commit('app/LOGOUT')
						this.toWxchatLogin("/pages/login-reg/login-reg", null)
					}
				})
				uni.removeStorageSync('isHelper')
			},
			toWxchatLogin(url, state) {
				url = url || "/pages/index/index"
				state = state || "cli"
				const redirect_uri = encodeURIComponent(`${this.$config.redirect_uri}/api/gzh#${url}`)
				const auth = () => window.location.href =
					`${this.$config.wxURL}?appid=${this.$config.appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`
				auth()
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #fff;
	}

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

		.title {
			color: #333333;
			font-size: 40rpx;
			font-weight: bold;
			margin-top: 136rpx;
		}

		.tip {
			width: 560rpx;
			font-size: 28rpx;
			font-weight: 400;
			color: #999999;
			margin-top: 40rpx;
			line-height: 44rpx;
		}
	}

	.login_out {
		width: 220rpx;
		height: 88rpx;
		// background: #007AFF;
		margin-top: 140rpx;
		color: #999;
		font-size: 30rpx;
		color: $base-color;
	}
</style>
