<template>
	<view style="display: flex;flex-direction: column;">
		<!-- 禁用弹窗 -->
			 <restrictedTip ref="restrictedTip"/>
		<!-- #ifdef APP -->
		<text class="iconfont icon-youjiantou zuojiantou" @click="goBack()" style="top: 10rpx;"></text>
		<!-- #endif -->
		
		<view class="">
			<menu-list :menuList="minorMenuLists" @tipMessage="tipMessage()"></menu-list>
		</view>
		
	
	</view>
</template>

<script>
	import  MenuList from "@/components/menuList/menuList.vue"
	import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
	import restrictedTip from '@/components/commonPopup/restrictedTip.vue';
	import api from "@/api/api";
	export default {
		components:{
			MenuList,
			restrictedTip,
		},
		data() {
			return {
				userInfo:{},
				minorMenuLists: [
					{
						key:'1',
						title: '手机号绑定',
						icon: '',
						link: '',
						contentType: uni.getStorageSync('user_mobile'),
						isOpen: true,
						isShow: true,
						isTips: false,
						isType: 'text',
						isJump: false
					},
					{
						key:'2',
						title: '合伙人解约',
						icon: '',
						link: '/myPackageA/setting/logOff',
						isOpen: true,
						isShow: true,
						isTips: false,
						isType: 'radio',
						isJump:false,
					}
				]
			}
		},
		onShow() {
			if(uni.getStorageSync('loginType')=='codelogin'){
							this.queryInfo()
						}
			this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
			if(this.userInfo.partnerIsActive&&this.userInfo.partnerIsActive==2){
				this.minorMenuLists.forEach(item=>{
					if(item.key=='2'){
						item.isJump = true
					}
				})
			}
			// #ifdef H5
			initJssdkShare(() => {
			  setWechatShare();
			}, window.location.href);
			// #endif
		},
		methods:{
			queryInfo() {
							api.queryInfo({userId:uni.getStorageSync('cffp_userId')}).then(res=>{
								// 保存用户得个人信息
								if (res['success']) {
									delete res.data.commonResult
									
									const cffp_userInfo = {
										...res.data
									}
									// 账号禁用用户
									if(res.data.userIsActive&&res.data.userIsActive==2){
										this.$refs.restrictedTip.open()
										uni.setStorageSync('userIsActive',String(res.data.userIsActive))
										return
									}
									if(res.data.userIsActive&&res.data.userIsActive!=2){
										this.$refs.restrictedTip.close()
										uni.removeStorageSync('userIsActive')
									}
									
									uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo));
									uni.setStorageSync('user_mobile', res.data.mobile)
									
								}
								
							})
						},
			goBack() {
				uni.navigateBack({
					delta: 1  
				});
			},
			
		}
	}
</script>

<style lang="scss" scoped>

</style>
