efdf4650 by 任超

style:全局字典

1 parent 5f8e7d8a
......@@ -310,7 +310,7 @@
</el-form-item>
</el-col>
<!-- <el-col :span="8">
<el-col :span="8">
<el-form-item prop="ZT" class="borderTopNone">
<span slot="label">
状态: <br />
......@@ -321,7 +321,7 @@
</el-option>
</el-select>
</el-form-item>
</el-col> -->
</el-col>
</el-row>
<el-row>
......
......@@ -33,7 +33,7 @@ import './image/icons' // icon
import store from './store'
import router from './router'
import _ from 'lodash'
// import './permission' // permission control
import './permission' // permission control
Vue.use(Element, { size: 'small', zIndex: 1000 })
Vue.use(Base)
Vue.component('icon', Icon);
......
......@@ -10,23 +10,28 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration
router.beforeEach(async (to, from, next) => {
NProgress.start()
document.title = getPageTitle(to.meta.title)
let hasAddDict = store.state.dict.addDict
let hasAddRoute = store.state.permission.addRoutes
if (!hasAddDict) {
store.dispatch('dict/generateDic')
}
if (hasAddRoute) {
next()
// next({ ...to, replace: true })
} else {
const { result: getMenuData } = await getMenuInfo()
const accessRoutes = await store.dispatch('permission/generateRoutes', getMenuData)
// 获取用户信息
await store.dispatch('user/getUserInfo')
router.addRoutes([...accessRoutes, { path: '*', redirect: '/404', hidden: true }])
const routeTo = Cookies.get('routerTo')
if (routeTo && routeTo !== '/') {
next({ ...to, replace: true })
} else {
next('/home')
}
}
// else {
// const { result: getMenuData } = await getMenuInfo()
// const accessRoutes = await store.dispatch('permission/generateRoutes', getMenuData)
// // 获取用户信息
// await store.dispatch('user/getUserInfo')
// router.addRoutes([...accessRoutes, { path: '*', redirect: '/404', hidden: true }])
// const routeTo = Cookies.get('routerTo')
// if (routeTo && routeTo !== '/') {
// next({ ...to, replace: true })
// } else {
// next('/home')
// }
// }
next()
NProgress.done()
})
router.afterEach(to => {
......
import { getAllDict } from '@/api/user'
const state = {
dictData: {},
addDict: false,
}
const mutations = {
SET_DATA: (state, data) => {
state.addDict = true
state.dictData = data
},
RESET_DICT: (state) => {
state.addDict = false
}
}
const actions = {
generateDic ({ commit }) {
return new Promise(async (resolve) => {
let { result: res } = await getAllDict()
commit('SET_DATA', res)
resolve(true)
})
},
resetdict ({ commit }) {
commit('RESET_DICT')
}
}
export default {
namespaced: true,
state,
mutations,
actions
}
......@@ -355,14 +355,16 @@ aside {
// 通过 入库
.adopt {
color: #00FAA8;
position: relative;
}
.adopt::before {
position: absolute;
content: '';
display: block;
width: 5px;
height: 5px;
background: #999999;
background: #00FAA8;
border-radius: 50%;
margin-right: 6px;
}
......