parent
92ab617a9f
commit
5420136712
@ -1,136 +1,142 @@
|
||||
import request from '@/utils/request'
|
||||
import request from "@/utils/request";
|
||||
import { parseStrEmpty } from "@/utils/ruoyi";
|
||||
|
||||
// 查询用户列表
|
||||
export function listUser(query) {
|
||||
return request({
|
||||
url: '/system/user/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
url: "/system/user/list",
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询用户详细
|
||||
export function getUser(userId) {
|
||||
return request({
|
||||
url: '/system/user/' + parseStrEmpty(userId),
|
||||
method: 'get'
|
||||
})
|
||||
url: "/system/user/" + parseStrEmpty(userId),
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 新增用户
|
||||
export function addUser(data) {
|
||||
return request({
|
||||
url: '/system/user',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
url: "/system/user",
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 修改用户
|
||||
export function updateUser(data) {
|
||||
return request({
|
||||
url: '/system/user',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
url: "/system/user",
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除用户
|
||||
export function delUser(userId) {
|
||||
return request({
|
||||
url: '/system/user/' + userId,
|
||||
method: 'delete'
|
||||
})
|
||||
url: "/system/user/" + userId,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
export function resetUserPwd(userId, password) {
|
||||
const data = {
|
||||
userId,
|
||||
password
|
||||
}
|
||||
password,
|
||||
};
|
||||
return request({
|
||||
url: '/system/user/resetPwd',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
url: "/system/user/resetPwd",
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 用户状态修改
|
||||
export function changeUserStatus(userId, status) {
|
||||
const data = {
|
||||
userId,
|
||||
status
|
||||
}
|
||||
status,
|
||||
};
|
||||
return request({
|
||||
url: '/system/user/changeStatus',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
url: "/system/user/changeStatus",
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询用户个人信息
|
||||
export function getUserProfile() {
|
||||
return request({
|
||||
url: '/system/user/profile',
|
||||
method: 'get'
|
||||
})
|
||||
url: "/system/user/profile",
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 修改用户个人信息
|
||||
export function updateUserProfile(data) {
|
||||
return request({
|
||||
url: '/system/user/profile',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
url: "/system/user/profile",
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
export function updateUserPwd(oldPassword, newPassword) {
|
||||
const data = {
|
||||
oldPassword,
|
||||
newPassword
|
||||
}
|
||||
newPassword,
|
||||
};
|
||||
return request({
|
||||
url: '/system/user/profile/updatePwd',
|
||||
method: 'put',
|
||||
params: data
|
||||
})
|
||||
url: "/system/user/profile/updatePwd",
|
||||
method: "put",
|
||||
params: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 用户头像上传
|
||||
export function uploadAvatar(data) {
|
||||
return request({
|
||||
url: '/system/user/profile/avatar',
|
||||
method: 'post',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
data: data
|
||||
})
|
||||
url: "/system/user/profile/avatar",
|
||||
method: "post",
|
||||
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询授权角色
|
||||
export function getAuthRole(userId) {
|
||||
return request({
|
||||
url: '/system/user/authRole/' + userId,
|
||||
method: 'get'
|
||||
})
|
||||
url: "/system/user/authRole/" + userId,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 保存授权角色
|
||||
export function updateAuthRole(data) {
|
||||
return request({
|
||||
url: '/system/user/authRole',
|
||||
method: 'put',
|
||||
params: data
|
||||
})
|
||||
url: "/system/user/authRole",
|
||||
method: "put",
|
||||
params: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询部门下拉树结构
|
||||
// export function deptTreeSelect() {
|
||||
// return request({
|
||||
// url: '/system/user/deptTree',
|
||||
// method: 'get'
|
||||
// })
|
||||
// }
|
||||
export function deptTreeSelect() {
|
||||
return request({
|
||||
url: '/system/user/deptTree',
|
||||
method: 'get'
|
||||
})
|
||||
url: "/system/dept/treeselect",
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 847 B |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* @Author: 许宏杰
|
||||
* @Date: 2021-12-28 16:05:36
|
||||
* @LastEditors: 许宏杰
|
||||
* @LastEditTime: 2022-03-24 14:25:05
|
||||
* @FilePath: \taicangpopulationpc\src\utils\regex\formRegex.js
|
||||
*/
|
||||
//以key:value方式一次性全部导出
|
||||
export default {
|
||||
// 邮箱
|
||||
checkEmail: (rule, value, callback) => {
|
||||
const mailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
|
||||
if (!value) {
|
||||
return callback(new Error("邮箱不能为空"));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (mailReg.test(value)) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请输入正确的邮箱格式"));
|
||||
}
|
||||
}, 100);
|
||||
},
|
||||
//手机号
|
||||
checkPhone: (rule, value, callback) => {
|
||||
const phoneReg = /^1[3|4|5|7|8][0-9]{9}$/;
|
||||
if (!value) {
|
||||
return callback(new Error("电话号码不能为空"));
|
||||
}
|
||||
setTimeout(() => {
|
||||
// Number.isInteger是es6验证数字是否为整数的方法,但是我实际用的时候输入的数字总是识别成字符串
|
||||
// 所以我就在前面加了一个+实现隐式转换
|
||||
if (!Number.isInteger(+value)) {
|
||||
callback(new Error("请输入数字值"));
|
||||
} else {
|
||||
if (phoneReg.test(value)) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("电话号码格式不正确"));
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
},
|
||||
//正整数大于0
|
||||
checkcontractLeaseArea: (rule, value, callback) => {
|
||||
const contractLeaseArea = /^[1-9]\d*$/;
|
||||
if (!value) {
|
||||
return callback(new Error("数字不能小于且等于0"));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (contractLeaseArea.test(value)) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请输入大于0的数字"));
|
||||
}
|
||||
}, 100);
|
||||
},
|
||||
//只接受中文汉字
|
||||
ChineseCharacters(text) {
|
||||
let personalName = (rule, value, callback) => {
|
||||
const names = /^[\u4e00-\u9fa5]{2,15}$/;
|
||||
if (!value) {
|
||||
return callback(new Error(`${text}名称不能为空`));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (names.test(value)) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error(`${text}只能为中文汉字`));
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
return personalName;
|
||||
},
|
||||
//身份证
|
||||
idCard: (rule, value, callback) => {
|
||||
let id =
|
||||
/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
|
||||
if (!value) {
|
||||
return callback(new Error("身份证号码不能为空"));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (id.test(value)) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("请输入正确的身份证号码"));
|
||||
}
|
||||
}, 100);
|
||||
},
|
||||
};
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* @Author: 许宏杰
|
||||
* @Date: 2021-12-28 10:21:48
|
||||
* @LastEditors: 许宏杰
|
||||
* @LastEditTime: 2021-12-28 16:22:32
|
||||
* @FilePath: \hezhangzhipc\src\utils\regex\index.js
|
||||
*/
|
||||
import formRegex from './formRegex.js'//引入自己的正则文件目录
|
||||
|
||||
export default {
|
||||
formRegex,//导出
|
||||
}
|
||||
|
||||
//页面使用
|
||||
// 引入 import 名字 from "@/utils/regex/index.js";
|
||||
// 使用 名字.index导出名字.key
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue