Commit ef335994 by 姜雷

Merge branch 'develop' into 'test'

Develop See merge request !1
parents 84a8a7a2 ee54a093
VUE_APP_BASE_URL=/systemManageShell/
VUE_APP_LIB_BASE_URL=/systemManageShell/
VUE_APP_CUSTOMER_MENU_CODE=0001
VUE_APP_BASE_MENU_CODE=0002
VUE_APP_SYSTEM_MENU_CODE=0003
......
......@@ -13,11 +13,14 @@ npm run build:master # 生成环境
根目录下`.env.dev`,`.env.test`,`.env.master`,分别替换服务地址
```bash
# 如果多项目配置在同一域名下需要配置项目的文件路径
VUE_APP_BASE_URL=/systemManageShell/ # 项目文件路径 配合nginx设置
VUE_APP_LIB_MANAGER=http://ex-dev-dcxy-static.168cad.top # 静态项目部署地址
VUE_APP_SYSTEM_SERVER_URL=http://ex-dev-dcxy-system-manage.168cad.top #系统管理接口
VUE_APP_CUSTOMER_SERVER_URL=http://ex-dev-customer-manage.168cad.top #会员系统接口
VUE_APP_BASE_SERVER_URL=http://ex-dev-dcxy-base-manage.168cad.top #基础服务接口
VUE_APP_BASE_SERVER_URL_APP=http://ex-dev-dcxy-base-app.168cad.top #基础服务APP接口
VUE_APP_SYSTEM_SERVER_URL=http://ex-dev-dcxy-system-manage.168cad.top # 系统管理接口
VUE_APP_CUSTOMER_SERVER_URL=http://ex-dev-customer-manage.168cad.top # 会员系统接口
VUE_APP_BASE_SERVER_URL=http://ex-dev-dcxy-base-manage.168cad.top # 基础服务接口
VUE_APP_BASE_SERVER_URL_APP=http://ex-dev-dcxy-base-app.168cad.top # 基础服务APP接口
```
## Build Setup
......
......@@ -6,15 +6,20 @@
"private": true,
"scripts": {
"dev": "vue-cli-service serve --port 8891",
"dev:local": "vue-cli-service serve ./src/dev-local/develop.js --port 8891",
"start": "npm run dev",
"lint": "eslint --ext .js,.vue src",
"build": "vue-cli-service build --modern",
"build:dev": "cross-env npm run buildapp:dev && npm run buildlib:dev",
"build:test": "vue-cli-service build --modern --mode test",
"build:master": "vue-cli-service build --modern --mode master",
"build:prod": "vue-cli-service build --modern",
"buildapp:dev": "vue-cli-service build --modern --mode dev",
"buildlib:dev": "vue-cli-service build --target lib --name manageShell ./src/lib/main.js --modern --mode dev",
"build:test": "cross-env npm run buildapp:test && npm run buildlib:test",
"buildapp:test": "vue-cli-service build --modern --mode test",
"buildlib:test": "vue-cli-service build --target lib --name manageShell ./src/lib/main.js --modern --mode test",
"build:master": "cross-env npm run buildapp:master && npm run buildlib:master",
"buildapp:master": "vue-cli-service build --modern --mode master",
"buildlib:master": "vue-cli-service build --target lib --name manageShell ./src/lib/main.js --modern --mode master",
"build:prod": "vue-cli-service build --modern",
"analyz": "cross-env NODE_ENV=production npm_config_report=true npm run build"
},
"dependencies": {
......@@ -29,11 +34,8 @@
"popmotion": "^8.1.22",
"qiniu-js": "^2.2.0",
"rym-element-ui": "^0.1.46",
"vue": "^2.5.2",
"vue-qr": "^1.2.8",
"vue-router": "^3.0.1",
"vuedraggable": "^2.16.0",
"vuex": "^3.0.1",
"wangeditor": "^3.1.1"
},
"devDependencies": {
......
......@@ -8,6 +8,7 @@
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuex@3.1.0/dist/vuex.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-router@3.0.1/dist/vue-router.js"></script>
<script src="<%= VUE_APP_LIB_MANAGER %><%= VUE_APP_LIB_BASE_URL %>lib/manageShell.umd.js"></script>
<script src="<%= VUE_APP_LIB_MANAGER %>/customerManage/lib/customerManage.umd.js"></script>
<script src="<%= VUE_APP_LIB_MANAGER %>/baseManage/lib/baseManage.umd.js"></script>
<script src="<%= VUE_APP_LIB_MANAGER %>/systemManage/lib/systemManage.umd.js"></script>
......@@ -23,6 +24,10 @@
rel="stylesheet"
href="<%= VUE_APP_LIB_MANAGER %>/systemManage/lib/systemManage.css"
/>
<link
rel="stylesheet"
href="<%= VUE_APP_LIB_MANAGER %><%= VUE_APP_LIB_BASE_URL %>lib/manageShell.css"
/>
<title>系统管理</title>
</head>
<body>
......
......@@ -8,8 +8,8 @@
<el-option
v-for="(item, index) in serviceTypeLists[ServiceType]"
:key="index"
:value="item.id"
:label="item.serviceName"
:value="item.value"
:label="item.name"
></el-option>
</el-select>
</template>
......
......@@ -27,15 +27,19 @@ const actions = {
return fetchServiceList({
params: { serviceType },
}).then(res => {
const { selfService } = res;
commit(SERVICE_TYPE_LIST, { list: selfService, index: serviceType });
commit(FETCH_STATE, false);
console.log(res);
const { data } = res;
commit(SERVICE_TYPE_LIST, { list: data, index: serviceType });
commit(FETCH_STATE, { value: false, index: serviceType });
});
},
};
const mutations = {
[SERVICE_TYPE_LIST](state, { list, index }) {
console.log(index, list);
state.lists[index] = list;
},
[FETCH_STATE](state, { value, index }) {
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuex@3.1.0/dist/vuex.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-router@3.0.1/dist/vue-router.js"></script>
<link
rel="stylesheet"
href="<%= VUE_APP_LIB_MANAGER %>/customerManage/lib/customerManage.css"
/>
<link
rel="stylesheet"
href="<%= VUE_APP_LIB_MANAGER %>/baseManage/lib/baseManage.css"
/>
<link
rel="stylesheet"
href="<%= VUE_APP_LIB_MANAGER %>/systemManage/lib/systemManage.css"
/>
<title>系统管理</title>
</head>
<body>
<noscript>
<strong
>We're sorry but hello-world doesn't work properly without JavaScript
enabled. Please enable it to continue.</strong
>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
<script src="<%= VUE_APP_LIB_MANAGER %>/customerManage/lib/customerManage.umd.js"></script>
<script src="<%= VUE_APP_LIB_MANAGER %>/baseManage/lib/baseManage.umd.js"></script>
<script src="<%= VUE_APP_LIB_MANAGER %>/systemManage/lib/systemManage.umd.js"></script>
</html>
import System from '../lib/main';
window.manageShell = { default: System };
setTimeout(() => {
let allAasyncRouterMap = [
...customerManage.default,
...baseManage.default,
...systemManage.default,
];
System.createSystem({
basePath: process.env.VUE_APP_BASE_URL,
routers: allAasyncRouterMap,
routeFilter: (routes, allRoute) => {
if (allRoute && allRoute.length) {
let addRoute = System.utils.route.formatRouteLink(allRoute);
for (let index = 0; index < addRoute.length; index++) {
const element = addRoute[index];
if (element.children) {
routes = routes.concat(element.children);
}
}
}
return {
allRoute,
routes,
};
},
});
}, 1000);
import axios from 'axios';
import { Message, MessageBox } from 'element-ui';
// import store from '../store';
import store from '../store';
import { SUCCESS_CODE } from '@/config';
import { errorHandle } from '@/api/validate';
import { getYourIP } from '@/utils/getIp.js';
......@@ -10,7 +10,7 @@ getYourIP(ipVal => {
ip = ipVal;
});
const createBaseFetch = (config, store) => {
const createBaseFetch = config => {
// 创建axios实例
const service = axios.create({
timeout: 10000,
......
import 'normalize.css/normalize.css';
import App from '../App';
import router, { constantRouterMap, routeStore } from '../router';
import { constantRouterMap, routeStore } from '../router';
import store from '../store';
import createBaseFetch from './Api';
import configRoutePermission from './permission';
......@@ -12,60 +12,48 @@ import { formatRouteLink } from '@/utils/route';
import storeModule from './storeModule';
import mixinModule from './mixins';
const createSystem = ({ routers, routeFilter }) => {
class SystemShell {
constructor() {
this.createBaseFetch = createBaseFetch;
this.fetch = createBaseFetch(
{
timeout: 10000,
},
store
);
this.initSystem();
}
mixins = mixinModule;
storeModule = storeModule;
initSystem() {
routeStore.install(store);
extendCom(Vue);
configRoutePermission(router, store, routers);
Vue.config.productionTip = false;
}
mount() {
/* eslint-disable no-new */
let app = new Vue({
el: '#app',
router,
store,
render: h => {
let routes = [...constantRouterMap];
let allRoute = store.getters.asyncRoutes;
if (typeof routeFilter === 'function') {
allRoute = routeFilter(allRoute);
}
if (allRoute && allRoute.length) {
let addRoute = formatRouteLink(allRoute);
for (let index = 0; index < addRoute.length; index++) {
const element = addRoute[index];
if (element.children) {
routes = routes.concat(element.children);
}
}
}
return <App route={routes} allRoutes={allRoute} />;
},
});
return app;
}
import utilsModule from './utils';
const fetch = createBaseFetch({
timeout: 10000,
});
class SystemShell {
constructor() {
this.Api = fetch;
this.storeModule = storeModule;
this.mixinModule = mixinModule;
this.utils = utilsModule;
}
const systemShell = new SystemShell();
window.$$SystemShell = systemShell;
return systemShell;
};
export default createSystem;
createSystem = ({ basePath = '/', routers, routeFilter }) => {
const router = new VueRouter({
mode: 'history',
base: basePath,
scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap,
});
routeStore.install(store);
extendCom(Vue);
configRoutePermission(router, store, routers);
Vue.config.productionTip = false;
let app = new Vue({
el: '#app',
router,
store,
render: h => {
let routes = [...constantRouterMap];
let allRoute = store.getters.asyncRoutes;
if (typeof routeFilter === 'function') {
const data = routeFilter(routes, allRoute);
routes = data.routes;
allRoute = data.allRoute;
}
return <App route={routes} allRoutes={allRoute} />;
},
});
return app;
};
createBaseFetch = createBaseFetch;
}
export default new SystemShell();
......@@ -5,7 +5,13 @@ import Operator from '../mixins/operator';
import Admin from '../mixins/admins/admins';
import Menu from '../mixins/menu/menus';
import UserInfoLabel from '../mixins/user/getUserInfoLabel';
import UserBaseInfo from '../mixins/user/userBaseInfo';
import BaseInfo from '../mixins/user/userBaseInfo';
import Validate from '../mixins/user/validate';
import Area from '../components/input/AreaSelect/mixin';
import BaseData from '../components/input/BaseDataSelect/mixin';
import BeanType from '../components/input/BeanTypeSelect/mixin';
import OperatorOptions from '../components/input/OperatorSelect/mixin';
import ServiceType from '../components/input/ServiceTypeSelect/mixin';
export default {
Dialog,
......@@ -14,6 +20,16 @@ export default {
Operator,
Admin,
Menu,
UserInfoLabel,
UserBaseInfo,
User: {
BaseInfo,
UserInfoLabel,
Validate,
},
Input: {
Area,
BaseData,
BeanType,
OperatorOptions,
ServiceType,
},
};
import * as main from '../utils/index';
import * as auth from '../utils/auth';
import * as route from '../utils/route';
import downloadUrl from '../utils/download';
import { getYourIP } from '../utils/getIp';
import * as validate from '../utils/validate';
export default {
...main,
auth,
route,
downloadFiles: downloadUrl,
getIp: getYourIP,
validate,
};
import createSystem from './lib/main';
let allAasyncRouterMap = [
...customerManage.default,
...baseManage.default,
...systemManage.default,
];
let app = createSystem({
const System = manageShell.default;
System.createSystem({
basePath: process.env.VUE_APP_BASE_URL,
routers: allAasyncRouterMap,
// routeFilter: allRoute => {
// let filterRoute = allRoute.find(menu => menu.menuCode == '0001');
// return filterRoute ? [filterRoute] : [];
// },
routeFilter: (routes, allRoute) => {
if (allRoute && allRoute.length) {
let addRoute = System.utils.route.formatRouteLink(allRoute);
for (let index = 0; index < addRoute.length; index++) {
const element = addRoute[index];
if (element.children) {
routes = routes.concat(element.children);
}
}
}
return {
allRoute,
routes,
};
},
});
app.mount();
import router, { asyncRouterMap } from './router';
import store from './store';
import NProgress from 'nprogress'; // Progress 进度条
import 'nprogress/nprogress.css'; // Progress 进度条样式
import { getToken } from '@/utils/auth'; // 验权
import { getAuthRoute } from './utils/route';
let allAasyncRouterMap = [
...customerManage.default,
...baseManage.default,
...systemManage.default,
];
NProgress.configure({ showSpinner: false }); // NProgress Configuration
const whiteList = process.env.VUE_APP_WHITE_LIST.split(','); // 不重定向白名单
const getRouteAdd = () => {
let allRoute = store.getters.asyncRoutes;
let asyncRouters = getAuthRoute(allAasyncRouterMap, allRoute);
router.addRoutes(asyncRouters); // 动态添加可访问路由表
router.addRoutes(asyncRouterMap);
};
router.beforeEach((to, from, next) => {
NProgress.start(); // 进度条Progress
if (getToken()) {
if (to.path === '/login') {
next({ path: '/' });
NProgress.done();
} else {
if (store.getters.isRouteDone) {
next(); //
} else {
let addRoute = store.getters.asyncRoutes;
if (addRoute && addRoute.length) {
getRouteAdd();
store.dispatch('GenerateRoutes');
next({ ...to, replace: true });
} else {
store
.dispatch('TokenLogin', {
data: { token: getToken() },
})
.then(() => {
getRouteAdd();
store.dispatch('GenerateRoutes');
next({ ...to, replace: true });
})
.catch(err => {
console.log(err);
store.dispatch('FedLogOut').then(() => {
next({ path: '/login' });
});
});
}
}
}
} else {
if (whiteList.indexOf(to.path) !== -1) {
next();
} else {
next('/login');
NProgress.done();
}
}
});
router.afterEach(() => {
NProgress.done(); // 结束Progress
});
......@@ -33,9 +33,8 @@ const asyncRouterMap = [{ path: '*', redirect: '/404', hidden: true }];
export { constantRouterMap, asyncRouterMap, routeStore };
export default new VueRouter({
mode: 'history',
base: process.env.VUE_APP_BASE_URL,
scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap,
});
export default {
constantRouterMap,
asyncRouterMap,
routeStore,
};
......@@ -9,6 +9,10 @@ let isLib = (() => {
}
})();
let isLocal = (() => {
return /develop/.test(process.argv[3]);
})();
module.exports = {
publicPath: process.env.VUE_APP_BASE_URL,
outputDir: isLib ? Path.join('dist', 'lib') : 'dist',
......@@ -21,4 +25,14 @@ module.exports = {
},
],
},
chainWebpack: config => {
if (!isLib && isLocal) {
config.plugin('html').tap(args => {
if (process.env.NODE_ENV == 'development') {
args[0].template = Path.join('src', 'dev-local', 'develop.html');
}
return args;
});
}
},
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment