diff --git a/src/views/package-home/index.vue b/src/views/package-home/index.vue index ddd6a24..9c68aa0 100644 --- a/src/views/package-home/index.vue +++ b/src/views/package-home/index.vue @@ -31,6 +31,12 @@ export default { created() { this.getAuth(); }, + computed: { + isWeChat() { + const ua = window.navigator.userAgent.toLowerCase(); + return /micromessenger/.test(ua); + } + }, mounted() { this.getParams(); }, @@ -136,34 +142,43 @@ export default { let isWhiteTitle = this.whiteTitleList.includes(this.currentIotTitle) > 0; let cardInfoBaseUrl = encodeURIComponent(`${commonUrl}/h5-frontendweb/#/cardInfo?imei=${params.imei}&iccid=${params.iccid}`); let toupBaseUrl = encodeURIComponent(`${commonUrl}/h5-frontendweb/#/${params.routerName}?imei=${params.imei}&iccid=${params.iccid}`); - if (this.isHasBasePackage) { - // 有套餐 - if (this.isRecharge) { - // 已支付,跳转话费查询页面 - console.log("有套餐跳转话费查询页面"); - let wxRedUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${cardInfoBaseUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`; - window.location.href = wxRedUrl; - } else if (!this.isRecharge) { - // 未支付, 跳转套餐充值页面 - console.log("跳转套餐充值页面"); - let wxRedUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${cardInfoBaseUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`; - window.location.href = wxRedUrl; - } - } else { - // 无套餐 - if (isWhiteTitle) { - // 是零川或者小台风,跳转话费查询页面 - let wxRedUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${cardInfoBaseUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`; - window.location.href = wxRedUrl; - console.log("无套餐跳转话费查询页面"); + if (this.isWeChat) { + + if (this.isHasBasePackage) { + // 有套餐 + if (this.isRecharge) { + // 已支付,跳转话费查询页面 + console.log("有套餐跳转话费查询页面"); + let wxRedUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${cardInfoBaseUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`; + window.location.href = wxRedUrl; + } else if (!this.isRecharge) { + // 未支付, 跳转套餐充值页面 + console.log("跳转套餐充值页面"); + let wxRedUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${cardInfoBaseUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`; + window.location.href = wxRedUrl; + } } else { - // 跳转错误页面; - this.$router.replace({ - name: 'iotcardError' - }) - console.log("跳转错误页面"); + // 无套餐 + if (isWhiteTitle) { + // 是零川或者小台风,跳转话费查询页面 + let wxRedUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${cardInfoBaseUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`; + window.location.href = wxRedUrl; + console.log("无套餐跳转话费查询页面"); + } else { + // 跳转错误页面; + this.$router.replace({ + name: 'iotcardError' + }) + console.log("跳转错误页面"); + } } + } else { + this.$router.replace({ + name: "cardInfo", + query: { imei: this.params.imei, iccid: this.params.iccid, isShowMenu: true, isHasCode: true } + }); } + // 2023.09.20 废弃 /* if(this.isRecharge) { let redUrl = encodeURIComponent(`${commonUrl}/h5-frontendweb/#/cardInfo?imei=${params.imei}&iccid=${params.iccid}`);