diff --git a/.env.development b/.env.development index de583d09..337165b2 100644 --- a/.env.development +++ b/.env.development @@ -2,4 +2,4 @@ ENV = 'development' # base api -VUE_APP_BASE_API = '/dev-api' +VUE_APP_BASE_API = 'http://localhost:9527/bwhse' diff --git a/package.json b/package.json index 02f68e23..f00f5230 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,8 @@ "chalk": "2.4.2", "chokidar": "2.1.5", "connect": "3.6.6", - "eslint": "6.7.2", + "eslint": "^6.7.2", + "eslint-config-elemefe": "^0.3.0", "eslint-plugin-vue": "6.2.2", "html-webpack-plugin": "3.2.0", "husky": "1.3.1", diff --git a/src/api/public.js b/src/api/public.js new file mode 100644 index 00000000..36ee43e2 --- /dev/null +++ b/src/api/public.js @@ -0,0 +1,11 @@ +import request from '@/utils/request' + +export default { + getButtons(funid) { + return request({ + url: `/commonAction.do`, + method: 'post', + data: `funid=queryevent&eventcode=query_loadtb&selpfunid=&selfunid=${funid}&selpagetype=editgrid&user_id=administrator&dataType=json&query_type=0&has_page=0` + }).then(response => response.data) + } +} diff --git a/src/api/user.js b/src/api/user.js index b8b8741c..436705b3 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -2,7 +2,7 @@ import request from '@/utils/request' export function login(data) { return request({ - url: '/vue-element-admin/user/login', + url: '/commonAction.do', method: 'post', data }) diff --git a/src/assets/login/2.jpg b/src/assets/login/2.jpg new file mode 100644 index 00000000..6f9d127a Binary files /dev/null and b/src/assets/login/2.jpg differ diff --git a/src/assets/login/background.jpg b/src/assets/login/background.jpg new file mode 100644 index 00000000..9321481e Binary files /dev/null and b/src/assets/login/background.jpg differ diff --git a/src/assets/login/background1.jpg b/src/assets/login/background1.jpg new file mode 100644 index 00000000..d437841e Binary files /dev/null and b/src/assets/login/background1.jpg differ diff --git a/src/assets/login/background2.jpg b/src/assets/login/background2.jpg new file mode 100644 index 00000000..172d9e0a Binary files /dev/null and b/src/assets/login/background2.jpg differ diff --git a/src/assets/login/background3.jpg b/src/assets/login/background3.jpg new file mode 100644 index 00000000..c0591ea7 Binary files /dev/null and b/src/assets/login/background3.jpg differ diff --git a/src/assets/login/background5.jpg b/src/assets/login/background5.jpg new file mode 100644 index 00000000..2e3ebf7d Binary files /dev/null and b/src/assets/login/background5.jpg differ diff --git a/src/assets/login/left.jpg b/src/assets/login/left.jpg new file mode 100644 index 00000000..f7474152 Binary files /dev/null and b/src/assets/login/left.jpg differ diff --git a/src/assets/login/left.svg b/src/assets/login/left.svg new file mode 100644 index 00000000..e63746c2 --- /dev/null +++ b/src/assets/login/left.svg @@ -0,0 +1,350 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/login/left1.jpg b/src/assets/login/left1.jpg new file mode 100644 index 00000000..2415a0bf Binary files /dev/null and b/src/assets/login/left1.jpg differ diff --git a/src/assets/login/left5.png b/src/assets/login/left5.png new file mode 100644 index 00000000..6d1038ab Binary files /dev/null and b/src/assets/login/left5.png differ diff --git a/src/components/Buttons/index.vue b/src/components/Buttons/index.vue new file mode 100644 index 00000000..9f5a62b2 --- /dev/null +++ b/src/components/Buttons/index.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/src/permission.js b/src/permission.js index ff5eaad2..ee32a09e 100644 --- a/src/permission.js +++ b/src/permission.js @@ -28,7 +28,20 @@ router.beforeEach(async(to, from, next) => { } else { // determine whether the user has obtained his permission roles through getInfo const hasRoles = store.getters.roles && store.getters.roles.length > 0 + const sessionRoles = sessionStorage.getItem('ROLES') if (hasRoles) { + // generate accessible routes map based on roles + const accessRoutes = await store.dispatch('permission/generateRoutes', store.getters.roles) + + // dynamically add accessible routes + router.addRoutes(accessRoutes) + next() + } else if (sessionRoles) { + // generate accessible routes map based on roles + const accessRoutes = await store.dispatch('permission/generateRoutes', store.getters.roles) + + // dynamically add accessible routes + router.addRoutes(accessRoutes) next() } else { try { diff --git a/src/router/index.js b/src/router/index.js index 2be959d2..c06e6e2c 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -83,18 +83,6 @@ export const constantRoutes = [ } ] }, - { - path: '/documentation', - component: Layout, - children: [ - { - path: 'index', - component: () => import('@/views/documentation/index'), - name: 'Documentation', - meta: { title: 'Documentation', icon: 'documentation', affix: true } - } - ] - }, { path: '/guide', component: Layout, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 78009412..dbaf3f01 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, getInfo } from '@/api/user' import { getToken, setToken, removeToken } from '@/utils/auth' import router, { resetRouter } from '@/router' @@ -33,13 +33,16 @@ const actions = { login({ commit }, userInfo) { const { username, password } = userInfo return new Promise((resolve, reject) => { - login({ username: username.trim(), password: password }).then(response => { - const { data } = response - commit('SET_TOKEN', data.token) - setToken(data.token) + login(`funid=login&eventcode=login&pagetype=login&user_code=${username.trim()}&user_pass=${password}`).then(res => { + console.log(res.data.data, 'res') + commit('SET_ROLES', res.data.data.role_id) + // const { data } = res.data + commit('SET_TOKEN', '123') + setToken('123') + sessionStorage.setItem('ROLES', res.data.data.role_id) resolve() - }).catch(error => { - reject(error) + }).catch(err => { + reject(err) }) }) }, @@ -75,20 +78,21 @@ const actions = { // user logout logout({ commit, state, dispatch }) { return new Promise((resolve, reject) => { - logout(state.token).then(() => { - commit('SET_TOKEN', '') - commit('SET_ROLES', []) - removeToken() - resetRouter() + // logout(state.token).then(() => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + sessionStorage.clear + removeToken() + resetRouter() - // reset visited views and cached views - // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485 - dispatch('tagsView/delAllViews', null, { root: true }) + // reset visited views and cached views + // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485 + dispatch('tagsView/delAllViews', null, { root: true }) - resolve() - }).catch(error => { - reject(error) - }) + resolve() + // }).catch(error => { + // reject(error) + // }) }) }, diff --git a/src/utils/request.js b/src/utils/request.js index 2fb95ac0..0aa50490 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -5,7 +5,7 @@ import { getToken } from '@/utils/auth' // create an axios instance const service = axios.create({ - baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url + baseURL: '/bwhse', // url = base url + request url // withCredentials: true, // send cookies when cross-domain requests timeout: 5000 // request timeout }) @@ -43,10 +43,9 @@ service.interceptors.response.use( * You can also judge the status by HTTP Status Code */ response => { - const res = response.data - + const res = response // if the custom code is not 20000, it is judged as an error. - if (res.code !== 20000) { + if (res.status !== 200) { Message({ message: res.message || 'Error', type: 'error', diff --git a/src/views/guide/api/index.js b/src/views/guide/api/index.js new file mode 100644 index 00000000..0dd530dd --- /dev/null +++ b/src/views/guide/api/index.js @@ -0,0 +1,11 @@ +import request from '@/utils/request' + +export default { + getDept() { + return request({ + url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_dept&user_id=administrator`, + method: 'post', + data: `start=0&limit=50&where_sql=&where_value=&where_type=&is_query=1&query_type=0` + }).then(response => response.data) + } +} diff --git a/src/views/guide/index.vue b/src/views/guide/index.vue index 4897c8fb..7e5e6917 100644 --- a/src/views/guide/index.vue +++ b/src/views/guide/index.vue @@ -1,36 +1,115 @@ + diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 25906405..ba0f929b 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,85 +1,88 @@ @@ -204,18 +189,23 @@ export default { /* 修复input 背景不协调 和光标变色 */ /* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */ -$bg:#283443; +$bg:#F6F6F6; $light_gray:#fff; -$cursor: #fff; +$cursor: #000; @supports (-webkit-mask: none) and (not (cater-color: $cursor)) { .login-container .el-input input { + height: 31px !important; color: $cursor; } } /* reset element-ui css */ .login-container { + background-color: #F1F7FC !important; + width:100%; + height:100%; + background-size:100% 100%; .el-input { display: inline-block; height: 47px; @@ -227,10 +217,8 @@ $cursor: #fff; -webkit-appearance: none; border-radius: 0px; padding: 12px 5px 12px 15px; - color: $light_gray; + color: #000; height: 47px; - caret-color: $cursor; - &:-webkit-autofill { box-shadow: 0 0 0px 1000px $bg inset !important; -webkit-text-fill-color: $cursor !important; @@ -239,8 +227,8 @@ $cursor: #fff; } .el-form-item { - border: 1px solid rgba(255, 255, 255, 0.1); - background: rgba(0, 0, 0, 0.1); + border: 1px solid #c1c1c1; + background:#F6F6F6; border-radius: 5px; color: #454545; } @@ -248,23 +236,53 @@ $cursor: #fff; diff --git a/vue.config.js b/vue.config.js index 33a63483..8095e592 100644 --- a/vue.config.js +++ b/vue.config.js @@ -30,13 +30,33 @@ module.exports = { lintOnSave: process.env.NODE_ENV === 'development', productionSourceMap: false, devServer: { + hot: true, port: port, open: true, overlay: { warnings: false, errors: true }, - before: require('./mock/mock-server.js') + proxy: { + '/bwhse': { + target: 'http://localhost:8088', + ws: false, + changeOrigin: true, + pathRewrite: { '^/bwhse': '/bwhse' } + } + } + // proxy: { + // // change xxx-api/login => mock/login + // // detail: https://cli.vuejs.org/config/#devserver-proxy + // [process.env.VUE_APP_BASE_API]: { + // target: `http://127.0.0.1:${port}/mock`, + // changeOrigin: true, + // pathRewrite: { + // ['^' + process.env.VUE_APP_BASE_API]: '' + // } + // } + // }, + // before: require('./mock/mock-server.js') }, configureWebpack: { // provide the app's title in webpack's name field, so that