Commit 136f54c0 by 姜雷

添加公用处理方法

parent d39bbbc2
...@@ -12,6 +12,7 @@ import { formatRouteLink } from '@/utils/route'; ...@@ -12,6 +12,7 @@ import { formatRouteLink } from '@/utils/route';
import storeModule from './storeModule'; import storeModule from './storeModule';
import mixinModule from './mixins'; import mixinModule from './mixins';
import utilsModule from './utils';
const fetch = createBaseFetch( const fetch = createBaseFetch(
{ {
...@@ -20,26 +21,19 @@ const fetch = createBaseFetch( ...@@ -20,26 +21,19 @@ const fetch = createBaseFetch(
store store
); );
const createSystem = ({ routers, routeFilter }) => { class SystemShell {
class SystemShell {
constructor() { constructor() {
this.createBaseFetch = createBaseFetch; this.Api = fetch;
this.fetch = fetch; this.storeModule = storeModule;
this.initSystem(); this.mixinModule = mixinModule;
this.utils = utilsModule;
} }
createSystem = ({ routers, routeFilter }) => {
mixins = mixinModule;
storeModule = storeModule;
initSystem() {
routeStore.install(store); routeStore.install(store);
extendCom(Vue); extendCom(Vue);
configRoutePermission(router, store, routers); configRoutePermission(router, store, routers);
Vue.config.productionTip = false; Vue.config.productionTip = false;
}
mount() {
/* eslint-disable no-new */
let app = new Vue({ let app = new Vue({
el: '#app', el: '#app',
router, router,
...@@ -63,15 +57,7 @@ const createSystem = ({ routers, routeFilter }) => { ...@@ -63,15 +57,7 @@ const createSystem = ({ routers, routeFilter }) => {
}, },
}); });
return app; return app;
} };
} createBaseFetch = createBaseFetch;
const systemShell = new SystemShell(); }
window.$$SystemShell = systemShell; export default new SystemShell();
return systemShell;
};
export default {
createBaseFetch,
Api: fetch,
createSystem,
};
import * as main from '../utils/index';
import * as auth from '../utils/auth';
import downloadUrl from '../utils/download';
import { getYourIP } from '../utils/getIp';
import * as validate from '../utils/validate';
export default {
...main,
auth,
downloadFiles: downloadUrl,
getIp: getYourIP,
validate,
};
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