Merge branch 'dev' into vite

# Conflicts:
#	examples/router/autoRoutes.js
#	package.json
#	packages/bigscreen/designer/components/Add.vue
#	project/dv/apps/AppGridDV.vue
#	vue.config.js
This commit is contained in:
aixianling
2022-08-23 11:14:38 +08:00
125 changed files with 15445 additions and 4898 deletions

View File

@@ -11,7 +11,7 @@
<main-content class="fill"/>
</el-row>
<div v-if="dialog" class="sign-box">
<ai-sign style="margin: auto" :instance="$axios" :action="{login}"
<ai-sign style="margin: auto" :instance="$request" :action="{login}"
visible @login="getToken" :showScanLogin="false"/>
</div>
<el-button type="info" v-if="!showTools" class="fixedBtn" @click="showTools=true">显示工具栏</el-button>
@@ -22,7 +22,7 @@
import SliderNav from "./components/sliderNav";
import MainContent from "./components/mainContent";
import HeaderNav from "./components/headerNav";
import {mapMutations, mapState} from "vuex";
import {mapActions, mapMutations, mapState} from "vuex";
export default {
name: 'app',
@@ -42,7 +42,8 @@ export default {
}
},
methods: {
...mapMutations(['setToken']),
...mapMutations(['setToken', 'setFinanceUser']),
...mapActions(['getUserInfo']),
getToken(params) {
if (params.access_token) {
this.setToken([params.token_type, params.access_token].join(' '))
@@ -52,25 +53,19 @@ export default {
} else this.$message.error(params.msg || "登录失败!")
},
getUserInfo() {
this.$axios.post("/admin/user/detail-phone").then(res => {
if (res?.data) {
this.$store.commit("setUserInfo", res.data)
if (/^\/project\/xiushan/.test(location.pathname)) {
this.$store.commit("setFinanceUser")
}
}
})
},
handleLogin() {
this.$axios.delete("/auth/token/logout").finally(() => {
this.$request.delete("/auth/token/logout").finally(() => {
this.dialog = true
})
},
},
created() {
if (this.user.token) this.getUserInfo()
wx = jWeixin
if (this.user.token) this.getUserInfo().then(() => {
if (/^\/project\/xiushan/.test(location.pathname)) {
this.setFinanceUser()
}
})
}
}
</script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

View File

@@ -1,5 +1,5 @@
<template>
<div class="headerNav">
<div class="headerNav navBg">
<div style="position: relative">
<ai-icon type="logo" :icon="'iconcunwei'"/>
<ai-icon type="logo" :icon="'iconcunwei'" class="textShadow"/>
@@ -78,7 +78,6 @@ export default {
display: flex;
align-items: center;
width: 100%;
background-image: url("../assets/nav_bg.png");
background-repeat: no-repeat;
background-size: 100% 48px;
position: fixed;

View File

@@ -16,11 +16,19 @@ Vue.use(vcUI);
Vue.use(dvui)
//富文本编辑器配置
Vue.config.productionTip = false;
Vue.prototype.$axios = axios;
Vue.prototype.formatContent = (val) => val.replace(/(\r\n)|(\n)/g, '<br>');
Object.keys(utils).map((e) => (Vue.prototype[e] = utils[e]));
new Vue({
Vue.prototype.$request = axios
const app = new Vue({
router,
store,
render: (h) => h(App)
}).$mount('#app');
render: h => h(App)
});
let theme = null
store.dispatch('getSystem').then(({colorScheme}) => {
theme = JSON.parse(colorScheme || null)
Vue.prototype.$theme = theme?.web || "blue"
return import(`dvcp-ui/lib/styles/theme.${theme?.web}.scss`).catch(() => 0)
}).finally(() => {
!theme ? app.$mount('#app') : import(`dvcp-ui/lib/styles/common.scss`).finally(() => app.$mount('#app'))
})

View File

@@ -14,15 +14,15 @@ export default {
return this.loadApps()
},
loadApps() {
//锁屏loading
waiting.init({innerHTML: '应用加载中..'})
let apps = require.context('../../', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, "lazy")
Promise.all(apps.keys().map(path => apps(path).then(file => {
//新App的自动化格式
let apps = require.context('../../packages/', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy'),
projects = require.context('../../project/', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
const promise = (mods, base) => Promise.all(mods.keys().map(path => mods(path).then(file => {
if (file.default) {
let {name, label} = file.default,
addApp = {
name: path.replace(/\.\/?(vue)?/g, '')?.split("/").join("_"), label: label || name,
path: path.replace(/\.(\/.+\/App.+)\.vue$/, '$1'),
path: `/${base}${path.replace(/\.(\/.+\/App.+)\.vue$/, '$1')}`,
component: appEntry,
module: file.default
}
@@ -31,7 +31,12 @@ export default {
//命名规范入口文件必须以App开头
return store.commit("addApp", addApp)
} else return 0
}))).then(() => {
})))
waiting.init({innerHTML: '应用加载中..'})
Promise.all([
promise(apps, "packages"),
promise(projects, "project")
]).then(() => {
axios.post("/node/wechatapps/addOrUpdate", {
type: "web",
list: this.routes().map(({path: libPath, label, module: {name}, name: id}) => ({

View File

@@ -3,8 +3,7 @@ import {Message} from 'element-ui'
let baseURLs = {
production: "/",
development: '/lan',
oms: '/oms'
development: '/lan'
}
instance.defaults.baseURL = baseURLs[process.env.NODE_ENV]
instance.interceptors.request.use(config => {
@@ -16,15 +15,13 @@ instance.interceptors.request.use(config => {
config.baseURL = "/saas"
} else if (/\/xiushan/.test(location.pathname)) {
config.baseURL = "/xsjr"
config.url = config.url.replace(/(app|auth|admin)\//, "")
} else if (/project\/oms/.test(location.pathname)) {
config.baseURL = "/omsapi"
config.url = config.url.replace(/(app|auth|admin)\//, "")
} else if (/#url-/.test(location.hash)) {
config.baseURL = location.hash.replace(/#url-/, '/')
if (["/xsjr", "/omsapi"].includes(config.baseURL)) {
config.url = config.url.replace(/(app|auth|admin)\//, "")
}
}
if (["/xsjr", "/omsapi"].includes(config.baseURL)) {
config.url = config.url.replace(/(app|auth|admin)\//, "")
}
return config
}, error => Message.error(error))

View File

@@ -1,57 +1,28 @@
import Vue from 'vue'
import Vuex from 'vuex'
import preState from 'vuex-persistedstate'
import request from '../router/axios'
import * as modules from "dvcp-ui/lib/js/modules"
import axios from "../router/axios";
Vue.use(Vuex)
const user = {
state: {
info: {},
token: '',
financeUser: {}
},
mutations: {
setFinanceUser(state) {
request.post("appfinancialorganizationuser/checkUser").then(res => {
state.financeUser = res.data
})
},
setUserInfo(state, userInfo) {
state.info = userInfo
},
setToken(state, token) {
state.token = token
}
}
}
export default new Vuex.Store({
state: {
dicts: [],
apps: []
},
mutations: {
setDicts(state, payload) {
if (payload) {
payload.map(p => {
if (state.dicts.some(d => d.key == p.key)) {
const index = state.dicts.findIndex(d => d.key == p.key)
state.dicts.splice(index, 1)
state.dicts.push(p)
} else {
state.dicts.push(p)
}
})
}
},
addApp(state, app) {
state.apps.push(app)
},
cleanApps(state) {
state.apps = []
},
setFinanceUser(state) {
axios.post("appfinancialorganizationuser/checkUser").then(res => {
state.user.financeUser = res.data
}).catch(() => 0)
}
},
modules: {user},
modules,
plugins: [preState()]
})

View File

@@ -1,6 +1,6 @@
<template>
<section class="appEntry">
<component v-if="app" :is="app" :instance="$axios" :dict="$dict" :permissions="$permissions"/>
<component v-if="app" :is="app" :instance="$request" :dict="$dict" :permissions="$permissions"/>
<ai-empty v-else>无法找到应用文件</ai-empty>
</section>
</template>