|
@@ -20,46 +20,46 @@ request.interceptors.request.use(config => {
|
|
|
|
|
|
})
|
|
|
request.interceptors.response.use((res) => {
|
|
|
- // if (res && res.data) {
|
|
|
+ if (res && res.data) {
|
|
|
|
|
|
- // switch (res.data.code) {
|
|
|
- // case 200:
|
|
|
- // break;
|
|
|
- // case 401:
|
|
|
- // // Toast("登录失败,需要再次登录")
|
|
|
- // window.setTimeout(() => {
|
|
|
+ switch (res.data.code) {
|
|
|
+ case 200:
|
|
|
+ break;
|
|
|
+ case 401:
|
|
|
+ // Toast("登录失败,需要再次登录")
|
|
|
+ window.setTimeout(() => {
|
|
|
|
|
|
- // switch (import.meta.env.MODE) {
|
|
|
- // case "development":
|
|
|
- // location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx3043c2c1decb01ed&redirect_uri=https://sdjk-h5.zzxcx.net/&response_type=code&scope=snsapi_userinfo&state=LOGIN#wechat_redirect`)
|
|
|
- // break;
|
|
|
- // case "test":
|
|
|
- // location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx3043c2c1decb01ed&redirect_uri=https://sdjk-h51.zzxcx.net/&response_type=code&scope=snsapi_userinfo&state=LOGIN#wechat_redirect`)
|
|
|
- // break;
|
|
|
- // case "production":
|
|
|
- // location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx3043c2c1decb01ed&redirect_uri=https://sdjk-h5.zzxcx.net/&response_type=code&scope=snsapi_userinfo&state=LOGIN#wechat_redirect`);
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }, 2000)
|
|
|
+ switch (process.env.NODE_ENV) {
|
|
|
+ case "development":
|
|
|
+ location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx457ba48e0801c0b6&redirect_uri=https://nbjk1-h5.zzxcx.net/&response_type=code&scope=snsapi_userinfo&state=LOGIN#wechat_redirect`)
|
|
|
+ break;
|
|
|
+ case "test":
|
|
|
+ location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx457ba48e0801c0b6&redirect_uri=https://nbjk1-h5.zzxcx.net/&response_type=code&scope=snsapi_userinfo&state=LOGIN#wechat_redirect`)
|
|
|
+ break;
|
|
|
+ case "production":
|
|
|
+ location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx457ba48e0801c0b6&redirect_uri=https://nbjk-h5.zzxcx.net/&response_type=code&scope=snsapi_userinfo&state=LOGIN#wechat_redirect`);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }, 2000)
|
|
|
|
|
|
- // break;
|
|
|
- // case 502:
|
|
|
- // console.log('进入502')
|
|
|
- // if (res.data.msg == "微信授权无效,请重新授权") {
|
|
|
- // location.replace("https://coach.zzxcx.net/")
|
|
|
- // return
|
|
|
- // }
|
|
|
+ break;
|
|
|
+ case 502:
|
|
|
+ console.log('进入502')
|
|
|
+ if (res.data.msg == "微信授权无效,请重新授权") {
|
|
|
+ location.replace("https://coach.zzxcx.net/")
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- // Toast.fail(res.data.msg)
|
|
|
+ //Toast.fail(res.data.msg)
|
|
|
|
|
|
|
|
|
- // break;
|
|
|
- // default:
|
|
|
- // Toast.fail(res.data.msg)
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ //Toast.fail(res.data.msg)
|
|
|
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// console.log(res)
|
|
|
|