From a9bbbe822377536e6f3374b05e2b64b12b2f188c Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期一, 27 五月 2024 10:25:43 +0800
Subject: [PATCH] action文档

---
 Source/ProjectWeb/src/router/avue-router.js |   55 +++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/Source/ProjectWeb/src/router/avue-router.js b/Source/ProjectWeb/src/router/avue-router.js
index a12448f..52c14c9 100644
--- a/Source/ProjectWeb/src/router/avue-router.js
+++ b/Source/ProjectWeb/src/router/avue-router.js
@@ -1,3 +1,5 @@
+import {validatenull} from "@/util/validate";
+
 let RouterPlugin = function () {
   this.$router = null;
   this.$store = null;
@@ -90,14 +92,15 @@
      * first: 涓轰簡鍖哄垎澶栫晫 璋冪敤formatRoutes 鍜� 褰撳墠鏂囦欢璋冪敤 formatRoutes
      */
     formatRoutes: function (aMenu = [], first) {
-      // debugger;
       const aRouter = []
       // 鑾峰彇鍒板叏灞�閰嶇疆涓殑 props
       const propsConfig = this.$website.menu.props;
       // 璁剧疆 props榛樿鍊� 浣滅敤灏辨槸灏嗗瓧娈佃缃垚閰嶇疆鐨�
       const propsDefault = {
         label: propsConfig.label || 'name',
-        path: propsConfig.path || 'path',
+        path: 'code',
+        code: 'code',
+        pathValue: 'pathValue',
         icon: propsConfig.icon || 'icon',
         children: propsConfig.children || 'children',
         meta: propsConfig.meta || 'meta',
@@ -110,16 +113,40 @@
         const oMenu = aMenu[i];
         // 杩欎竴鍧楃殑璧嬪�� 涔熷氨鏄彇鍒拌繑鍥炵殑鍊�
         let path = (() => {
-            if (first) {
-              // 灏� '/index' 鏇挎崲涓� ''
-              return oMenu[propsDefault.path].replace('/index', '')
-            } else {
-              return oMenu[propsDefault.path]
-            }
-          })(),
-          //鐗规畩澶勭悊缁勪欢 鎵ц瀹岃繖涓� component 涔熷氨鏄簿纭埌鍏蜂綋鐨勬枃浠朵簡  views鏂囦欢澶逛笅闈㈠氨鏄叿浣撶殑椤甸潰浠g爜
-          component = 'views' + path,
-          name = oMenu[propsDefault.label],
+          if (first) {
+            // 灏� '/index' 鏇挎崲涓� ''
+            return oMenu[propsDefault.pathValue].replace('/index', '')
+          } else {
+            return oMenu[propsDefault.pathValue]
+          }
+        })();
+        let code = (() => {
+          return oMenu[propsDefault.code]
+        })();
+
+        let component = '';
+        let parts = '';
+
+        // 濡傛灉璺緞涓瓨鍦� '?'锛屽垯鍙栭棶鍙峰墠闈㈤儴鍒嗙粰 parts
+        if (path.includes('?')) {
+          parts = path.split("?")[0];
+        } else {
+          parts = path; // 涓嶅瓨鍦� '?' 鏁存潯璺緞灏辨槸 parts
+        }
+        if(validatenull(parts)){
+          parts='UI';
+        }
+        // 濡傛灉闂彿鍓嶉潰閮ㄥ垎涓嶅湪 ['ui', 'UI', 'base'] 涓紝鍒欐槸鑷畾涔夌粍浠�
+        if (!['ui', 'UI', 'base','bs'].includes(parts) && parts.indexOf('views/')==-1) {
+          component = `views/custom-ui/${parts}`;
+        }else if (['UI', 'ui', 'base','bs'].includes(parts)) {
+          // 濡傛灉闂彿鍓嶉潰绛変簬 UI銆乽i 鍒欎负UI寮曟搸
+          component = 'views/base/UIContentViewer';
+        }else{
+          component = `${parts}`;
+        }
+
+        let name = oMenu[propsDefault.label],
           icon = oMenu[propsDefault.icon],
           children = oMenu[propsDefault.children],
           meta = oMenu[propsDefault.meta] || {};
@@ -134,7 +161,7 @@
         //鏄惁鏈夊瓙璺敱
         const isChild = children.length !== 0;
         const oRouter = {
-          path: path,
+          path: '/' + code,
           component(resolve) {
             // 鍒ゆ柇鏄惁涓洪璺敱
             if (first) {
@@ -162,7 +189,7 @@
           children: !isChild ? (() => {
             if (first) {
               // 杩欓噷鐨刬sURL鍒ゆ柇锛屽洜涓鸿繖涓綉绔欐湁浣跨敤 iframe銆傛墍浠ラ渶瑕佸垽鏂槸鍚︿负缃戦〉閾炬帴
-              if (!isURL(path)) oMenu[propsDefault.path] = `${path}/index`;
+              if (!isURL(path)) oMenu[propsDefault.pathValue] = `${path}/index`;
               return [{
                 component(resolve) {
                   require([`../${component}.vue`], resolve)

--
Gitblit v1.9.3