Просмотр исходного кода

feat:微信端 其他域名访问

wangshan 1 год назад
Родитель
Сommit
7cdecf5590
1 измененных файлов с 9 добавлено и 6 удалено
  1. 9 6
      tripartiteAuth/static/js/tripartiteAuth.js

+ 9 - 6
tripartiteAuth/static/js/tripartiteAuth.js

@@ -33,6 +33,8 @@ var vmSol = new Vue({
   data: {
     header_show: false,
     isWeiXinBrowser: true,
+    isH5: true,
+    isApp: true,
     index: 0,
     images: ['/common-module/solution/image/viewImg.png'],
     // ISO img队列
@@ -197,9 +199,10 @@ var vmSol = new Vue({
   created: function () {
     // 再次判断 客户端归属
     // 判断是否是wx环境
-
     var isWeiXinBrowser =
-      navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
+        navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
+    this.isH5 = window.location.href.toLowerCase().indexOf('h5') !== -1
+    this.isApp =  window.location.href.toLowerCase().indexOf('app') !== -1
 
     this.isWeiXinBrowser = isWeiXinBrowser
 
@@ -231,24 +234,24 @@ var vmSol = new Vue({
     },
     // 跳转了解详情
     href_more: function (urlType, urlpathId) {
-      var apporwx = this.isWeiXinBrowser ? 'wx' : 'app'
+      var apporwx = this.isWeiXinBrowser&&!this.isH5&&!this.isApp ? 'wx' : 'app'
       // window.location.href = `https://wx.jianyu360.cn/weixin/frontPage/bigmember/free/perfect_info?source=certificateServices-${apporwx}-landingPage-${urlpathId}`
       // 立即成为 合作商
       if (urlType === 'go_nowcooper') {
         window.location.href =
           `${
-            this.isWeiXinBrowser ? '/weixin/frontPage' : '/jyapp/frontPage'
+            this.isWeiXinBrowser&&!this.isH5&&!this.isApp ? '/weixin/frontPage' : '/jyapp/frontPage'
           }/bigmember/free/perfect_info_partner?source=certificateServices-${apporwx}-landingPage-jy_cooperprocess&header=` +
           encodeURIComponent('立即成为合作商')
       } else {
         window.location.href = `${
-          this.isWeiXinBrowser ? '/weixin/frontPage' : '/jyapp/frontPage'
+          this.isWeiXinBrowser&&!this.isH5&&!this.isApp ? '/weixin/frontPage' : '/jyapp/frontPage'
         }/bigmember/free/perfect_info?source=certificateServices-${apporwx}-landingPage-${urlpathId}`
       }
     },
     // 咨询客服
     gocustomer: function (urlpath) {
-      window.location.href = this.isWeiXinBrowser
+      window.location.href = this.isWeiXinBrowser&&!this.isH5&&!this.isApp
         ? '/big/wx/page/customer'
         : '/jyapp/free/customer'
     }, // 获取二维码