diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/config/MyMetaObjectHandler.java b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/config/MyMetaObjectHandler.java index a0432f08..b3d2a5d8 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/config/MyMetaObjectHandler.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/config/MyMetaObjectHandler.java @@ -5,6 +5,7 @@ import com.xiaowang.jayucloud.salon.core.support.privacy.PhoneCrypto; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.reflection.MetaObject; import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; import java.time.LocalDateTime; @@ -67,7 +68,8 @@ public class MyMetaObjectHandler implements MetaObjectHandler { return; } Object value = metaObject.getValue(source); - String hash = value == null ? null : PhoneCrypto.current().index(String.valueOf(value)); + String text = value == null ? null : String.valueOf(value).trim(); + String hash = !StringUtils.hasText(text) ? null : PhoneCrypto.current().index(text); metaObject.setValue(target, hash); } } diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/user/service/impl/UserServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/user/service/impl/UserServiceImpl.java index ec8e200e..91dd7995 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/user/service/impl/UserServiceImpl.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/user/service/impl/UserServiceImpl.java @@ -384,7 +384,7 @@ public class UserServiceImpl extends ServiceImpl implements if (userDTO == null || !Integer.valueOf(3).equals(userDTO.getType())) throw new IllegalArgumentException("仅支持新增美甲师"); if (shopId == null || shopId <= 0) throw new IllegalArgumentException("门店不能为空"); if (!StringUtils.hasText(userDTO.getNickname())) throw new IllegalArgumentException("美甲师姓名不能为空"); - String phone = validateUserPhone(userDTO.getPhone(), null, true); + String phone = validateUserPhone(userDTO.getPhone(), null, false); UserDO userDO = new UserDO(); userDO.setShopId(shopId); userDO.setNickname(userDTO.getNickname().trim()); diff --git a/JC-Salon-WeChat/pages/employee-create/index.js b/JC-Salon-WeChat/pages/employee-create/index.js index 30f5cd12..86be3fc0 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.js +++ b/JC-Salon-WeChat/pages/employee-create/index.js @@ -325,25 +325,28 @@ Page({ } return } - if (!nickname || !phone) { - wx.showToast({ title: '请补全美甲师信息', icon: 'none' }) + if (!nickname) { + wx.showToast({ title: '请填写美甲师姓名', icon: 'none' }) return } - if (!/^1[3-9]\d{9}$/.test(phone)) { + if (phone && !/^1[3-9]\d{9}$/.test(phone)) { wx.showToast({ title: '请输入正确手机号', icon: 'none' }) return } this.setData({ creating: true }) try { - const result = await employeesApi.createUser({ + const payload = { nickname, - phone, - contactPhone: phone, wechatId, color: form.color, avatar: form.avatar || undefined, type: 3 - }) + } + if (phone) { + payload.phone = phone + payload.contactPhone = phone + } + const result = await employeesApi.createUser(payload) const id = result && typeof result === 'object' ? (result.id || result.userId) : result const employee = { id, name: nickname, title: nickname, avatar: form.avatar || '' } this.setData({ createdEmployee: employee, applicationApproved: false }) diff --git a/JC-Salon-WeChat/pages/employee-create/index.wxml b/JC-Salon-WeChat/pages/employee-create/index.wxml index b0435774..ba7d180c 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.wxml +++ b/JC-Salon-WeChat/pages/employee-create/index.wxml @@ -9,11 +9,12 @@ 美甲师头像 - 点击选择图片,可稍后补充 + 点击选择图片 - {{avatarUploading ? '上传中' : '更换'}} + + - + @@ -21,8 +22,8 @@ - 手机号 - + 手机号 + 微信号 @@ -34,7 +35,7 @@ {{form.color}} - 选择颜色› + 选择颜色