jumpAuthMixin.js 928 Bytes
module.exports = Behavior({
  methods: {
    getNickNameAndHeadUrl() {
      const redirectUrl = `https://scrm.glsx.com.cn/wy-wx-oauth`,
        appid = 'wx1cf40dc91c28a7fd',
        wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(redirectUrl)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
      wx.p.router.jumpH5(wxUrl)
    },
    jumpLoading() {
      const {
        options
      } = this
      let query = ['isLogin=1'],
        params = {
          merchantId: options.merchantId || ''
        }
      Object.keys(options).map(key => {
        if (key != 'scene') query.push(`${key}=${options[key]}`)
      })
      let url = encodeURIComponent(`/${this.route}?${query.join('&')}`)
      params.url = url
      if (options.scene) params.scene = options.scene
      wx.p.router.redirectTo('/pages/loading/loading', params)
   },
  }
})