feat(security): 优化登录与支付密码错误提示文案并完善双端安全中心交互
- 安全校验提示:优化 AccountSecurity 与 MasterSecurity 密码错误提示,区分登录密码与支付密码,并增加剩余可重试次数提示 - 接口响应对齐:优化 Auth、MasterAuth、Security、Sms 控制器在短信验证码发送与密码校验时的异常处理与返回格式 - 腾讯云短信SDK:优化 SmsSingleSender::sendWithParam 方法入参默认值 - 双端小程序:优化用户端与师傅端登录页及账号安全中心的密码修改与找回交互逻辑
这个提交包含在:
@@ -79,7 +79,7 @@ class SmsSingleSender
|
||||
* @param string $ext 服务端原样返回的参数,可填空串
|
||||
* @return string 应答json字符串,详细内容参见腾讯云协议文档
|
||||
*/
|
||||
public function sendWithParam($nationCode, $phoneNumber, $templId = 0, $params,
|
||||
public function sendWithParam($nationCode, $phoneNumber, $templId = 0, $params = [],
|
||||
$sign = "", $extend = "", $ext = "")
|
||||
{
|
||||
$random = $this->util->getRandom();
|
||||
|
||||
@@ -62,9 +62,13 @@ class Auth extends Base
|
||||
$this->error('该账号尚未设置登录密码,请使用微信一键登录后设置密码');
|
||||
}
|
||||
try {
|
||||
\app\common\library\AccountSecurity::verify((int)$user['id'], 'login', $password);
|
||||
\app\common\library\AccountSecurity::verify((int)$user['id'], 'login', $password, '登录密码');
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage() === '密码不正确' ? '手机号或密码不正确' : $e->getMessage());
|
||||
$msg = $e->getMessage();
|
||||
if (strpos($msg, '不正确') !== false) {
|
||||
$msg = str_replace('登录密码不正确', '手机号或密码不正确', $msg);
|
||||
}
|
||||
$this->error($msg);
|
||||
}
|
||||
$this->auth->direct($user['id']);
|
||||
}
|
||||
@@ -102,12 +106,13 @@ class Auth extends Base
|
||||
|
||||
try {
|
||||
$res = SmsService::sendVerifyCode($mobile, 'user_resetpwd', $this->request->ip());
|
||||
$this->success('验证码已发送,请注意查收', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
return;
|
||||
}
|
||||
$this->success('验证码已发送,请注意查收', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,9 +56,13 @@ class MasterAuth extends MasterBase
|
||||
$this->error('该师傅账号尚未设置登录密码,请使用微信一键登录后在账号安全中设置密码');
|
||||
}
|
||||
try {
|
||||
MasterSecurity::verify((int)$master['id'], 'login', $password);
|
||||
MasterSecurity::verify((int)$master['id'], 'login', $password, '登录密码');
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage() === '密码不正确' ? '手机号或密码不正确' : $e->getMessage());
|
||||
$msg = $e->getMessage();
|
||||
if (strpos($msg, '不正确') !== false) {
|
||||
$msg = str_replace('登录密码不正确', '手机号或密码不正确', $msg);
|
||||
}
|
||||
$this->error($msg);
|
||||
}
|
||||
if (!$this->masterAuth->direct((int)$master['id'])) {
|
||||
$this->error($this->masterAuth->getError() ?: '登录失败');
|
||||
@@ -199,12 +203,13 @@ class MasterAuth extends MasterBase
|
||||
|
||||
try {
|
||||
$res = SmsService::sendVerifyCode($mobile, 'master_resetpwd', $this->request->ip());
|
||||
$this->success('验证码已发送,请注意查收', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
return;
|
||||
}
|
||||
$this->success('验证码已发送,请注意查收', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -288,12 +293,13 @@ class MasterAuth extends MasterBase
|
||||
|
||||
try {
|
||||
$res = SmsService::sendVerifyCode($mobile, 'master_changepwd', $this->request->ip());
|
||||
$this->success('验证码已发送至绑定手机', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
return;
|
||||
}
|
||||
$this->success('验证码已发送至绑定手机', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -322,9 +328,13 @@ class MasterAuth extends MasterBase
|
||||
$ignoreOld = true;
|
||||
} else {
|
||||
try {
|
||||
MasterSecurity::verify($mid, 'login', $old);
|
||||
MasterSecurity::verify($mid, 'login', $old, '原登录密码');
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
$msg = $e->getMessage();
|
||||
if (strpos($msg, '15分钟') !== false) {
|
||||
$msg .= ',或点击下方改用短信验证码';
|
||||
}
|
||||
$this->error($msg);
|
||||
}
|
||||
$ignoreOld = false;
|
||||
}
|
||||
@@ -384,12 +394,13 @@ class MasterAuth extends MasterBase
|
||||
|
||||
try {
|
||||
$res = SmsService::sendVerifyCode($mobile, 'master_paypwd', $this->request->ip());
|
||||
$this->success('验证码已发送至绑定手机', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
return;
|
||||
}
|
||||
$this->success('验证码已发送至绑定手机', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,9 +430,13 @@ class MasterAuth extends MasterBase
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
MasterSecurity::verify($mid, 'payment', (string)$this->request->post('old_password', ''));
|
||||
MasterSecurity::verify($mid, 'payment', (string)$this->request->post('old_password', ''), '原支付密码');
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
$msg = $e->getMessage();
|
||||
if (strpos($msg, '15分钟') !== false) {
|
||||
$msg .= ',或点击下方改用短信验证码';
|
||||
}
|
||||
$this->error($msg);
|
||||
}
|
||||
}
|
||||
$updated = Db::name('master_security')
|
||||
|
||||
@@ -44,12 +44,13 @@ class Security extends Base
|
||||
|
||||
try {
|
||||
$res = SmsService::sendVerifyCode($mobile, 'user_changepwd', $this->request->ip());
|
||||
$this->success('验证码已发送至绑定手机', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
return;
|
||||
}
|
||||
$this->success('验证码已发送至绑定手机', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
}
|
||||
|
||||
public function changeLoginPassword()
|
||||
@@ -70,7 +71,15 @@ class Security extends Base
|
||||
}
|
||||
$ignoreOld = true;
|
||||
} else {
|
||||
try { AccountSecurity::verify($uid, 'login', $old); } catch (\Throwable $e) { $this->error($e->getMessage()); }
|
||||
try {
|
||||
AccountSecurity::verify($uid, 'login', $old, '原登录密码');
|
||||
} catch (\Throwable $e) {
|
||||
$msg = $e->getMessage();
|
||||
if (strpos($msg, '15分钟') !== false) {
|
||||
$msg .= ',或点击下方改用短信验证码';
|
||||
}
|
||||
$this->error($msg);
|
||||
}
|
||||
$ignoreOld = false;
|
||||
}
|
||||
} else {
|
||||
@@ -111,12 +120,13 @@ class Security extends Base
|
||||
|
||||
try {
|
||||
$res = SmsService::sendVerifyCode($mobile, 'user_paypwd', $this->request->ip());
|
||||
$this->success('验证码已发送至绑定手机', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
return;
|
||||
}
|
||||
$this->success('验证码已发送至绑定手机', array_merge($res, [
|
||||
'mobile' => substr_replace($mobile, '****', 3, 4),
|
||||
]));
|
||||
}
|
||||
|
||||
public function changePaymentPassword()
|
||||
@@ -139,8 +149,15 @@ class Security extends Base
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
} else {
|
||||
try { AccountSecurity::verify($uid, 'payment', (string)$this->request->post('old_password', '')); }
|
||||
catch (\Throwable $e) { $this->error($e->getMessage()); }
|
||||
try {
|
||||
AccountSecurity::verify($uid, 'payment', (string)$this->request->post('old_password', ''), '原支付密码');
|
||||
} catch (\Throwable $e) {
|
||||
$msg = $e->getMessage();
|
||||
if (strpos($msg, '15分钟') !== false) {
|
||||
$msg .= ',或点击下方改用短信验证码';
|
||||
}
|
||||
$this->error($msg);
|
||||
}
|
||||
}
|
||||
$updated = Db::name('user_security')->where('user_id', $uid)->where('payment_password_hash', $oldHash)->update([
|
||||
'payment_password_hash' => password_hash($new, PASSWORD_DEFAULT),
|
||||
|
||||
@@ -87,10 +87,11 @@ class Sms extends Api
|
||||
|
||||
try {
|
||||
$res = SmsService::sendVerifyCode($mobile, $event, $this->request->ip());
|
||||
$this->success('验证码已发送,请注意查收', $res);
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
return;
|
||||
}
|
||||
$this->success('验证码已发送,请注意查收', $res);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,9 +109,10 @@ class Sms extends Api
|
||||
|
||||
try {
|
||||
SmsService::verifyCode($rawMobile, $captcha, $event, false);
|
||||
$this->success('验证码正确');
|
||||
} catch (\Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
return;
|
||||
}
|
||||
$this->success('验证码正确');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,12 @@ class AccountSecurity
|
||||
Db::execute("INSERT IGNORE INTO `{$prefix}user_security` (`user_id`) VALUES (?)", [(int)$uid]);
|
||||
}
|
||||
|
||||
public static function verify($uid, $kind, $password)
|
||||
public static function verify($uid, $kind, $password, $label = null)
|
||||
{
|
||||
if (!in_array($kind, ['login', 'payment'], true)) {
|
||||
throw new \InvalidArgumentException('验证类型错误');
|
||||
}
|
||||
$label = ($label !== null && $label !== '') ? (string)$label : ($kind === 'payment' ? '支付密码' : '登录密码');
|
||||
$attemptsField = $kind === 'payment' ? 'payment_failed_attempts' : 'failed_attempts';
|
||||
$lockedField = $kind === 'payment' ? 'payment_locked_until' : 'locked_until';
|
||||
self::ensure($uid);
|
||||
@@ -27,7 +28,7 @@ class AccountSecurity
|
||||
try {
|
||||
$row = Db::name('user_security')->where('user_id', (int)$uid)->lock(true)->find();
|
||||
if ((int)$row[$lockedField] > time()) {
|
||||
throw new \RuntimeException('密码错误次数过多,请15分钟后重试');
|
||||
throw new \RuntimeException($label . '错误次数过多,请15分钟后重试');
|
||||
}
|
||||
if ($kind === 'login') {
|
||||
$user = Db::name('user')->field('password,salt')->where('id', (int)$uid)->find();
|
||||
@@ -49,7 +50,11 @@ class AccountSecurity
|
||||
throw $e;
|
||||
}
|
||||
if (!$correct) {
|
||||
throw new \RuntimeException($failures >= 5 ? '密码错误次数过多,请15分钟后重试' : '密码不正确');
|
||||
if ($failures >= 5) {
|
||||
throw new \RuntimeException($label . '错误次数过多,请15分钟后重试');
|
||||
}
|
||||
$remain = 5 - $failures;
|
||||
throw new \RuntimeException($label . '不正确,还可尝试 ' . $remain . ' 次');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,11 +18,12 @@ class MasterSecurity
|
||||
Db::execute("INSERT IGNORE INTO `{$prefix}master_security` (`master_id`) VALUES (?)", [(int)$masterId]);
|
||||
}
|
||||
|
||||
public static function verify($masterId, $kind, $password)
|
||||
public static function verify($masterId, $kind, $password, $label = null)
|
||||
{
|
||||
if (!in_array($kind, ['login', 'payment'], true)) {
|
||||
throw new \InvalidArgumentException('验证类型错误');
|
||||
}
|
||||
$label = ($label !== null && $label !== '') ? (string)$label : ($kind === 'payment' ? '支付密码' : '登录密码');
|
||||
$masterId = (int)$masterId;
|
||||
$attemptsField = $kind === 'payment' ? 'payment_failed_attempts' : 'failed_attempts';
|
||||
$lockedField = $kind === 'payment' ? 'payment_locked_until' : 'locked_until';
|
||||
@@ -32,7 +33,7 @@ class MasterSecurity
|
||||
try {
|
||||
$row = Db::name('master_security')->where('master_id', $masterId)->lock(true)->find();
|
||||
if ((int)$row[$lockedField] > time()) {
|
||||
throw new \RuntimeException('密码错误次数过多,请15分钟后重试');
|
||||
throw new \RuntimeException($label . '错误次数过多,请15分钟后重试');
|
||||
}
|
||||
if ($kind === 'login') {
|
||||
$master = Db::name('master')->field('password,salt')->where('id', $masterId)->find();
|
||||
@@ -54,7 +55,11 @@ class MasterSecurity
|
||||
throw $e;
|
||||
}
|
||||
if (!$correct) {
|
||||
throw new \RuntimeException($failures >= 5 ? '密码错误次数过多,请15分钟后重试' : '密码不正确');
|
||||
if ($failures >= 5) {
|
||||
throw new \RuntimeException($label . '错误次数过多,请15分钟后重试');
|
||||
}
|
||||
$remain = 5 - $failures;
|
||||
throw new \RuntimeException($label . '不正确,还可尝试 ' . $remain . ' 次');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -253,7 +253,11 @@ function api(route, data, token) {
|
||||
}, mToken2);
|
||||
assert.strictEqual(finishRes.json.code, 1, finishRes.json.msg);
|
||||
assert.strictEqual(finishRes.json.data.verify_code, undefined, 'master finish response must not expose verify_code');
|
||||
assert.strictEqual(finishRes.json.data.sms_sent, false, 'sms_sent should be false when qcloudsms not configured');
|
||||
if (!hasAppId) {
|
||||
assert.strictEqual(finishRes.json.data.sms_sent, false, 'sms_sent should be false when qcloudsms not configured');
|
||||
} else {
|
||||
assert.strictEqual(typeof finishRes.json.data.sms_sent, 'boolean', 'sms_sent should be a boolean');
|
||||
}
|
||||
assert.strictEqual(finishRes.json.data.sms_mobile_mask, '139****5678');
|
||||
assert.strictEqual(sql(`SELECT status FROM fa_order WHERE id=${orderId}`), '7');
|
||||
const msgContent = sql(`SELECT content FROM fa_message WHERE receive_type='user' AND receive_id=${uid} AND order_id=${orderId} ORDER BY id DESC LIMIT 1`);
|
||||
|
||||
@@ -131,89 +131,112 @@
|
||||
<!-- 短信重置密码弹窗 -->
|
||||
<view class="reset-mask" v-if="showReset" @tap="closeResetModal">
|
||||
<view class="reset-sheet" @tap.stop>
|
||||
<view class="reset-handle"></view>
|
||||
<view class="reset-head">
|
||||
<text class="reset-title">短信重置登录密码</text>
|
||||
<view class="reset-head-meta">
|
||||
<text class="reset-title">重置登录密码</text>
|
||||
<text class="reset-sub">验证注册手机号后即可设置新密码</text>
|
||||
</view>
|
||||
<view class="reset-close clickable-hover" @tap="closeResetModal">
|
||||
<image class="reset-close-ico" src="/static/icons/close.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="input-row">
|
||||
<view class="input-icon-box">
|
||||
<image class="field-icon" src="/static/icons/login-phone.svg" mode="aspectFit" />
|
||||
<view class="reset-body">
|
||||
<view class="reset-field-group">
|
||||
<view class="reset-label-row">
|
||||
<text class="reset-label">注册手机号</text>
|
||||
</view>
|
||||
<view class="reset-input-box">
|
||||
<image class="reset-prefix-ico" src="/static/icons/login-phone.svg" mode="aspectFit" />
|
||||
<input
|
||||
class="field-input"
|
||||
type="number"
|
||||
maxlength="11"
|
||||
v-model="resetMobile"
|
||||
placeholder="请输入注册手机号"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<input
|
||||
class="field-input"
|
||||
type="number"
|
||||
maxlength="11"
|
||||
v-model="resetMobile"
|
||||
placeholder="请输入注册手机号"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="reset-sms-row">
|
||||
<view class="input-row reset-sms-input-row">
|
||||
<input
|
||||
class="field-input"
|
||||
type="number"
|
||||
maxlength="6"
|
||||
v-model="resetCode"
|
||||
placeholder="请输入短信验证码"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
<view class="reset-field-group">
|
||||
<view class="reset-label-row">
|
||||
<text class="reset-label">短信验证码</text>
|
||||
<text class="reset-rule">5分钟内有效</text>
|
||||
</view>
|
||||
<view class="reset-input-box reset-sms-box">
|
||||
<input
|
||||
class="field-input"
|
||||
type="number"
|
||||
maxlength="6"
|
||||
v-model="resetCode"
|
||||
placeholder="请输入6位短信验证码"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
<view class="reset-sms-divider"></view>
|
||||
<button
|
||||
class="reset-inline-btn clickable-hover"
|
||||
:disabled="sendingResetSms || resetCountdown > 0"
|
||||
@tap="sendResetSms"
|
||||
>
|
||||
{{ resetCountdown > 0 ? resetCountdown + 's 后重发' : (sendingResetSms ? '发送中...' : '获取验证码') }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="reset-field-group">
|
||||
<view class="reset-label-row">
|
||||
<text class="reset-label">新登录密码</text>
|
||||
<text class="reset-rule">6至30位非空字符</text>
|
||||
</view>
|
||||
<view class="reset-input-box">
|
||||
<image class="reset-prefix-ico" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
<input
|
||||
class="field-input"
|
||||
:password="!showResetPwd"
|
||||
maxlength="30"
|
||||
v-model="resetNewPwd"
|
||||
placeholder="请设置新登录密码"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
<view class="input-eye-btn clickable-hover" @tap="showResetPwd = !showResetPwd">
|
||||
<image
|
||||
class="eye-icon"
|
||||
:src="showResetPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="reset-field-group">
|
||||
<view class="reset-label-row">
|
||||
<text class="reset-label">确认新密码</text>
|
||||
</view>
|
||||
<view class="reset-input-box" :class="{ 'is-error': resetConfirmPwd.length > 0 && resetNewPwd !== resetConfirmPwd }">
|
||||
<image class="reset-prefix-ico" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
<input
|
||||
class="field-input"
|
||||
:password="!showResetPwd"
|
||||
maxlength="30"
|
||||
v-model="resetConfirmPwd"
|
||||
placeholder="请再次输入新登录密码"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
</view>
|
||||
<text v-if="resetConfirmPwd.length > 0 && resetNewPwd !== resetConfirmPwd" class="reset-error">两次输入的密码不一致</text>
|
||||
</view>
|
||||
|
||||
<button
|
||||
class="reset-sms-btn clickable-hover"
|
||||
:disabled="sendingResetSms || resetCountdown > 0"
|
||||
@tap="sendResetSms"
|
||||
class="btn-account-primary reset-submit clickable-hover"
|
||||
:class="{ disabled: resetLoading }"
|
||||
:disabled="resetLoading"
|
||||
@tap="submitResetPassword"
|
||||
>
|
||||
{{ resetCountdown > 0 ? resetCountdown + 's' : (sendingResetSms ? '发送中' : '获取验证码') }}
|
||||
<text class="btn-text">{{ resetLoading ? '提交中...' : '确认重置密码' }}</text>
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<view class="input-row">
|
||||
<view class="input-icon-box">
|
||||
<image class="field-icon" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
</view>
|
||||
<input
|
||||
class="field-input"
|
||||
:password="!showResetPwd"
|
||||
maxlength="30"
|
||||
v-model="resetNewPwd"
|
||||
placeholder="请输入新密码(6至30位)"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
<view class="input-eye-btn clickable-hover" @tap="showResetPwd = !showResetPwd">
|
||||
<image
|
||||
class="eye-icon"
|
||||
:src="showResetPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="input-row">
|
||||
<view class="input-icon-box">
|
||||
<image class="field-icon" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
</view>
|
||||
<input
|
||||
class="field-input"
|
||||
:password="!showResetPwd"
|
||||
maxlength="30"
|
||||
v-model="resetConfirmPwd"
|
||||
placeholder="再次输入新密码"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<button
|
||||
class="btn-account-primary clickable-hover"
|
||||
:class="{ disabled: resetLoading }"
|
||||
@tap="submitResetPassword"
|
||||
>
|
||||
<text class="btn-text">{{ resetLoading ? '提交中...' : '确认重置密码' }}</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -973,70 +996,154 @@
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 999;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
background: rgba(15, 23, 42, 0.5);
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
.reset-sheet {
|
||||
width: 100%;
|
||||
max-height: 90vh;
|
||||
overflow-y: auto;
|
||||
background: #FFFFFF;
|
||||
border-radius: 28rpx 28rpx 0 0;
|
||||
padding: 32rpx 36rpx calc(40rpx + env(safe-area-inset-bottom));
|
||||
border-radius: 36rpx 36rpx 0 0;
|
||||
padding: 16rpx 0 calc(36rpx + env(safe-area-inset-bottom));
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.reset-handle {
|
||||
width: 72rpx;
|
||||
height: 8rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #E5E6EB;
|
||||
margin: 0 auto 20rpx;
|
||||
}
|
||||
.reset-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 28rpx;
|
||||
padding: 0 32rpx 24rpx;
|
||||
border-bottom: 1rpx solid #F0F0F2;
|
||||
}
|
||||
.reset-head-meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
.reset-title {
|
||||
font-size: 34rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
color: #1D2129;
|
||||
color: #1F1F1F;
|
||||
line-height: 1.25;
|
||||
}
|
||||
.reset-sub {
|
||||
font-size: 24rpx;
|
||||
color: #888888;
|
||||
}
|
||||
.reset-close {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50%;
|
||||
background: #F5F6F8;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.reset-close-ico {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
opacity: 0.65;
|
||||
}
|
||||
.reset-sms-row {
|
||||
.reset-body {
|
||||
padding: 28rpx 32rpx 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24rpx;
|
||||
}
|
||||
.reset-field-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10rpx;
|
||||
}
|
||||
.reset-label-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 24rpx;
|
||||
justify-content: space-between;
|
||||
padding: 0 4rpx;
|
||||
}
|
||||
.reset-sms-input-row {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.reset-sms-btn {
|
||||
flex-shrink: 0;
|
||||
height: 96rpx;
|
||||
line-height: 96rpx;
|
||||
padding: 0 28rpx;
|
||||
border-radius: 48rpx;
|
||||
background: #FFF7F0;
|
||||
color: #F0710D;
|
||||
.reset-label {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
border: 1.5rpx solid rgba(240, 113, 13, 0.35);
|
||||
color: #1F1F1F;
|
||||
}
|
||||
.reset-sms-btn::after {
|
||||
.reset-rule {
|
||||
font-size: 22rpx;
|
||||
color: #888888;
|
||||
}
|
||||
.reset-error {
|
||||
font-size: 22rpx;
|
||||
color: #E8331B;
|
||||
padding-left: 4rpx;
|
||||
}
|
||||
.reset-input-box {
|
||||
height: 92rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 0 18rpx 0 24rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #F7F8FA;
|
||||
border: 1.5rpx solid #EBEDF0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14rpx;
|
||||
transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
.reset-input-box:focus-within {
|
||||
background: #FFFFFF;
|
||||
border-color: #F0710D;
|
||||
box-shadow: 0 0 0 4rpx rgba(240, 113, 13, 0.1);
|
||||
}
|
||||
.reset-input-box.is-error {
|
||||
background: #FFF8F7;
|
||||
border-color: #E8331B;
|
||||
}
|
||||
.reset-prefix-ico {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
flex-shrink: 0;
|
||||
opacity: 0.75;
|
||||
}
|
||||
.reset-sms-box {
|
||||
padding-right: 8rpx;
|
||||
}
|
||||
.reset-sms-divider {
|
||||
width: 1.5rpx;
|
||||
height: 36rpx;
|
||||
background: #E5E6EB;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.reset-inline-btn {
|
||||
flex-shrink: 0;
|
||||
height: 76rpx;
|
||||
padding: 0 20rpx;
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #F0710D;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.reset-inline-btn::after {
|
||||
border: none;
|
||||
}
|
||||
.reset-sms-btn[disabled] {
|
||||
opacity: 0.6;
|
||||
color: #86909C;
|
||||
background: #F7F8FA;
|
||||
border-color: #E5E6EB;
|
||||
.reset-inline-btn[disabled] {
|
||||
color: #AAAAAA;
|
||||
font-weight: 500;
|
||||
}
|
||||
.reset-submit {
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -97,120 +97,158 @@
|
||||
<!-- 登录密码 / 支付密码设置与修改底部弹窗 -->
|
||||
<view v-if="mode && mode !== 'cert'" class="mask" @tap="cancelSheet">
|
||||
<view class="sheet" @tap.stop>
|
||||
<view class="sheet-handle"></view>
|
||||
<view class="sheet-head">
|
||||
<text class="title">{{ sheetTitle }}</text>
|
||||
<text class="close clickable-hover" @tap="cancelSheet">取消</text>
|
||||
<view class="sheet-head-meta">
|
||||
<text class="title">{{ sheetTitle }}</text>
|
||||
<text class="sheet-sub">{{ sheetDesc }}</text>
|
||||
</view>
|
||||
<view class="sheet-close-btn clickable-hover" @tap="cancelSheet">
|
||||
<image class="sheet-close-ico" src="/static/icons/close.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="hasCurrentPassword" class="mode-tabs">
|
||||
<view
|
||||
class="mode-tab"
|
||||
:class="{ active: currentVerifyMode === 'old_password' }"
|
||||
@tap="switchVerifyMode('old_password')"
|
||||
>原密码验证</view>
|
||||
<view
|
||||
class="mode-tab"
|
||||
:class="{ active: currentVerifyMode === 'sms' }"
|
||||
@tap="switchVerifyMode('sms')"
|
||||
>短信验证码</view>
|
||||
</view>
|
||||
|
||||
<template v-if="hasCurrentPassword && currentVerifyMode === 'sms'">
|
||||
<text class="sms-target">验证码将发送至绑定手机:{{ status.mobile || '当前绑定手机号' }}</text>
|
||||
<view class="sms-row">
|
||||
<view class="input-box sms-input-box">
|
||||
<view class="sheet-body">
|
||||
<view v-if="hasCurrentPassword && currentVerifyMode === 'old_password'" class="field-group">
|
||||
<view class="field-label-row">
|
||||
<text class="field-label">{{ isPaymentMode ? '原支付密码' : '原登录密码' }}</text>
|
||||
</view>
|
||||
<view class="input-box" :class="{ 'is-error': !!oldPasswordError }">
|
||||
<image class="input-prefix-ico" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
<input
|
||||
v-model="smsCode"
|
||||
v-if="isPaymentMode"
|
||||
v-model="oldPassword"
|
||||
class="input-field"
|
||||
type="number"
|
||||
:password="!showOldPwd"
|
||||
maxlength="6"
|
||||
placeholder="请输入6位短信验证码"
|
||||
placeholder="请输入原6位数字支付密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="oldPasswordError = ''; verifyLocked = false"
|
||||
/>
|
||||
<input
|
||||
v-else
|
||||
v-model="oldPassword"
|
||||
class="input-field"
|
||||
:password="!showOldPwd"
|
||||
maxlength="30"
|
||||
placeholder="请输入当前登录密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="oldPasswordError = ''; verifyLocked = false"
|
||||
/>
|
||||
<view class="eye-btn clickable-hover" @tap="showOldPwd = !showOldPwd">
|
||||
<image class="eye-ico" :src="showOldPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<button class="sms-btn clickable-hover" :disabled="sendingSms || smsCountdown > 0" @tap="sendPwdSms">
|
||||
{{ smsCountdown > 0 ? smsCountdown + 's后重试' : (sendingSms ? '发送中...' : '获取验证码') }}
|
||||
</button>
|
||||
<text v-if="oldPasswordError" class="field-error">{{ oldPasswordError }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<view v-else-if="hasCurrentPassword" class="input-box">
|
||||
<input
|
||||
v-if="isPaymentMode"
|
||||
v-model="oldPassword"
|
||||
class="input-field"
|
||||
type="number"
|
||||
:password="!showOldPwd"
|
||||
maxlength="6"
|
||||
placeholder="请输入原6位数字支付密码"
|
||||
/>
|
||||
<input
|
||||
v-else
|
||||
v-model="oldPassword"
|
||||
class="input-field"
|
||||
:password="!showOldPwd"
|
||||
maxlength="30"
|
||||
placeholder="请输入原登录密码"
|
||||
/>
|
||||
<view class="eye-btn" @tap="showOldPwd = !showOldPwd">
|
||||
<image class="eye-ico" :src="showOldPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
<view class="field-group">
|
||||
<view class="field-label-row">
|
||||
<text class="field-label">{{ isPaymentMode ? '新支付密码' : '新登录密码' }}</text>
|
||||
<text class="field-rule">{{ isPaymentMode ? '6位纯数字' : '6至30位非空字符' }}</text>
|
||||
</view>
|
||||
<view class="input-box" :class="{ 'is-error': !!newPasswordError }">
|
||||
<image class="input-prefix-ico" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
<input
|
||||
v-if="isPaymentMode"
|
||||
v-model="newPassword"
|
||||
class="input-field"
|
||||
type="number"
|
||||
:password="!showNewPwd"
|
||||
maxlength="6"
|
||||
placeholder="请输入6位数字支付密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="newPasswordError = ''; confirmPasswordError = ''"
|
||||
/>
|
||||
<input
|
||||
v-else
|
||||
v-model="newPassword"
|
||||
class="input-field"
|
||||
:password="!showNewPwd"
|
||||
maxlength="30"
|
||||
placeholder="请设置新登录密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="newPasswordError = ''; confirmPasswordError = ''"
|
||||
/>
|
||||
<view class="eye-btn clickable-hover" @tap="showNewPwd = !showNewPwd">
|
||||
<image class="eye-ico" :src="showNewPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<text v-if="newPasswordError" class="field-error">{{ newPasswordError }}</text>
|
||||
</view>
|
||||
|
||||
<view class="field-group">
|
||||
<view class="field-label-row">
|
||||
<text class="field-label">{{ isPaymentMode ? '确认支付密码' : '确认新密码' }}</text>
|
||||
</view>
|
||||
<view class="input-box" :class="{ 'is-error': passwordMismatch || !!confirmPasswordError }">
|
||||
<image class="input-prefix-ico" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
<input
|
||||
v-if="isPaymentMode"
|
||||
v-model="confirmPassword"
|
||||
class="input-field"
|
||||
type="number"
|
||||
:password="!showConfirmPwd"
|
||||
maxlength="6"
|
||||
placeholder="请再次输入6位数字支付密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="confirmPasswordError = ''"
|
||||
/>
|
||||
<input
|
||||
v-else
|
||||
v-model="confirmPassword"
|
||||
class="input-field"
|
||||
:password="!showConfirmPwd"
|
||||
maxlength="30"
|
||||
placeholder="请再次输入新登录密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="confirmPasswordError = ''"
|
||||
/>
|
||||
<view class="eye-btn clickable-hover" @tap="showConfirmPwd = !showConfirmPwd">
|
||||
<image class="eye-ico" :src="showConfirmPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<text v-if="confirmPasswordError || passwordMismatch" class="field-error">{{ confirmPasswordError || '两次输入的密码不一致' }}</text>
|
||||
</view>
|
||||
|
||||
<template v-if="hasCurrentPassword && currentVerifyMode === 'sms'">
|
||||
<view class="field-group">
|
||||
<view class="field-label-row">
|
||||
<text class="field-label">短信验证码</text>
|
||||
<text class="field-rule">将发送至 {{ status.mobile || '绑定手机号' }}</text>
|
||||
</view>
|
||||
<view class="input-box sms-box" :class="{ 'is-error': !!smsCodeError }">
|
||||
<input
|
||||
v-model="smsCode"
|
||||
class="input-field"
|
||||
type="number"
|
||||
maxlength="6"
|
||||
placeholder="请输入6位短信验证码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="smsCodeError = ''"
|
||||
/>
|
||||
<view class="sms-divider"></view>
|
||||
<button class="inline-sms-btn clickable-hover" :disabled="sendingSms || smsCountdown > 0" @tap="sendPwdSms">
|
||||
{{ smsCountdown > 0 ? smsCountdown + 's 后重发' : (sendingSms ? '发送中...' : '获取验证码') }}
|
||||
</button>
|
||||
</view>
|
||||
<text v-if="smsCodeError" class="field-error">{{ smsCodeError }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<button class="primary sheet-submit clickable-hover" :disabled="busy" @tap="savePassword">
|
||||
{{ busy ? '提交中...' : (hasCurrentPassword ? '确认修改' : '确认设置') }}
|
||||
</button>
|
||||
|
||||
<view v-if="hasCurrentPassword" class="switch-row">
|
||||
<text
|
||||
class="switch-link clickable-hover"
|
||||
:class="{ 'is-highlight': verifyLocked && currentVerifyMode === 'old_password' }"
|
||||
@tap="switchVerifyMode(currentVerifyMode === 'old_password' ? 'sms' : 'old_password')"
|
||||
>{{ currentVerifyMode === 'old_password' ? (isPaymentMode ? '忘记原支付密码?改用短信验证码' : '忘记原密码?改用短信验证码') : (isPaymentMode ? '记得原支付密码?改用原密码验证' : '记得原密码?改用原密码验证') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="input-box">
|
||||
<input
|
||||
v-if="isPaymentMode"
|
||||
v-model="newPassword"
|
||||
class="input-field"
|
||||
type="number"
|
||||
:password="!showNewPwd"
|
||||
maxlength="6"
|
||||
placeholder="请输入6位数字支付密码"
|
||||
/>
|
||||
<input
|
||||
v-else
|
||||
v-model="newPassword"
|
||||
class="input-field"
|
||||
:password="!showNewPwd"
|
||||
maxlength="30"
|
||||
placeholder="新登录密码(6至30位非空字符)"
|
||||
/>
|
||||
<view class="eye-btn" @tap="showNewPwd = !showNewPwd">
|
||||
<image class="eye-ico" :src="showNewPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="input-box">
|
||||
<input
|
||||
v-if="isPaymentMode"
|
||||
v-model="confirmPassword"
|
||||
class="input-field"
|
||||
type="number"
|
||||
:password="!showConfirmPwd"
|
||||
maxlength="6"
|
||||
placeholder="再次输入6位数字支付密码"
|
||||
/>
|
||||
<input
|
||||
v-else
|
||||
v-model="confirmPassword"
|
||||
class="input-field"
|
||||
:password="!showConfirmPwd"
|
||||
maxlength="30"
|
||||
placeholder="再次输入新登录密码"
|
||||
/>
|
||||
<view class="eye-btn" @tap="showConfirmPwd = !showConfirmPwd">
|
||||
<image class="eye-ico" :src="showConfirmPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button class="primary clickable-hover" :disabled="busy" @tap="savePassword">
|
||||
{{ busy ? '提交中...' : (hasCurrentPassword ? '确认修改' : '确认设置') }}
|
||||
</button>
|
||||
|
||||
<text
|
||||
v-if="hasCurrentPassword && currentVerifyMode === 'old_password'"
|
||||
class="switch-link clickable-hover"
|
||||
@tap="switchVerifyMode('sms')"
|
||||
>{{ isPaymentMode ? '忘记原支付密码?使用短信验证码修改' : '忘记原密码?使用短信验证码修改' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -220,7 +258,7 @@
|
||||
import { onLoad, onShow, onBackPress, onUnload } from '@dcloudio/uni-app';
|
||||
import YjyfNavBar from '@/components/YjyfNavBar.vue';
|
||||
import api from '@/utils/api.js';
|
||||
import { clearAuth } from '@/utils/request.js';
|
||||
import { clearAuth, toLogin } from '@/utils/request.js';
|
||||
import { finishPaymentSetup } from '@/utils/payment-setup.mjs';
|
||||
|
||||
const loaded = ref(false), busy = ref(false), mode = ref('');
|
||||
@@ -233,6 +271,7 @@
|
||||
const showOldPwd = ref(false), showNewPwd = ref(false), showConfirmPwd = ref(false);
|
||||
const loginVerifyMode = ref('old_password'), paymentVerifyMode = ref('old_password');
|
||||
const smsCode = ref(''), smsCountdown = ref(0), sendingSms = ref(false);
|
||||
const oldPasswordError = ref(''), newPasswordError = ref(''), confirmPasswordError = ref(''), smsCodeError = ref(''), verifyLocked = ref(false);
|
||||
let smsTimer = null;
|
||||
|
||||
const companyName = ref(''), licenseNo = ref(''), legalPerson = ref(''), licenseImage = ref(''), imagePreview = ref('');
|
||||
@@ -254,6 +293,8 @@
|
||||
if (isPaymentMode.value) return status.value.has_payment_password ? '修改支付密码' : '设置支付密码';
|
||||
return status.value.has_login_password ? '修改登录密码' : '设置登录密码';
|
||||
});
|
||||
const sheetDesc = computed(() => isPaymentMode.value ? '用于账户余额支付安全验证' : '用于 H5 网页端手机号密码登录');
|
||||
const passwordMismatch = computed(() => confirmPassword.value.length > 0 && newPassword.value !== confirmPassword.value);
|
||||
|
||||
async function load() { try { status.value = await api.securityStatus(); loaded.value = true; } catch (e) {} }
|
||||
function clearSmsTimer() { if (smsTimer) { clearInterval(smsTimer); smsTimer = null; } }
|
||||
@@ -265,6 +306,12 @@
|
||||
else { smsCountdown.value -= 1; }
|
||||
}, 1000);
|
||||
}
|
||||
function clearFieldErrors() {
|
||||
oldPasswordError.value = '';
|
||||
newPasswordError.value = '';
|
||||
confirmPasswordError.value = '';
|
||||
smsCodeError.value = '';
|
||||
}
|
||||
function resetPwdFields() {
|
||||
oldPassword.value = '';
|
||||
newPassword.value = '';
|
||||
@@ -273,12 +320,16 @@
|
||||
showOldPwd.value = false;
|
||||
showNewPwd.value = false;
|
||||
showConfirmPwd.value = false;
|
||||
verifyLocked.value = false;
|
||||
clearFieldErrors();
|
||||
}
|
||||
function switchVerifyMode(nextMode) {
|
||||
if (isPaymentMode.value) paymentVerifyMode.value = nextMode;
|
||||
else loginVerifyMode.value = nextMode;
|
||||
oldPassword.value = '';
|
||||
smsCode.value = '';
|
||||
verifyLocked.value = false;
|
||||
clearFieldErrors();
|
||||
}
|
||||
async function sendPwdSms() {
|
||||
if (sendingSms.value || smsCountdown.value > 0) return;
|
||||
@@ -307,34 +358,60 @@
|
||||
if (cert.value) { companyName.value = cert.value.company_name; licenseNo.value = cert.value.license_no; legalPerson.value = cert.value.legal_person; }
|
||||
mode.value = 'cert';
|
||||
}
|
||||
function applyServerFieldError(e) {
|
||||
if (e && e.code === 401) {
|
||||
uni.showToast({ title: '登录已失效,请重新登录', icon: 'none' });
|
||||
setTimeout(() => toLogin(), 800);
|
||||
return;
|
||||
}
|
||||
const msg = String((e && e.message) || '操作失败,请稍后重试');
|
||||
if (/验证码/.test(msg) && !/改用短信验证码/.test(msg)) {
|
||||
smsCodeError.value = msg;
|
||||
return;
|
||||
}
|
||||
if (/原登录密码|原支付密码|原密码|密码不正确|次数过多|15分钟|旧密码/.test(msg)) {
|
||||
oldPasswordError.value = msg;
|
||||
if (/15分钟|次数过多/.test(msg)) verifyLocked.value = true;
|
||||
return;
|
||||
}
|
||||
if (/6位|6至30位|非空字符|新密码/.test(msg)) {
|
||||
newPasswordError.value = msg;
|
||||
return;
|
||||
}
|
||||
uni.showToast({ title: msg, icon: 'none' });
|
||||
}
|
||||
function validPassword() {
|
||||
clearFieldErrors();
|
||||
let ok = true;
|
||||
if (hasCurrentPassword.value) {
|
||||
if (currentVerifyMode.value === 'sms') {
|
||||
if (!/^\d{4,6}$/.test(smsCode.value.trim())) {
|
||||
uni.showToast({ title: '请输入有效的短信验证码', icon: 'none' });
|
||||
return false;
|
||||
smsCodeError.value = '请输入有效的6位短信验证码';
|
||||
ok = false;
|
||||
}
|
||||
} else if (isPaymentMode.value && !/^\d{6}$/.test(oldPassword.value)) {
|
||||
uni.showToast({ title: '请输入6位原支付密码', icon: 'none' });
|
||||
return false;
|
||||
oldPasswordError.value = '请输入原6位数字支付密码';
|
||||
ok = false;
|
||||
} else if (!isPaymentMode.value && !oldPassword.value) {
|
||||
uni.showToast({ title: '请输入原登录密码', icon: 'none' });
|
||||
return false;
|
||||
oldPasswordError.value = '请输入原登录密码';
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
if (isPaymentMode.value && !/^\d{6}$/.test(newPassword.value)) {
|
||||
uni.showToast({ title: '支付密码须为6位数字', icon: 'none' });
|
||||
return false;
|
||||
newPasswordError.value = '新支付密码须为6位纯数字';
|
||||
ok = false;
|
||||
} else if (!isPaymentMode.value && !/^\S{6,30}$/.test(newPassword.value)) {
|
||||
newPasswordError.value = '新登录密码须为6至30位非空字符';
|
||||
ok = false;
|
||||
}
|
||||
if (!isPaymentMode.value && !/^\S{6,30}$/.test(newPassword.value)) {
|
||||
uni.showToast({ title: '登录密码须为6至30位非空字符', icon: 'none' });
|
||||
return false;
|
||||
if (!confirmPassword.value) {
|
||||
confirmPasswordError.value = isPaymentMode.value ? '请再次输入新支付密码' : '请再次输入新登录密码';
|
||||
ok = false;
|
||||
} else if (newPassword.value !== confirmPassword.value) {
|
||||
confirmPasswordError.value = '两次输入的新密码不一致';
|
||||
ok = false;
|
||||
}
|
||||
if (newPassword.value !== confirmPassword.value) {
|
||||
uni.showToast({ title: '两次输入的新密码不一致', icon: 'none' });
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return ok;
|
||||
}
|
||||
async function savePassword() {
|
||||
if (busy.value || !validPassword()) return;
|
||||
@@ -344,7 +421,7 @@
|
||||
const payload = currentVerifyMode.value === 'sms' && hasCurrentPassword.value
|
||||
? { verify_mode: 'sms', sms_code: smsCode.value.trim(), new_password: newPassword.value }
|
||||
: { verify_mode: 'old_password', old_password: oldPassword.value, new_password: newPassword.value };
|
||||
await api.changeLoginPassword(payload);
|
||||
await api.changeLoginPassword(payload, { silent: true });
|
||||
clearAuth(); uni.showToast({ title: '密码已更新,请重新登录', icon: 'none' });
|
||||
setTimeout(() => uni.reLaunch({ url: '/pages/login/login' }), 700); return;
|
||||
}
|
||||
@@ -353,14 +430,16 @@
|
||||
const payPayload = currentVerifyMode.value === 'sms'
|
||||
? { verify_mode: 'sms', sms_code: smsCode.value.trim(), new_password: newPassword.value }
|
||||
: { verify_mode: 'old_password', old_password: oldPassword.value, new_password: newPassword.value };
|
||||
await api.changePaymentPassword(payPayload);
|
||||
await api.changePaymentPassword(payPayload, { silent: true });
|
||||
}
|
||||
else await api.setPaymentPassword({ new_password: newPassword.value });
|
||||
else await api.setPaymentPassword({ new_password: newPassword.value }, { silent: true });
|
||||
busy.value = false; close(); uni.showToast({ title: firstSetup ? '设置成功' : '修改成功', icon: 'success' });
|
||||
if (setupFromPayment.value && firstSetup) {
|
||||
try { await finishPaymentSetup(uni, returnOrder.value); } catch (e) { uni.showToast({ title: e.message, icon: 'none' }); }
|
||||
} else await load();
|
||||
} catch (e) {} finally { busy.value = false; }
|
||||
} catch (e) {
|
||||
applyServerFieldError(e);
|
||||
} finally { busy.value = false; }
|
||||
}
|
||||
function chooseLicense() { if (busy.value) return; uni.chooseImage({ count: 1, sizeType: ['compressed'], success: async res => {
|
||||
busy.value = true; try {
|
||||
@@ -504,88 +583,109 @@
|
||||
.field text { width: 200rpx; flex-shrink: 0; }
|
||||
.field input { flex: 1; min-width: 0; font-size: 27rpx; }
|
||||
|
||||
.mask { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-end; }
|
||||
.mask { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, 0.5); display: flex; align-items: flex-end; }
|
||||
.sheet {
|
||||
width: 100%;
|
||||
max-height: 90vh;
|
||||
overflow-y: auto;
|
||||
box-sizing: border-box;
|
||||
padding: 32rpx 32rpx calc(40rpx + env(safe-area-inset-bottom));
|
||||
border-radius: $yjyf-radius-lg $yjyf-radius-lg 0 0;
|
||||
padding: 16rpx 0 calc(36rpx + env(safe-area-inset-bottom));
|
||||
border-radius: 36rpx 36rpx 0 0;
|
||||
background: $yjyf-bg-card;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4rpx; }
|
||||
.title { color: $yjyf-text-main; font-size: $yjyf-font-title; font-weight: 700; }
|
||||
.close { color: $yjyf-text-secondary; font-size: $yjyf-font-body; padding: 8rpx 0 8rpx 16rpx; }
|
||||
|
||||
.mode-tabs { display: flex; gap: 16rpx; }
|
||||
.mode-tab {
|
||||
flex: 1;
|
||||
height: 76rpx;
|
||||
box-sizing: border-box;
|
||||
.sheet-handle {
|
||||
width: 72rpx;
|
||||
height: 8rpx;
|
||||
border-radius: $yjyf-radius-pill;
|
||||
background: #E5E6EB;
|
||||
margin: 0 auto 20rpx;
|
||||
}
|
||||
.sheet-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: $yjyf-radius-sm;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
padding: 0 32rpx 24rpx;
|
||||
border-bottom: 1rpx solid $yjyf-border-color;
|
||||
}
|
||||
.sheet-head-meta { display: flex; flex-direction: column; gap: 6rpx; }
|
||||
.title { color: $yjyf-text-main; font-size: 36rpx; font-weight: 700; line-height: 1.25; }
|
||||
.sheet-sub { color: $yjyf-text-secondary; font-size: $yjyf-font-sub; }
|
||||
.sheet-close-btn {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50%;
|
||||
background: $yjyf-bg-page;
|
||||
border: 1.5rpx solid transparent;
|
||||
color: $yjyf-text-secondary;
|
||||
font-size: $yjyf-font-sub;
|
||||
font-weight: 600;
|
||||
}
|
||||
.mode-tab.active {
|
||||
background: $yjyf-primary-bg;
|
||||
color: $yjyf-primary;
|
||||
border-color: rgba(240, 113, 13, 0.35);
|
||||
}
|
||||
|
||||
.sms-target { font-size: $yjyf-font-micro; color: $yjyf-text-secondary; }
|
||||
.sms-row { display: flex; align-items: center; gap: 16rpx; }
|
||||
.sms-input-box { flex: 1; min-width: 0; }
|
||||
.sms-btn {
|
||||
flex-shrink: 0;
|
||||
height: 92rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 28rpx;
|
||||
margin: 0;
|
||||
border-radius: $yjyf-radius-sm;
|
||||
background: $yjyf-primary-bg;
|
||||
color: $yjyf-primary;
|
||||
font-size: $yjyf-font-sub;
|
||||
font-weight: 600;
|
||||
border: 1.5rpx solid rgba(240, 113, 13, 0.35);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.sms-btn::after { border: none; }
|
||||
.sms-btn[disabled] { opacity: 0.6; color: $yjyf-text-secondary; background: $yjyf-bg-page; border-color: $yjyf-border-color; }
|
||||
.sheet-close-ico { width: 26rpx; height: 26rpx; opacity: 0.65; }
|
||||
|
||||
.sheet-body {
|
||||
padding: 28rpx 32rpx 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24rpx;
|
||||
}
|
||||
|
||||
.field-group { display: flex; flex-direction: column; gap: 10rpx; }
|
||||
.field-label-row { display: flex; align-items: center; justify-content: space-between; padding: 0 4rpx; }
|
||||
.field-label { font-size: 26rpx; font-weight: 600; color: $yjyf-text-main; }
|
||||
.field-rule { font-size: $yjyf-font-micro; color: $yjyf-text-secondary; }
|
||||
.field-error { font-size: $yjyf-font-micro; color: $yjyf-danger; padding-left: 4rpx; }
|
||||
|
||||
.input-box {
|
||||
height: 92rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 0 20rpx 0 24rpx;
|
||||
border-radius: $yjyf-radius-sm;
|
||||
background: $yjyf-bg-page;
|
||||
border: 1.5rpx solid transparent;
|
||||
padding: 0 18rpx 0 24rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #F7F8FA;
|
||||
border: 1.5rpx solid #EBEDF0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
gap: 14rpx;
|
||||
transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
.input-box:focus-within {
|
||||
background: $yjyf-bg-card;
|
||||
border-color: $yjyf-primary;
|
||||
box-shadow: 0 0 0 4rpx rgba(240, 113, 13, 0.1);
|
||||
}
|
||||
.input-box.is-error {
|
||||
background: #FFF8F7;
|
||||
border-color: $yjyf-danger;
|
||||
}
|
||||
.input-prefix-ico { width: 34rpx; height: 34rpx; flex-shrink: 0; opacity: 0.75; }
|
||||
.input-field { flex: 1; min-width: 0; height: 92rpx; font-size: $yjyf-font-body; color: $yjyf-text-main; }
|
||||
.eye-btn { width: 56rpx; height: 56rpx; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
|
||||
.field-placeholder { font-size: 26rpx; color: $yjyf-text-muted; }
|
||||
.eye-btn { width: 64rpx; height: 64rpx; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
|
||||
.eye-ico { width: 34rpx; height: 34rpx; }
|
||||
|
||||
.sms-box { padding-right: 8rpx; }
|
||||
.sms-divider { width: 1.5rpx; height: 36rpx; background: #E5E6EB; flex-shrink: 0; }
|
||||
.inline-sms-btn {
|
||||
flex-shrink: 0;
|
||||
height: 76rpx;
|
||||
padding: 0 20rpx;
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: $yjyf-primary;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.inline-sms-btn::after { border: none; }
|
||||
.inline-sms-btn[disabled] { color: $yjyf-text-muted; font-weight: 500; }
|
||||
|
||||
.primary {
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
height: 92rpx;
|
||||
margin: 8rpx 0 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
@@ -595,12 +695,15 @@
|
||||
background: $yjyf-gradient-primary;
|
||||
box-shadow: $yjyf-shadow-button;
|
||||
color: $yjyf-text-inverse;
|
||||
font-size: $yjyf-font-body;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
border: none;
|
||||
}
|
||||
.primary::after { border: none; }
|
||||
.primary[disabled] { opacity: 0.65; }
|
||||
.sheet-submit { margin-top: 8rpx; }
|
||||
|
||||
.switch-link { text-align: center; font-size: $yjyf-font-sub; color: $yjyf-info; padding-top: 4rpx; }
|
||||
.switch-row { display: flex; justify-content: center; padding-top: 2rpx; }
|
||||
.switch-link { padding: 12rpx 24rpx; font-size: $yjyf-font-sub; color: $yjyf-text-secondary; }
|
||||
.switch-link.is-highlight { color: $yjyf-primary; font-weight: 600; }
|
||||
</style>
|
||||
|
||||
@@ -18,13 +18,13 @@ export default {
|
||||
profile: () => get('/auth/profile'),
|
||||
selectIdentity: (data) => post('/auth/selectIdentity', data),
|
||||
securityStatus: () => get('/security/status'),
|
||||
sendPasswordSms: () => post('/security/sendPasswordSms', {}),
|
||||
sendPaymentPasswordSms: () => post('/security/sendPaymentPasswordSms', {}),
|
||||
changeLoginPassword: (data) => post('/security/changeLoginPassword', data),
|
||||
sendPasswordSms: (opt) => post('/security/sendPasswordSms', {}, opt),
|
||||
sendPaymentPasswordSms: (opt) => post('/security/sendPaymentPasswordSms', {}, opt),
|
||||
changeLoginPassword: (data, opt) => post('/security/changeLoginPassword', data, opt),
|
||||
sendResetPasswordSms: (data) => post('/auth/sendResetPasswordSms', data),
|
||||
resetPasswordBySms: (data) => post('/auth/resetPasswordBySms', data),
|
||||
setPaymentPassword: (data) => post('/security/setPaymentPassword', data),
|
||||
changePaymentPassword: (data) => post('/security/changePaymentPassword', data),
|
||||
setPaymentPassword: (data, opt) => post('/security/setPaymentPassword', data, opt),
|
||||
changePaymentPassword: (data, opt) => post('/security/changePaymentPassword', data, opt),
|
||||
submitEnterpriseCert: (data) => post('/security/submitEnterpriseCert', data),
|
||||
recognizeEnterpriseLicense: (data) => post('/security/recognizeEnterpriseLicense', data),
|
||||
saveAccount: (data) => post('/auth/saveAccount', data),
|
||||
|
||||
@@ -121,89 +121,112 @@
|
||||
<!-- 短信重置密码弹窗 -->
|
||||
<view class="reset-mask" v-if="showReset" @tap="closeResetModal">
|
||||
<view class="reset-sheet" @tap.stop>
|
||||
<view class="reset-handle"></view>
|
||||
<view class="reset-head">
|
||||
<text class="reset-title">短信重置登录密码</text>
|
||||
<view class="reset-head-meta">
|
||||
<text class="reset-title">重置登录密码</text>
|
||||
<text class="reset-sub">验证师傅账号绑定手机后即可设置新密码</text>
|
||||
</view>
|
||||
<view class="reset-close clickable-hover" @tap="closeResetModal">
|
||||
<image class="reset-close-ico" src="/static/icons/close.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="input-row">
|
||||
<view class="input-icon-box">
|
||||
<image class="field-icon" src="/static/icons/login-phone.svg" mode="aspectFit" />
|
||||
<view class="reset-body">
|
||||
<view class="reset-field-group">
|
||||
<view class="reset-label-row">
|
||||
<text class="reset-label">师傅手机号</text>
|
||||
</view>
|
||||
<view class="reset-input-box">
|
||||
<image class="reset-prefix-ico" src="/static/icons/login-phone.svg" mode="aspectFit" />
|
||||
<input
|
||||
class="field-input"
|
||||
type="number"
|
||||
maxlength="11"
|
||||
v-model="resetMobile"
|
||||
placeholder="请输入师傅账号手机号"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<input
|
||||
class="field-input"
|
||||
type="number"
|
||||
maxlength="11"
|
||||
v-model="resetMobile"
|
||||
placeholder="请输入师傅账号手机号"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="reset-sms-row">
|
||||
<view class="input-row reset-sms-input-row">
|
||||
<input
|
||||
class="field-input"
|
||||
type="number"
|
||||
maxlength="6"
|
||||
v-model="resetCode"
|
||||
placeholder="请输入短信验证码"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
<view class="reset-field-group">
|
||||
<view class="reset-label-row">
|
||||
<text class="reset-label">短信验证码</text>
|
||||
<text class="reset-rule">5分钟内有效</text>
|
||||
</view>
|
||||
<view class="reset-input-box reset-sms-box">
|
||||
<input
|
||||
class="field-input"
|
||||
type="number"
|
||||
maxlength="6"
|
||||
v-model="resetCode"
|
||||
placeholder="请输入6位短信验证码"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
<view class="reset-sms-divider"></view>
|
||||
<button
|
||||
class="reset-inline-btn clickable-hover"
|
||||
:disabled="sendingResetSms || resetCountdown > 0"
|
||||
@tap="sendResetSms"
|
||||
>
|
||||
{{ resetCountdown > 0 ? resetCountdown + 's 后重发' : (sendingResetSms ? '发送中...' : '获取验证码') }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="reset-field-group">
|
||||
<view class="reset-label-row">
|
||||
<text class="reset-label">新登录密码</text>
|
||||
<text class="reset-rule">6至30位非空字符</text>
|
||||
</view>
|
||||
<view class="reset-input-box">
|
||||
<image class="reset-prefix-ico" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
<input
|
||||
class="field-input"
|
||||
:password="!showResetPwd"
|
||||
maxlength="30"
|
||||
v-model="resetNewPwd"
|
||||
placeholder="请设置新登录密码"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
<view class="input-eye-btn clickable-hover" @tap="showResetPwd = !showResetPwd">
|
||||
<image
|
||||
class="eye-icon"
|
||||
:src="showResetPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="reset-field-group">
|
||||
<view class="reset-label-row">
|
||||
<text class="reset-label">确认新密码</text>
|
||||
</view>
|
||||
<view class="reset-input-box" :class="{ 'is-error': resetConfirmPwd.length > 0 && resetNewPwd !== resetConfirmPwd }">
|
||||
<image class="reset-prefix-ico" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
<input
|
||||
class="field-input"
|
||||
:password="!showResetPwd"
|
||||
maxlength="30"
|
||||
v-model="resetConfirmPwd"
|
||||
placeholder="请再次输入新登录密码"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
</view>
|
||||
<text v-if="resetConfirmPwd.length > 0 && resetNewPwd !== resetConfirmPwd" class="reset-error">两次输入的密码不一致</text>
|
||||
</view>
|
||||
|
||||
<button
|
||||
class="reset-sms-btn clickable-hover"
|
||||
:disabled="sendingResetSms || resetCountdown > 0"
|
||||
@tap="sendResetSms"
|
||||
class="btn-account-primary reset-submit clickable-hover"
|
||||
:class="{ disabled: resetLoading }"
|
||||
:disabled="resetLoading"
|
||||
@tap="submitResetPassword"
|
||||
>
|
||||
{{ resetCountdown > 0 ? resetCountdown + 's' : (sendingResetSms ? '发送中' : '获取验证码') }}
|
||||
<text class="btn-text">{{ resetLoading ? '提交中...' : '确认重置密码' }}</text>
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<view class="input-row">
|
||||
<view class="input-icon-box">
|
||||
<image class="field-icon" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
</view>
|
||||
<input
|
||||
class="field-input"
|
||||
:password="!showResetPwd"
|
||||
maxlength="30"
|
||||
v-model="resetNewPwd"
|
||||
placeholder="请输入新密码(6至30位)"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
<view class="input-eye-btn clickable-hover" @tap="showResetPwd = !showResetPwd">
|
||||
<image
|
||||
class="eye-icon"
|
||||
:src="showResetPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="input-row">
|
||||
<view class="input-icon-box">
|
||||
<image class="field-icon" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
</view>
|
||||
<input
|
||||
class="field-input"
|
||||
:password="!showResetPwd"
|
||||
maxlength="30"
|
||||
v-model="resetConfirmPwd"
|
||||
placeholder="再次输入新密码"
|
||||
placeholder-class="field-placeholder"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<button
|
||||
class="btn-account-primary clickable-hover"
|
||||
:class="{ disabled: resetLoading }"
|
||||
@tap="submitResetPassword"
|
||||
>
|
||||
<text class="btn-text">{{ resetLoading ? '提交中...' : '确认重置密码' }}</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -836,70 +859,154 @@
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 999;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
background: rgba(15, 23, 42, 0.5);
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
.reset-sheet {
|
||||
width: 100%;
|
||||
max-height: 90vh;
|
||||
overflow-y: auto;
|
||||
background: #FFFFFF;
|
||||
border-radius: 28rpx 28rpx 0 0;
|
||||
padding: 32rpx 36rpx calc(40rpx + env(safe-area-inset-bottom));
|
||||
border-radius: 36rpx 36rpx 0 0;
|
||||
padding: 16rpx 0 calc(36rpx + env(safe-area-inset-bottom));
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.reset-handle {
|
||||
width: 72rpx;
|
||||
height: 8rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #E5E6EB;
|
||||
margin: 0 auto 20rpx;
|
||||
}
|
||||
.reset-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 28rpx;
|
||||
padding: 0 32rpx 24rpx;
|
||||
border-bottom: 1rpx solid #F0F0F2;
|
||||
}
|
||||
.reset-head-meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
.reset-title {
|
||||
font-size: 34rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
color: #1D2129;
|
||||
color: #1F1F1F;
|
||||
line-height: 1.25;
|
||||
}
|
||||
.reset-sub {
|
||||
font-size: 24rpx;
|
||||
color: #888888;
|
||||
}
|
||||
.reset-close {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50%;
|
||||
background: #F5F6F8;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.reset-close-ico {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
opacity: 0.65;
|
||||
}
|
||||
.reset-sms-row {
|
||||
.reset-body {
|
||||
padding: 28rpx 32rpx 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24rpx;
|
||||
}
|
||||
.reset-field-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10rpx;
|
||||
}
|
||||
.reset-label-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 24rpx;
|
||||
justify-content: space-between;
|
||||
padding: 0 4rpx;
|
||||
}
|
||||
.reset-sms-input-row {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.reset-sms-btn {
|
||||
flex-shrink: 0;
|
||||
height: 96rpx;
|
||||
line-height: 96rpx;
|
||||
padding: 0 28rpx;
|
||||
border-radius: 48rpx;
|
||||
background: #FFF7F0;
|
||||
color: #F0710D;
|
||||
.reset-label {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
border: 1.5rpx solid rgba(240, 113, 13, 0.35);
|
||||
color: #1F1F1F;
|
||||
}
|
||||
.reset-sms-btn::after {
|
||||
.reset-rule {
|
||||
font-size: 22rpx;
|
||||
color: #888888;
|
||||
}
|
||||
.reset-error {
|
||||
font-size: 22rpx;
|
||||
color: #E8331B;
|
||||
padding-left: 4rpx;
|
||||
}
|
||||
.reset-input-box {
|
||||
height: 92rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 0 18rpx 0 24rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #F7F8FA;
|
||||
border: 1.5rpx solid #EBEDF0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14rpx;
|
||||
transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
.reset-input-box:focus-within {
|
||||
background: #FFFFFF;
|
||||
border-color: #F0710D;
|
||||
box-shadow: 0 0 0 4rpx rgba(240, 113, 13, 0.1);
|
||||
}
|
||||
.reset-input-box.is-error {
|
||||
background: #FFF8F7;
|
||||
border-color: #E8331B;
|
||||
}
|
||||
.reset-prefix-ico {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
flex-shrink: 0;
|
||||
opacity: 0.75;
|
||||
}
|
||||
.reset-sms-box {
|
||||
padding-right: 8rpx;
|
||||
}
|
||||
.reset-sms-divider {
|
||||
width: 1.5rpx;
|
||||
height: 36rpx;
|
||||
background: #E5E6EB;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.reset-inline-btn {
|
||||
flex-shrink: 0;
|
||||
height: 76rpx;
|
||||
padding: 0 20rpx;
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #F0710D;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.reset-inline-btn::after {
|
||||
border: none;
|
||||
}
|
||||
.reset-sms-btn[disabled] {
|
||||
opacity: 0.6;
|
||||
color: #86909C;
|
||||
background: #F7F8FA;
|
||||
border-color: #E5E6EB;
|
||||
.reset-inline-btn[disabled] {
|
||||
color: #AAAAAA;
|
||||
font-weight: 500;
|
||||
}
|
||||
.reset-submit {
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -69,142 +69,158 @@
|
||||
<!-- 密码设置 / 修改底部弹窗 -->
|
||||
<view v-if="mode" class="mask" @tap="cancelSheet">
|
||||
<view class="sheet" @tap.stop>
|
||||
<view class="sheet-handle"></view>
|
||||
<view class="sheet-head">
|
||||
<text class="title">{{ sheetTitle }}</text>
|
||||
<text class="close" @tap="cancelSheet">取消</text>
|
||||
<view class="sheet-head-meta">
|
||||
<text class="title">{{ sheetTitle }}</text>
|
||||
<text class="sheet-sub">{{ sheetDesc }}</text>
|
||||
</view>
|
||||
<view class="sheet-close-btn clickable-hover" @tap="cancelSheet">
|
||||
<image class="sheet-close-ico" src="/static/icons/close.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 登录密码表单 -->
|
||||
<template v-if="mode === 'login'">
|
||||
<view v-if="status.has_login_password" class="mode-tabs">
|
||||
<view class="mode-tab" :class="{ active: loginVerifyMode === 'old_password' }" @tap="switchLoginMode('old_password')">原密码验证</view>
|
||||
<view class="mode-tab" :class="{ active: loginVerifyMode === 'sms' }" @tap="switchLoginMode('sms')">短信验证码</view>
|
||||
</view>
|
||||
<template v-if="status.has_login_password && loginVerifyMode === 'sms'">
|
||||
<text class="sms-target">验证码将发送至绑定手机:{{ status.mobile || '当前绑定手机号' }}</text>
|
||||
<view class="sms-row">
|
||||
<view class="input-box sms-input-box">
|
||||
<input
|
||||
v-model="smsCode"
|
||||
class="input-field"
|
||||
type="number"
|
||||
maxlength="6"
|
||||
placeholder="请输入6位短信验证码"
|
||||
/>
|
||||
<view class="sheet-body">
|
||||
<view v-if="hasCurrentPassword && currentVerifyMode === 'old_password'" class="field-group">
|
||||
<view class="field-label-row">
|
||||
<text class="field-label">{{ isPaymentMode ? '原支付密码' : '原登录密码' }}</text>
|
||||
</view>
|
||||
<view class="input-box" :class="{ 'is-error': !!oldPasswordError }">
|
||||
<image class="input-prefix-ico" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
<input
|
||||
v-if="isPaymentMode"
|
||||
v-model="oldPassword"
|
||||
class="input-field"
|
||||
type="number"
|
||||
:password="!showOldPwd"
|
||||
maxlength="6"
|
||||
placeholder="请输入原6位数字支付密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="oldPasswordError = ''; verifyLocked = false"
|
||||
/>
|
||||
<input
|
||||
v-else
|
||||
v-model="oldPassword"
|
||||
class="input-field"
|
||||
:password="!showOldPwd"
|
||||
maxlength="30"
|
||||
placeholder="请输入当前登录密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="oldPasswordError = ''; verifyLocked = false"
|
||||
/>
|
||||
<view class="eye-btn clickable-hover" @tap="showOldPwd = !showOldPwd">
|
||||
<image class="eye-ico" :src="showOldPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
<button class="sms-btn" :disabled="sendingSms || smsCountdown > 0" @tap="sendPwdSms">
|
||||
{{ smsCountdown > 0 ? smsCountdown + 's后重试' : (sendingSms ? '发送中...' : '获取验证码') }}
|
||||
</button>
|
||||
</view>
|
||||
</template>
|
||||
<view v-else-if="status.has_login_password" class="input-box">
|
||||
<input
|
||||
v-model="oldPassword"
|
||||
class="input-field"
|
||||
:password="!showOldPwd"
|
||||
placeholder="请输入原登录密码"
|
||||
/>
|
||||
<view class="eye-btn" @tap="showOldPwd = !showOldPwd">
|
||||
<image class="eye-ico" :src="showOldPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
<text v-if="oldPasswordError" class="field-error">{{ oldPasswordError }}</text>
|
||||
</view>
|
||||
<view class="input-box">
|
||||
<input
|
||||
v-model="newPassword"
|
||||
class="input-field"
|
||||
:password="!showNewPwd"
|
||||
maxlength="30"
|
||||
placeholder="新登录密码(6至30位非空字符)"
|
||||
/>
|
||||
<view class="eye-btn" @tap="showNewPwd = !showNewPwd">
|
||||
<image class="eye-ico" :src="showNewPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="input-box">
|
||||
<input
|
||||
v-model="confirmPassword"
|
||||
class="input-field"
|
||||
:password="!showConfirmPwd"
|
||||
maxlength="30"
|
||||
placeholder="再次输入新登录密码"
|
||||
/>
|
||||
<view class="eye-btn" @tap="showConfirmPwd = !showConfirmPwd">
|
||||
<image class="eye-ico" :src="showConfirmPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<button class="primary clickable-hover" :disabled="busy" @tap="savePassword">
|
||||
{{ busy ? '提交中...' : (status.has_login_password ? '确认修改' : '确认设置') }}
|
||||
</button>
|
||||
<text v-if="status.has_login_password && loginVerifyMode === 'old_password'" class="switch-link" @tap="switchLoginMode('sms')">忘记原密码?使用短信验证码修改</text>
|
||||
</template>
|
||||
|
||||
<!-- 支付密码表单 -->
|
||||
<template v-else-if="mode === 'payment'">
|
||||
<view v-if="status.has_payment_password" class="mode-tabs">
|
||||
<view class="mode-tab" :class="{ active: paymentVerifyMode === 'old_password' }" @tap="switchPaymentMode('old_password')">原密码验证</view>
|
||||
<view class="mode-tab" :class="{ active: paymentVerifyMode === 'sms' }" @tap="switchPaymentMode('sms')">短信验证码</view>
|
||||
<view class="field-group">
|
||||
<view class="field-label-row">
|
||||
<text class="field-label">{{ isPaymentMode ? '新支付密码' : '新登录密码' }}</text>
|
||||
<text class="field-rule">{{ isPaymentMode ? '6位纯数字' : '6至30位非空字符' }}</text>
|
||||
</view>
|
||||
<view class="input-box" :class="{ 'is-error': !!newPasswordError }">
|
||||
<image class="input-prefix-ico" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
<input
|
||||
v-if="isPaymentMode"
|
||||
v-model="newPassword"
|
||||
class="input-field"
|
||||
type="number"
|
||||
:password="!showNewPwd"
|
||||
maxlength="6"
|
||||
placeholder="请输入6位数字支付密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="newPasswordError = ''; confirmPasswordError = ''"
|
||||
/>
|
||||
<input
|
||||
v-else
|
||||
v-model="newPassword"
|
||||
class="input-field"
|
||||
:password="!showNewPwd"
|
||||
maxlength="30"
|
||||
placeholder="请设置新登录密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="newPasswordError = ''; confirmPasswordError = ''"
|
||||
/>
|
||||
<view class="eye-btn clickable-hover" @tap="showNewPwd = !showNewPwd">
|
||||
<image class="eye-ico" :src="showNewPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<text v-if="newPasswordError" class="field-error">{{ newPasswordError }}</text>
|
||||
</view>
|
||||
<template v-if="status.has_payment_password && paymentVerifyMode === 'sms'">
|
||||
<text class="sms-target">验证码将发送至绑定手机:{{ status.mobile || '当前绑定手机号' }}</text>
|
||||
<view class="sms-row">
|
||||
<view class="input-box sms-input-box">
|
||||
|
||||
<view class="field-group">
|
||||
<view class="field-label-row">
|
||||
<text class="field-label">{{ isPaymentMode ? '确认支付密码' : '确认新密码' }}</text>
|
||||
</view>
|
||||
<view class="input-box" :class="{ 'is-error': passwordMismatch || !!confirmPasswordError }">
|
||||
<image class="input-prefix-ico" src="/static/icons/login-lock.svg" mode="aspectFit" />
|
||||
<input
|
||||
v-if="isPaymentMode"
|
||||
v-model="confirmPassword"
|
||||
class="input-field"
|
||||
type="number"
|
||||
:password="!showConfirmPwd"
|
||||
maxlength="6"
|
||||
placeholder="请再次输入6位数字支付密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="confirmPasswordError = ''"
|
||||
/>
|
||||
<input
|
||||
v-else
|
||||
v-model="confirmPassword"
|
||||
class="input-field"
|
||||
:password="!showConfirmPwd"
|
||||
maxlength="30"
|
||||
placeholder="请再次输入新登录密码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="confirmPasswordError = ''"
|
||||
/>
|
||||
<view class="eye-btn clickable-hover" @tap="showConfirmPwd = !showConfirmPwd">
|
||||
<image class="eye-ico" :src="showConfirmPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<text v-if="confirmPasswordError || passwordMismatch" class="field-error">{{ confirmPasswordError || '两次输入的密码不一致' }}</text>
|
||||
</view>
|
||||
|
||||
<template v-if="hasCurrentPassword && currentVerifyMode === 'sms'">
|
||||
<view class="field-group">
|
||||
<view class="field-label-row">
|
||||
<text class="field-label">短信验证码</text>
|
||||
<text class="field-rule">将发送至 {{ status.mobile || '绑定手机号' }}</text>
|
||||
</view>
|
||||
<view class="input-box sms-box" :class="{ 'is-error': !!smsCodeError }">
|
||||
<input
|
||||
v-model="smsCode"
|
||||
class="input-field"
|
||||
type="number"
|
||||
maxlength="6"
|
||||
placeholder="请输入6位短信验证码"
|
||||
placeholder-class="field-placeholder"
|
||||
@input="smsCodeError = ''"
|
||||
/>
|
||||
<view class="sms-divider"></view>
|
||||
<button class="inline-sms-btn clickable-hover" :disabled="sendingSms || smsCountdown > 0" @tap="sendPwdSms">
|
||||
{{ smsCountdown > 0 ? smsCountdown + 's 后重发' : (sendingSms ? '发送中...' : '获取验证码') }}
|
||||
</button>
|
||||
</view>
|
||||
<button class="sms-btn" :disabled="sendingSms || smsCountdown > 0" @tap="sendPwdSms">
|
||||
{{ smsCountdown > 0 ? smsCountdown + 's后重试' : (sendingSms ? '发送中...' : '获取验证码') }}
|
||||
</button>
|
||||
<text v-if="smsCodeError" class="field-error">{{ smsCodeError }}</text>
|
||||
</view>
|
||||
</template>
|
||||
<view v-else-if="status.has_payment_password" class="input-box">
|
||||
<input
|
||||
v-model="oldPassword"
|
||||
class="input-field"
|
||||
type="number"
|
||||
:password="!showOldPwd"
|
||||
maxlength="6"
|
||||
placeholder="请输入原6位数字支付密码"
|
||||
/>
|
||||
<view class="eye-btn" @tap="showOldPwd = !showOldPwd">
|
||||
<image class="eye-ico" :src="showOldPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="input-box">
|
||||
<input
|
||||
v-model="newPassword"
|
||||
class="input-field"
|
||||
type="number"
|
||||
:password="!showNewPwd"
|
||||
maxlength="6"
|
||||
placeholder="请输入6位数字支付密码"
|
||||
/>
|
||||
<view class="eye-btn" @tap="showNewPwd = !showNewPwd">
|
||||
<image class="eye-ico" :src="showNewPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="input-box">
|
||||
<input
|
||||
v-model="confirmPassword"
|
||||
class="input-field"
|
||||
type="number"
|
||||
:password="!showConfirmPwd"
|
||||
maxlength="6"
|
||||
placeholder="再次输入6位数字支付密码"
|
||||
/>
|
||||
<view class="eye-btn" @tap="showConfirmPwd = !showConfirmPwd">
|
||||
<image class="eye-ico" :src="showConfirmPwd ? '/static/icons/login-eye-open.svg' : '/static/icons/login-eye-close.svg'" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<button class="primary clickable-hover" :disabled="busy" @tap="savePassword">
|
||||
{{ busy ? '提交中...' : (status.has_payment_password ? '确认修改' : '确认设置') }}
|
||||
|
||||
<button class="primary sheet-submit clickable-hover" :disabled="busy" @tap="savePassword">
|
||||
{{ busy ? '提交中...' : (hasCurrentPassword ? '确认修改' : '确认设置') }}
|
||||
</button>
|
||||
<text v-if="status.has_payment_password && paymentVerifyMode === 'old_password'" class="switch-link" @tap="switchPaymentMode('sms')">忘记原支付密码?使用短信验证码修改</text>
|
||||
</template>
|
||||
|
||||
<view v-if="hasCurrentPassword" class="switch-row">
|
||||
<text
|
||||
class="switch-link clickable-hover"
|
||||
:class="{ 'is-highlight': verifyLocked && currentVerifyMode === 'old_password' }"
|
||||
@tap="switchVerifyMode(currentVerifyMode === 'old_password' ? 'sms' : 'old_password')"
|
||||
>{{ currentVerifyMode === 'old_password' ? (isPaymentMode ? '忘记原支付密码?改用短信验证码' : '忘记原密码?改用短信验证码') : (isPaymentMode ? '记得原支付密码?改用原密码验证' : '记得原密码?改用原密码验证') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -237,6 +253,11 @@
|
||||
const smsCode = ref('');
|
||||
const smsCountdown = ref(0);
|
||||
const sendingSms = ref(false);
|
||||
const oldPasswordError = ref('');
|
||||
const newPasswordError = ref('');
|
||||
const confirmPasswordError = ref('');
|
||||
const smsCodeError = ref('');
|
||||
const verifyLocked = ref(false);
|
||||
let smsTimer = null;
|
||||
|
||||
const isAccountSafe = computed(() => !!(status.value.mobile && status.value.has_payment_password));
|
||||
@@ -254,12 +275,17 @@
|
||||
return 'tag-muted';
|
||||
});
|
||||
|
||||
const isPaymentMode = computed(() => mode.value === 'payment');
|
||||
const hasCurrentPassword = computed(() => isPaymentMode.value ? !!status.value.has_payment_password : !!status.value.has_login_password);
|
||||
const currentVerifyMode = computed(() => isPaymentMode.value ? paymentVerifyMode.value : loginVerifyMode.value);
|
||||
const sheetTitle = computed(() => {
|
||||
if (mode.value === 'login') {
|
||||
return status.value.has_login_password ? '修改登录密码' : '设置登录密码';
|
||||
if (isPaymentMode.value) {
|
||||
return status.value.has_payment_password ? '修改支付密码' : '设置支付密码';
|
||||
}
|
||||
return status.value.has_payment_password ? '修改支付密码' : '设置支付密码';
|
||||
return status.value.has_login_password ? '修改登录密码' : '设置登录密码';
|
||||
});
|
||||
const sheetDesc = computed(() => isPaymentMode.value ? '用于余额提现安全确认' : '用于 H5 网页端手机号密码登录');
|
||||
const passwordMismatch = computed(() => confirmPassword.value.length > 0 && newPassword.value !== confirmPassword.value);
|
||||
|
||||
async function load() {
|
||||
if (!isLogin()) {
|
||||
@@ -292,16 +318,20 @@
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function switchLoginMode(nextMode) {
|
||||
loginVerifyMode.value = nextMode;
|
||||
oldPassword.value = '';
|
||||
smsCode.value = '';
|
||||
function clearFieldErrors() {
|
||||
oldPasswordError.value = '';
|
||||
newPasswordError.value = '';
|
||||
confirmPasswordError.value = '';
|
||||
smsCodeError.value = '';
|
||||
}
|
||||
|
||||
function switchPaymentMode(nextMode) {
|
||||
paymentVerifyMode.value = nextMode;
|
||||
function switchVerifyMode(nextMode) {
|
||||
if (isPaymentMode.value) paymentVerifyMode.value = nextMode;
|
||||
else loginVerifyMode.value = nextMode;
|
||||
oldPassword.value = '';
|
||||
smsCode.value = '';
|
||||
verifyLocked.value = false;
|
||||
clearFieldErrors();
|
||||
}
|
||||
|
||||
async function sendPwdSms() {
|
||||
@@ -327,6 +357,8 @@
|
||||
showOldPwd.value = false;
|
||||
showNewPwd.value = false;
|
||||
showConfirmPwd.value = false;
|
||||
verifyLocked.value = false;
|
||||
clearFieldErrors();
|
||||
}
|
||||
|
||||
function close() {
|
||||
@@ -345,41 +377,72 @@
|
||||
uni.navigateTo({ url: '/pages/master/apply' });
|
||||
}
|
||||
|
||||
function applyServerFieldError(e) {
|
||||
if (e && e.code === 401) {
|
||||
uni.showToast({ title: '登录已失效,请重新登录', icon: 'none' });
|
||||
setTimeout(() => toLogin('/pages/master/security'), 800);
|
||||
return;
|
||||
}
|
||||
const msg = String((e && e.message) || '操作失败,请稍后重试');
|
||||
if (/验证码/.test(msg) && !/改用短信验证码/.test(msg)) {
|
||||
smsCodeError.value = msg;
|
||||
return;
|
||||
}
|
||||
if (/原登录密码|原支付密码|原密码|密码不正确|次数过多|15分钟|旧密码/.test(msg)) {
|
||||
oldPasswordError.value = msg;
|
||||
if (/15分钟|次数过多/.test(msg)) verifyLocked.value = true;
|
||||
return;
|
||||
}
|
||||
if (/6位|6至30位|非空字符|新密码/.test(msg)) {
|
||||
newPasswordError.value = msg;
|
||||
return;
|
||||
}
|
||||
uni.showToast({ title: msg, icon: 'none' });
|
||||
}
|
||||
|
||||
function validPassword() {
|
||||
clearFieldErrors();
|
||||
let ok = true;
|
||||
const isPayment = mode.value === 'payment';
|
||||
const useSms = isPayment
|
||||
? (status.value.has_payment_password && paymentVerifyMode.value === 'sms')
|
||||
: (status.value.has_login_password && loginVerifyMode.value === 'sms');
|
||||
if (useSms) {
|
||||
if (!/^\d{4,6}$/.test(smsCode.value.trim())) {
|
||||
uni.showToast({ title: '请输入有效的短信验证码', icon: 'none' });
|
||||
return false;
|
||||
smsCodeError.value = '请输入有效的6位短信验证码';
|
||||
ok = false;
|
||||
}
|
||||
} else {
|
||||
const needOld = isPayment ? status.value.has_payment_password : status.value.has_login_password;
|
||||
if (needOld && !oldPassword.value) {
|
||||
uni.showToast({ title: '请输入原密码', icon: 'none' });
|
||||
return false;
|
||||
if (needOld && isPayment && !/^\d{6}$/.test(oldPassword.value)) {
|
||||
oldPasswordError.value = '请输入原6位数字支付密码';
|
||||
ok = false;
|
||||
} else if (needOld && !isPayment && !oldPassword.value) {
|
||||
oldPasswordError.value = '请输入原登录密码';
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isPayment) {
|
||||
if (!/^\d{6}$/.test(newPassword.value)) {
|
||||
uni.showToast({ title: '支付密码须为6位数字', icon: 'none' });
|
||||
return false;
|
||||
newPasswordError.value = '新支付密码须为6位纯数字';
|
||||
ok = false;
|
||||
}
|
||||
} else {
|
||||
if (!/^\S{6,30}$/.test(newPassword.value)) {
|
||||
uni.showToast({ title: '登录密码须为6至30位非空字符', icon: 'none' });
|
||||
return false;
|
||||
newPasswordError.value = '新登录密码须为6至30位非空字符';
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (newPassword.value !== confirmPassword.value) {
|
||||
uni.showToast({ title: '两次输入的新密码不一致', icon: 'none' });
|
||||
return false;
|
||||
if (!confirmPassword.value) {
|
||||
confirmPasswordError.value = isPayment ? '请再次输入新支付密码' : '请再次输入新登录密码';
|
||||
ok = false;
|
||||
} else if (newPassword.value !== confirmPassword.value) {
|
||||
confirmPasswordError.value = '两次输入的新密码不一致';
|
||||
ok = false;
|
||||
}
|
||||
return true;
|
||||
return ok;
|
||||
}
|
||||
|
||||
async function savePassword() {
|
||||
@@ -398,7 +461,7 @@
|
||||
old_password: oldPassword.value,
|
||||
new_password: newPassword.value
|
||||
};
|
||||
await api.changeLoginPassword(payload);
|
||||
await api.changeLoginPassword(payload, { silent: true });
|
||||
clearAuth();
|
||||
uni.showToast({ title: '密码已更新,请重新登录', icon: 'none' });
|
||||
setTimeout(() => uni.reLaunch({ url: '/pages/login/login' }), 800);
|
||||
@@ -407,7 +470,7 @@
|
||||
|
||||
const firstSetup = !status.value.has_payment_password;
|
||||
if (firstSetup) {
|
||||
await api.setPaymentPassword({ new_password: newPassword.value });
|
||||
await api.setPaymentPassword({ new_password: newPassword.value }, { silent: true });
|
||||
} else {
|
||||
const payPayload = paymentVerifyMode.value === 'sms'
|
||||
? {
|
||||
@@ -420,7 +483,7 @@
|
||||
old_password: oldPassword.value,
|
||||
new_password: newPassword.value
|
||||
};
|
||||
await api.changePaymentPassword(payPayload);
|
||||
await api.changePaymentPassword(payPayload, { silent: true });
|
||||
}
|
||||
|
||||
busy.value = false;
|
||||
@@ -432,6 +495,7 @@
|
||||
await load();
|
||||
}
|
||||
} catch (e) {
|
||||
applyServerFieldError(e);
|
||||
} finally {
|
||||
busy.value = false;
|
||||
}
|
||||
@@ -487,7 +551,7 @@
|
||||
} else if (initialOpen.value === 'payment') {
|
||||
setupOpened = true;
|
||||
openPassword('payment');
|
||||
if (status.value.has_payment_password) switchPaymentMode('sms');
|
||||
if (status.value.has_payment_password) switchVerifyMode('sms');
|
||||
}
|
||||
});
|
||||
onUnload(() => {
|
||||
@@ -567,82 +631,109 @@
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.mask { position: fixed; inset: 0; z-index: 999; display: flex; align-items: flex-end; background: rgba(0, 0, 0, 0.45); }
|
||||
.mask { position: fixed; inset: 0; z-index: 999; display: flex; align-items: flex-end; background: rgba(15, 23, 42, 0.5); }
|
||||
.sheet {
|
||||
width: 100%;
|
||||
padding: 32rpx 32rpx calc(40rpx + env(safe-area-inset-bottom));
|
||||
border-radius: $yjyf-radius-lg $yjyf-radius-lg 0 0;
|
||||
max-height: 90vh;
|
||||
overflow-y: auto;
|
||||
box-sizing: border-box;
|
||||
padding: 16rpx 0 calc(36rpx + env(safe-area-inset-bottom));
|
||||
border-radius: 36rpx 36rpx 0 0;
|
||||
background: $yjyf-bg-card;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4rpx; }
|
||||
.title { font-size: $yjyf-font-title; font-weight: 700; color: $yjyf-text-main; }
|
||||
.close { font-size: $yjyf-font-sub; color: $yjyf-text-secondary; padding: 8rpx 0 8rpx 16rpx; }
|
||||
.sheet-handle {
|
||||
width: 72rpx;
|
||||
height: 8rpx;
|
||||
border-radius: $yjyf-radius-pill;
|
||||
background: #E5E6EB;
|
||||
margin: 0 auto 20rpx;
|
||||
}
|
||||
.sheet-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding: 0 32rpx 24rpx;
|
||||
border-bottom: 1rpx solid $yjyf-border-color;
|
||||
}
|
||||
.sheet-head-meta { display: flex; flex-direction: column; gap: 6rpx; }
|
||||
.title { font-size: 36rpx; font-weight: 700; color: $yjyf-text-main; line-height: 1.25; }
|
||||
.sheet-sub { font-size: $yjyf-font-sub; color: $yjyf-text-secondary; }
|
||||
.sheet-close-btn {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50%;
|
||||
background: $yjyf-bg-page;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.sheet-close-ico { width: 26rpx; height: 26rpx; opacity: 0.65; }
|
||||
|
||||
.sheet-body {
|
||||
padding: 28rpx 32rpx 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24rpx;
|
||||
}
|
||||
|
||||
.field-group { display: flex; flex-direction: column; gap: 10rpx; }
|
||||
.field-label-row { display: flex; align-items: center; justify-content: space-between; padding: 0 4rpx; }
|
||||
.field-label { font-size: 26rpx; font-weight: 600; color: $yjyf-text-main; }
|
||||
.field-rule { font-size: $yjyf-font-micro; color: $yjyf-text-secondary; }
|
||||
.field-error { font-size: $yjyf-font-micro; color: $yjyf-danger; padding-left: 4rpx; }
|
||||
|
||||
.input-box {
|
||||
height: 92rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 0 20rpx 0 24rpx;
|
||||
border-radius: $yjyf-radius-sm;
|
||||
background: $yjyf-bg-page;
|
||||
border: 1.5rpx solid transparent;
|
||||
padding: 0 18rpx 0 24rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #F7F8FA;
|
||||
border: 1.5rpx solid #EBEDF0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
gap: 14rpx;
|
||||
transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
.input-box:focus-within {
|
||||
background: $yjyf-bg-card;
|
||||
border-color: $yjyf-primary;
|
||||
box-shadow: 0 0 0 4rpx rgba(240, 113, 13, 0.1);
|
||||
}
|
||||
.input-box.is-error {
|
||||
background: #FFF8F7;
|
||||
border-color: $yjyf-danger;
|
||||
}
|
||||
.input-prefix-ico { width: 34rpx; height: 34rpx; flex-shrink: 0; opacity: 0.75; }
|
||||
.input-field { flex: 1; min-width: 0; height: 92rpx; font-size: $yjyf-font-body; color: $yjyf-text-main; }
|
||||
.eye-btn { width: 56rpx; height: 56rpx; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
|
||||
.field-placeholder { font-size: 26rpx; color: $yjyf-text-muted; }
|
||||
.eye-btn { width: 64rpx; height: 64rpx; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
|
||||
.eye-ico { width: 34rpx; height: 34rpx; }
|
||||
|
||||
.hint { font-size: $yjyf-font-micro; color: $yjyf-text-muted; line-height: 1.5; }
|
||||
.center-hint { text-align: center; }
|
||||
.mode-tabs { display: flex; gap: 16rpx; }
|
||||
.mode-tab {
|
||||
flex: 1;
|
||||
height: 76rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: $yjyf-radius-sm;
|
||||
background: $yjyf-bg-page;
|
||||
border: 1.5rpx solid transparent;
|
||||
color: $yjyf-text-secondary;
|
||||
font-size: $yjyf-font-sub;
|
||||
font-weight: 600;
|
||||
}
|
||||
.mode-tab.active { background: $yjyf-primary-bg; color: $yjyf-primary; border-color: rgba(240, 113, 13, 0.35); }
|
||||
.sms-target { font-size: $yjyf-font-micro; color: $yjyf-text-secondary; }
|
||||
.sms-row { display: flex; align-items: center; gap: 16rpx; }
|
||||
.sms-input-box { flex: 1; min-width: 0; }
|
||||
.sms-btn {
|
||||
.sms-box { padding-right: 8rpx; }
|
||||
.sms-divider { width: 1.5rpx; height: 36rpx; background: #E5E6EB; flex-shrink: 0; }
|
||||
.inline-sms-btn {
|
||||
flex-shrink: 0;
|
||||
height: 92rpx;
|
||||
box-sizing: border-box;
|
||||
height: 76rpx;
|
||||
padding: 0 20rpx;
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 28rpx;
|
||||
margin: 0;
|
||||
border-radius: $yjyf-radius-sm;
|
||||
background: $yjyf-primary-bg;
|
||||
color: $yjyf-primary;
|
||||
font-size: $yjyf-font-sub;
|
||||
font-weight: 600;
|
||||
border: 1.5rpx solid rgba(240, 113, 13, 0.35);
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.sms-btn::after { border: none; }
|
||||
.sms-btn[disabled] { opacity: 0.6; color: $yjyf-text-secondary; background: $yjyf-bg-page; border-color: $yjyf-border-color; }
|
||||
.switch-link { text-align: center; font-size: $yjyf-font-sub; color: $yjyf-info; padding-top: 4rpx; }
|
||||
.inline-sms-btn::after { border: none; }
|
||||
.inline-sms-btn[disabled] { color: $yjyf-text-muted; font-weight: 500; }
|
||||
|
||||
.primary {
|
||||
width: 100%;
|
||||
height: 90rpx;
|
||||
height: 92rpx;
|
||||
margin: 8rpx 0 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
@@ -652,10 +743,15 @@
|
||||
background: $yjyf-gradient-primary;
|
||||
box-shadow: $yjyf-shadow-button;
|
||||
color: $yjyf-text-inverse;
|
||||
font-size: $yjyf-font-body;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
border: none;
|
||||
}
|
||||
.primary::after { border: none; }
|
||||
.primary[disabled] { opacity: 0.65; }
|
||||
.sheet-submit { margin-top: 8rpx; }
|
||||
|
||||
.switch-row { display: flex; justify-content: center; padding-top: 2rpx; }
|
||||
.switch-link { padding: 12rpx 24rpx; font-size: $yjyf-font-sub; color: $yjyf-text-secondary; }
|
||||
.switch-link.is-highlight { color: $yjyf-primary; font-weight: 600; }
|
||||
</style>
|
||||
|
||||
@@ -20,13 +20,13 @@ export default {
|
||||
logout: () => post('/master_auth/logout', {}, { silent: true }),
|
||||
profile: () => get('/master_auth/profile'),
|
||||
securityStatus: () => get('/master_auth/securityStatus'),
|
||||
sendPasswordSms: () => post('/master_auth/sendPasswordSms', {}),
|
||||
sendPaymentPasswordSms: () => post('/master_auth/sendPaymentPasswordSms', {}),
|
||||
changeLoginPassword: (data) => post('/master_auth/changeLoginPassword', data),
|
||||
sendPasswordSms: (opt) => post('/master_auth/sendPasswordSms', {}, opt),
|
||||
sendPaymentPasswordSms: (opt) => post('/master_auth/sendPaymentPasswordSms', {}, opt),
|
||||
changeLoginPassword: (data, opt) => post('/master_auth/changeLoginPassword', data, opt),
|
||||
sendResetPasswordSms: (data) => post('/master_auth/sendResetPasswordSms', data),
|
||||
resetPasswordBySms: (data) => post('/master_auth/resetPasswordBySms', data),
|
||||
setPaymentPassword: (data) => post('/master_auth/setPaymentPassword', data),
|
||||
changePaymentPassword: (data) => post('/master_auth/changePaymentPassword', data),
|
||||
setPaymentPassword: (data, opt) => post('/master_auth/setPaymentPassword', data, opt),
|
||||
changePaymentPassword: (data, opt) => post('/master_auth/changePaymentPassword', data, opt),
|
||||
|
||||
/* ---------- 师傅业务 ---------- */
|
||||
masterApply: (data) => post('/master/apply', data),
|
||||
|
||||
在新工单中引用
屏蔽一个用户