liukangdong
2024-08-05 00bf17838b496e6fcfed2e521f9c27f8f0e3e3c7
wechat_jiaxuan/app.js
@@ -4,26 +4,29 @@
} from './api/index'
import CustomHook from 'spa-custom-hooks';
let globalData = {
  // token: wx.getStorageSync('token'),
  token: '',
  primary: '#B08771',
  bottomLift: ''
}
let pathMap = [
  '/pages/detailDis/product',
  '/pages/detailDis/case',
  '/pages/detailDis/realpic',
  '/pages/consult/detail',
  '/pages/productVideo/index',
]
App({
  globalData,
  onLaunch: function (op) {
    console.log('options', op.query)
    let pathMap = [
      '/pages/detailDis/product',
      '/pages/detailDis/case',
      '/pages/detailDis/realpic',
      '/pages/consult/detail',
      '/pages/productVideo/index',
    ]
    //获取当前设备信息
    const WindowInfo = wx.getWindowInfo()
    if (WindowInfo.safeArea.top > 20) {
      this.globalData.bottomLift = WindowInfo.screenHeight - WindowInfo.safeArea.bottom
    }
  },
  onShow(op) {
    // 授权登录
    var userId = null
    if (op.query.scene) {
@@ -85,12 +88,13 @@
            }
          })
        } else {
          if (op.query.scene) {
            let temp = op.query.scene.split('_')
            wx.navigateTo({
              url: `${pathMap[temp[1]]}?id=${temp[0]}&userId=${temp[2]}`,
            })
          }
          this.globalData.token = token
          // if (op.query.scene) {
          //   let temp = op.query.scene.split('_')
          //   wx.navigateTo({
          //     url: `${pathMap[temp[1]]}?id=${temp[0]}&userId=${temp[2]}`,
          //   })
          // }
        }
      })
    } else {
@@ -134,9 +138,15 @@
        }
      })
    }
  },
  onShow(options) {
    console.log('options', options);
    // const token = wx.getStorageSync('token') || ''
    // if(token){
    //   if (options.query.scene) {
    //     let temp = options.query.scene.split('_')
    //     wx.navigateTo({
    //       url: `${pathMap[temp[1]]}?id=${temp[0]}&userId=${temp[2]}`,
    //     })
    //   }
    // }
  }
})
CustomHook.install({