|
|
@@ -1,17 +1,15 @@
|
|
|
export default function ({ isServer, store, req, redirect, route }) {
|
|
|
if (isServer && !req) return
|
|
|
+ if (isServer) return
|
|
|
// nuxt拦截器 存在一个问题,如果进入到了判断的地方,一定需要做跳转路由相关操作,不然会出现404
|
|
|
+ // && window.__wxjs_environment !== 'miniprogram'
|
|
|
if (!store.state.option.wechatInfo.data.openid) {
|
|
|
let ua = store.state.option.userAgent.toLowerCase()
|
|
|
- // let _info = localStorage.getItem('USOFTMALLWECHATINFO')
|
|
|
if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger' && req.url.indexOf('?code') === -1) {
|
|
|
- // 判断是浏览器,且不存在code
|
|
|
- console.log('进入拦截器')
|
|
|
- if (isServer) {
|
|
|
- return redirect(`/mobile/wechat/toggle?url=${route.path}`)
|
|
|
- }
|
|
|
- } else {
|
|
|
- return true
|
|
|
+ // 判断是浏览器,且不存在code且不是微信小程序打开
|
|
|
+ // return redirect(`/mobile/wechat/toggle?url=${route.path}`)
|
|
|
+ // window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com${route.path}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
|
|
|
+ // return
|
|
|
}
|
|
|
}
|
|
|
}
|