From 4b095c07a7a5a2aa4f04fac64ba444c50bd7ce22 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Mon, 15 Apr 2024 19:15:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=9C=E5=B1=B1=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=9D=83=E9=99=90=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.production | 8 ++-- package.json | 1 + src/api/auth/authAdmin.js | 11 +++++ src/store/modules/user.js | 7 +-- src/views/myLogin.vue | 89 ++++++++++++++++++++++++++++++++++++--- 5 files changed, 102 insertions(+), 14 deletions(-) diff --git a/.env.production b/.env.production index 4cb67a1..6df4002 100644 --- a/.env.production +++ b/.env.production @@ -11,7 +11,7 @@ ENV = 'production' # VUE_APP_BASE_API = 'http://116.204.106.103:9150/UDI_SPMS_SERVER/' # 平潭 -VUE_APP_BASE_API = 'http://121.204.169.96:9150/UDI_SPMS_SERVER/' +# VUE_APP_BASE_API = 'http://121.204.169.96:9150/UDI_SPMS_SERVER/' # 文明懂 # VUE_APP_BASE_API = 'http://192.168.0.62:9150/UDI_SPMS_SERVER/' @@ -27,13 +27,13 @@ VUE_APP_BASE_API = 'http://121.204.169.96:9150/UDI_SPMS_SERVER/' # VUE_APP_BASE_API = 'http://dm.xmglxp.com:8081/UDI_SPMS_SERVER/' -# VUE_APP_BASE_API = 'http://dm.xmglxp.com:81/UDI_SPMS_SERVER/' +# VUE_APP_BASE_API = 'http://dm.xmglxp.com:83/UDI_SPMS_SERVER/' #诏安医院 # VUE_APP_BASE_API = 'http://139.9.174.242:9150/UDI_SPMS_SERVER/' # VUE_APP_BASE_API = 'http://192.168.0.17:9150/UDI_SPMS_SERVER/' # 大田 -# VUE_APP_BASE_API = 'http://110.83.220.178:9150/UDI_SPMS_SERVER/' +VUE_APP_BASE_API = 'http://110.83.220.178:9150/UDI_SPMS_SERVER/' # 云霄妇幼 # VUE_APP_BASE_API = 'http://192.168.0.72:9150/UDI_SPMS_SERVER/' @@ -45,7 +45,7 @@ VUE_APP_BASE_API = 'http://121.204.169.96:9150/UDI_SPMS_SERVER/' # 东山 # VUE_APP_BASE_API = 'http://116.204.108.228:9150/UDI_SPMS_SERVER/' -# VUE_APP_BASE_API = 'http://192.168.0.125:9150/UDI_SPMS_SERVER/' +# VUE_APP_BASE_API = 'http://192.168.0.117:9150/UDI_SPMS_SERVER/' # 应用访问路径 例如使用前缀 /admin/ diff --git a/package.json b/package.json index e24e05e..a0493bf 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "highlight.js": "9.18.5", "js-beautify": "1.13.0", "js-cookie": "3.0.1", + "js-sha256": "^0.11.0", "jsencrypt": "3.0.0-rc.1", "nprogress": "0.2.0", "pinyin": "^2.10.2", diff --git a/src/api/auth/authAdmin.js b/src/api/auth/authAdmin.js index 389c614..55c0ba4 100644 --- a/src/api/auth/authAdmin.js +++ b/src/api/auth/authAdmin.js @@ -45,6 +45,7 @@ export function authCustomerRoleList(query) { params: query }); } + // 保存 export function authAdminSave(data, formName, method = "post") { let url = @@ -74,6 +75,7 @@ export function updateInv(data) { data: data }); } + //获取当前登陆人用户信息 export function selectUser(query) { return axios({ @@ -91,6 +93,15 @@ export function modifyPasswd(data) { }); } +export function forceModifyPasswd(data) { + return axios({ + url: "/admin/auth/admin/force/updateUser", + method: "post", + data: data + }); +} + + export function filterByUser(query) { return axios({ url: "/admin/auth/admin/selectUser", diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 245e430..c433c49 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -6,7 +6,7 @@ import { removeAdminId, setAdminId, } from "@/utils/auth"; - +import {sha256} from "js-sha256"; const user = { state: { adminId: "", @@ -71,7 +71,8 @@ const user = { // 登录 Login({ commit }, userInfo) { const username = userInfo.username.trim(); - const password = userInfo.password; + // const password = userInfo.password; + const password = sha256(userInfo.password) const code = userInfo.code; const uuid = userInfo.uuid; return new Promise((resolve, reject) => { @@ -82,7 +83,7 @@ const user = { setAdminId(res.data.id); commit("SET_TOKEN", res.data.token); commit("SET_ADMINID", res.data.id); - resolve(); + resolve(res); } else { reject(res.message); } diff --git a/src/views/myLogin.vue b/src/views/myLogin.vue index 8985d11..3514274 100644 --- a/src/views/myLogin.vue +++ b/src/views/myLogin.vue @@ -94,6 +94,28 @@ + + + + + + + + + + + + + + +
{ - this.$router - .push({path: this.redirect || "/"}) - .catch((res) => { + if (res.data.needChangePwd == true) { + this.$confirm('系统检测到您的密码长时间未修改,为保证您的账号安全建议立即修改密码?', '提示', { + confirmButtonText: '立即修改', + cancelButtonText: '忽略', + type: 'warning' + }).then(() => { + this.passwordFormVisible = true; + this.passwordFormData = { + oldPassword: "", + newPassword: "", + confirmPassword: "", + }; + }).catch(() => { + this.$router + .push({path: this.redirect || "/"}) + .catch((res) => { + }); }); + + } else { + this.$router + .push({path: this.redirect || "/"}) + .catch((res) => { + }); + } }) .catch((res) => { this.loading = false; - this.$refs.checkV.refresh(); this.$message.error(res); if (this.captchaEnabled) { this.getCode(); @@ -278,6 +325,34 @@ export default { this.subTitle = res.data.subTitle; }); }, + passwdSubmit() { + if (this.passwordFormData.newPassword != this.passwordFormData.confirmPassword) { + this.$message.error("新密码与确认密码不一致!!!!"); + return + } + if (this.passwordFormData.passWord == this.passwordFormData.newPassword) { + this.$message.error("旧密码与新密码不能相同!!!!"); + return + } + this.loading = true; + forceModifyPasswd(this.passwordFormData).then((response) => { + if (response.code === 20000) { + this.loading = false; + this.$confirm('密码重置成功,请点击确定重新登录', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$store.dispatch('LogOut').then(() => { + location.href = process.env.VUE_APP_CONTEXT_PATH; + }) + }).catch(() => { + }); + } else { + this.$message.error(response.message); + } + }); + }, }, components: { Verify,