diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/auth/service/impl/VerificationCodeServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/auth/service/impl/VerificationCodeServiceImpl.java
index 37017c0c..b15c35bd 100644
--- a/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/auth/service/impl/VerificationCodeServiceImpl.java
+++ b/JC-Salon-Core/src/main/java/com/xiaowang/jacyucloudsalon/core/modules/auth/service/impl/VerificationCodeServiceImpl.java
@@ -97,11 +97,10 @@ public class VerificationCodeServiceImpl implements VerificationCodeService {
String codeKey = CODE_PREFIX + phone;
String sendTimeKey = SEND_TIME_PREFIX + phone;
+ messageHubClientService.sendSmsVerificationCode(sceneCode, phone, code);
redisTemplate.opsForValue().set(codeKey, code, Duration.ofMinutes(CODE_EXPIRE_MINUTES));
redisTemplate.opsForValue().set(sendTimeKey, String.valueOf(System.currentTimeMillis()),
Duration.ofSeconds(RESEND_INTERVAL_SECONDS));
-
- messageHubClientService.sendSmsVerificationCode(sceneCode, phone, code);
log.info("验证码已发送,手机号: {}, sceneCode: {}", phone, sceneCode);
}
diff --git a/JC-Salon-WeChat/pages/appointment-form/index.js b/JC-Salon-WeChat/pages/appointment-form/index.js
index e414f937..a027f887 100644
--- a/JC-Salon-WeChat/pages/appointment-form/index.js
+++ b/JC-Salon-WeChat/pages/appointment-form/index.js
@@ -693,6 +693,10 @@ Page({
wx.showToast({ title: '请补全预约信息', icon: 'none' })
return
}
+ if (!/^1[3-9]\d{9}$/.test(String(form.phone).trim())) {
+ wx.showToast({ title: '请输入正确手机号', icon: 'none' })
+ return
+ }
if (!durationMinutes) {
wx.showToast({ title: '请填写预约时长', icon: 'none' })
return
diff --git a/JC-Salon-WeChat/pages/appointment-form/index.wxml b/JC-Salon-WeChat/pages/appointment-form/index.wxml
index a725d8fe..47fa1bc3 100644
--- a/JC-Salon-WeChat/pages/appointment-form/index.wxml
+++ b/JC-Salon-WeChat/pages/appointment-form/index.wxml
@@ -7,7 +7,7 @@
手机号
-
+
正在搜索客户...
diff --git a/JC-Salon-WeChat/pages/customers/index.js b/JC-Salon-WeChat/pages/customers/index.js
index cb5468c5..0d140be2 100644
--- a/JC-Salon-WeChat/pages/customers/index.js
+++ b/JC-Salon-WeChat/pages/customers/index.js
@@ -85,6 +85,10 @@ Page({
wx.showToast({ title: '请填写客户姓名和手机号', icon: 'none' })
return
}
+ if (!/^1[3-9]\d{9}$/.test(phone)) {
+ wx.showToast({ title: '请输入正确手机号', icon: 'none' })
+ return
+ }
this.setData({ creating: true })
try {
await customersApi.create({ nickname, phone })
diff --git a/JC-Salon-WeChat/pages/customers/index.wxml b/JC-Salon-WeChat/pages/customers/index.wxml
index c853c402..369c52f4 100644
--- a/JC-Salon-WeChat/pages/customers/index.wxml
+++ b/JC-Salon-WeChat/pages/customers/index.wxml
@@ -35,7 +35,7 @@
手机号
-
+
diff --git a/JC-Salon-WeChat/pages/employees/index.js b/JC-Salon-WeChat/pages/employees/index.js
index 417c9c61..d351c82f 100644
--- a/JC-Salon-WeChat/pages/employees/index.js
+++ b/JC-Salon-WeChat/pages/employees/index.js
@@ -161,6 +161,10 @@ Page({
wx.showToast({ title: '请补全美甲师信息', icon: 'none' })
return
}
+ if (!/^1[3-9]\d{9}$/.test(phone)) {
+ wx.showToast({ title: '请输入正确手机号', icon: 'none' })
+ return
+ }
this.setData({ creating: true })
try {
await employeesApi.createUser({
diff --git a/JC-Salon-WeChat/pages/employees/index.wxml b/JC-Salon-WeChat/pages/employees/index.wxml
index af3f16dc..8ae50780 100644
--- a/JC-Salon-WeChat/pages/employees/index.wxml
+++ b/JC-Salon-WeChat/pages/employees/index.wxml
@@ -49,7 +49,7 @@
手机号
-
+
登录账号
diff --git a/JC-Salon-WeChat/pages/login/index.js b/JC-Salon-WeChat/pages/login/index.js
index 3c49eae8..15c766bf 100644
--- a/JC-Salon-WeChat/pages/login/index.js
+++ b/JC-Salon-WeChat/pages/login/index.js
@@ -121,8 +121,11 @@ Page({
onInput(event) {
const field = event.currentTarget.dataset.field
+ const value = field === 'phone'
+ ? String(event.detail.value || '').replace(/\D/g, '').slice(0, 11)
+ : event.detail.value
this.setData({
- [`form.${field}`]: event.detail.value
+ [`form.${field}`]: value
})
},
@@ -135,6 +138,9 @@ Page({
},
async sendLoginCode() {
+ if (!this.ensureAgreementAccepted()) {
+ return
+ }
const phone = String(this.data.form.phone || '').trim()
if (!PHONE_REGEX.test(phone)) {
wx.showToast({ title: '请输入正确手机号', icon: 'none' })
diff --git a/JC-Salon-WeChat/pages/profile/index.js b/JC-Salon-WeChat/pages/profile/index.js
index 0f48b262..f2f0242d 100644
--- a/JC-Salon-WeChat/pages/profile/index.js
+++ b/JC-Salon-WeChat/pages/profile/index.js
@@ -220,6 +220,11 @@ Page({
async saveProfile() {
const form = this.data.profileForm
const nickname = String(form.nickname || '').trim()
+ const contactPhone = String(form.contactPhone || '').trim()
+ if (contactPhone && !/^1[3-9]\d{9}$/.test(contactPhone)) {
+ wx.showToast({ title: '请输入正确联系电话', icon: 'none' })
+ return
+ }
if (!nickname) {
wx.showToast({ title: '请填写昵称', icon: 'none' })
return
@@ -229,7 +234,7 @@ Page({
await userApi.updateInfo({
nickname,
avatar: form.avatar || '',
- contactPhone: String(form.contactPhone || '').trim(),
+ contactPhone,
wechatId: String(form.wechatId || '').trim(),
signature: String(form.signature || '').trim()
})
diff --git a/JC-Salon-WeChat/pages/profile/index.wxml b/JC-Salon-WeChat/pages/profile/index.wxml
index 37fda680..c9654420 100644
--- a/JC-Salon-WeChat/pages/profile/index.wxml
+++ b/JC-Salon-WeChat/pages/profile/index.wxml
@@ -84,7 +84,7 @@
联系电话
-
+
微信号
diff --git a/JC-Salon-WeChat/pages/register/index.js b/JC-Salon-WeChat/pages/register/index.js
index a382d147..a09d4b9c 100644
--- a/JC-Salon-WeChat/pages/register/index.js
+++ b/JC-Salon-WeChat/pages/register/index.js
@@ -18,7 +18,8 @@ Page({
loading: false,
codeLoading: false,
countdown: 0,
- countdownTimer: null
+ countdownTimer: null,
+ agreementAccepted: false
},
async onLoad(options) {
@@ -39,11 +40,20 @@ Page({
}
},
- onInput(event) { this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value }) },
+ onInput(event) {
+ const field = event.currentTarget.dataset.field
+ const value = field === 'phone'
+ ? String(event.detail.value || '').replace(/\D/g, '').slice(0, 11)
+ : event.detail.value
+ this.setData({ [`form.${field}`]: value })
+ },
togglePasswordMode() { this.setData({ passwordMode: !this.data.passwordMode }) },
+ toggleAgreement() { this.setData({ agreementAccepted: !this.data.agreementAccepted }) },
+
async sendCode() {
+ if (!this.data.agreementAccepted) { wx.showToast({ title: '请先同意用户协议和隐私政策', icon: 'none' }); return }
const phone = String(this.data.form.phone || '').trim()
if (!PHONE_REGEX.test(phone)) { wx.showToast({ title: '请输入正确手机号', icon: 'none' }); return }
if (this.data.codeLoading || this.data.countdown > 0) return
diff --git a/JC-Salon-WeChat/pages/register/index.wxml b/JC-Salon-WeChat/pages/register/index.wxml
index d11233e0..7aadaa20 100644
--- a/JC-Salon-WeChat/pages/register/index.wxml
+++ b/JC-Salon-WeChat/pages/register/index.wxml
@@ -3,9 +3,9 @@
123
验证手机号手机号将作为你的工作台登录账号
- 手机号手机号已验证
+ 手机号手机号已验证
验证码
- 使用密码注册 ›
+ {{agreementAccepted ? '✓' : ''}}我已阅读并同意《用户协议》和《隐私政策》使用密码注册 ›
设置密码确认密码