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

fix: 移除微信业务跳转直接使用解码后的URL

修改了权限验证和微信授权页面中的跳转逻辑,移除了通过微信业务URL跳转的方式,
直接使用解码后的目标URL进行跳转,简化了跳转流程并避免潜在的问题
lsc 1 месяц назад
Родитель
Сommit
3ffd28dc4a
2 измененных файлов с 10 добавлено и 7 удалено
  1. 2 1
      src/permission.js
  2. 8 6
      src/views/wechatAuth/index.vue

+ 2 - 1
src/permission.js

@@ -51,7 +51,8 @@ router.beforeEach(async(to, from, next) => {
         const redirect_uri = to.query.url ? encodeURIComponent('url=' + encodeURIComponent(to.query.url)) : ''
         const isApp = to.query.isApp ? to.query.isApp : '2'
         if (isApp === '2' && redirect_uri) {
-          window.location.href = `weixin://dl/business/?appid=wxf8a72764a38a40b2&path=pages/index/index&query=${redirect_uri}`
+          // window.location.href = `weixin://dl/business/?appid=wxf8a72764a38a40b2&path=pages/index/index&query=${redirect_uri}`
+          window.location.href = decodeURIComponent(redirect_uri)
         } else if (redirect_uri) {
           window.location.href = decodeURIComponent(redirect_uri)
         } else {

+ 8 - 6
src/views/wechatAuth/index.vue

@@ -176,9 +176,10 @@ export default {
                   //   // 可以添加其他需要的参数
                   //   timestamp: Date.now().toString()
                   // }).toString()
-                  window.location.href = `weixin://dl/business/?appid=wxf8a72764a38a40b2&path=pages/index/index&query=${encodeURIComponent(
-                    'url=' + encodeURIComponent(redirect_uri)
-                  )}`
+                  // window.location.href = `weixin://dl/business/?appid=wxf8a72764a38a40b2&path=pages/index/index&query=${encodeURIComponent(
+                  //   'url=' + encodeURIComponent(redirect_uri)
+                  // )}`
+                  window.location.href = decodeURIComponent(redirect_uri)
                 } else {
                   window.location.href = decodeURIComponent(redirect_uri)
                 }
@@ -304,9 +305,10 @@ export default {
               //   timestamp: Date.now().toString()
               // }).toString()
 
-              window.location.href = `weixin://dl/business/?appid=wxf8a72764a38a40b2&path=pages/index/index&query=${encodeURIComponent(
-                'url=' + encodeURIComponent(redirect_uri)
-              )}`
+              // window.location.href = `weixin://dl/business/?appid=wxf8a72764a38a40b2&path=pages/index/index&query=${encodeURIComponent(
+              //   'url=' + encodeURIComponent(redirect_uri)
+              // )}`
+              window.location.href = decodeURIComponent(redirect_uri)
             } else {
               window.location.href = decodeURIComponent(redirect_uri)
             }