Bladeren bron

feat: 修复外部链接问题

zhangyuhan 2 jaren geleden
bovenliggende
commit
9439fa9359

+ 2 - 1
src/web/staticres/common-module/messageCenter/js/detail.js

@@ -147,7 +147,8 @@ var vm = new Vue({
       } else {
         let toLink = appType == 'android' ? url.androidUrl : url.iosUrl
         if (toLink) {
-          if (toLink[0] !== '/') {
+          const hasHttp = /^http(s)?:\/\//.test(toLink)
+          if (!hasHttp && toLink[0] !== '/') {
             toLink = '/' + toLink
           }
           // 检查是否 tabbar 页面

+ 2 - 1
src/web/staticres/common-module/messageCenter/js/index.js

@@ -169,7 +169,8 @@ var vm = new Vue({
 
         let toLink = appType == 'android' ? url.androidUrl : url.iosUrl
         if (toLink) {
-          if (toLink[0] !== '/') {
+          const hasHttp = /^http(s)?:\/\//.test(toLink)
+          if (!hasHttp && toLink[0] !== '/') {
             toLink = '/' + toLink
           }
           if (!num) {