소스 검색

feat: 将项目中使用了 window.open(bigScreenHref, '_self')的地方调整为this..push,解决路跳转到非指定路由上的问题

wu.jian2 1 년 전
부모
커밋
916128e753

+ 8 - 2
data-room-ui/packages/BigScreenList/EditForm.vue

@@ -377,13 +377,19 @@ export default {
     },
     // 跳转设计态
     toDesign (form) {
-      const { href: bigScreenHref } = this.$router.resolve({
+      // const { href: bigScreenHref } = this.$router.resolve({
+      //   path: window.BS_CONFIG?.routers?.designUrl || '/big-screen/design',
+      //   query: {
+      //     code: form.code
+      //   }
+      // })
+      // window.open(bigScreenHref, '_self')
+      this.$router.push({
         path: window.BS_CONFIG?.routers?.designUrl || '/big-screen/design',
         query: {
           code: form.code
         }
       })
-      window.open(bigScreenHref, '_self')
     }
   }
 }

+ 9 - 3
data-room-ui/packages/BigScreenList/index.vue

@@ -232,13 +232,19 @@ export default {
     },
     design (screen) {
       const path = window.BS_CONFIG?.routers?.designUrl || '/big-screen/design'
-      const { href } = this.$router.resolve({
+      // const { href } = this.$router.resolve({
+      //   path,
+      //   query: {
+      //     code: screen.code
+      //   }
+      // })
+      // window.open(href, '_self')
+      this.$router.push({
         path,
         query: {
           code: screen.code
         }
       })
-      window.open(href, '_self')
     },
     add () {
       const page = {
@@ -309,7 +315,7 @@ export default {
      */
     getCoverPicture (url) {
       return getFileUrl(url)
-    },
+    }
   }
 }
 </script>

+ 8 - 2
data-room-ui/packages/BigScreenManagement/addDialog.vue

@@ -392,13 +392,19 @@ export default {
     // 跳转设计态
     toDesign (form) {
       // eslint-disable-next-line no-case-declarations
-      const { href: bigScreenHref } = this.$router.resolve({
+      // const { href: bigScreenHref } = this.$router.resolve({
+      //   path: window.BS_CONFIG?.routers?.designUrl || '/big-screen/design',
+      //   query: {
+      //     code: form.code
+      //   }
+      // })
+      // window.open(bigScreenHref, '_self')
+      this.$router.push({
         path: window.BS_CONFIG?.routers?.designUrl || '/big-screen/design',
         query: {
           code: form.code
         }
       })
-      window.open(bigScreenHref, '_self')
     },
     // 得到模板列表
     getTemplateList (type) {

+ 9 - 3
data-room-ui/packages/BigScreenManagement/index.vue

@@ -51,7 +51,7 @@
                 <span class="el-dropdown-link menu-dropdown-link">
                   <i class="el-icon-more" />
                 </span>
-                <el-dropdown-menu  slot="dropdown">
+                <el-dropdown-menu slot="dropdown">
                   <el-dropdown-item @click.native="handleDropdownClick('edit',data,node)">编辑 </el-dropdown-item>
                   <el-dropdown-item
                     v-if="data.type!=='catalog'"
@@ -593,13 +593,19 @@ export default {
         className
       }).then((code) => {
         const path = window.BS_CONFIG?.routers?.designUrl || '/big-screen/design'
-        const { href } = this.$router.resolve({
+        // const { href } = this.$router.resolve({
+        //   path,
+        //   query: {
+        //     code: code
+        //   }
+        // })
+        // window.open(href, '_self')
+        this.$router.push({
           path,
           query: {
             code: code
           }
         })
-        window.open(href, '_self')
       }).finally(() => {
         this.templateLoading = true
       })

+ 29 - 14
data-room-ui/packages/ComponentList/EditForm.vue

@@ -526,20 +526,35 @@ export default {
     // 跳转设计态
     toDesign (form) {
       const path = this.type === 'component' ? (window.BS_CONFIG?.routers?.designUrl || '/big-screen/design') : 'big-screen-biz-component-design'
-      const { href: bigScreenHref } = this.type === 'bizComponent' ? this.$router.resolve({
-        path,
-        query: {
-          code: form.code,
-          type: this.bizType
-        }
-      }) : this.$router.resolve({
-        path,
-        query: {
-          code: form.code
-        }
-      })
-      // 新窗口打开
-      window.open(bigScreenHref, '_self')
+      // const { href: bigScreenHref } = this.type === 'bizComponent' ? this.$router.resolve({
+      //   path,
+      //   query: {
+      //     code: form.code,
+      //     type: this.bizType
+      //   }
+      // }) : this.$router.resolve({
+      //   path,
+      //   query: {
+      //     code: form.code
+      //   }
+      // })
+      // window.open(bigScreenHref, '_self')
+      if (this.type === 'bizComponent') {
+        this.$router.push({
+          path,
+          query: {
+            code: form.code,
+            type: this.bizType
+          }
+        })
+      } else {
+        this.$router.push({
+          path,
+          query: {
+            code: form.code
+          }
+        })
+      }
     }
   }
 }

+ 10 - 4
data-room-ui/packages/ComponentList/index.vue

@@ -346,14 +346,20 @@ export default {
     },
     design (screen) {
       const path = this.catalogInfo === 'component' ? (window.BS_CONFIG?.routers?.designUrl || '/big-screen/design') : (window.BS_CONFIG?.routers?.bizComponentDesignUrl || 'big-screen-biz-component-design')
-      const { href } = this.$router.resolve({
+      // const { href } = this.$router.resolve({
+      //   path,
+      //   query: {
+      //     code: screen.code
+      //   }
+      // })
+      // 新窗口打开
+      // window.open(href, '_self')
+      this.$router.push({
         path,
         query: {
           code: screen.code
         }
       })
-      // 新窗口打开
-      window.open(href, '_self')
     },
     add () {
       const page = {
@@ -426,7 +432,7 @@ export default {
      */
     getCoverPicture (url) {
       return getFileUrl(url)
-    },
+    }
   }
 }
 </script>

+ 8 - 2
data-room-ui/packages/SourceList/EditForm.vue

@@ -321,13 +321,19 @@ export default {
     },
     // 跳转设计态
     toDesign (form) {
-      const { href: bigScreenHref } = this.$router.resolve({
+      // const { href: bigScreenHref } = this.$router.resolve({
+      //   path: window.BS_CONFIG?.routers?.designUrl || '/big-screen/design',
+      //   query: {
+      //     code: form.code
+      //   }
+      // })
+      // window.open(bigScreenHref, '_self')
+      this.$router.push({
         path: window.BS_CONFIG?.routers?.designUrl || '/big-screen/design',
         query: {
           code: form.code
         }
       })
-      window.open(bigScreenHref, '_self')
     }
   }
 }