<template>
	<view class="p-root-person-userinfo g_w_all g_h_all g_bg_f_5 g_kuaishou">
		<view class="g_h_16"></view>
		<g-panel-form-item
			:list="[
				{
					icon: '',
					label: '修改密码',
					result: '',
					path: '/root/person/pwdLogin',
					tip: 'changePassword',
				},
			]"
			@clickItem="handleClickItem"
		/>
		<view class="g_mt_24">
			<g-panel-form-item
				:list="[
					{
						icon: '',
						label: '用户协议',
						result: '',
						path: '/root/person/agreeUser',
						tip: 'userAgreement',
					},
					{
						icon: '',
						label: '隐私政策',
						result: '',
						path: '/root/person/agreePrive',
						tip: 'proveAgreement',
					},
					{
						icon: '',
						label: '关于' + pageTitle,
						result: '版本' + version,
						path: '/root/person/about',
						tip: 'about',
					},
				]"
				@clickItem="handleClickItem"
			/>
		</view>
		<view class="g_mt_24 g_ml_10 g_mr_10">
			<rh-button primaryColor='#3578f6' btnText="退出登录" type="delete" size="medium" @clickBtn="handleLayout" mode="square" />
		</view>
	</view>
</template>

<script>
export default {
	onReady() {},
	onShareAppMessage() {
		return this.G.shareFun();
	},
	data() {
		return {
			pageTitle: getApp().globalData.title,
			loading: true,
			version: this.G.store().version,
			showInvite: true, // 邀请关注弹窗显示
			isCreator: false,
		};
	},
	onLoad() {
		let that = this;
		this.showInvite = uni.getStorageSync("SHOW_INVITE_ALL") == 1 ? true : false;
	},
	onShow() {
		let that = this;
		that.isCreator = uni.getStorageSync("IS_CREATOR") == 1 ? true : false;
	},
	methods: {
		handleLayout() {
			let that = this;
			that.G.handleConfirm({
				content: "确认退出登录吗？",
				success(res) {
					if (res.confirm) {
						that.G.Get(that.api.login_out, {}, (res) => {
							that.G.clearLocalStorage();
							let params = {
								path: "",
								level: "",
							};
							uni.reLaunch({
								url: "/root/login/index?" + that.G.objToStr(params),
							});
						});
					}
				},
			});
		},
		handleClickItem(e) {
			console.log("item点击事件：", e);
			if (e.item.path) {
				uni.navigateTo({
					url: e.item.path,
				});
			}
		},
		/**
		 *  设置是否显示邀请关注弹窗
		 */
		handleSee(e) {
			console.log(e);
			uni.setStorageSync("SHOW_INVITE_ALL", e == true ? 1 : 2);
		},
	},
};
</script>

<style lang="scss">
.p-root-person-userinfo {
}
</style>
