chore(uni-admin): 同步官方 2.5.1 框架文件

来源: gitee.com/dcloud/uni-admin master (2.5.1, 2025-04-24)。含 uni-stat-tabs 组件更新、uni-id-users/uni-id-log validator、uni-stat 页面修复、菜单初始数据与 DB schema 更新;版本号对齐 2.5.1。
This commit is contained in:
12914
2026-09-06 20:05:19 +08:00
parent 96d8f20d88
commit 6e224e285f
13 changed files with 388 additions and 618 deletions
+12 -160
View File
@@ -1,16 +1,21 @@
// 表单校验规则由 schema2code 生成,不建议直接修改校验规则,而建议通过 schema2code 生成, 详情: https://uniapp.dcloud.net.cn/uniCloud/schema
// 校验规则由 schema 生成,请不要直接修改当前文件,如果需要请在uniCloud控制台修改schema
// uniCloud: https://unicloud.dcloud.net.cn/
const validator = {
"create_date": {
export default {
"user_name": {
"rules": [
{
"format": "timestamp"
"format": "string"
}
]
},
"device_uuid": {
"content": {
"rules": [
{
"required": true
},
{
"format": "string"
}
@@ -23,164 +28,11 @@ const validator = {
}
]
},
"state": {
"create_date": {
"rules": [
{
"format": "int"
}
]
},
"type": {
"rules": [
{
"format": "string"
},
{
"range": [
{
"value": "logout",
"text": "logout"
},
{
"value": "login",
"text": "login"
},
{
"value": "register",
"text": "register"
},
{
"value": "reset-pwd",
"text": "reset-pwd"
},
{
"value": "bind-mobile",
"text": "bind-mobile"
},
{
"value": "bind-weixin",
"text": "bind-weixin"
},
{
"value": "bind-qq",
"text": "bind-qq"
},
{
"value": "bind-apple",
"text": "bind-apple"
},
{
"value": "bind-alipay",
"text": "bind-alipay"
}
]
}
]
},
"ua": {
"rules": [
{
"format": "string"
}
]
},
"user_id": {
"rules": [
{
"required": true
},
{
"format": "string"
}
]
},
"username": {
"rules": [
{
"format": "string"
}
]
},
"email": {
"rules": [
{
"format": "string"
}
]
},
"mobile": {
"rules": [
{
"format": "string"
}
]
},
"appid": {
"rules": [
{
"format": "string"
"format": "timestamp"
}
]
}
}
const enumConverter = {
"type_valuetotext": {
"logout": "logout",
"login": "login",
"register": "register",
"reset-pwd": "reset-pwd",
"bind-mobile": "bind-mobile",
"bind-weixin": "bind-weixin",
"bind-qq": "bind-qq",
"bind-apple": "bind-apple",
"bind-alipay": "bind-alipay"
}
}
function filterToWhere(filter, command) {
let where = {}
for (let field in filter) {
let { type, value } = filter[field]
switch (type) {
case "search":
if (typeof value === 'string' && value.length) {
where[field] = new RegExp(value)
}
break;
case "select":
if (value.length) {
let selectValue = []
for (let s of value) {
selectValue.push(command.eq(s))
}
where[field] = command.or(selectValue)
}
break;
case "range":
if (value.length) {
let gt = value[0]
let lt = value[1]
where[field] = command.and([command.gte(gt), command.lte(lt)])
}
break;
case "date":
if (value.length) {
let [s, e] = value
let startDate = new Date(s)
let endDate = new Date(e)
where[field] = command.and([command.gte(startDate), command.lte(endDate)])
}
break;
case "timestamp":
if (value.length) {
let [startDate, endDate] = value
where[field] = command.and([command.gte(startDate), command.lte(endDate)])
}
break;
}
}
return where
}
export { validator, enumConverter, filterToWhere }
+179 -414
View File
@@ -2,425 +2,190 @@
const validator = {
"ali_openid": {
"rules": [
{
"format": "string"
}
]
},
"apple_openid": {
"rules": [
{
"format": "string"
}
]
},
"avatar": {
"rules": [
{
"format": "string"
}
],
"title": "头像地址",
"label": "头像地址"
},
"avatar_file": {
"rules": [
{
"format": "file"
}
],
"title": "头像文件",
"label": "头像文件"
},
"comment": {
"rules": [
{
"format": "string"
}
],
"title": "备注",
"label": "备注"
},
"dcloud_appid": {
"rules": [
{
"format": "array"
}
]
},
"department_id": {
"rules": [
{
"format": "array"
}
],
"title": "部门",
"label": "部门"
},
"email": {
"rules": [
{
"format": "string"
},
{
"format": "email"
}
],
"title": "邮箱",
"label": "邮箱"
},
"email_confirmed": {
"rules": [
{
"format": "int"
},
{
"range": [
{
"text": "未验证",
"value": 0
},
{
"text": "已验证",
"value": 1
}
]
}
],
"title": "邮箱验证状态",
"defaultValue": 0,
"label": "邮箱验证状态"
},
"gender": {
"rules": [
{
"format": "int"
},
{
"range": [
{
"text": "未知",
"value": 0
},
{
"text": "男",
"value": 1
},
{
"text": "女",
"value": 2
}
]
}
],
"title": "性别",
"defaultValue": 0,
"label": "性别"
},
"invite_time": {
"rules": [
{
"format": "timestamp"
}
]
},
"inviter_uid": {
"rules": [
{
"format": "array"
}
]
},
"last_login_date": {
"rules": [
{
"format": "timestamp"
}
]
},
"last_login_ip": {
"rules": [
{
"format": "string"
}
]
},
"mobile": {
"rules": [
{
"format": "string"
},
{
"pattern": "^\\+?[0-9-]{3,20}$"
}
],
"title": "手机号码",
"label": "手机号码"
},
"mobile_confirmed": {
"rules": [
{
"format": "int"
},
{
"range": [
{
"text": "未验证",
"value": 0
},
{
"text": "已验证",
"value": 1
}
]
}
],
"title": "手机号验证状态",
"defaultValue": 0,
"label": "手机号验证状态"
},
"my_invite_code": {
"rules": [
{
"format": "string"
}
]
},
"nickname": {
"rules": [
{
"format": "string"
}
],
"title": "昵称",
"label": "昵称"
},
"password": {
"rules": [
{
"format": "password"
}
],
"title": "密码",
"label": "密码"
},
"password_secret_version": {
"rules": [
{
"format": "int"
}
],
"title": "passwordSecret",
"label": "passwordSecret"
},
"realname_auth": {
"rules": [
{
"format": "object"
}
]
},
"register_date": {
"rules": [
{
"format": "timestamp"
}
]
},
"register_ip": {
"rules": [
{
"format": "string"
}
]
},
"role": {
"rules": [
{
"format": "array"
}
],
"title": "角色",
"label": "角色"
},
"tags": {
"rules": [
{
"format": "array"
}
],
"title": "标签",
"label": "标签"
},
"score": {
"rules": [
{
"format": "int"
}
]
},
"status": {
"rules": [
{
"format": "int"
},
{
"range": [
{
"text": "正常",
"value": 0
},
{
"text": "禁用",
"value": 1
},
{
"text": "审核中",
"value": 2
},
{
"text": "审核拒绝",
"value": 3
},
{
"text": "已注销",
"value": 4
}
]
}
],
"title": "用户状态",
"defaultValue": 0,
"label": "用户状态"
},
"token": {
"rules": [
{
"format": "array"
}
]
},
"username": {
"rules": [
{
"format": "string"
}
],
"title": "用户名",
"label": "用户名"
},
"wx_openid": {
"rules": [
{
"format": "object"
}
]
},
"wx_unionid": {
"rules": [
{
"format": "string"
}
]
},
"qq_openid": {
"rules": [
{
"format": "object"
}
]
},
"qq_unionid": {
"rules": [
{
"format": "string"
}
]
},
"third_party": {
"rules": [
{
"format": "object"
}
]
},
"identities": {
"rules": [
{
"format": "array"
}
]
}
"username": {
"rules": [{
"required": true,
"errorMessage": '请输入用户名',
},
{
"minLength": 3,
"maxLength": 32,
"errorMessage": '用户名长度在 {minLength} 到 {maxLength} 个字符',
},
{
validateFunction: function(rule, value, data, callback) {
// console.log(value);
if (/^1\d{10}$/.test(value) || /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(value)) {
callback('用户名不能是:手机号或邮箱')
};
if (/^\d+$/.test(value)) {
callback('用户名不能为纯数字')
};
if(/[\u4E00-\u9FA5\uF900-\uFA2D]{1,}/.test(value)){
callback('用户名不能包含中文')
}
return true
}
}
],
"label": "用户名"
},
"nickname": {
"rules": [{
minLength: 3,
maxLength: 32,
errorMessage: '昵称长度在 {minLength} 到 {maxLength} 个字符',
},
{
validateFunction: function(rule, value, data, callback) {
// console.log(value);
if (/^1\d{10}$/.test(value) || /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(value)) {
callback('昵称不能是:手机号或邮箱')
};
if (/^\d+$/.test(value)) {
callback('昵称不能为纯数字')
};
// if(/[\u4E00-\u9FA5\uF900-\uFA2D]{1,}/.test(value)){
// callback('昵称不能包含中文')
// }
return true
}
}
],
"label": "昵称"
},
"password": {
"rules": [{
"required": true,
},
{
"format": "password"
},
{
"minLength": 6
}
],
"label": "密码"
},
"mobile": {
"rules": [{
"format": "string"
},
{
"pattern": "^\\+?[0-9-]{3,20}$"
}
],
"label": "手机号码"
},
"status": {
"rules": [{
"format": "int"
},
{
"range": [{
"text": "正常",
"value": 0
},
{
"text": "禁用",
"value": 1
},
{
"text": "审核中",
"value": 2
},
{
"text": "审核拒绝",
"value": 3
}
]
}
],
"defaultValue": 0,
"label": "用户状态"
},
"email": {
"rules": [{
"format": "string"
},
{
"format": "email"
}
],
"label": "邮箱"
},
"role": {
"rules": [{
"format": "array"
}],
"label": "角色"
},
"last_login_date": {
"rules": [{
"format": "timestamp"
}]
}
}
const enumConverter = {
"email_confirmed_valuetotext": {
"0": "未验证",
"1": "已验证"
},
"gender_valuetotext": {
"0": "未知",
"1": "男",
"2": "女"
},
"mobile_confirmed_valuetotext": {
"0": "未验证",
"1": "已验证"
},
"status_valuetotext": {
"0": "正常",
"1": "禁用",
"2": "审核中",
"3": "审核拒绝",
"4": "已注销"
}
"status_valuetotext": {
"0": "正常",
"1": "禁用",
"2": "审核中",
"3": "审核拒绝"
}
}
function filterToWhere(filter, command) {
let where = {}
for (let field in filter) {
let { type, value } = filter[field]
switch (type) {
case "search":
if (typeof value === 'string' && value.length) {
where[field] = new RegExp(value)
}
break;
case "select":
if (value.length) {
let selectValue = []
for (let s of value) {
selectValue.push(command.eq(s))
}
where[field] = command.or(selectValue)
}
break;
case "range":
if (value.length) {
let gt = value[0]
let lt = value[1]
where[field] = command.and([command.gte(gt), command.lte(lt)])
}
break;
case "date":
if (value.length) {
let [s, e] = value
let startDate = new Date(s)
let endDate = new Date(e)
where[field] = command.and([command.gte(startDate), command.lte(endDate)])
}
break;
case "timestamp":
if (value.length) {
let [startDate, endDate] = value
where[field] = command.and([command.gte(startDate), command.lte(endDate)])
}
break;
}
}
return where
let where = {}
for (let field in filter) {
let {
type,
value
} = filter[field]
switch (type) {
case "search":
if (typeof value === 'string' && value.length) {
where[field] = new RegExp(value)
}
break;
case "select":
if (value.length) {
let selectValue = []
for (let s of value) {
selectValue.push(command.eq(s))
}
where[field] = command.or(selectValue)
}
break;
case "range":
if (value.length) {
let gt = value[0]
let lt = value[1]
where[field] = command.and([command.gte(gt), command.lte(lt)])
}
break;
case "date":
if (value.length) {
let [s, e] = value
let startDate = new Date(s)
let endDate = new Date(e)
where[field] = command.and([command.gte(startDate), command.lte(endDate)])
}
break;
case "timestamp":
if (value.length) {
let [startDate, endDate] = value
where[field] = command.and([command.gte(startDate), command.lte(endDate)])
}
break;
}
}
return where
}
export { validator, enumConverter, filterToWhere }
export {
validator,
enumConverter,
filterToWhere
}