From e69e753f6a3b1d2a3237bd3ab1d520c3f9856444 Mon Sep 17 00:00:00 2001 From: chenJinxu <2183691628@qq.com> Date: Fri, 21 Jun 2024 17:29:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E9=9D=9E=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=B5=8F=E8=A7=88=E5=99=A8=E7=8E=AF=E5=A2=83=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E8=AF=9D=E8=B4=B9=E6=9F=A5=E8=AF=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/package-home/index.vue | 65 ++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 25 deletions(-) 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}`);