支持管理账号手机号选填
This commit is contained in:
@@ -75,7 +75,7 @@ export interface ListUsersParams {
|
||||
export interface CreateUserRequest {
|
||||
account: string
|
||||
nickname: string
|
||||
phone: string
|
||||
phone?: string
|
||||
contactPhone?: string
|
||||
birthday?: string
|
||||
wechatId?: string
|
||||
|
||||
@@ -236,7 +236,7 @@
|
||||
<a-form-item label="手机号" name="phone">
|
||||
<a-input
|
||||
v-model:value="formState.phone"
|
||||
placeholder="请输入手机号"
|
||||
placeholder="选填,填写后保持唯一"
|
||||
:maxlength="11"
|
||||
inputmode="numeric"
|
||||
autocomplete="off"
|
||||
@@ -256,9 +256,8 @@
|
||||
<a-form-item
|
||||
label="微信号"
|
||||
name="wechatId"
|
||||
:required="[2, 3].includes(Number(formState.type))"
|
||||
>
|
||||
<a-input v-model:value="formState.wechatId" placeholder="店长和美甲师必填" />
|
||||
<a-input v-model:value="formState.wechatId" placeholder="选填,未填时使用登录账号兜底" />
|
||||
</a-form-item>
|
||||
<a-form-item label="微信二维码" name="wechatQrCode">
|
||||
<div class="wechat-qr-field">
|
||||
@@ -932,7 +931,7 @@ const handleWechatQrUpload: UploadProps['customRequest'] = async (options) => {
|
||||
const validatePhoneUniqueness = async (value: string) => {
|
||||
const normalized = value?.trim()
|
||||
if (!normalized) {
|
||||
throw new Error('请输入手机号')
|
||||
return
|
||||
}
|
||||
if (!PHONE_REGEX.test(normalized)) {
|
||||
throw new Error('请输入正确的 11 位手机号')
|
||||
@@ -1075,7 +1074,6 @@ const formRules = {
|
||||
],
|
||||
nickname: [{ required: true, message: '请输入昵称', trigger: 'blur' }],
|
||||
phone: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{
|
||||
validator: async (_rule: unknown, value: string) => {
|
||||
await validatePhoneUniqueness(value)
|
||||
@@ -1084,15 +1082,6 @@ const formRules = {
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
wechatId: [{
|
||||
validator: async (_rule: unknown, value: string) => {
|
||||
if ([2, 3].includes(Number(formState.type)) && !value?.trim()) {
|
||||
return Promise.reject('店长和美甲师必须填写微信号')
|
||||
}
|
||||
return Promise.resolve()
|
||||
},
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
password: [{
|
||||
validator: async (_rule: unknown, value: string) => {
|
||||
validateOptionalPasswordStrength(value)
|
||||
@@ -1379,7 +1368,7 @@ const buildDraftPayload = () => ({
|
||||
account: formState.account,
|
||||
nickname: formState.nickname,
|
||||
phone: formState.phone,
|
||||
contactPhone: formState.phone,
|
||||
contactPhone: formState.contactPhone,
|
||||
birthday: formState.birthday,
|
||||
wechatId: formState.wechatId,
|
||||
wechatQrCode: formState.wechatQrCode,
|
||||
@@ -1445,8 +1434,8 @@ const showEditModal = (record: any) => {
|
||||
Object.assign(formState, {
|
||||
account: record.account,
|
||||
nickname: record.nickname,
|
||||
phone: record.phone || record.contactPhone || '',
|
||||
contactPhone: record.phone || record.contactPhone || '',
|
||||
phone: record.phone || '',
|
||||
contactPhone: record.contactPhone || '',
|
||||
birthday: record.birthday || '',
|
||||
wechatId: record.wechatId || '',
|
||||
wechatQrCode: record.wechatQrCode || '',
|
||||
@@ -1534,7 +1523,7 @@ const handleModalOk = async () => {
|
||||
account: formState.account.trim(),
|
||||
nickname: formState.nickname.trim(),
|
||||
phone: primaryPhone,
|
||||
contactPhone: primaryPhone,
|
||||
contactPhone: primaryPhone || undefined,
|
||||
birthday: formState.birthday || undefined,
|
||||
wechatId: formState.wechatId.trim(),
|
||||
wechatQrCode: formState.wechatQrCode,
|
||||
|
||||
@@ -50,7 +50,8 @@ describe('admin modal and user form behavior', () => {
|
||||
expect(userFormModal).not.toContain('formState.contactPhone')
|
||||
expect(usersView).toContain('const primaryPhone = formState.phone.trim()')
|
||||
expect(usersView).toContain('phone: primaryPhone')
|
||||
expect(usersView).toContain('contactPhone: primaryPhone')
|
||||
expect(usersView).toContain('contactPhone: primaryPhone || undefined')
|
||||
expect(usersView).toContain('选填,填写后保持唯一')
|
||||
})
|
||||
|
||||
it('uses a polished date picker and visible required markers for conditional user fields', () => {
|
||||
@@ -64,7 +65,8 @@ describe('admin modal and user form behavior', () => {
|
||||
expect(userFormModal).toContain('value-format="YYYY-MM-DD"')
|
||||
expect(userFormModal).toContain('class="user-date-picker"')
|
||||
expect(usersView).toContain('.user-date-picker')
|
||||
expect(wechatIdField).toContain(':required="[2, 3].includes(Number(formState.type))"')
|
||||
expect(wechatIdField).not.toContain(':required="[2, 3].includes(Number(formState.type))"')
|
||||
expect(wechatIdField).toContain('选填,未填时使用登录账号兜底')
|
||||
expect(shopIdsField).toContain(':required="Number(formState.type) !== 4"')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -568,7 +568,7 @@ Page({
|
||||
if (!this.data.userForm.account) {
|
||||
return '请输入账号'
|
||||
}
|
||||
if (!this.data.userForm.phone || this.data.userForm.phone.length !== 11) {
|
||||
if (this.data.userForm.phone && this.data.userForm.phone.length !== 11) {
|
||||
return '请输入 11 位手机号'
|
||||
}
|
||||
if (this.data.mode === 'create' && !this.data.userForm.password) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<input class="field-input" value="{{userForm.account}}" data-field="account" bindinput="handleUserInput"></input>
|
||||
</view>
|
||||
<view class="field-group">
|
||||
<text class="field-label">手机号</text>
|
||||
<text class="field-label">手机号(选填)</text>
|
||||
<input class="field-input" type="number" value="{{userForm.phone}}" data-field="phone" bindinput="handleUserInput"></input>
|
||||
</view>
|
||||
<view class="field-group">
|
||||
|
||||
@@ -439,7 +439,7 @@ Page({
|
||||
if (!form.account) {
|
||||
return '请输入账号'
|
||||
}
|
||||
if (!form.phone || form.phone.length !== 11) {
|
||||
if (form.phone && form.phone.length !== 11) {
|
||||
return '请输入 11 位手机号'
|
||||
}
|
||||
if (this.data.mode === 'create' && !form.password) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<view class="page-stack">
|
||||
<view class="surface-card">
|
||||
<text class="section-title">{{mode === 'edit' ? '更新用户资料' : '创建后台账号'}}</text>
|
||||
<text class="section-desc">账号仅允许字母和数字,手机号保持全局唯一。店长创建美甲师时,这里会直接绑定当前店铺。</text>
|
||||
<text class="section-desc">账号仅允许字母和数字,手机号选填且填写后保持全局唯一。店长创建美甲师时,这里会直接绑定当前店铺。</text>
|
||||
|
||||
<view class="field-group">
|
||||
<text class="field-label">昵称</text>
|
||||
@@ -15,7 +15,7 @@
|
||||
<input class="field-input" value="{{form.account}}" data-field="account" bindinput="handleInputChange"></input>
|
||||
</view>
|
||||
<view class="field-group">
|
||||
<text class="field-label">手机号</text>
|
||||
<text class="field-label">手机号(选填)</text>
|
||||
<input class="field-input" type="number" value="{{form.phone}}" data-field="phone" bindinput="handleInputChange"></input>
|
||||
</view>
|
||||
<view class="field-group">
|
||||
|
||||
+1
-4
@@ -260,7 +260,7 @@ public class AdminManagerController {
|
||||
dto.setShopId(managedShopId);
|
||||
dto.setShopIds(List.of(managedShopId));
|
||||
}
|
||||
if (!StringUtils.hasText(dto.getWechatId())) {
|
||||
if (!StringUtils.hasText(dto.getWechatId()) && StringUtils.hasText(dto.getPhone())) {
|
||||
dto.setWechatId(dto.getPhone());
|
||||
}
|
||||
return Result.success(userService.createUser(dto));
|
||||
@@ -418,9 +418,6 @@ public class AdminManagerController {
|
||||
userDTO.setAvatar(dto.getAvatar().trim());
|
||||
}
|
||||
if (dto.getPhone() != null) {
|
||||
if (!StringUtils.hasText(dto.getPhone())) {
|
||||
throw new RuntimeException("登录手机号不能为空");
|
||||
}
|
||||
userDTO.setPhone(dto.getPhone().trim());
|
||||
}
|
||||
if (dto.getContactPhone() != null) {
|
||||
|
||||
+50
-4
@@ -384,9 +384,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
|
||||
List<Long> validatedShopIds = resolveValidatedShopIds(userDTO.getShopIds(), userDTO.getShopId());
|
||||
Long validatedShopId = pickPrimaryShopId(validatedShopIds);
|
||||
String validatedPhone = validateUserPhone(userDTO.getPhone(), null, true);
|
||||
String validatedPhone = validateUserPhone(userDTO.getPhone(), null, false);
|
||||
Integer userType = userDTO.getType();
|
||||
String validatedWechatId = UserProfileFieldSupport.normalizeOptionalText(userDTO.getWechatId());
|
||||
String validatedWechatId = normalizeServiceUserWechatId(
|
||||
userType,
|
||||
userDTO.getWechatId(),
|
||||
validatedPhone,
|
||||
validatedAccount
|
||||
);
|
||||
UserProfileFieldSupport.requireWechatIdForServiceUser(userType, validatedWechatId);
|
||||
|
||||
/**
|
||||
@@ -559,8 +564,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
validatePasswordStrength(userDTO.getPassword());
|
||||
userDO.setPassword(passwordEncoder.encode(userDTO.getPassword()));
|
||||
}
|
||||
if (userDTO.getPhone() != null) {
|
||||
userDO.setPhone(validateUserPhone(userDTO.getPhone(), id, true));
|
||||
boolean phoneUpdateRequested = userDTO.getPhone() != null;
|
||||
String validatedPhone = null;
|
||||
if (phoneUpdateRequested) {
|
||||
validatedPhone = validateUserPhone(userDTO.getPhone(), id, false);
|
||||
userDO.setPhone(validatedPhone);
|
||||
}
|
||||
if (userDTO.getContactPhone() != null) {
|
||||
userDO.setContactPhone(UserProfileFieldSupport.normalizeOptionalText(userDTO.getContactPhone()));
|
||||
@@ -594,6 +602,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
userDO.setVipId(userDTO.getVipId());
|
||||
}
|
||||
Integer targetUserType = userDO.getType();
|
||||
userDO.setWechatId(normalizeServiceUserWechatId(
|
||||
targetUserType,
|
||||
userDO.getWechatId(),
|
||||
userDO.getPhone(),
|
||||
userDO.getAccount()
|
||||
));
|
||||
UserProfileFieldSupport.requireWechatIdForServiceUser(targetUserType, userDO.getWechatId());
|
||||
List<Long> validatedShopIds = null;
|
||||
boolean shopBindingChanged = userDTO.getShopIds() != null || userDTO.getShopId() != null;
|
||||
@@ -612,6 +626,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
userDO.setUpdateTime(LocalDateTime.now());
|
||||
boolean updated = userMapper.updateById(userDO) > 0;
|
||||
if (updated) {
|
||||
if (phoneUpdateRequested && validatedPhone == null) {
|
||||
clearUserPhone(id);
|
||||
}
|
||||
if (shopBindingChanged) {
|
||||
userShopBindingSupport.syncUserShopBindings(id, validatedShopIds);
|
||||
}
|
||||
@@ -630,6 +647,35 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
return updated;
|
||||
}
|
||||
|
||||
private String normalizeServiceUserWechatId(Integer userType, String wechatId, String phone, String account) {
|
||||
String normalizedWechatId = UserProfileFieldSupport.normalizeOptionalText(wechatId);
|
||||
if (!Integer.valueOf(2).equals(userType) && !Integer.valueOf(3).equals(userType)) {
|
||||
return normalizedWechatId;
|
||||
}
|
||||
if (StringUtils.hasText(normalizedWechatId)) {
|
||||
return normalizedWechatId;
|
||||
}
|
||||
String normalizedPhone = UserProfileFieldSupport.normalizeOptionalText(phone);
|
||||
if (StringUtils.hasText(normalizedPhone)) {
|
||||
return normalizedPhone;
|
||||
}
|
||||
return UserProfileFieldSupport.normalizeOptionalText(account);
|
||||
}
|
||||
|
||||
private void clearUserPhone(Long userId) {
|
||||
int updatedRows = userMapper.update(
|
||||
null,
|
||||
new LambdaUpdateWrapper<UserDO>()
|
||||
.eq(UserDO::getId, userId)
|
||||
.eq(UserDO::getIsDelete, 0)
|
||||
.set(UserDO::getPhone, null)
|
||||
.set(UserDO::getPhoneVerified, 0)
|
||||
);
|
||||
if (updatedRows <= 0) {
|
||||
throw new RuntimeException("手机号清空失败,用户ID:" + userId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @param id 用户ID
|
||||
|
||||
+48
@@ -164,6 +164,30 @@ class AdminManagerControllerTest {
|
||||
verify(userService).createUser(dto);
|
||||
}
|
||||
|
||||
@Test
|
||||
void createEmployeeUserShouldAllowBlankPhoneWhenAccountExists() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
UserDO manager = new UserDO();
|
||||
manager.setType(2);
|
||||
manager.setShopId(8L);
|
||||
UserDTO dto = new UserDTO();
|
||||
dto.setPhone(" ");
|
||||
dto.setAccount("artist002");
|
||||
dto.setWechatId(" ");
|
||||
when(adminScopeHelper.getCurrentUser(request)).thenReturn(manager);
|
||||
when(adminScopeHelper.isPlatformAdmin(manager)).thenReturn(false);
|
||||
when(adminScopeHelper.getManagedShopId(manager)).thenReturn(8L);
|
||||
when(userService.createUser(dto)).thenReturn(105L);
|
||||
|
||||
Result<Long> result = controller.createEmployeeUser(request, dto);
|
||||
|
||||
assertThat(result.getData()).isEqualTo(105L);
|
||||
assertThat(dto.getPhone()).isEqualTo(" ");
|
||||
assertThat(dto.getWechatId()).isEqualTo(" ");
|
||||
assertThat(dto.getAccount()).isEqualTo("artist002");
|
||||
verify(userService).createUser(dto);
|
||||
}
|
||||
|
||||
@Test
|
||||
void createCustomerShouldForceNormalUserInCurrentShop() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
@@ -285,6 +309,30 @@ class AdminManagerControllerTest {
|
||||
));
|
||||
}
|
||||
|
||||
@Test
|
||||
void saveEmployeeShouldPassBlankPhoneToUserService() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
UserDO manager = new UserDO();
|
||||
manager.setType(2);
|
||||
NailArtistInfoDTO dto = new NailArtistInfoDTO();
|
||||
dto.setId(12L);
|
||||
dto.setUserId(7L);
|
||||
dto.setPhone(" ");
|
||||
NailArtistInfoDTO saved = new NailArtistInfoDTO();
|
||||
saved.setUserId(7L);
|
||||
when(adminScopeHelper.getCurrentUser(request)).thenReturn(manager);
|
||||
when(adminScopeHelper.isPlatformAdmin(manager)).thenReturn(false);
|
||||
when(userService.updateUser(any(), any(UserDTO.class))).thenReturn(true);
|
||||
when(nailArtistInfoService.saveOrUpdateNailArtistInfo(any())).thenReturn(saved);
|
||||
|
||||
Result<NailArtistInfoDTO> result = controller.saveEmployee(request, dto);
|
||||
|
||||
assertThat(result.getData()).isSameAs(saved);
|
||||
verify(userService).updateUser(argThat(userId -> Long.valueOf(7L).equals(userId)), argThat(userDTO ->
|
||||
"".equals(userDTO.getPhone())
|
||||
));
|
||||
}
|
||||
|
||||
@Test
|
||||
void saveEmployeeShouldStopWhenUserOutOfScope() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
|
||||
+30
@@ -186,6 +186,36 @@ class UserServiceImplPermissionAssignmentTest {
|
||||
verifyNoInteractions(permissionMapper, userPermissionMapper);
|
||||
}
|
||||
|
||||
@Test
|
||||
void createNailArtistAllowsBlankPhoneAndUsesAccountAsWechatFallback() {
|
||||
com.xiaowang.jayucloud.core.modules.user.dto.UserDTO request = new com.xiaowang.jayucloud.core.modules.user.dto.UserDTO();
|
||||
request.setAccount("artist003");
|
||||
request.setPassword("Abc123456");
|
||||
request.setNickname("Artist");
|
||||
request.setPhone(" ");
|
||||
request.setWechatId(" ");
|
||||
request.setType(3);
|
||||
request.setShopIds(List.of(8L));
|
||||
|
||||
when(userMapper.selectOne(org.mockito.ArgumentMatchers.any())).thenReturn(null);
|
||||
when(userShopBindingSupport.isShopActive(8L)).thenReturn(true);
|
||||
when(permissionMapper.selectList(any())).thenReturn(existingManagedPermissionsFromCatalog());
|
||||
when(userPermissionMapper.selectList(any())).thenReturn(List.of());
|
||||
doAnswer(invocation -> {
|
||||
UserDO userDO = invocation.getArgument(0);
|
||||
assertThat(userDO.getPhone()).isNull();
|
||||
assertThat(userDO.getWechatId()).isEqualTo("artist003");
|
||||
userDO.setId(43L);
|
||||
return 1;
|
||||
}).when(userMapper).insert(org.mockito.ArgumentMatchers.any(UserDO.class));
|
||||
|
||||
Long userId = service.createUser(request);
|
||||
|
||||
assertThat(userId).isEqualTo(43L);
|
||||
verify(userShopBindingSupport).syncUserShopBindings(43L, List.of(8L));
|
||||
verify(nailArtistInfoService).saveOrUpdateNailArtistInfo(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void managerWebPhoneLoginRejectsPlainCustomer() {
|
||||
PhoneLoginRequestDTO request = new PhoneLoginRequestDTO();
|
||||
|
||||
@@ -198,7 +198,7 @@ export interface CustomerCreateRequest {
|
||||
|
||||
export interface EmployeeCreateRequest {
|
||||
nickname: string
|
||||
phone: string
|
||||
phone?: string
|
||||
account: string
|
||||
password?: string
|
||||
contactPhone?: string
|
||||
|
||||
@@ -82,9 +82,9 @@
|
||||
</div>
|
||||
|
||||
<div class="field"><label class="required">昵称</label><input v-model.trim="editForm.nickname" placeholder="请输入昵称" /></div>
|
||||
<div class="field"><label class="required">登录手机号</label><input v-model.trim="editForm.phone" inputmode="tel" placeholder="请输入登录手机号" /></div>
|
||||
<div class="field"><label>登录手机号</label><input v-model.trim="editForm.phone" inputmode="tel" placeholder="选填,填写后用于手机号登录" /></div>
|
||||
<div class="field"><label>联系电话</label><input v-model.trim="editForm.contactPhone" inputmode="tel" placeholder="请输入联系电话" /></div>
|
||||
<div class="field"><label class="required">微信号</label><input v-model.trim="editForm.wechatId" placeholder="请输入微信号" /></div>
|
||||
<div class="field"><label>微信号</label><input v-model.trim="editForm.wechatId" placeholder="请输入微信号" /></div>
|
||||
<div class="field"><label>身份/级别</label><input v-model.trim="editForm.identity" placeholder="例如:高级美甲师" /></div>
|
||||
<div class="field">
|
||||
<label>状态</label>
|
||||
@@ -361,14 +361,11 @@ const validateEditForm = (): boolean => {
|
||||
toast.error('请输入员工昵称')
|
||||
return false
|
||||
}
|
||||
if (!phonePattern.test(editForm.phone.trim())) {
|
||||
const phone = editForm.phone.trim()
|
||||
if (phone && !phonePattern.test(phone)) {
|
||||
toast.error('请输入正确的登录手机号')
|
||||
return false
|
||||
}
|
||||
if (!editForm.wechatId.trim()) {
|
||||
toast.error('请输入微信号')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
>
|
||||
<div class="modal-form">
|
||||
<div class="field"><label class="required">姓名</label><input v-model.trim="createForm.nickname" placeholder="请输入姓名" /></div>
|
||||
<div class="field"><label class="required">手机号</label><input v-model.trim="createForm.phone" inputmode="numeric" placeholder="请输入手机号" /></div>
|
||||
<div class="field"><label>手机号</label><input v-model.trim="createForm.phone" inputmode="numeric" placeholder="选填,填写后用于手机号登录" /></div>
|
||||
<div class="field"><label class="required">登录账号</label><input v-model.trim="createForm.account" placeholder="请输入登录账号" /></div>
|
||||
<div class="field"><label>初始密码</label><input v-model="createForm.password" type="password" placeholder="不填则使用默认密码" /></div>
|
||||
<div class="field"><label>微信号</label><input v-model.trim="createForm.wechatId" placeholder="请输入微信号" /></div>
|
||||
@@ -79,6 +79,7 @@ const createModalVisible = ref(false)
|
||||
const creating = ref(false)
|
||||
const defaultPasswordNoticeVisible = ref(false)
|
||||
const defaultPasswordNoticePassword = ref('')
|
||||
const phonePattern = /^1[3-9]\d{9}$/
|
||||
const buildEmptyCreateForm = (): CreateEmployeeForm => ({
|
||||
nickname: '',
|
||||
phone: '',
|
||||
@@ -177,19 +178,23 @@ const createEmployee = async (): Promise<void> => {
|
||||
const phone = createForm.phone.trim()
|
||||
const account = createForm.account.trim()
|
||||
const password = createForm.password.trim()
|
||||
const wechatId = createForm.wechatId.trim() || phone
|
||||
if (!nickname || !phone || !account) {
|
||||
const wechatId = createForm.wechatId.trim()
|
||||
if (!nickname || !account) {
|
||||
toast.error('请补全美甲师信息')
|
||||
return
|
||||
}
|
||||
if (phone && !phonePattern.test(phone)) {
|
||||
toast.error('请输入正确的手机号')
|
||||
return
|
||||
}
|
||||
creating.value = true
|
||||
try {
|
||||
const requestData: EmployeeCreateRequest = {
|
||||
nickname,
|
||||
phone,
|
||||
phone: phone || undefined,
|
||||
account,
|
||||
contactPhone: phone,
|
||||
wechatId
|
||||
contactPhone: phone || undefined,
|
||||
wechatId: wechatId || undefined
|
||||
}
|
||||
if (password) {
|
||||
requestData.password = password
|
||||
|
||||
@@ -3,6 +3,7 @@ const { chooseImageFilePath, uploadObjectFile } = require('../../utils/upload')
|
||||
|
||||
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
|
||||
const DEFAULT_EMPLOYEE_PASSWORD = 'JayuCloud@123'
|
||||
const PHONE_REGEX = /^1[3-9]\d{9}$/
|
||||
|
||||
function buildScheduleSummary(item) {
|
||||
const mode = item.scheduleModeSummary || item.scheduleMode || '未设置'
|
||||
@@ -78,13 +79,9 @@ Page({
|
||||
onCreateInput(event) {
|
||||
const field = event.currentTarget.dataset.field
|
||||
const value = event.detail.value
|
||||
const updates = {
|
||||
this.setData({
|
||||
[`createForm.${field}`]: value
|
||||
}
|
||||
if (field === 'phone' && !this.data.createForm.account) {
|
||||
updates['createForm.account'] = value
|
||||
}
|
||||
this.setData(updates)
|
||||
})
|
||||
},
|
||||
|
||||
resetCreateForm() {
|
||||
@@ -137,20 +134,24 @@ Page({
|
||||
const phone = String(form.phone || '').trim()
|
||||
const account = String(form.account || '').trim()
|
||||
const password = String(form.password || '').trim()
|
||||
const wechatId = String(form.wechatId || '').trim() || phone
|
||||
if (!nickname || !phone || !account || !password) {
|
||||
const wechatId = String(form.wechatId || '').trim()
|
||||
if (!nickname || !account || !password) {
|
||||
wx.showToast({ title: '请补全美甲师信息', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (phone && !PHONE_REGEX.test(phone)) {
|
||||
wx.showToast({ title: '请输入 11 位手机号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ creating: true })
|
||||
try {
|
||||
await employeesApi.createUser({
|
||||
nickname,
|
||||
phone,
|
||||
contactPhone: phone,
|
||||
phone: phone || undefined,
|
||||
contactPhone: phone || undefined,
|
||||
account,
|
||||
password,
|
||||
wechatId,
|
||||
wechatId: wechatId || undefined,
|
||||
avatar: form.avatar || undefined,
|
||||
type: 3
|
||||
})
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
<input value="{{createForm.nickname}}" data-field="nickname" bindinput="onCreateInput" placeholder="请输入姓名" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text class="required-label">手机号</text>
|
||||
<input value="{{createForm.phone}}" data-field="phone" bindinput="onCreateInput" type="number" placeholder="请输入手机号" />
|
||||
<text>手机号</text>
|
||||
<input value="{{createForm.phone}}" data-field="phone" bindinput="onCreateInput" type="number" placeholder="选填,填写后用于手机号登录" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text class="required-label">登录账号</text>
|
||||
|
||||
@@ -144,3 +144,11 @@
|
||||
- 处理方式:按用户确认,JayuCloud 生产后台服务器账号为 `root`,清单中 `122503wcy....` 可作为 SSH 密码在本机内部使用;后续探测只输出连接状态、主机、端口和服务状态。
|
||||
- 以后避免:读取 `D:\doc\服务器分类清单.md`、`D:\doc\服务器业务中间件分类清单.md` 中 JayuCloud 服务器凭据时,不要把 `....` 自动当脱敏占位;如果需要区分脱敏与真实值,先用安全连接验证,不凭格式猜测。
|
||||
- 验证方式:用该密码已成功登录 6 台生产后端节点,并确认 `jayu-cloud-core.service` / `jayu-cloud-gateway.service` 均为 `active/enabled`,本机健康检查通过。
|
||||
|
||||
## 2026-07-21 本机 PATH 中的 Node 16 会导致 GitNexus 和 Vite 失败
|
||||
|
||||
- 问题:直接运行 `gitnexus` 或 `npm run build/test:unit` 时,命令会走 PATH 里微信开发者工具的 Node 16.13.1,GitNexus 报 `diagChan.tracingChannel is not a function`,Vite 报 `node:fs/promises` 不存在 `constants` 导出。
|
||||
- 原因:全局 npm shim 和项目 `.bin/*.cmd` 最终会调用裸 `node`;当前 PATH 中旧 Node 排在 Node 24 前面。
|
||||
- 处理方式:GitNexus 使用 `E:\Development\Node\node-v24\node.exe` 直接执行全局 `gitnexus/dist/cli/index.js`;前端验证使用 Node 24 直接执行本地 `vitest.mjs`、`vue-tsc.js`、`vite.js`。
|
||||
- 以后避免:涉及 GitNexus、Vite、Vitest、vue-tsc 的验证前先确认 `node --version`;如果默认不是 Node 20.19+ 或 22.12+,不要调用裸 `npm` 或 `.bin/*.cmd`。
|
||||
- 验证方式:`E:\Development\Node\node-v24\node.exe --version` 返回 v24.16.0;用该 Node 直接执行 GitNexus、Vitest、vue-tsc、Vite build 均通过。
|
||||
|
||||
+8
-7
@@ -2,18 +2,19 @@
|
||||
|
||||
## 当前任务
|
||||
|
||||
店长参与制作自管理入口修复。
|
||||
新增/编辑用户、美甲师、店长等管理账号时支持手机号选填。
|
||||
|
||||
## 已完成
|
||||
|
||||
- 已确认后台美甲师管理页店长列表复用 `getByShopId`,被 `type=3` 过滤后无法展示当前店长本人。
|
||||
- 已新增后台管理专用列表方法,店长进入后台美甲师列表时会补入当前店长自己的兜底资料,默认 `participateProduction=0`。
|
||||
- 已保持前台可预约列表、门店统计和员工导出继续使用原 `getByShopId` 公共语义。
|
||||
- 已补充服务层测试,覆盖当前店长兜底行和其他店长不混入。
|
||||
- 后端用户创建/编辑已支持手机号为空;填写手机号时仍校验格式和唯一性。
|
||||
- 后端服务人员未填微信号时按手机号、账号顺序兜底,避免无手机号但有账号时创建失败。
|
||||
- 设计师后台、设计师小程序、店务 Web、店务小程序的用户/美甲师/员工表单已改为手机号选填,账号仍必填。
|
||||
- 已补充后端控制器和用户服务测试,并更新设计师后台用户弹窗测试。
|
||||
- 已完成定向后端测试、设计师后台单测、两个 Web 项目类型检查和构建、小程序 JS 语法检查。
|
||||
|
||||
## 下一步
|
||||
|
||||
- 无。
|
||||
- 暂存本次任务相关文件并提交。
|
||||
|
||||
## 当前阻塞点
|
||||
|
||||
@@ -21,4 +22,4 @@
|
||||
|
||||
## 最近一次重要操作结果
|
||||
|
||||
2026-07-20 执行 `gitnexus detect-changes -r JayuCloud -s staged` 成功,风险等级 low,未影响已索引流程。
|
||||
2026-07-21 执行 `gitnexus detect-changes -r JayuCloud -s compare -b master` 成功,显示 18 个文件、42 个符号、33 条流程,风险等级为 critical;实际验证已覆盖用户创建/编辑手机号选填和员工保存链路。
|
||||
|
||||
Reference in New Issue
Block a user