From eae2747b5ea8522e8ee52fb03c53a9fce2cdd744 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期二, 07 一月 2025 10:52:09 +0800
Subject: [PATCH] 修改密码
---
.env.development | 10 ++--
src/views/system/user/index.vue | 2
src/views/system/user/component/userDialog.vue | 54 +++++++++++++++++++-------
3 files changed, 45 insertions(+), 21 deletions(-)
diff --git a/.env.development b/.env.development
index d37ea2f..50f6c79 100644
--- a/.env.development
+++ b/.env.development
@@ -1,20 +1,20 @@
# 本地环境
ENV = 'development'
-#VITE_API_URL = 'http://192.168.0.27:8084'
-#张凤接口地址
+VITE_API_URL = 'http://192.168.2.11:8084'
+#贺哥接口地址
#VITE_API_URL = 'http://192.168.0.38:8086'
#黄振接口地址
-#VITE_API_URL = 'http://192.168.0.27:8084'
+#VITE_API_URL = 'http://192.168.0.30:8084'
#戚会山接口地址
-#VITE_API_URL = 'http://121.239.169.27:16070'
+#VITE_API_URL = 'http://aq.gusulab.ac.cn:18087/api'
#线上正式环境接口地址
#VITE_API_URL = 'http://192.168.0.52:8011/safeplatform'
#本地预发接口地址
-VITE_API_URL = 'http://aq.gusulab.ac.cn:18087/api'
+#VITE_API_URL = 'http://aq.gusulab.ac.cn:18087/api'
#本地测试接口地址
diff --git a/src/views/system/user/component/userDialog.vue b/src/views/system/user/component/userDialog.vue
index 12f8b32..b104036 100644
--- a/src/views/system/user/component/userDialog.vue
+++ b/src/views/system/user/component/userDialog.vue
@@ -3,40 +3,46 @@
<el-dialog :title="title" v-model="isShowUserDialog" width="769px">
<el-form :model="userForm" size="default" ref="userRef" :rules="userFormRules" label-width="90px">
<el-row :gutter="35">
- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb25">
<el-form-item label="用户名" prop="name">
<el-input v-model.trim="userForm.name" placeholder="用户名" clearable></el-input>
</el-form-item>
</el-col>
- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb25">
<el-form-item label="真实姓名" prop="realName">
<el-input v-model.trim="userForm.realName" placeholder="真实姓名" clearable></el-input>
</el-form-item>
</el-col>
- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20" v-if="isAdd">
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb25">
<el-form-item label="账户密码" prop="pwd">
<el-input v-model.trim="userForm.pwd" placeholder="账户密码" type="password" show-password>
</el-input>
</el-form-item>
</el-col>
- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+<!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20" v-if="isAdd">-->
+<!-- <el-form-item label="账户密码" prop="pwd">-->
+<!-- <el-input v-model.trim="userForm.pwd" placeholder="账户密码" type="password" show-password>-->
+<!-- </el-input>-->
+<!-- </el-form-item>-->
+<!-- </el-col>-->
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb25">
<el-form-item label="关联角色" prop="roleIds">
<el-select v-model="userForm.roleIds" placeholder="关联角色" clearable class="w100" multiple>
<el-option v-for="item in roleData" :key="item.id" :label="item.name" :value="item.id"> </el-option>
</el-select>
</el-form-item>
</el-col>
- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb25">
<el-form-item label="部门" prop="depId">
<el-cascader :options="departmentData" :props="{ emitPath: false, checkStrictly: true, value: 'id', label: 'depName' }" placeholder="部门" clearable class="w100" v-model="userForm.depId"> </el-cascader>
</el-form-item>
</el-col>
- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb25">
<el-form-item label="手机号" prop="phone">
<el-input v-model.trim="userForm.phone" placeholder="手机号" clearable></el-input>
</el-form-item>
</el-col>
- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb25">
<el-form-item label="是否专家" prop="identityStatus">
<el-radio-group v-model="userForm.identityStatus">
<el-radio :label="0">是</el-radio>
@@ -44,26 +50,26 @@
</el-radio-group>
</el-form-item>
</el-col>
- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20" v-if="userForm.identityStatus == 0">
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb25" v-if="userForm.identityStatus == 0">
<el-form-item label="专家类型" prop="identityIds">
<el-select v-model="userForm.identityIds" placeholder="专家类型" clearable class="w100" multiple>
<el-option v-for="item in expData" :key="item.id" :label="item.identity" :value="item.id"> </el-option>
</el-select>
</el-form-item>
</el-col>
- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb25">
<el-form-item label="证件类型" prop="idType">
<el-select v-model="userForm.idType" placeholder="证件类型" clearable class="w100">
<el-option :key="1" label="身份证" :value="1"> </el-option>
</el-select>
</el-form-item>
</el-col>
- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb25">
<el-form-item label="证件号码" prop="idSerial">
<el-input v-model.trim="userForm.idSerial" placeholder="证件号码" clearable></el-input>
</el-form-item>
</el-col>
- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20" v-if="userForm.identityStatus == 0">
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb25" v-if="userForm.identityStatus == 0">
<el-form-item label="资质证书" prop="">
<el-upload accept="image/*" :action="uploadUrl" :headers="header" method="post" :data="{module: 'accountPath'}" :on-success="handleAvatarSuccess" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='imgLimit' v-model:file-list="fileList" list-type="picture-card" :before-upload="picSize" :on-remove="handleRemove" :before-remove="beforeRemove">
<el-icon><Plus /></el-icon>
@@ -92,7 +98,7 @@
import { reactive, toRefs, onMounted, defineComponent, ref } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { userApi } from '/@/api/systemManage/user';
-import {checkChineseName, verifyFullName, verifyIdCard, verifyPhone} from "/@/utils/toolsValidate";
+import {checkChineseName, verifyFullName, verifyIdCard, verifyPhone, verifyPwd} from "/@/utils/toolsValidate";
import axios from 'axios';
import Cookies from "js-cookie";
import {useUserInfo} from "/@/stores/userInfo";
@@ -136,10 +142,25 @@
url: string;
}
+
+
export default defineComponent({
name: 'userDialog',
setup(props, context) {
const userRef = ref()
+ const validatePwd = (rule: any, value: any, callback: any)=>{
+ if(value === '' && state.title === '新增用户'){
+ callback(new Error('请输入密码'))
+ }else if(value!='' && value != undefined){
+ if(!verifyPwd(value)){
+ callback(new Error('密码须包含大小写字母、数字、特殊字符,长度不少于8位'))
+ }else{
+ callback()
+ }
+ }else {
+ callback()
+ }
+ }
const state = reactive<UserState>({
title: '',
isShowUserDialog: false,
@@ -165,7 +186,7 @@
identityStatus: [{ required: true, message: '请选择是否为专家', trigger: 'change' }],
identityIds: [{ required: true, message: '请选择专家类型', trigger: 'change' }],
idType: [{ required: true, message: '请选择证件类型', trigger: 'blur' }],
- pwd: [{ required: true, message: '请输入账户密码', trigger: 'blur' }],
+ pwd: [{validator: validatePwd, trigger: 'blur' }],
},
departmentData: [], // 部门数据
roleData: [], //角色数据
@@ -182,6 +203,8 @@
tk: Cookies.get('token')
}
});
+
+
// 打开弹窗
const openDialog = (type: string, value: any, departmentList: [], roleList: [],expList: []) => {
state.isShowUserDialog = true;
@@ -208,6 +231,7 @@
state.title = '修改用户';
state.isAdd = false
state.userForm = JSON.parse(JSON.stringify(value));
+ state.userForm.pwd = '';
state.userForm.roleIds = JSON.parse(JSON.stringify(value)).roles.map(i=>i.roleId)
state.userForm.identityIds = JSON.parse(JSON.stringify(value)).userIdentities.map(i=>i.userIdentityId)
}
@@ -262,8 +286,8 @@
});
}
} else {
- const {name, realName, roleIds, depId, phone, idType, idSerial, id, identityStatus, identityIds, qualificationAttId} = state.userForm
- const data = {name, realName, roleIds, depId, phone, idType, idSerial,id, identityStatus, identityIds, qualificationAttId}
+ const {name, realName, roleIds, depId, phone, idType, idSerial, id, identityStatus, identityIds, qualificationAttId, pwd} = state.userForm
+ const data = {name, realName, roleIds, depId, phone, idType, idSerial,id, identityStatus, identityIds, qualificationAttId, pwd}
let res = await userApi().modUser(data);
if (res.data.code === 100) {
ElMessage({
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 3227346..099239e 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -46,7 +46,7 @@
<template #default="scope">
<el-button :disabled="scope.row.name === 'admin'" size="small" text type="primary" @click="onOpenUserDialog('修改', scope.row)">修改</el-button>
<el-button style="color: red" :disabled="scope.row.name === 'admin'" size="small" text type="primary" @click="onRowDel(scope.row)">删除</el-button>
- <el-button v-if="scope.row.name !== 'admin'" style="color: red" :disabled="!isAdmin" size="small" text type="primary" @click="onResetPwd(scope.row)">重置密码</el-button>
+ <el-button v-if="scope.row.name !== 'admin'" style="color: red" :disabled="!isAdmin" size="small" text type="primary" @click="onResetPwd(scope.row)">重置密码</el-button>
</template>
</el-table-column>
</el-table>
--
Gitblit v1.9.2