From 59765cab961847dfd101e69ae6d8d1d501a5284c Mon Sep 17 00:00:00 2001
From: yuxc <yuxc@vci-tech.com>
Date: 星期二, 04 六月 2024 11:10:28 +0800
Subject: [PATCH] 1、ice配置文件上传
---
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.10.0