<template>
	<view class="page flex-col" style="padding: 20px;text-align: center;">

		<view class="group_7 flex-col">
			<image class="image_13" referrerpolicy="no-referrer"
				src="/static/index/psxhll1soar5dp5wn2jlvvrqvf7b47fqmkea3a0403-f365-4753-82b1-86b4727a2b1e.png" />
			<text class="text_11">爱享城</text>
			<text class="text_12">ENJOY&nbsp;PATTING</text>
			<view class="image-text_6 flex-row justify-between">
				<image class="label_1" referrerpolicy="no-referrer"
					src="/static/index/psadrazbttmrtxhnxze76fefzf3t4bnn6j65a90f56-ee02-44e1-b656-03bb113cf40b.png" />
				<text class="text-group_7">热点资讯资讯 敬请期待！</text>
			</view>
		</view>
	</view>

</template>
<script>
	export default {
		data() {
			return {
				userinfo: null,
				data: {
					_token: "",
					uid: 0,
				}
			}
		},
		onLoad() {

		},
		onShow() {
			var user = this.$api.getUserinfo();
			if (user) {
				this.userinfo = user;
				this.data.id = user.id;
				this.getMhUserinfo();
			} else {
				this.userinfo = null;
				uni.showToast({
					title: "请先登录",
					icon: "none"
				})
				setTimeout(function() {
					uni.navigateTo({
						url: "/pages/lanhu_login/index"
					})
				}, 1000)
			}
		},
		methods: {
			getMhUserinfo() {
				var data = new Object();
				data.uid = this.data.id;
				this.$api
					.MhPostModel(data, 'user/info')
					.then(res => {
						//// console.log('user/info信息', JSON.stringify(res));
						if (res.data.code != 1) {

						} else {
							this.userinfo = res.data.data;
							if (this.userinfo.duihuan == 1) {
								uni.showModal({
									title: '提示',
									content: '请进入兑换区复购，恢复预约功能！',
									showCancel: false,
									success: function(res) {
										if (res.confirm) {
											uni.navigateTo({
												url: '/pages/shop/duihuan'
											});
										} else if (res.cancel) {
											console.log('用户点击取消');
										}
									}
								});
							}
							this.$api.setUserinfo(res.data.data);

						}
					})
					.catch(err => {
						// console.log('request fail', JSON.stringify(err));
					});
			},
		}
	}
</script>
<style lang='css'>
	@import '../common/common.css';
	@import './assets/style/index.rpx.css';
</style>