This commit is contained in:
+3
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -384,7 +384,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> 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());
|
||||
|
||||
@@ -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 })
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
<image wx:else class="avatar-preview" src="/assets/images/default-user-avatar.png" mode="aspectFit"></image>
|
||||
<view class="avatar-copy">
|
||||
<text class="avatar-title">美甲师头像</text>
|
||||
<text class="avatar-tip">点击选择图片,可稍后补充</text>
|
||||
<text class="avatar-tip">点击选择图片</text>
|
||||
</view>
|
||||
<text class="avatar-action">{{avatarUploading ? '上传中' : '更换'}}</text>
|
||||
<!-- <text class="avatar-action">{{avatarUploading ? '上传中' : '更换'}}</text> -->
|
||||
<button wx:if="{{form.avatarUrl}}" class="avatar-action" catchtap="removeAvatar" style="width: 95rpx; display: block; box-sizing: border-box; left: 58rpx; top: 0rpx; height: 24rpx; position: relative">移除</button>
|
||||
</view>
|
||||
<button wx:if="{{form.avatarUrl}}" class="remove-avatar" catchtap="removeAvatar">移除当前头像</button>
|
||||
|
||||
|
||||
<view class="card form-card create-form">
|
||||
<view class="field">
|
||||
@@ -21,8 +22,8 @@
|
||||
<input value="{{form.nickname}}" data-field="nickname" bindinput="onInput" placeholder="请输入美甲师姓名" />
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label required">手机号</text>
|
||||
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" type="number" maxlength="11" placeholder="请输入手机号" />
|
||||
<text class="field-label">手机号</text>
|
||||
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" type="number" maxlength="11" placeholder="选填" />
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">微信号</text>
|
||||
@@ -34,7 +35,7 @@
|
||||
<view class="color-current">
|
||||
<view class="color-current-chip" style="background: {{form.color}};"></view>
|
||||
<text class="color-current-value">{{form.color}}</text>
|
||||
<view class="color-select-btn" bindtap="openColorSheet">选择颜色<text class="color-select-arrow">›</text></view>
|
||||
<view class="color-select-btn" bindtap="openColorSheet">选择颜色</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="login-unlinked" bindtap="openUserPicker">
|
||||
|
||||
Reference in New Issue
Block a user