diff --git a/src/api/base/contun.js b/src/api/base/customer.js similarity index 100% rename from src/api/base/contun.js rename to src/api/base/customer.js diff --git a/src/api/base/project.js b/src/api/base/project.js index faae32d..6908678 100644 --- a/src/api/base/project.js +++ b/src/api/base/project.js @@ -5,11 +5,11 @@ import request from '@/utils/request' /** 新增工程 */ export const addProjectApi = (data) => { - return request.post('/xxx/xx', data) + return request.post('/base/project/add', data) } /** 删除工程 */ export const deleteProjectApi = (id) => { - return request.delete('/xxx/xx', id) + return request.delete('/base/project/deleteProById', id) } /** 修改工程 */ export const editProjectApi = (data) => { diff --git a/src/api/base/unitType.js b/src/api/base/unitType.js index 061df6a..76d9d9a 100644 --- a/src/api/base/unitType.js +++ b/src/api/base/unitType.js @@ -13,7 +13,7 @@ export const deleteUnitTypeApi = (id) => { } /** 修改单位类型*/ export const editUnitTypeApi = (data) => { - return request.post('/xxx/xx', data) + return request.post('/base/unittype/update', data) } /** 单位类型列表查询 */ export const queryUnitTypeListApi = (data) => { diff --git a/src/permission.js b/src/permission.js index 1d597ec..5297df9 100644 --- a/src/permission.js +++ b/src/permission.js @@ -12,47 +12,46 @@ const whiteList = ['/login', '/register'] router.beforeEach((to, from, next) => { NProgress.start() - next() - // if (getToken()) { - // console.log(getToken()) - // to.meta.title && store.dispatch('settings/setTitle', to.meta.title) - // /* has token*/ - // if (to.path === '/login') { - // next({ path: '/' }) - // NProgress.done() - // } else if (whiteList.indexOf(to.path) !== -1) { - // next() - // } else { - // if (store.getters.roles.length === 0) { - // isRelogin.show = true - // // 判断当前用户是否已拉取完user_info信息 - // store.dispatch('GetInfo').then(() => { - // isRelogin.show = false - // store.dispatch('GenerateRoutes').then(accessRoutes => { - // // 根据roles权限生成可访问的路由表 - // router.addRoutes(accessRoutes) // 动态添加可访问路由表 - // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 - // }) - // }).catch(err => { - // store.dispatch('LogOut').then(() => { - // Message.error(err) - // next({ path: '/' }) - // }) - // }) - // } else { - // next() - // } - // } - // } else { - // // 没有token - // if (whiteList.indexOf(to.path) !== -1) { - // // 在免登录白名单,直接进入 - // next() - // } else { - // next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页 - // NProgress.done() - // } - // } + if (getToken()) { + console.log(getToken()) + to.meta.title && store.dispatch('settings/setTitle', to.meta.title) + /* has token*/ + if (to.path === '/login') { + next({ path: '/' }) + NProgress.done() + } else if (whiteList.indexOf(to.path) !== -1) { + next() + } else { + if (store.getters.roles.length === 0) { + isRelogin.show = true + // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(() => { + isRelogin.show = false + store.dispatch('GenerateRoutes').then(accessRoutes => { + // 根据roles权限生成可访问的路由表 + router.addRoutes(accessRoutes) // 动态添加可访问路由表 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 + }) + }).catch(err => { + store.dispatch('LogOut').then(() => { + Message.error(err) + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + // 没有token + if (whiteList.indexOf(to.path) !== -1) { + // 在免登录白名单,直接进入 + next() + } else { + next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页 + NProgress.done() + } + } }) router.afterEach(() => { diff --git a/src/router/index.js b/src/router/index.js index 821607b..87e0365 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -72,30 +72,30 @@ export const constantRoutes = [ name: 'Index', meta: { title: '首页', icon: 'dashboard', affix: true } }, - { - path: 'ProjectManage', - component: () => import('@/views/base/project'), - name: 'ProjectManage', - meta: { title: '工程管理', icon: 'dashboard', affix: true } - }, - { - path: 'ContactUnits', - component: () => import('@/views/base/contun'), - name: 'ContactUnits', - meta: { title: '往来单位', icon: 'dashboard', affix: true } - }, - { - path: 'UnitType', - component: () => import('@/views/base/unitType'), - name: 'UnitType', - meta: { title: '单位类型', icon: 'dashboard', affix: true } - }, - { - path: 'ProtocolManage', - component: () => import('@/views/base/agreement'), - name: 'ProtocolManage', - meta: { title: '协议管理', icon: 'dashboard', affix: true } - } + // { + // path: 'ProjectManage', + // component: () => import('@/views/base/project'), + // name: 'ProjectManage', + // meta: { title: '工程管理', icon: 'dashboard', affix: true } + // }, + // { + // path: 'ContactUnits', + // component: () => import('@/views/base/contun'), + // name: 'ContactUnits', + // meta: { title: '往来单位', icon: 'dashboard', affix: true } + // }, + // { + // path: 'UnitType', + // component: () => import('@/views/base/unitType'), + // name: 'UnitType', + // meta: { title: '单位类型', icon: 'dashboard', affix: true } + // }, + // { + // path: 'ProtocolManage', + // component: () => import('@/views/base/agreement'), + // name: 'ProtocolManage', + // meta: { title: '协议管理', icon: 'dashboard', affix: true } + // } ] }, { diff --git a/src/store/modules/user.js b/src/store/modules/user.js index fdede50..a501b49 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -92,6 +92,8 @@ const user = { commit('SET_TOKEN', data.access_token) setExpiresIn(data.expires_in) commit('SET_EXPIRES_IN', data.expires_in) + + console.log(res, '登录成功') resolve() }).catch(error => { reject(error) diff --git a/src/views/base/contun/components/form-contact-units.vue b/src/views/base/customer/components/form-contact-units.vue similarity index 100% rename from src/views/base/contun/components/form-contact-units.vue rename to src/views/base/customer/components/form-contact-units.vue diff --git a/src/views/base/contun/config.js b/src/views/base/customer/config.js similarity index 100% rename from src/views/base/contun/config.js rename to src/views/base/customer/config.js diff --git a/src/views/base/contun/index.vue b/src/views/base/customer/index.vue similarity index 100% rename from src/views/base/contun/index.vue rename to src/views/base/customer/index.vue diff --git a/src/views/base/project/components/form-project.vue b/src/views/base/project/components/form-project.vue index 3ca292b..a659a0f 100644 --- a/src/views/base/project/components/form-project.vue +++ b/src/views/base/project/components/form-project.vue @@ -10,13 +10,13 @@ > - - + + - - + + @@ -110,6 +110,7 @@ diff --git a/src/views/login1.vue b/src/views/login1.vue index 15bebeb..7dc274d 100644 --- a/src/views/login1.vue +++ b/src/views/login1.vue @@ -1,124 +1,174 @@ diff --git a/vue.config.js b/vue.config.js index 4dbd076..a716e25 100644 --- a/vue.config.js +++ b/vue.config.js @@ -35,7 +35,7 @@ module.exports = { proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `http://192.168.2.130:18080`, + target: `http://192.168.2.39:18080`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: ''