liukangdong
2024-07-23 7a2084c90ed29a4ec9d4267deb2b78f0d49c904d
wechat_staff/app.js
@@ -1,4 +1,6 @@
import { wxLoginCustomer } from './api/index'
import {
  wxLoginCustomer
} from './api/index'
App({
  globalData: {
    primary: '#B08771',
@@ -10,12 +12,6 @@
    if (WindowInfo.safeArea.top > 20) {
      this.globalData.bottomLift = WindowInfo.screenHeight - WindowInfo.safeArea.bottom;
    } 
    const res = wx.getStorageSync('member')
    if (res) {
      this.globalData.userInfo = res
      console.error("res",res)
    } else {
      // 登录
      wx.login({
        timeout: 5000,
        success(res) {
@@ -24,12 +20,10 @@
            wxLoginCustomer({
              code: res.code
            }).then(res => {
              console.log(res)
              if (res && res.data.users) {
                wx.setStorageSync('member', res.data.users)
                wx.setStorageSync('openid', res.data.users.openid)
            if (res && res.data) {
              wx.setStorageSync('member', res.data.users || '')
                wx.setStorageSync('sessionKey', res.data.sessionKey)
                wx.setStorageSync('token', res.data.token)
              wx.setStorageSync('token', res.data.token || '')
              } else {
                wx.navigateTo({
                  url: '/pages/login/index',
@@ -48,6 +42,5 @@
          console.log(err)
        }
      })
    }
  }
})