From 2ebaaeec771f1cf1b113ccfc9fd46bbe1404fa67 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Fri, 11 Sep 2026 15:35:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=BE=AE=E4=BF=A1=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E7=BB=91=E5=AE=9A=E5=87=AD=E8=AF=81=E6=97=B6=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-WeChat/pages/register/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/JC-Salon-WeChat/pages/register/index.js b/JC-Salon-WeChat/pages/register/index.js index e32fc289..a382d147 100644 --- a/JC-Salon-WeChat/pages/register/index.js +++ b/JC-Salon-WeChat/pages/register/index.js @@ -71,13 +71,19 @@ Page({ goBackStep() { this.setData({ step: Math.max(1, this.data.step - 1) }) }, + async getCurrentWxCode() { + const result = await new Promise((resolve, reject) => wx.login({ success: resolve, fail: reject })) + return result.code + }, + async submit() { const form = this.data.form if (this.data.role === 'manager' && !String(form.shopName || '').trim()) { wx.showToast({ title: '请输入店铺名称', icon: 'none' }); return } if (this.data.role === 'staff' && !form.shopId) { wx.showToast({ title: '请选择要加入的店铺', icon: 'none' }); return } this.setData({ loading: true }) try { - await authApi.register({ phone: form.phone, verificationCode: this.data.registrationTicket ? undefined : form.code, registrationTicket: this.data.registrationTicket || undefined, applicationId: this.data.applicationId || undefined, password: form.password, confirmPassword: form.confirmPassword, shopName: form.shopName, shopAddress: form.shopAddress, shopId: form.shopId, roleType: this.data.role === 'manager' ? 'MANAGER' : 'STAFF', agreementAccepted: true, wxCode: this.data.wxCode }) + const wxCode = this.data.registrationTicket ? await this.getCurrentWxCode() : this.data.wxCode + await authApi.register({ phone: form.phone, verificationCode: this.data.registrationTicket ? undefined : form.code, registrationTicket: this.data.registrationTicket || undefined, applicationId: this.data.applicationId || undefined, password: form.password, confirmPassword: form.confirmPassword, shopName: form.shopName, shopAddress: form.shopAddress, shopId: form.shopId, roleType: this.data.role === 'manager' ? 'MANAGER' : 'STAFF', agreementAccepted: true, wxCode }) this.setData({ step: 4 }) } catch (error) { wx.showToast({ title: error.message || '提交失败', icon: 'none' }) } finally { this.setData({ loading: false }) } },