--no commit message
Showing
5 changed files
with
57 additions
and
31 deletions
1 | import Vue from 'vue' | 1 | import Vue from 'vue' |
2 | import request from '@/utils/request' | 2 | import request from '@/utils/request' |
3 | console.log(Vue.prototype, Vue.prototype.BASE_API); | ||
4 | import SERVER from './config' | 3 | import SERVER from './config' |
5 | // 获取用户信息 | 4 | // 获取用户信息 |
6 | export function getUserInfo () { | 5 | export function getUserInfo () { | ... | ... |
... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
2 | * @Author: yangwei | 2 | * @Author: yangwei |
3 | * @Date: 2023-01-16 09:10:12 | 3 | * @Date: 2023-01-16 09:10:12 |
4 | * @LastEditors: Please set LastEditors | 4 | * @LastEditors: Please set LastEditors |
5 | * @LastEditTime: 2023-03-21 14:15:40 | 5 | * @LastEditTime: 2023-03-21 15:00:04 |
6 | * @FilePath: \bdcjg-web\src\main.js | 6 | * @FilePath: \bdcjg-web\src\main.js |
7 | * @Description: | 7 | * @Description: |
8 | * | 8 | * |
... | @@ -51,7 +51,7 @@ Vue.directive('fo', { | ... | @@ -51,7 +51,7 @@ Vue.directive('fo', { |
51 | import './image/icons' // icon | 51 | import './image/icons' // icon |
52 | import store from './store' | 52 | import store from './store' |
53 | import router from './router' | 53 | import router from './router' |
54 | import _, { set } from 'lodash' | 54 | import _ from 'lodash' |
55 | Vue.use(Element, { size: 'small', zIndex: 1000 }) | 55 | Vue.use(Element, { size: 'small', zIndex: 1000 }) |
56 | Vue.use(Base) | 56 | Vue.use(Base) |
57 | Vue.component('icon', Icon); | 57 | Vue.component('icon', Icon); |
... | @@ -60,16 +60,12 @@ Vue.use(dataV) | ... | @@ -60,16 +60,12 @@ Vue.use(dataV) |
60 | axios.get("./config.json") | 60 | axios.get("./config.json") |
61 | .then((res) => { | 61 | .then((res) => { |
62 | Vue.prototype.BASE_API = res.data | 62 | Vue.prototype.BASE_API = res.data |
63 | localStorage.setItem('ApiUrl', JSON.stringify(res.data)); | ||
63 | require('./permission') | 64 | require('./permission') |
64 | 65 | new Vue({ | |
65 | setTimeout(() => { | 66 | el: '#app', |
66 | new Vue({ | 67 | router, |
67 | el: '#app', | 68 | store, |
68 | router, | 69 | render: h => h(App) |
69 | store, | 70 | }) |
70 | render: h => h(App) | 71 | }) |
71 | }) | ||
72 | }, 20) | ||
73 | |||
74 | }) | ||
75 | |||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -2,13 +2,13 @@ | ... | @@ -2,13 +2,13 @@ |
2 | * @Author: xiaomiao 1158771342@qq.com | 2 | * @Author: xiaomiao 1158771342@qq.com |
3 | * @Date: 2023-03-09 15:24:53 | 3 | * @Date: 2023-03-09 15:24:53 |
4 | * @LastEditors: Please set LastEditors | 4 | * @LastEditors: Please set LastEditors |
5 | * @LastEditTime: 2023-03-21 14:05:43 | 5 | * @LastEditTime: 2023-03-21 16:05:39 |
6 | * @FilePath: \上报\bdcjg-web\src\store\modules\permission.js | 6 | * @FilePath: \上报\bdcjg-web\src\store\modules\permission.js |
7 | * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE | 7 | * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE |
8 | */ | 8 | */ |
9 | import Vue from 'vue' | 9 | import Vue from 'vue' |
10 | import { constantRoutes } from '@/router' | 10 | import { constantRoutes } from '@/router' |
11 | import asyncRouter from '@/utils/asyncRouter.js' | 11 | // import asyncRouter from '@/utils/asyncRouter.js' |
12 | const state = { | 12 | const state = { |
13 | routes: [], | 13 | routes: [], |
14 | addRoutes: false, | 14 | addRoutes: false, |
... | @@ -26,6 +26,38 @@ const mutations = { | ... | @@ -26,6 +26,38 @@ const mutations = { |
26 | const actions = { | 26 | const actions = { |
27 | // 添加全部菜单 | 27 | // 添加全部菜单 |
28 | generateRoutes ({ commit }, getMenuInfo) { | 28 | generateRoutes ({ commit }, getMenuInfo) { |
29 | let Layout; | ||
30 | if (Vue.prototype.BASE_API.THEME == 'sb') { | ||
31 | Layout = r => require.ensure([], () => r(require(`@/layout1`))) | ||
32 | } else { | ||
33 | Layout = r => require.ensure([], () => r(require(`@/layout`))) | ||
34 | } | ||
35 | function asyncRouter (routers) { | ||
36 | routers.forEach(item => { | ||
37 | if (!item.children) { | ||
38 | delete item.children | ||
39 | } else { | ||
40 | item.children = asyncRouter(item.children) | ||
41 | } | ||
42 | item.path = JSON.parse(item.metadata)?.path || '/' | ||
43 | if (!item.parentId) { | ||
44 | item.component = Layout | ||
45 | console.log(item.component); | ||
46 | } else { | ||
47 | item.component = loadView(item.uri) | ||
48 | } | ||
49 | item.meta = { | ||
50 | title: item.name, | ||
51 | icon: item.icon | ||
52 | } | ||
53 | }) | ||
54 | return routers | ||
55 | } | ||
56 | function loadView (view) { | ||
57 | return r => require.ensure([], () => r(require(`@/views${view}.vue`))) | ||
58 | } | ||
59 | |||
60 | |||
29 | return new Promise(resolve => { | 61 | return new Promise(resolve => { |
30 | // 将权限菜单数组转成路由树数据结构 | 62 | // 将权限菜单数组转成路由树数据结构 |
31 | let permission_tree = asyncRouter(getMenuInfo) | 63 | let permission_tree = asyncRouter(getMenuInfo) | ... | ... |
1 | /* | 1 | |
2 | * @Description: | 2 | var Layout; |
3 | * @Autor: renchao | 3 | let ApiUrl = localStorage.getItem('ApiUrl') |
4 | * @LastEditTime: 2023-03-21 14:45:26 | 4 | if (ApiUrl.THEME == 'sb') { |
5 | */ | 5 | Layout = r => require.ensure([], () => r(require(`@/layout1`))) |
6 | import Vue from 'vue' | 6 | } else { |
7 | import Layout from '@/layout' | 7 | Layout = r => require.ensure([], () => r(require(`@/layout`))) |
8 | const config = require('/public/config.json') | 8 | } |
9 | console.log(config, 'Vue.2222222222222.BASE_API'); | 9 | |
10 | export default function filterAsyncRouter (routers) { | 10 | export default function filterAsyncRouter (routers) { |
11 | routers.forEach(item => { | 11 | routers.forEach(item => { |
12 | if (!item.children) { | 12 | if (!item.children) { |
... | @@ -19,6 +19,7 @@ export default function filterAsyncRouter (routers) { | ... | @@ -19,6 +19,7 @@ export default function filterAsyncRouter (routers) { |
19 | item.component = Layout | 19 | item.component = Layout |
20 | } else { | 20 | } else { |
21 | item.component = loadView(item.uri) | 21 | item.component = loadView(item.uri) |
22 | console.log(item.component, 'item.componentitem.component'); | ||
22 | } | 23 | } |
23 | item.meta = { | 24 | item.meta = { |
24 | title: item.name, | 25 | title: item.name, | ... | ... |
1 | /* | 1 | /* |
2 | * @Description: | 2 | * @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器 |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2023-03-21 13:46:56 | 4 | * @LastEditTime: 2023-03-21 15:03:37 |
5 | */ | ||
6 | /** | ||
7 | * 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器 | ||
8 | */ | 5 | */ |
9 | import axios from "axios"; | 6 | import axios from "axios"; |
10 | import { Message } from "element-ui"; | 7 | import { Message } from "element-ui"; |
... | @@ -17,6 +14,7 @@ const service = axios.create({ | ... | @@ -17,6 +14,7 @@ const service = axios.create({ |
17 | headers: { | 14 | headers: { |
18 | "Content-Type": "application/json; charset=utf-8", | 15 | "Content-Type": "application/json; charset=utf-8", |
19 | }, | 16 | }, |
17 | |||
20 | timeout: 15000, | 18 | timeout: 15000, |
21 | }); | 19 | }); |
22 | 20 | ... | ... |
-
Please register or sign in to post a comment