Procházet zdrojové kódy

测试用例:分享功能优化

洪海涛 před 4 roky
rodič
revize
aed8906f8b

+ 5 - 5
src/views/useCase/components/requirementCase.vue

@@ -32,7 +32,7 @@ export default {
         : getEnv() === 'pre'
           ? 'http://agiletc-pre.intra.xiaojukeji.com/#'
           : 'http://agiletc.intra.xiaojukeji.com/#'
-      const src = `${host}${this.srcHost}${this.$route.query.detailCaseUrl || encodeURIComponent(bizId)}`
+      const src = `${host}${this.$route.query.detailCaseUrl?'/case/caseManager/zhihui/' : this.srcHost }${ this.$route.query.detailCaseUrl || encodeURIComponent(bizId)}`
       return src
     }
   },
@@ -56,12 +56,12 @@ export default {
         const { href, hash } = window.location;
         // 链接跳转时发送message的data
         if (event === 'case-link') {
-          const bizIdParams = payload.url.replace(/http.*case\/caseList\/zhihui\//, ''); // 截取 iframe 传递过来的页面地址
-          if(bizIdParams.search(/http/) > -1) return; // 字符串截取失败终止
-          let websiteUrl = `${ href }&detailCaseUrl=${bizIdParams}`; // 新的页面地址
+          const detailCaseUrl = payload.url.replace(/http.*zhihui\//, ''); // 截取 iframe 传递过来的页面地址
+          if(detailCaseUrl.search(/http/) > -1) return; // 字符串截取失败终止
+          let websiteUrl = `${ href }&detailCaseUrl=${encodeURIComponent(detailCaseUrl)}`; // 新的页面地址
           // 如果当前打开页面地址是已分享地址,则将原有的 detailCaseUrl 值替换
           if (hash.search(/detailCaseUrl/) > -1) {
-            websiteUrl = href.replace(/detailCaseUrl=.*/,`detailCaseUrl=${bizIdParams}`);
+            websiteUrl = href.replace(/detailCaseUrl=.*/,`detailCaseUrl=${encodeURIComponent(detailCaseUrl)}`);
           }
           // 改变浏览器历史URL
           window.history.pushState({url: websiteUrl, title: document.title}, document.title, websiteUrl)