diff --git a/src/App.vue b/src/App.vue index 7295af1..db71ed9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -8,17 +8,17 @@ import Setting from '@/setting'; import util from '@/libs/util'; export default { - name: 'App', - created () { - //在页面加载时读取localStorage里的状态信息 - if (util.local.get(Setting.storeKey) ) { - this.$store.replaceState(Object.assign({}, this.$store.state,util.local.get(Setting.storeKey))) - } + name: 'App', + created () { + //在页面加载时读取localStorage里的状态信息 + if (util.local.get(Setting.storeKey) ) { + this.$store.replaceState(Object.assign({}, this.$store.state,util.local.get(Setting.storeKey))) + } - //在页面刷新时将vuex里的信息保存到localStorage里 - window.addEventListener("beforeunload",()=>{ - util.local.get(Setting.usernameKey) && util.local.set(Setting.storeKey,this.$store.state) - }) - } + //在页面刷新时将vuex里的信息保存到localStorage里 + window.addEventListener("beforeunload",()=>{ + util.local.get(Setting.tokenKey) && util.local.set(Setting.storeKey,this.$store.state) + }) + } } \ No newline at end of file diff --git a/src/api/index.js b/src/api/index.js index 0bc77d2..dbc39c8 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,26 +1,31 @@ import Setting from '@/setting' let uploadURL = Setting.upload.apiURL let host = 'http://www.liuwanr.cn' -let host1 = 'http://192.168.31.125:9000' +let host1 = 'http://192.168.31.125:9000'//林 +let host2 = 'http://192.168.31.140:9000'//7 +let host3 = 'http://192.168.31.137:9000'//陈 export default { // 登录注册 - logins: `${host}/liuwanr/userInfo/adminLogins`, + logins: `${host3}/users/users/user/login`, + verification:`${host3}/users/users/user/captcha`, - uploadUserAvatars: `liuwanr/userInfo/uploadUserAvatars`, - queryProvince: `liuwanr/province/queryProvince`, - queryCity: `liuwanr/city/queryCity`, - querySchoolData: `liuwanr/customer/querySchool`, - queryAccountIsExist:`liuwanr/userInfo/queryAccountIsExist`, + // 公用接口 + queryProvince: `${host3}/nakadai/nakadai/province/queryProvince`, + queryCity: `${host3}/nakadai/nakadai/city/queryCity`, queryWorkNumberIsExist:`evaluation/tms/userInfo/queryWorkNumberIsExist`, queryStaffWorkNumberIsExist:`evaluation/tms/system/queryStaffWorkNumberIsExist`, - querySchool: `liuwanr/customer/querySchool`, + querySchool: `${host3}/nakadai/nakadai/school/querySchool`, + queryCourseDiscipline: `${host2}/nakadai/nakadai/discipline/queryDiscipline`, + queryCourseProfessionalClass: `${host2}/nakadai/nakadai/professionalClass/queryProfessionalClass`, + queryCourseProfessional: `${host2}/nakadai/nakadai/professional/queryProfessional`, // 个人中心 - userInfo:`${host1}/data/userInfo/userInfo`, - updateUser:`${host1}/data/userInfo/updateUser`, - findPasswordByEmail:`/data/userInfo/findPasswordByEmail`, - findPasswordByPhone:`/data/userInfo/findPasswordByPhone`, + uploadUserAvatars: `${host1}/users/users/userAccount/updateUserAvatars`, + userInfo:`${host1}/users/users/userInfo/getUserInfo`, + updateUser:`${host1}/users/users/userInfo/updateUser`, + findPasswordByEmail:`/users/users/userAccount/findPasswordByEmail`, + findPasswordByPhone:`/users/users/userAccount/findPasswordByPhone`, bingEmail:`evaluation/tms/user/bingEmail`, bindPhone:`evaluation/tms/user/bindPhone`, @@ -31,53 +36,55 @@ export default { removeMoreVideo: `${uploadURL}/oss/manage/removeMoreVideo`, removeVideo: `${uploadURL}/oss/manage/removeVideo`, - //查询电话是否存在 - queryProvince: `cjEnterprise/province/queryProvince`, - queryCity: `cjEnterprise/city/queryCity`, - queryClient: `cjEnterprise/client/list`, - // 用户管理 - saveUser: `/users/data/user/save`, - getUserList: `/users/data/user/getUserList`, - getUserTotalBySchoolId: `${host1}/users/data/user/getUserTotalBySchoolId`, - checkAccount:`/users/data/user/checkAccount`, - getDetail:`/users/data/user/getDetail`, - modifyUser:`/users/data/user/modify`, - export_failure:`${Setting.apiBaseURL}/users/data/user/export_failure`, - uploadFile:`${Setting.apiBaseURL}/users/data/user/uploadFile`, - + saveUser: `/users/users/data/user/save`, + getUserList: `/users/users/data/user/getUserList`, + getUserTotalBySchoolId: `${host1}/users/users/data/user/getUserTotalBySchoolId`, + checkAccount:`/users/users/data/user/checkAccount`, + getDetail:`/users/users/data/user/getDetail`, + modifyUser:`/users/users/data/user/modify`, + export_failure:`${Setting.apiBaseURL}/users/users/data/user/export_failure`, + uploadFile:`${Setting.apiBaseURL}/users/users/data/user/uploadFile`, + deleteUser:`${Setting.apiBaseURL}/users/users/data/user/delete`, + resetPwd: `${host2}/users/users/userAccount/resetPwd`, + sendPhoneOrEmailCode: `${host2}/users/users/userAccount/sendPhoneOrEmailCode`, + bindPhoneOrEmail: `${host2}/users/users/userAccount/bindPhoneOrEmail`, + examinePassword: `${host1}/users/users/userAccount/examinePassword`, + // 角色管理 - batchRemove:`/data/role/batchRemove`, - getRole:`/data/role/get`, - getName:`/data/role/getName`, - listRole:`/data/role/list`, - removeRole:`/data/role/remove`, - saveOrUpdate:`/data/role/saveOrUpdate`, - getRoles:`/data/role/getRole`, + batchRemove:`/data/data/role/batchRemove`, + getRole:`/data/data/role/get`, + getName:`/data/data/role/getName`, + listRole:`/data/data/role/list`, + removeRole:`/data/data/role/remove`, + saveOrUpdate:`/data/data/role/saveOrUpdate`, + getRoles:`/data/data/role/getRole`, + getPermissions:`/data/data/permission/getPermissions`, // 权限菜单管理 - doAssign:`/data/permission/doAssign`, - queryPermissionMenu:`/data/permission/queryPermissionMenu`, - savePer:`/data/permission/save`, - toAssign:`/data/permission/toAssign`, + doAssign:`/data/data/permission/doAssign`, + queryPermissionMenu:`/data/data/permission/queryPermissionMenu`, + savePer:`/data/data/permission/save`, + toAssign:`/data/data/permission/toAssign`, // 表展示 - getIdQueryTable:`/data/table/getIdQueryTable`, - getTableByClassification:`/data/table/getTableByClassification`, - getTableByCondition:`/data/table/getTableByCondition`, - downloadData:`${host1}/data/download`, - previewData:`${host1}/data/preview`, - downloadRecord:`${host1}/data/myDownload/downloadRecord`, - getDownloadRecord:`data/myDownload/getDownloadRecord`, - downloadAgain:`${host1}/data/downloadAgain`, + getIdQueryTable:`/data/data/table/getIdQueryTable`, + getTableByClassification:`/data/data/table/getTableByClassification`, + getTableByCondition:`/data/data/table/getTableByCondition`, + downloadData:`${host1}/data/data/download`, + previewData:`${host1}/data/data/preview`, + downloadRecord:`${host1}/data/data/myDownload/downloadRecord`, + getDownloadRecord:`/data/data/myDownload/getDownloadRecord`, + downloadAgain:`${host1}/data/data/downloadAgain`, + isDownload:`${host1}/data/data/product/isDownload`, // 数据操作记录 - queryAccumulate:`${host1}/data/dataRecord/queryAccumulate`, - queryDatabaseInfo:`${host1}/data/dataRecord/queryDatabaseInfo`, - queryDatabaseInfoByMonth:`${host1}/data/dataRecord/queryDatabaseInfoByMonth`, - saveRecord:`${host1}/data/dataRecord/saveRecord`, - databaseInfoExport:`${host1}/data/dataRecord/databaseInfoExport`, - databaseInfoByMonthExport:`${host1}/data/dataRecord/databaseInfoByMonthExport`, - onlineNumber:`${host1}/data/dataRecord/onlineNumber`, - getProductInfoBySchoolId:`${host1}/data/product/getProductInfoBySchoolId`, + queryAccumulate:`${host1}/data/data/dataRecord/queryAccumulate`, + queryDatabaseInfo:`${host1}/data/data/dataRecord/queryDatabaseInfo`, + queryDatabaseInfoByMonth:`${host1}/data/data/dataRecord/queryDatabaseInfoByMonth`, + saveRecord:`${host1}/data/data/dataRecord/saveRecord`, + databaseInfoExport:`${host1}/data/data/dataRecord/data/databaseInfoExport`, + databaseInfoByMonthExport:`${host1}/data/data/dataRecord/data/databaseInfoByMonthExport`, + onlineNumber:`${host1}/data/data/dataRecord/onlineNumber`, + getProductInfoBySchoolId:`${host1}/data/data/product/getProductInfoBySchoolId`, } \ No newline at end of file diff --git a/src/assets/img/code.png b/src/assets/img/code.png new file mode 100644 index 0000000..2528edb Binary files /dev/null and b/src/assets/img/code.png differ diff --git a/src/assets/img/password.png b/src/assets/img/password.png index 0a5d167..1dba44b 100644 Binary files a/src/assets/img/password.png and b/src/assets/img/password.png differ diff --git a/src/assets/img/setting.png b/src/assets/img/setting.png new file mode 100644 index 0000000..c98384e Binary files /dev/null and b/src/assets/img/setting.png differ diff --git a/src/layouts/footer/index.vue b/src/layouts/footer/index.vue index 0790252..316b4f8 100644 --- a/src/layouts/footer/index.vue +++ b/src/layouts/footer/index.vue @@ -1,6 +1,6 @@ diff --git a/src/libs/auth/generateBtnPermission.js b/src/libs/auth/generateBtnPermission.js index a6bbc80..d8ed295 100644 --- a/src/libs/auth/generateBtnPermission.js +++ b/src/libs/auth/generateBtnPermission.js @@ -12,14 +12,14 @@ export default function(data){ if(n.children.length){ result.push(`${e.name}:${n.name}`) n.children.map(j => { - j.select && (e.component ? result.push(`${e.component}:${n.name}:${j.name}`) : result.push(`${n.component}:${j.name}`)) + j.select && (e.path ? result.push(`${e.path}:${n.name}:${j.name}`) : result.push(`${n.path}:${j.name}`)) }) }else{ - result.push(`${e.component}:${n.name}`) + result.push(`${e.path}:${n.name}`) } } }) } }) - store.commit('addBtnPerData',{btnPermissions: result}) + store.dispatch('auth/addBtnAuth',result) } diff --git a/src/libs/route/addRoutes.js b/src/libs/route/addRoutes.js index 331056f..ea953ee 100644 --- a/src/libs/route/addRoutes.js +++ b/src/libs/route/addRoutes.js @@ -11,12 +11,12 @@ function createMeta(item){ function createRoute(data){ data.map(e => { - if(e.select && e.component){ + if(e.select && e.path){ let meta = createMeta(e) newRoutes.push({ - name: e.component, - path: e.component, - component: () => import(`@/pages/${e.component}.vue`), + name: e.path, + path: e.path, + path: () => import(`@/pages/${e.path}.vue`), meta }) } @@ -27,8 +27,6 @@ function createRoute(data){ export default function(data,path){ generateBtnPermission(data) createRoute(data) - let routes = router.options.routes - routes[1].children = [...routes[1].children,...newRoutes] - store.commit("addRoutesData", { routes }) - router.addRoutes(routes) + store.dispatch('auth/addRoutes',newRoutes) + // router.addRoutes(routes) } \ No newline at end of file diff --git a/src/libs/route/generateRoutes.js b/src/libs/route/generateRoutes.js index 02362a4..638f846 100644 --- a/src/libs/route/generateRoutes.js +++ b/src/libs/route/generateRoutes.js @@ -3,7 +3,7 @@ import router from '@/router'; export default function(){ setTimeout(() => { - let routes = store.state.routes + let routes = store.state.auth.routes routes.forEach(e => { if(e.path == '/'){ e.component = () => import('@/layouts/home/index.vue') diff --git a/src/pages/account/login/index.vue b/src/pages/account/login/index.vue index c19909e..0b2aa13 100644 --- a/src/pages/account/login/index.vue +++ b/src/pages/account/login/index.vue @@ -9,17 +9,19 @@
登录
- + - + - + + + + + + -
- 15天免费登录 -
登录
@@ -34,18 +36,24 @@ import util from '@/libs/util' export default { data: function() { return { + verificationIMG: '', loginForm: { - username: 'admin', - password: 'admin', + account: 'admin', + password: '111aaa', + random: '', + code: '' }, loginRules: { - username: [{ required: true, message: '请输入用户名', trigger: 'blur' }], + account: [{ required: true, message: '请输入用户名', trigger: 'blur' }], password: [{ required: true, message: '请输入密码', trigger: 'blur' }], + code: [{ required: true, message: '请输入验证码', trigger: 'blur' }], }, - remember: false }; }, components: {vHead}, + mounted(){ + this.getVerImg() + }, methods: { ...mapActions('user', [ 'login' @@ -53,18 +61,23 @@ export default { submitForm() { this.$refs.login.validate(valid => { if (valid) { - let data = { - username: this.loginForm.username, - password: this.loginForm.password, - remember: this.remember - } - this.login(data).then(() => { + this.login(this.loginForm).then(() => { let redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : '/index' this.$router.replace(redirect) - }).catch(() => {}) + }).catch(res => { + this.getVerImg() + this.loginForm.code = '' + }) } }) }, + getVerImg(){ + if(!this.loginForm.account){ + return this.verificationIMG = '' + } + this.loginForm.random = Math.floor(Math.random()*999999999) + this.verificationIMG = this.api.verification+'?random='+`${this.loginForm.random}` + } }, }; @@ -129,7 +142,7 @@ export default { border-bottom: 1px solid #e4e4e4; border-radius: 0 !important; } - .account,.password{ + .account,.password,.code{ z-index: 10; position: absolute; top: 11px; @@ -143,8 +156,15 @@ export default { height: 24px; background-image: url(../../../assets/img/password.png); } - .check{ - text-align: left; + .code{ + width: 22px; + height: 24px; + background-image: url(../../../assets/img/code.png); + } + .ver-img{ + position: absolute; + top: -10px; + right: 0; } /deep/.el-form-item__error{ top: 105%; @@ -163,15 +183,6 @@ export default { border-radius: 8px; border: 0; } - .links{ - margin: 20px 0 20px; - } - .login-tips{ - margin-bottom: 20px; - font-size: 16px; - color: #105CB2; - text-align: center; - } } } } diff --git a/src/pages/data/list/index.vue b/src/pages/data/list/index.vue index b133fbb..9802e45 100644 --- a/src/pages/data/list/index.vue +++ b/src/pages/data/list/index.vue @@ -131,13 +131,13 @@