From 0c45e5dd8a8fdaae2b6c9fc7abb6aa990a216f9a Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Tue, 13 Jul 2021 15:08:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 22 +- src/api/index.js | 113 +++--- src/assets/img/code.png | Bin 0 -> 771 bytes src/assets/img/password.png | Bin 1283 -> 507 bytes src/assets/img/setting.png | Bin 0 -> 442 bytes src/layouts/footer/index.vue | 2 +- src/layouts/header/index.vue | 58 ++- src/layouts/navbar/index.vue | 77 ++-- src/libs/auth/generateBtnPermission.js | 6 +- src/libs/route/addRoutes.js | 14 +- src/libs/route/generateRoutes.js | 2 +- src/pages/account/login/index.vue | 69 ++-- src/pages/data/list/index.vue | 72 ++-- src/pages/index/list/index.vue | 54 ++- src/pages/role/list/index.vue | 19 +- src/pages/setting/person/download.vue | 54 +-- src/pages/setting/person/index.vue | 19 +- src/pages/setting/person/info.vue | 540 ++++++++++++++++--------- src/pages/stat/list/index.vue | 25 +- src/pages/user/list/index.vue | 115 +++--- src/plugins/auth/index.js | 10 +- src/plugins/requests/index.js | 121 +++--- src/router/permission.js | 18 +- src/setting.js | 2 +- src/store/getters.js | 8 +- src/store/modules/auth.js | 26 ++ src/store/modules/data.js | 32 -- src/store/modules/role.js | 19 - src/store/modules/stat.js | 47 --- src/store/modules/user.js | 90 ++--- 30 files changed, 908 insertions(+), 726 deletions(-) create mode 100644 src/assets/img/code.png create mode 100644 src/assets/img/setting.png create mode 100644 src/store/modules/auth.js delete mode 100644 src/store/modules/data.js delete mode 100644 src/store/modules/role.js delete mode 100644 src/store/modules/stat.js 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 0000000000000000000000000000000000000000..2528edbf15a10b85a442681a925d7143209dc2a1 GIT binary patch literal 771 zcmV+e1N{7nP)H#ra#6I5&xzpI4Ak02Pd&_ocij-X&8k|y5mj8O{>ctJ#rch1{8NTpqD zlEy+56im<{f)?6{g+=^A{K7+1g}Z$+vKQ9N=I$iq!LaPky#H_Bn|*Hx%WSmF`luVA zweAPdFCwc&>CLki*1>hxs0KhH)&xt5wj2W*6SpZN*FGFn}|*sV=U~i*+`1TqHPTc*LAl?(-Nrz zEh0BcrBZ7?pZ^#ONTpI69LISF;1M(TMh{jgwJDKE{1_P-v2A04X|2bDAXw}Beou6A zK`-(=Z-|I41GvD-Z&-40-$ez_OGuw7EZ?WA}DRmFPVIn$YjCoKEl1wIBT-UXS zI~7-;i?(a6b;0(2A~MF9GjWhqD%IsUj_stFo10rTIyyRAxvuJc;CbE?BHAY+V#Tn0csL3Tpza zvr_69fF2R)C8835`*tw1eO9%)0JTJx9Klime*mRLO(+z(sQLf^002ovPDHLkV1h%B BRl@)P literal 0 HcmV?d00001 diff --git a/src/assets/img/password.png b/src/assets/img/password.png index 0a5d16711edae07ac4aeaae5ce4169a94c99b637..1dba44b64414fd246866c89ae5ba88f64f176bc9 100644 GIT binary patch literal 507 zcmVwQF$K&yab8b^aURKq}bpSg6UI2Ik zV7siSCT(N+M~*VZOX@o8(h*F(n{>{)F1&mM|3w|dskA2|Kcly1ws2<8MHOfCx~lF@ x|Ib%)2f#rSDavfj>_<@)G1D$rTMt{a{{WDA_Zj5~-r@iN002ovPDHLkV1gAP=2-v$ literal 1283 zcmV+e1^oJnP)JOa^MG;miY}QqZAc_SQTgHfxK{?H9d)%o#bAoT+-Nkh6VHEo)E z&nu@ikhba9KIk9s&vVatpZ9&<=XuXT*rpG+2^Y!%Vo2JQbMp8DLjb}2Mf~IM_ zG~O!USS)roBECjMyAbh)7(qnhoEt=RGL=eQE(Ko}Sl4x#bKZi80RTA8IbW9LRv8e9 zBjO7Ha8Z`!f!5a6Y%#_vU;t<%qCFiQ9m-aL%I%NG<8KksPR7_#MNzK)54^~L=<$tE zok%34bUMA$?RGD;w6x@exNbSsO-)TwLqo$Ok|aHih<{j?^>ru|nz_}$7>!2nx7ln$ zNY4YnX(Boj3)903ajc zz(&Br!+RA)Y2A#SB9VwsmgN8a``^XaF#u&*z7VYhrzwk2OuR zRaI3TM8rnJFkUH68qvS{`g)tHstW)>#f19%`@K%5^F_wkAyF0Q{L@0Aa7tCx>Ea$; z*FWN%r#a_(XJ_YZSsyQ{vXLg0aPK)g>@AG_*^Sq&^}V>gebgOC%EZR4P?3%krB5Py+zp0l+vBH6Y@CA{t|i z9T^=Ry)-g1VwLJ*aB%QpS(e`;qN8JDV;4*RuL9O}-9to&5YcWJ#`_{mUDsViBq|hk zsRaN*nFA5W0pJtEFn$p9uMi^+4-W@8=e2WlbA4T1T~q5`i(-12rnz5|q!8!)a3~b| zSsV~Ot*EGYN|K~b0C3~=)b{8Uk007@FEG(QZRdiXZ#iBUG z7!%ZT(=00j|8yk75_=H}+b{%M+K_xt@$yWO5ISLssXLJJ{LE$2K@YNIv9RpLJnB0fh% z&v4FKpNJRSp;Pc7J z$#cWQ!-cgbnozMMNv|WKVCOTh*ZWJ6sg-BeeNzz;#^dp7L_8n_#W_Eh&*#r{b#+}S z4J7EVuC5k>6K}OEM06sVO#WKx+bsbXy{_x}9YiF0egF}#S(bHNlB5a4Ff6~{e;)w6 zOhh$AG|oByYI=Hls*JssVQ=~sDeUBOxgKJSJ&TBs0)QBe!q2+_;BU_P*<3DnVRm*l zvl%UH8d#(&E{nRlx*ZOO<3YyQUI1`emNii*6n=6#of$<@*6jcFP`ye^;uiDye79Ma t#WI=9{Cd4yONd*lc&#AUv%YP>{{ivPhdmSc93cPz002ovPDHLkV1m5hNsIsh diff --git a/src/assets/img/setting.png b/src/assets/img/setting.png new file mode 100644 index 0000000000000000000000000000000000000000..c98384e8d192c04f4b32b6044762e22cb47ccf78 GIT binary patch literal 442 zcmV;r0Y(0aP))~t(rtM zd*vo0*EFq9K?;k|!~qUZ{EtX8XM_2(K|S1OgtwOZ{I=+2ouD=ggQ zh@_j(fCiA6Z36RcAgkW{d*|Fc5LCC^CU#fSY!>J|t5uR(3dhWR2JAx8a2BW+xUG}( zXWXi!l~xJOEbKQ|_6C$CRa%15L0kuxnv#YY3G?)2#c@30oI7m#uqbIGQw)WH%&eH! znOR|CC`R6e4Qwigzkh<7wfm=!YCSATl45M4h4BT0+v&LRrFRyrd;thA@`0qwbiZ>} k{!6Q9IR1bBf;v^z2VZZ)8$lucB>(^b07*qoM6N<$f=*D!N&o-= literal 0 HcmV?d00001 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 @@