Commit 80cc2748 by qinjianhui

feat: 菜单页面

parent 17a9a3dd
...@@ -11,13 +11,13 @@ export function getAllMenusTree() { ...@@ -11,13 +11,13 @@ export function getAllMenusTree() {
} }
export function addMenu(data) { export function addMenu(data) {
return axios.post('sysMenu/add', data) return axios.post('sysSaasMenu/add', data)
} }
export function updateMenu(data) { export function updateMenu(data) {
return axios.post('sysMenu/update', data) return axios.post('sysSaasMenu/update', data)
} }
export function deleteMenu(id) { export function deleteMenu(id) {
return axios.post(`sysMenu/delete/${id}`) return axios.post(`sysSaasMenu/delete/${id}`)
} }
...@@ -48,3 +48,16 @@ ...@@ -48,3 +48,16 @@
background-color: #fff; background-color: #fff;
border-radius: 8px; border-radius: 8px;
} }
.el-dialog__footer {
text-align: center;
padding: 10px;
.el-button--small {
padding: 9px 50px;
}
}
.el-dialog__body {
padding: 10px;
}
...@@ -5,6 +5,7 @@ import store from './store' ...@@ -5,6 +5,7 @@ import store from './store'
import element from '@/common/components/element-ui.js' import element from '@/common/components/element-ui.js'
import vxeTable from '@/common/components/vxeTable.js' import vxeTable from '@/common/components/vxeTable.js'
import './common/style/index.scss' import './common/style/index.scss'
import { getToken } from '@/utils/auth'
Vue.config.productionTip = false Vue.config.productionTip = false
...@@ -21,6 +22,15 @@ router.afterEach((to, from) => { ...@@ -21,6 +22,15 @@ router.afterEach((to, from) => {
store.commit('tags/setActive', to.name) store.commit('tags/setActive', to.name)
}) })
router.beforeEach((to, form, next) => {
const auth = getToken()
if (!auth && to.path !== '/login') {
next({ path: '/login' })
} else {
next()
}
})
new Vue({ new Vue({
router, router,
store, store,
......
const lastSavedTags = const lastSavedTags = localStorage.getItem('tags') ? JSON.parse(localStorage.getItem('tags')) || [] : []
JSON.parse(localStorage.getItem('tags')) || []
let tagId = lastSavedTags.reduce( let tagId = lastSavedTags.reduce(
(a, c) => Math.max(a, c.id), (a, c) => Math.max(a, c.id),
0, 0,
) )
console.log(lastSavedTags)
/** /**
* @type {import('vuex').StoreOptions} * @type {import('vuex').StoreOptions}
*/ */
const tags = { const tags = {
namespaced: true, namespaced: true,
state: { state: {
tags: lastSavedTags, tags: lastSavedTags || [],
activeTag: undefined, activeTag: undefined,
}, },
getters: { getters: {
...@@ -66,6 +65,9 @@ const tags = { ...@@ -66,6 +65,9 @@ const tags = {
JSON.stringify(state.tags), JSON.stringify(state.tags),
) )
}, },
removeAllTags(state) {
state.tags = []
},
}, },
} }
......
...@@ -31,6 +31,8 @@ export default { ...@@ -31,6 +31,8 @@ export default {
setUser(null) setUser(null)
setToken('') setToken('')
localStorage.setItem('tags', null)
this.$store.commit('tags/removeAllTags')
this.$router.push('/login') this.$router.push('/login')
}, },
}, },
......
...@@ -100,6 +100,12 @@ ...@@ -100,6 +100,12 @@
v-model="editForm.url" v-model="editForm.url"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="等级" prop="level">
<el-input
style="width: 164px"
v-model="editForm.level"
/>
</el-form-item>
<el-form-item label="启用状态"> <el-form-item label="启用状态">
<div style="width: 164px; display: inline-block"> <div style="width: 164px; display: inline-block">
<el-radio <el-radio
...@@ -135,11 +141,11 @@ ...@@ -135,11 +141,11 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer"> <div slot="footer">
<el-button size="mini" @click="clone" <el-button size="small" @click="clone"
>取 消</el-button >取 消</el-button
> >
<el-button <el-button
size="mini" size="small"
type="primary" type="primary"
@click="submit" @click="submit"
>保 存</el-button >保 存</el-button
......
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