fix: 编辑资料页邮箱输入草稿与已绑定状态分离,修复输入即显示已绑定的假象
This commit is contained in:
@@ -31,6 +31,7 @@ Page({
|
||||
chaishuName: '',
|
||||
binding: false,
|
||||
bindingEmail: false,
|
||||
emailInput: '',
|
||||
emailOtp: '',
|
||||
emailOtpSending: false,
|
||||
emailOtpCountdown: 0,
|
||||
@@ -349,8 +350,13 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
// 邮箱草稿输入(与已绑定状态 form.email 分离,避免输入即显示"已绑定"假象)
|
||||
onEmailInput(e) {
|
||||
this.setData({ emailInput: e.detail.value });
|
||||
},
|
||||
|
||||
async handleBindEmail() {
|
||||
const email = (this.data.form.email || '').trim();
|
||||
const email = (this.data.emailInput || '').trim();
|
||||
if (!email) {
|
||||
wx.showToast({ title: '请输入邮箱', icon: 'none' });
|
||||
return;
|
||||
@@ -381,7 +387,7 @@ Page({
|
||||
if (res.success) {
|
||||
wx.showToast({ title: res.data && res.data.chaishuAutoBound ? '绑定成功,已认证拆书帮身份' : '绑定成功', icon: 'none' });
|
||||
this.stopOtpCountdown();
|
||||
this.setData({ emailOtp: '' });
|
||||
this.setData({ emailOtp: '', emailInput: '' });
|
||||
this.loadProfile();
|
||||
} else {
|
||||
wx.showToast({ title: res.message || '绑定失败', icon: 'none' });
|
||||
@@ -399,7 +405,7 @@ Page({
|
||||
|
||||
async handleSendEmailOtp() {
|
||||
if (this.data.emailOtpSending || this.data.emailOtpCountdown > 0) return;
|
||||
const email = (this.data.form.email || '').trim();
|
||||
const email = (this.data.emailInput || '').trim();
|
||||
if (!email) {
|
||||
wx.showToast({ title: '请输入邮箱', icon: 'none' });
|
||||
return;
|
||||
|
||||
@@ -59,10 +59,9 @@
|
||||
<view class="email-row" wx:else>
|
||||
<input
|
||||
class="form-input email-input"
|
||||
value="{{form.email}}"
|
||||
placeholder="绑定后可用邮箱登录"
|
||||
data-field="email"
|
||||
bindinput="onInput"
|
||||
value="{{emailInput}}"
|
||||
placeholder="请输入完整邮箱(如 name@qq.com)"
|
||||
bindinput="onEmailInput"
|
||||
/>
|
||||
<button class="email-bind-btn" bindtap="handleBindEmail" disabled="{{bindingEmail}}">绑定</button>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user