2025-09-24 21:28:48 +08:00

51 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { miniProgramVersion, onGoH5Page } from '../../utils/getUserInfo'
import { handleShareAppMsg } from '../../utils/configs'
import { apiProblemLog } from '../../api/index/index'
import { apiLogout } from '../../api/login/index'
const H5Link = require('../../api/base').allBaseUrl.GDEnvs.web
Page({
data: {
appVersion: miniProgramVersion,
realNameStatus: '', // 实名状态 realNameStatus 0未实名1实名
phone: '' // 用户手机号
},
onGoH5 (e: any) {
apiProblemLog({ remark: JSON.stringify({ logName: '身份证更新', logParams: e }) })
onGoH5Page({ is_need_login: true, url: `${H5Link}${e.currentTarget.dataset.field}` })
},
// 点击退出登录
onLogout() {
apiLogout().then((res: any)=> {
if (res.code === '1000') {
wx.showToast({ title: '操作成功!', icon: 'none' })
try {
wx.removeStorageSync('user_info')
} catch (e) {
console.log('退出登录catch', e)
}
setTimeout(() => {
wx.reLaunch({ url: '/pages/index/index' })
}, 1000)
} else {
wx.showToast({ title: res.msg, icon: 'none' })
}
})
},
// 获取用户手机号
onLoad (options) {
this.setData({ realNameStatus: options.realNameStatus })
try {
const user_info = wx.getStorageSync('user_info')
if (user_info) {
this.setData({ phone: user_info.phone })
}
} catch (e) {
console.log('获取首页状态catch', e)
}
},
// 用户点击右上角分享
onShareAppMessage() {
handleShareAppMsg()
}
})