| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- // pages/person/person.js
- import { getHwUserInfo } from '../../utils/util'
- import { taxRegistration } from "../../service/hwVersion";
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- sign: '认证用户',
- userInfo: { authenticationStatus: 0 },
- taxUrl: '',
- taxName: ''
- },
- /**
- * 跳转用户信息列表
- *
- */
- toUserinfo() {
- wx.navigateTo({
- url: '/pages/userinfo/userinfo',
- })
- },
- /**
- * 退出登录
- * 清除所有缓存 并跳转登录页
- */
- quit() {
- wx.showModal({
- title: '是否退出登录',
- cancelColor: '#888A8E',
- confirmColor: '#31364C',
- success: (res) => {
- if (res.confirm) {
- wx.clearStorage({
- success: () => {
- wx.navigateBack({
- delta: 1
- })
- },
- })
- }
- },
- })
- },
- toWebView() {
- if (this.data.taxUrl) {
- wx.navigateTo({
- url: `/pages/web-view/web-view?url=${encodeURIComponent(this.data.taxUrl)}`
- })
- } else {
- wx.showToast({
- title: '该功能暂未开放',
- icon: 'none'
- })
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function () {
- wx.hideHomeButton();
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: async function () {
- wx.hideHomeButton();
- if (wx.getStorageSync('userId') && wx.getStorageSync('userToken')) {
- // 获取用户信息
- await getHwUserInfo()
- this.setData({
- userInfo: wx.getStorageSync('userInfo'),
- })
- taxRegistration().then(res => {
- const data = <responseOptionsType<taxRegistrationResponseType>>res
- this.setData({
- taxUrl: data.data?.taxUrl || '',
- taxName: data.data?.taxName || ''
- })
- if (data.data?.taxMessage && wx.getStorageSync('firstLogin')) {
- wx.showModal({
- title: '提示',
- content: data.data.taxMessage,
- showCancel: false,
- confirmText: '知道了',
- success: res => {
- if (res.confirm) {
- wx.setStorageSync('firstLogin', false)
- }
- }
- })
- }
- })
- } else {
- this.setData({
- userInfo: { authenticationStatus: 0 }
- })
- // wx.reLaunch({
- // url: '/pages/login/login',
- // })
- }
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- })
|