diff --git a/sheep/api/member/user.js b/sheep/api/member/user.js
index f0aba4ce..38ed1103 100644
--- a/sheep/api/member/user.js
+++ b/sheep/api/member/user.js
@@ -1,6 +1,19 @@
import request from '@/sheep/request2';
const UserApi = {
+ // 修改密码
+ updateUserPassword: (data) => {
+ return request({
+ url: '/app-api/member/user/update-password',
+ method: 'PUT',
+ data,
+ custom: {
+ loadingMsg: '验证中',
+ showSuccess: true,
+ successMsg: '修改成功'
+ },
+ });
+ },
// 重置密码
resetUserPassword: (data) => {
return request({
diff --git a/sheep/api/user.js b/sheep/api/user.js
index ee153b7f..6021a106 100644
--- a/sheep/api/user.js
+++ b/sheep/api/user.js
@@ -93,18 +93,6 @@ export default {
},
}),
- // 修改密码
- changePassword: (data) =>
- request({
- url: '/user/api/user/changePassword',
- method: 'POST',
- data,
- custom: {
- showSuccess: true,
- loadingMsg: '验证中',
- },
- }),
-
// 绑定、更换手机号
changeMobile: (data) =>
request({
@@ -117,18 +105,6 @@ export default {
},
}),
- // 修改用户名
- changeUsername: (data) =>
- request({
- url: '/user/api/user/changeUsername',
- method: 'POST',
- data,
- custom: {
- showSuccess: true,
- loadingMsg: '验证中',
- },
- }),
-
// 更新小程序信息
updateMpUserInfo: (data) =>
request({
diff --git a/sheep/components/s-auth-modal/components/change-password.vue b/sheep/components/s-auth-modal/components/change-password.vue
index 0e0af5cc..b02ea021 100644
--- a/sheep/components/s-auth-modal/components/change-password.vue
+++ b/sheep/components/s-auth-modal/components/change-password.vue
@@ -1,4 +1,4 @@
-
+
@@ -16,29 +16,32 @@
labelWidth="140"
labelAlign="center"
>
-
+
+ >
+
+
+
+
-
+
-
-
-
-
@@ -50,69 +53,51 @@
-
-
-
+
diff --git a/sheep/components/s-auth-modal/components/reset-password.vue b/sheep/components/s-auth-modal/components/reset-password.vue
index 53520432..bc1be8b3 100644
--- a/sheep/components/s-auth-modal/components/reset-password.vue
+++ b/sheep/components/s-auth-modal/components/reset-password.vue
@@ -1,4 +1,4 @@
-
+
diff --git a/sheep/hooks/useModal.js b/sheep/hooks/useModal.js
index 20a74684..377c07c4 100644
--- a/sheep/hooks/useModal.js
+++ b/sheep/hooks/useModal.js
@@ -58,7 +58,7 @@ export function closeMenuTools() {
}
// 发送短信验证码 60秒
-export function getSmsCode(event, mobile = '') {
+export function getSmsCode(event, mobile) {
const modalStore = $store('modal');
const lastSendTimer = modalStore.lastTimer[event];
if (typeof lastSendTimer === 'undefined') {
@@ -72,7 +72,8 @@ export function getSmsCode(event, mobile = '') {
$helper.toast('请稍后再试');
return;
}
- if (!test.mobile(mobile)) {
+ // 只有 mobile 非空时才校验。因为部分场景(修改密码),不需要输入手机
+ if (mobile && !test.mobile(mobile)) {
$helper.toast('手机号码格式不正确');
return;
}
@@ -82,6 +83,10 @@ export function getSmsCode(event, mobile = '') {
switch (event) {
case 'resetPassword':
scene = 4;
+ break;
+ case 'changePassword':
+ scene = 3;
+ break;
}
$api.AuthUtil.sendSmsCode(mobile, scene).then((res) => {
if (res.code === 0) {
diff --git a/sheep/store/modal.js b/sheep/store/modal.js
index a665d5d2..8672ca84 100644
--- a/sheep/store/modal.js
+++ b/sheep/store/modal.js
@@ -13,10 +13,11 @@ const modal = defineStore({
smsRegister: 0,
changeMobile: 0,
resetPassword: 0,
+ changePassword: 0,
}
}),
persist: {
- enabled: true,
+ enabled: true,
strategies: [
{
key: 'modal-store',