const LOGIN_LIST = ['pages/mine/mine']
/*
 * 全局注入器
 */
let page = {
	data() {
		return {

		}
	},
	computed: {
		//ios底部安全区域
		safeAreaBottom() {
			let info = uni.getSystemInfoSync()
			let safe = 20
			if (
				info && ['devtools', 'ios'].includes(info.platform) &&
				info.statusBarHeight > safe
			) {
				return info.statusBarHeight - safe + 'px'
			}
			return 0
		}
	},
	onLoad(options) {

	},
	onShow() {
		let currentPage = this.$util.getCurrentRoute()
		if (LOGIN_LIST.includes(currentPage)) {
			this.login()
		}
	},
	methods: {
		init(){
			console.log("登录成功，初始化数");
		},
		// 登录 begin
		showLogin() {
			this.$refs.login.show()
		},
		signIn(resp) {
			//获取数据
			this.init()
		},
		async login(e) {
			if (this.$isEmpty(this.vuex_userId)) {
				this.showLogin()
				return
			}
			//获取数据
			this.init()
			//获取手机号
			if (this.$isEmpty(this.vuex_phone)&&this.$config.isAuthPhone) {
				this.$refs.login.showPhoneModal()
			}
		},
		async checkIsCmcc(){
			if (this.$isEmpty(this.vuex_phone)) {
				return
			}
			let params={
				phone:this.vuex_phone
			}
			let res=await this.$api.CMCC.isCMCC(params)
			this.$u.vuex('vuex_isCMCC',!res.data.data)
			if (this.vuex_isCMCC) {
				uni.navigateTo({
					url:"/pages/webview/webview?mobile="+this.vuex_phone
				})
			}
		},
		phoneSuccess(){
			console.log('手机号获取成功>>>>>>>>');
		},
		// 登录 end
	},

}

export default page
