【更新】解决iss提到的手机号登录新用户报错及升级前端dayjs版本

This commit is contained in:
俞宝山 2025-12-24 16:56:20 +08:00
parent 04783aad59
commit cc5bf91e89
4 changed files with 80 additions and 13 deletions

View File

@ -33,7 +33,7 @@
"axios": "1.7.7",
"codemirror": "5.65.19",
"cropperjs": "1.6.2",
"dayjs": "1.11.13",
"dayjs": "1.11.19",
"echarts": "5.5.1",
"echarts-stat": "1.2.0",
"enquire.js": "2.1.6",

View File

@ -0,0 +1,72 @@
# XnBatchButton 批量操作按钮
`XnBatchButton` 是一个用于表格批量操作的通用按钮组件。它集成了选中项校验、操作确认(可选)以及加载状态管理,简化了批量删除、批量更新等场景的实现。
## 功能特性
- **自动校验**:点击时自动检查 `selectedRowKeys` 是否为空,若为空则提示“请选择一条或多条数据”。
- **确认提示**:支持通过 `isPopconFirm` 开启或关闭二次确认气泡框Popconfirm
- **参数封装**:回调时自动将选中的 ID 封装为对象数组 `[{ [idKey]: value }, ...]`
- **样式定制**:支持自定义按钮名称、类型、图标、颜色、尺寸等。
## Props
| 属性名 | 类型 | 默认值 | 说明 |
| --- | --- | --- | --- |
| `buttonName` | `String` | `'批量操作'` | 按钮上显示的文字。 |
| `buttonType` | `String` | `undefined` | 按钮类型,参考 Ant Design Vue Button `type` (e.g., 'primary', 'default')。 |
| `buttonDanger` | `Boolean` | `false` | 是否为危险按钮(红色)。 |
| `icon` | `String` | `undefined` | 按钮图标组件名。 |
| `size` | `String` | `'middle'` | 按钮尺寸。 |
| `color` | `String` | `''` | 图标的颜色样式。 |
| `selectedRowKeys` | `Array` | `[]` | **[必填]** 当前选中的行 Key 数组。 |
| `idKey` | `String` | `'id'` | 构造回调参数时使用的 Key 名。 |
| `isPopconFirm` | `Boolean` | `true` | 是否开启点击后的二次确认气泡框。 |
| `loading` | `Boolean` | `false` | 按钮是否处于加载状态。 |
## Events
| 事件名 | 说明 | 回调参数 |
| --- | --- | --- |
| `batchCallBack` | 点击确认(或点击按钮)并通过校验后触发。 | `(params: Array<Object>)` <br> 例如:`[{ id: 1 }, { id: 2 }]` |
## 使用示例
```vue
<template>
<div>
<!-- 表格组件 -->
<a-table
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:data-source="dataSource"
:columns="columns"
rowKey="id"
/>
<!-- 批量删除按钮 -->
<XnBatchButton
buttonName="批量删除"
icon="DeleteOutlined"
buttonDanger
:selectedRowKeys="selectedRowKeys"
@batchCallBack="handleBatchDelete"
/>
</div>
</template>
<script setup>
import { ref } from 'vue';
const selectedRowKeys = ref([]);
const onSelectChange = (keys) => {
selectedRowKeys.value = keys;
};
const handleBatchDelete = (params) => {
console.log('需要删除的参数:', params);
// params 结构: [{ id: 'key1' }, { id: 'key2' }]
// 这里调用 API 接口
};
</script>
```

View File

@ -75,9 +75,9 @@ public interface ClientUserService extends IService<ClientUser> {
* 添加用户
*
* @author xuyuxiang
* @date 2022/4/24 20:48
* @date 2022/4/24 20:47
*/
void add(ClientUserAddParam clientUserAddParam, String sourceFromType);
ClientUser add(ClientUserAddParam clientUserAddParam, String sourceFromType);
/**
* 编辑用户

View File

@ -212,7 +212,7 @@ public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientU
@Transactional(rollbackFor = Exception.class)
@Override
public void add(ClientUserAddParam clientUserAddParam, String sourceFromType) {
public ClientUser add(ClientUserAddParam clientUserAddParam, String sourceFromType) {
checkParam(clientUserAddParam);
ClientUser clientUser = BeanUtil.toBean(clientUserAddParam, ClientUser.class);
if(ObjectUtil.isEmpty(clientUser.getAvatar())) {
@ -232,6 +232,7 @@ public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientU
this.save(clientUser);
// 插入扩展信息
clientUserExtService.createExtInfo(clientUser.getId(), sourceFromType);
return clientUser;
}
private void checkParam(ClientUserAddParam clientUserAddParam) {
@ -946,9 +947,7 @@ public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientU
clientUserAddParam.setPhone(phone);
clientUserAddParam.setGender(CommonGenderEnum.UNKNOWN.getValue());
// 保存用户
this.add(clientUserAddParam, ClientUserSourceFromTypeEnum.SYSTEM_REGISTER.getValue());
// 获取用户信息
ClientUser clientUser = this.getOne(new LambdaQueryWrapper<ClientUser>().eq(ClientUser::getPhone, CommonCryptogramUtil.doSm4CbcEncrypt(phone)));
ClientUser clientUser = this.add(clientUserAddParam, ClientUserSourceFromTypeEnum.SYSTEM_REGISTER.getValue());
// 发送注册成功短信
String smsTemplateCode = devConfigApi.getValueByKey(SNOWY_SMS_TEMPLATE_NOTICE_REGISTER_SUCCESS_FOR_C_KEY);
// 不为空才发送
@ -975,9 +974,7 @@ public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientU
clientUserAddParam.setEmail(email);
clientUserAddParam.setGender(CommonGenderEnum.UNKNOWN.getValue());
// 保存用户
this.add(clientUserAddParam, ClientUserSourceFromTypeEnum.SYSTEM_REGISTER.getValue());
// 获取用户信息
ClientUser clientUser = this.getOne(new LambdaQueryWrapper<ClientUser>().eq(ClientUser::getEmail, email));
ClientUser clientUser = this.add(clientUserAddParam, ClientUserSourceFromTypeEnum.SYSTEM_REGISTER.getValue());
// 发送注册成功邮件
String emailTemplateContent = devConfigApi.getValueByKey(SNOWY_EMAIL_TEMPLATE_NOTICE_REGISTER_SUCCESS_FOR_C_KEY);
// 不为空才发送
@ -1006,9 +1003,7 @@ public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientU
clientUserAddParam.setPassword(password);
clientUserAddParam.setGender(CommonGenderEnum.UNKNOWN.getValue());
// 保存用户
this.add(clientUserAddParam, ClientUserSourceFromTypeEnum.SYSTEM_REGISTER.getValue());
// 返回用户
return this.getOne(new LambdaQueryWrapper<ClientUser>().eq(ClientUser::getAccount, account));
return this.add(clientUserAddParam, ClientUserSourceFromTypeEnum.SYSTEM_REGISTER.getValue());
}
@Override