diff --git a/package.json b/package.json index 6efba07..13f0bc8 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "test:ci": "npm run lint && npm run test:unit" }, "dependencies": { + "@riophae/vue-treeselect": "^0.4.0", "axios": "0.18.1", "bpmn-js": "^7.3.1", "bpmn-js-properties-panel": "^0.37.2", diff --git a/src/api/me.js b/src/api/me.js new file mode 100644 index 0000000..aca6a59 --- /dev/null +++ b/src/api/me.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' + +export function login(data) { + return request({ + url: '/api/auth/login', + method: 'post', + data, + isLoading: false + }) +} + +export function getInfo(token) { + return request({ + url: '/api/auth/me', + method: 'post', + params: { token }, + isLoading: false + }) +} + +export function logout() { + return request({ + url: '/api/auth/logout', + method: 'post' + }) +} + +export function permissions () { + return request({ + url: "/api/auth/permissions", + method: "post", + isLoading: false, + }) +} diff --git a/src/api/role.js b/src/api/role.js index 65c8381..60924ba 100644 --- a/src/api/role.js +++ b/src/api/role.js @@ -23,3 +23,19 @@ export function destroy (data) { data }) } + +export function getPermissions (params) { + return request({ + url: "/api/backend/role/get-permissions", + method: "get", + params + }) +} + +export function setPermissions (data) { + return request({ + url: "/api/backend/role/set-permissions", + method: "post", + data + }) +} diff --git a/src/api/user.js b/src/api/user.js index aca6a59..44fff87 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -1,34 +1,41 @@ -import request from '@/utils/request' +import request from '@/utils/request'; -export function login(data) { +export function index (params) { return request({ - url: '/api/auth/login', - method: 'post', - data, - isLoading: false + url: "/api/backend/user", + method: "get", + params }) } -export function getInfo(token) { +export function save (data) { return request({ - url: '/api/auth/me', - method: 'post', - params: { token }, - isLoading: false + url: "/api/backend/user/save", + method: "post", + data + }) +} + +export function destroy (data) { + return request({ + url: "/api/backend/user/delete", + method: "post", + data }) } -export function logout() { +export function getRoles (params) { return request({ - url: '/api/auth/logout', - method: 'post' + url: "/api/backend/user/get-roles", + method: "get", + params }) } -export function permissions () { +export function setRoles (data) { return request({ - url: "/api/auth/permissions", + url: "/api/backend/user/set-roles", method: "post", - isLoading: false, + data }) } diff --git a/src/assets/face.jpg b/src/assets/face.jpg new file mode 100644 index 0000000..8e5cd07 Binary files /dev/null and b/src/assets/face.jpg differ diff --git a/src/components/ThemePicker/index.vue b/src/components/ThemePicker/index.vue new file mode 100644 index 0000000..9b6b924 --- /dev/null +++ b/src/components/ThemePicker/index.vue @@ -0,0 +1,176 @@ + + + + + diff --git a/src/icons/svg/folder.svg b/src/icons/svg/folder.svg new file mode 100644 index 0000000..2d2cbca --- /dev/null +++ b/src/icons/svg/folder.svg @@ -0,0 +1 @@ + diff --git a/src/icons/svg/logout.svg b/src/icons/svg/logout.svg new file mode 100644 index 0000000..cd9668a --- /dev/null +++ b/src/icons/svg/logout.svg @@ -0,0 +1 @@ + diff --git a/src/layout/CardContainer.vue b/src/layout/CardContainer.vue new file mode 100644 index 0000000..ac18770 --- /dev/null +++ b/src/layout/CardContainer.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/layout/components/Navbar/Icon.vue b/src/layout/components/Navbar/Icon.vue index 78e7e08..a52d1c9 100644 --- a/src/layout/components/Navbar/Icon.vue +++ b/src/layout/components/Navbar/Icon.vue @@ -32,5 +32,6 @@ export default { diff --git a/src/layout/components/Navbar/Item.vue b/src/layout/components/Navbar/Item.vue index d1d1410..8c0c3a4 100644 --- a/src/layout/components/Navbar/Item.vue +++ b/src/layout/components/Navbar/Item.vue @@ -3,19 +3,21 @@ diff --git a/src/layout/components/Navbar/index.vue b/src/layout/components/Navbar/index.vue index 4f90c3c..014f219 100644 --- a/src/layout/components/Navbar/index.vue +++ b/src/layout/components/Navbar/index.vue @@ -15,12 +15,23 @@ @@ -43,28 +71,15 @@ @@ -73,13 +88,17 @@ import variables from "@/styles/variables.scss" import { mapGetters } from 'vuex' import Item from "./Item.vue" +import SvgIcon from '@/components/SvgIcon/index.vue' +import ThemePicker from '@/components/ThemePicker/index.vue' export default { components: { - Item + ThemePicker, + Item, + SvgIcon }, data () { return { - activeMenu: "" + isFullscreen: false, } }, computed: { @@ -91,21 +110,33 @@ export default { 'avatar', 'name', 'permission_routes', + 'department' ]), - // activeMenu() { - // const route = this.$route - // const { meta, path, matched } = route - // // if set path, the sidebar will highlight the path you set - // if (meta.activeMenu) { - // return meta.activeMenu - // } - // console.log(matched[matched.length-1].parent.path) - // return matched[matched.length-1].parent.path - // }, + activeMenu() { + const route = this.$route + const { + meta, + path + } = route + // if set path, the sidebar will highlight the path you set + if (meta.activeMenu) { + return meta.activeMenu + } + return path + }, }, methods: { - menuSelect (index,path) { - this.activeMenu = path[0] + handleFullscreen () { + this.isFullscreen = document.fullscreenElement !== null + }, + fullscreen () { + if (!document.fullscreenElement) { + // 请求全屏 + document.documentElement.requestFullscreen() + } else { + // 退出全屏 + document.exitFullscreen() + } }, async logout() { await this.$store.dispatch('user/logout') @@ -113,10 +144,16 @@ export default { } }, created() { + }, + mounted() { + document.addEventListener('fullscreenchange', this.handleFullscreen) + }, + beforeDestroy() { + document.removeEventListener('fullscreenchange', this.handleFullscreen) } } diff --git a/src/main.js b/src/main.js index 9fb3520..d9a7131 100644 --- a/src/main.js +++ b/src/main.js @@ -29,16 +29,28 @@ if (process.env.NODE_ENV === "production") { } // set ElementUI lang to EN -Vue.use(ElementUI, { locale }); +//Vue.use(ElementUI, { locale }); // 如果想要中文版 element-ui,按如下方式声明 -// Vue.use(ElementUI) -import { VXETable, VxeIcon, VxeTable, VxeColumn, VxeColgroup, VxeTableEditModule } from "vxe-table"; + Vue.use(ElementUI) + +//vxetable +import { VxeIcon, VxeTable, VxeColumn, VxeColgroup, VxeTableEditModule, VxeTableValidatorModule, VxeModal, VxeToolbar } from "vxe-table"; import "vxe-table/styles/index.scss" Vue.use(VxeTableEditModule); +Vue.use(VxeTableValidatorModule); Vue.use(VxeIcon); Vue.use(VxeTable); Vue.use(VxeColumn); Vue.use(VxeColgroup); +Vue.use(VxeModal); +Vue.use(VxeToolbar); +//treeselect +import '@riophae/vue-treeselect/dist/vue-treeselect.css' +import Treeselect from "@riophae/vue-treeselect" +Vue.component("Treeselect",Treeselect); + +import CardContainer from "@/layout/CardContainer.vue" +Vue.component("CardContainer",CardContainer) //wujie import Wujie from "wujie-vue2"; Vue.use(Wujie); diff --git a/src/permission.js b/src/permission.js index fdb579d..41d8294 100644 --- a/src/permission.js +++ b/src/permission.js @@ -12,7 +12,6 @@ const whiteList = ['/login'] // no redirect whitelist let isFirstEnter = true; //第一次进入获取用户信息 router.beforeEach(async(to, from, next) => { - console.log(from.path,to.path) // start progress bar NProgress.start() diff --git a/src/settings.js b/src/settings.js index 9cbbf15..f7909c9 100644 --- a/src/settings.js +++ b/src/settings.js @@ -1,7 +1,7 @@ module.exports = { title: 'Vue Admin Template', - copyright: '版权所有', + copyright: '常州环境监测中心', /** * @type {boolean} true | false diff --git a/src/store/getters.js b/src/store/getters.js index 2d79d65..2297fe2 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -4,6 +4,7 @@ const getters = { token: state => state.user.token, avatar: state => state.user.avatar, name: state => state.user.name, + department: state => state.user.department, admins: state => state.data.admins, departments: state => state.data.departments, permission_routes: state => state.permission.routes, diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index ea49a1b..27b3a1c 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -1,5 +1,5 @@ import { asyncRoutes, constantRoutes } from '@/router' -import { permissions } from "@/api/user" +import { permissions } from "@/api/me" import path from "path" import Layout from "@/layout" diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 160b63f..94f1871 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,4 +1,4 @@ -import { login, logout, getInfo } from '@/api/user' +import { login, logout, getInfo } from '@/api/me' import { getToken, setToken, removeToken } from '@/utils/auth' import { resetRouter } from '@/router' @@ -8,6 +8,7 @@ const getDefaultState = () => { name: '', avatar: '', adminId: '', + department: {}, role: [], } } @@ -32,6 +33,9 @@ const mutations = { }, SET_ADMIN_ID: (state, id) => { state.adminId = id + }, + SET_DEPARTMENT: (state, department) => { + state.department = department } } @@ -57,8 +61,9 @@ const actions = { return new Promise((resolve, reject) => { getInfo(state.token).then(response => { - const { name, avatar, id, role } = response + const { name, avatar, id, role, department } = response + commit('SET_DEPARTMENT',department) commit('SET_NAME', name) commit('SET_AVATAR', avatar) commit('SET_ADMIN_ID', id) diff --git a/src/styles/element-ui.scss b/src/styles/element-ui.scss index 0062411..bf5f6ec 100644 --- a/src/styles/element-ui.scss +++ b/src/styles/element-ui.scss @@ -47,3 +47,7 @@ .el-range-separator { box-sizing: content-box; } + +.el-submenu.is-active .el-submenu__title { + border-bottom: 2px solid; +} diff --git a/src/styles/navbar.css b/src/styles/navbar.scss similarity index 99% rename from src/styles/navbar.css rename to src/styles/navbar.scss index 45fce6c..357b9ef 100644 --- a/src/styles/navbar.css +++ b/src/styles/navbar.scss @@ -383,6 +383,11 @@ a { text-decoration: none } +a:hover { + --tblr-link-color-rgb: var(--tblr-link-hover-color-rgb); + text-decoration: underline +} + a:not([href]):not([class]),a:not([href]):not([class]):hover { color: inherit; text-decoration: none @@ -24695,7 +24700,7 @@ textarea[cols] { animation: animated-dots 1.2s steps(4,jump-none) infinite } -.modal-content .btn-close { +.modal-content>.btn-close,.modal-header>.btn-close { position: absolute; top: 0; right: 0; @@ -25222,7 +25227,8 @@ textarea[cols] { .ribbon-start { right: auto; - left: calc(-1 * var(--tblr-ribbon-margin)) + left: calc(-1 * var(--tblr-ribbon-margin)); + border-radius: 0 var(--tblr-ribbon-border-radius) var(--tblr-ribbon-border-radius) var(--tblr-ribbon-border-radius) } .ribbon-start:before { diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 782453c..e97ecaf 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -1,6 +1,9 @@ // sidebar +:root { + --theme-color: #5898f2; +} $menuText:#333; -$menuActiveText:#409EFF; +$menuActiveText: var(--theme-color); $subMenuActiveText:#f4f4f5; //https://github.com/ElemeFE/element/issues/12951 $menuBg:#fff; diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 2919cbb..07176f3 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -64,7 +64,7 @@ import { validUsername } from '@/utils/validate' -import { login, getInfo } from "@/api/user"; +import { login, getInfo } from "@/api/me"; const defaultSettings = require('../../../src/settings.js') export default { name: 'Login', diff --git a/src/views/system/components/AddMenu.vue b/src/views/system/components/AddMenu.vue new file mode 100644 index 0000000..c88b05f --- /dev/null +++ b/src/views/system/components/AddMenu.vue @@ -0,0 +1,137 @@ + + + + + diff --git a/src/views/system/components/AddRole.vue b/src/views/system/components/AddRole.vue new file mode 100644 index 0000000..91571bb --- /dev/null +++ b/src/views/system/components/AddRole.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/src/views/system/components/AddUser.vue b/src/views/system/components/AddUser.vue new file mode 100644 index 0000000..9f96edb --- /dev/null +++ b/src/views/system/components/AddUser.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/src/views/system/components/BindPermissions.vue b/src/views/system/components/BindPermissions.vue new file mode 100644 index 0000000..29a7fb3 --- /dev/null +++ b/src/views/system/components/BindPermissions.vue @@ -0,0 +1,98 @@ + + + + + diff --git a/src/views/system/components/BindRoles.vue b/src/views/system/components/BindRoles.vue new file mode 100644 index 0000000..a628edf --- /dev/null +++ b/src/views/system/components/BindRoles.vue @@ -0,0 +1,134 @@ + + + + + diff --git a/src/views/system/menu.vue b/src/views/system/menu.vue index 192af7c..51114bf 100644 --- a/src/views/system/menu.vue +++ b/src/views/system/menu.vue @@ -1,33 +1,191 @@ diff --git a/src/views/system/role.vue b/src/views/system/role.vue index c09b414..779f2d2 100644 --- a/src/views/system/role.vue +++ b/src/views/system/role.vue @@ -1,53 +1,72 @@