持续集成分支
This commit is contained in:
@@ -39,10 +39,10 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['user', 'apps']),
|
||||
...mapState(['user']),
|
||||
navs() {
|
||||
let reg = new RegExp(`.*${this.searchApp?.replace(/-/g,'')||''}.*`, 'gi')
|
||||
return (this.apps || []).filter(e => !this.searchApp || reg?.test(e.name) || reg?.test(e.label)).map(e => {
|
||||
return (this.$apps || []).filter(e => !this.searchApp || reg?.test(e.name) || reg?.test(e.label)).map(e => {
|
||||
if (/\/project\//.test(e.path)) {
|
||||
e.project = process.env.VUE_APP_SCOPE || e.path.replace(/.*project\/([^\/]+)\/.+/, '$1')
|
||||
} else if (/\/core\//.test(e.path)) {
|
||||
@@ -52,9 +52,9 @@ export default {
|
||||
})
|
||||
},
|
||||
menuPath() {
|
||||
let paths = [], current = this.apps?.find(e => e.name == this.$route.name)
|
||||
let paths = [], current = this.$apps?.find(e => e.name == this.$route.name)
|
||||
const findParent = name => {
|
||||
let menu = this.apps?.find(e => e.name == name)
|
||||
let menu = this.$apps?.find(e => e.name == name)
|
||||
if (menu) {
|
||||
paths.push(menu.name)
|
||||
if (!!menu.parentId) findParent(menu.parentId)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Vue from 'vue';
|
||||
import App from './App.vue';
|
||||
import ui from 'element-ui';
|
||||
import router from './router/router';
|
||||
import router from './router';
|
||||
import axios from './router/axios';
|
||||
import utils from './utils';
|
||||
import dui from 'dui';
|
||||
@@ -22,6 +22,7 @@ const app = new Vue({
|
||||
store,
|
||||
render: h => h(App)
|
||||
});
|
||||
|
||||
let theme = null
|
||||
store.dispatch('getSystem').then(res => {
|
||||
theme = JSON.parse(res?.colorScheme || null)
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
import store from "../store";
|
||||
import {waiting} from "../utils";
|
||||
import appEntry from "../views/appEntry";
|
||||
import router from "./router";
|
||||
|
||||
export default {
|
||||
routes: () => store.state.apps,
|
||||
init() {
|
||||
//约束正则式
|
||||
store.commit("cleanApps")
|
||||
// 自动化本工程应用
|
||||
waiting.init({innerHTML: '应用加载中..'})
|
||||
let startTime = new Date().getTime()
|
||||
/**
|
||||
* require.context 的路径变量范式只能为静态字符串
|
||||
*/
|
||||
switch (process.env.VUE_APP_SCOPE) {
|
||||
case 'dv':
|
||||
this.esm = {
|
||||
packages: require.context('../../packages/bigscreen', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
|
||||
}
|
||||
break
|
||||
case 'fengdu':
|
||||
this.esm = {
|
||||
project: require.context('../../project/fengdu', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
|
||||
}
|
||||
break
|
||||
case 'ai':
|
||||
this.esm = {
|
||||
biaopin: require.context('../../project/biaopin/AppCopilotConfig', true, /\.\/App[A-Z][^\/]+\.vue$/, 'lazy'),
|
||||
project: require.context('../../project/ai', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
|
||||
}
|
||||
break
|
||||
case 'oms':
|
||||
this.esm = {
|
||||
project: require.context('../../project/oms', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
|
||||
}
|
||||
break
|
||||
default:
|
||||
this.esm = {
|
||||
packages: require.context('../../packages/', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy'),
|
||||
project: require.context('../../project/', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
|
||||
}
|
||||
}
|
||||
console.log('模块引用用了%s秒', (new Date().getTime() - startTime) / 1000)
|
||||
startTime = new Date().getTime()
|
||||
this.loadApps().finally(() => {
|
||||
console.log('模块加载用了%s秒', (new Date().getTime() - startTime) / 1000)
|
||||
waiting.close()
|
||||
})
|
||||
},
|
||||
loadMods() {
|
||||
// return Promise.all(mods.apps.map(e => {
|
||||
// Vue.component(e.name, this.esm[e.workspace](e.esm))
|
||||
// const addApp = {...e, component: appEntry}
|
||||
// waiting.setContent(`加载${e.name}...`)
|
||||
// //命名规范入口文件必须以App开头
|
||||
// return store.commit("addApp", addApp)
|
||||
// }))
|
||||
},
|
||||
loadApps() {
|
||||
//新App的自动化格式
|
||||
const promise = (mods, base) => Promise.all(mods.keys().map(path => mods(path).then(file => {
|
||||
if (file.default) {
|
||||
const {name, label} = file.default
|
||||
const addApp = {
|
||||
name: [base, path.replace(/\.\/?(vue)?/g, '')?.split("/")].flat().join("_"),
|
||||
label: label || name,
|
||||
path: `/${base}${path.replace(/\.(\/.+\/App.+)\.vue$/, '$1')}`,
|
||||
component: appEntry,
|
||||
esm: file.default
|
||||
}
|
||||
waiting.setContent(`加载${name}...`)
|
||||
router.addRoute(addApp)
|
||||
//命名规范入口文件必须以App开头
|
||||
return store.commit("addApp", addApp)
|
||||
} else return 0
|
||||
}).catch(err => console.log(err))))
|
||||
return Promise.all(Object.entries(this.esm).map(([root, mods]) => promise(mods, root))).catch(console.error)
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
import Vue from 'vue'
|
||||
import VueRouter from 'vue-router'
|
||||
import autoRoutes from './autoRoutes'
|
||||
import apps from "./apps";
|
||||
|
||||
Vue.use(VueRouter)
|
||||
autoRoutes.init()
|
||||
Vue.prototype.$apps = apps
|
||||
export default new VueRouter({
|
||||
mode: 'history',
|
||||
hashbang: false,
|
||||
routes: autoRoutes.routes(),
|
||||
routes: apps,
|
||||
scrollBehavior(to) {
|
||||
if (to.hash) {
|
||||
return {
|
||||
@@ -5,22 +5,8 @@ import * as modules from "dui/lib/js/modules"
|
||||
import xsActions from "../../project/xiushan/actions"
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
apps: []
|
||||
},
|
||||
mutations: {
|
||||
addApp(state, app) {
|
||||
state.apps.push(app)
|
||||
},
|
||||
cleanApps(state) {
|
||||
state.apps = []
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
...xsActions
|
||||
},
|
||||
actions: {...xsActions},
|
||||
modules,
|
||||
plugins: [preState()]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user