style:全局字典
Showing
5 changed files
with
59 additions
and
17 deletions
| ... | @@ -310,7 +310,7 @@ | ... | @@ -310,7 +310,7 @@ |
| 310 | </el-form-item> | 310 | </el-form-item> |
| 311 | </el-col> | 311 | </el-col> |
| 312 | 312 | ||
| 313 | <!-- <el-col :span="8"> | 313 | <el-col :span="8"> |
| 314 | <el-form-item prop="ZT" class="borderTopNone"> | 314 | <el-form-item prop="ZT" class="borderTopNone"> |
| 315 | <span slot="label"> | 315 | <span slot="label"> |
| 316 | 状态: <br /> | 316 | 状态: <br /> |
| ... | @@ -321,7 +321,7 @@ | ... | @@ -321,7 +321,7 @@ |
| 321 | </el-option> | 321 | </el-option> |
| 322 | </el-select> | 322 | </el-select> |
| 323 | </el-form-item> | 323 | </el-form-item> |
| 324 | </el-col> --> | 324 | </el-col> |
| 325 | </el-row> | 325 | </el-row> |
| 326 | 326 | ||
| 327 | <el-row> | 327 | <el-row> | ... | ... |
| ... | @@ -33,7 +33,7 @@ import './image/icons' // icon | ... | @@ -33,7 +33,7 @@ import './image/icons' // icon |
| 33 | import store from './store' | 33 | import store from './store' |
| 34 | import router from './router' | 34 | import router from './router' |
| 35 | import _ from 'lodash' | 35 | import _ from 'lodash' |
| 36 | // import './permission' // permission control | 36 | import './permission' // permission control |
| 37 | Vue.use(Element, { size: 'small', zIndex: 1000 }) | 37 | Vue.use(Element, { size: 'small', zIndex: 1000 }) |
| 38 | Vue.use(Base) | 38 | Vue.use(Base) |
| 39 | Vue.component('icon', Icon); | 39 | Vue.component('icon', Icon); | ... | ... |
| ... | @@ -10,23 +10,28 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration | ... | @@ -10,23 +10,28 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration |
| 10 | router.beforeEach(async (to, from, next) => { | 10 | router.beforeEach(async (to, from, next) => { |
| 11 | NProgress.start() | 11 | NProgress.start() |
| 12 | document.title = getPageTitle(to.meta.title) | 12 | document.title = getPageTitle(to.meta.title) |
| 13 | let hasAddDict = store.state.dict.addDict | ||
| 13 | let hasAddRoute = store.state.permission.addRoutes | 14 | let hasAddRoute = store.state.permission.addRoutes |
| 15 | if (!hasAddDict) { | ||
| 16 | store.dispatch('dict/generateDic') | ||
| 17 | } | ||
| 14 | if (hasAddRoute) { | 18 | if (hasAddRoute) { |
| 15 | next() | 19 | next() |
| 16 | // next({ ...to, replace: true }) | ||
| 17 | } else { | ||
| 18 | const { result: getMenuData } = await getMenuInfo() | ||
| 19 | const accessRoutes = await store.dispatch('permission/generateRoutes', getMenuData) | ||
| 20 | // 获取用户信息 | ||
| 21 | await store.dispatch('user/getUserInfo') | ||
| 22 | router.addRoutes([...accessRoutes, { path: '*', redirect: '/404', hidden: true }]) | ||
| 23 | const routeTo = Cookies.get('routerTo') | ||
| 24 | if (routeTo && routeTo !== '/') { | ||
| 25 | next({ ...to, replace: true }) | ||
| 26 | } else { | ||
| 27 | next('/home') | ||
| 28 | } | ||
| 29 | } | 20 | } |
| 21 | // else { | ||
| 22 | // const { result: getMenuData } = await getMenuInfo() | ||
| 23 | // const accessRoutes = await store.dispatch('permission/generateRoutes', getMenuData) | ||
| 24 | // // 获取用户信息 | ||
| 25 | // await store.dispatch('user/getUserInfo') | ||
| 26 | // router.addRoutes([...accessRoutes, { path: '*', redirect: '/404', hidden: true }]) | ||
| 27 | // const routeTo = Cookies.get('routerTo') | ||
| 28 | // if (routeTo && routeTo !== '/') { | ||
| 29 | // next({ ...to, replace: true }) | ||
| 30 | // } else { | ||
| 31 | // next('/home') | ||
| 32 | // } | ||
| 33 | // } | ||
| 34 | next() | ||
| 30 | NProgress.done() | 35 | NProgress.done() |
| 31 | }) | 36 | }) |
| 32 | router.afterEach(to => { | 37 | router.afterEach(to => { | ... | ... |
src/store/modules/dict.js
0 → 100644
| 1 | import { getAllDict } from '@/api/user' | ||
| 2 | const state = { | ||
| 3 | dictData: {}, | ||
| 4 | addDict: false, | ||
| 5 | } | ||
| 6 | |||
| 7 | const mutations = { | ||
| 8 | SET_DATA: (state, data) => { | ||
| 9 | state.addDict = true | ||
| 10 | state.dictData = data | ||
| 11 | }, | ||
| 12 | RESET_DICT: (state) => { | ||
| 13 | state.addDict = false | ||
| 14 | } | ||
| 15 | } | ||
| 16 | |||
| 17 | const actions = { | ||
| 18 | generateDic ({ commit }) { | ||
| 19 | return new Promise(async (resolve) => { | ||
| 20 | let { result: res } = await getAllDict() | ||
| 21 | commit('SET_DATA', res) | ||
| 22 | resolve(true) | ||
| 23 | }) | ||
| 24 | }, | ||
| 25 | resetdict ({ commit }) { | ||
| 26 | commit('RESET_DICT') | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | export default { | ||
| 31 | namespaced: true, | ||
| 32 | state, | ||
| 33 | mutations, | ||
| 34 | actions | ||
| 35 | } |
| ... | @@ -355,14 +355,16 @@ aside { | ... | @@ -355,14 +355,16 @@ aside { |
| 355 | // 通过 入库 | 355 | // 通过 入库 |
| 356 | .adopt { | 356 | .adopt { |
| 357 | color: #00FAA8; | 357 | color: #00FAA8; |
| 358 | position: relative; | ||
| 358 | } | 359 | } |
| 359 | 360 | ||
| 360 | .adopt::before { | 361 | .adopt::before { |
| 362 | position: absolute; | ||
| 361 | content: ''; | 363 | content: ''; |
| 362 | display: block; | 364 | display: block; |
| 363 | width: 5px; | 365 | width: 5px; |
| 364 | height: 5px; | 366 | height: 5px; |
| 365 | background: #999999; | 367 | background: #00FAA8; |
| 366 | border-radius: 50%; | 368 | border-radius: 50%; |
| 367 | margin-right: 6px; | 369 | margin-right: 6px; |
| 368 | } | 370 | } | ... | ... |
-
Please register or sign in to post a comment