From 7d0b3c6908d46f82a285d5206ef165ea6488406f Mon Sep 17 00:00:00 2001
From: chc <1501738723@qq.com>
Date: Wed, 8 Mar 2023 10:25:23 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20:sparkles:=20=E5=95=86=E5=AE=B6?=
=?UTF-8?q?=E7=AB=AF=E5=A2=9E=E5=8A=A0=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81?=
=?UTF-8?q?,=E6=89=8B=E6=9C=BA=E5=8F=B7=E7=99=BB=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
seller/src/api/common.js | 9 +-
seller/src/api/index.js | 14 +-
seller/src/router/index.js | 23 +-
seller/src/router/router.js | 7 +-
seller/src/views/ForgetPassword.vue | 331 ++++++++++++++++++++++++++++
seller/src/views/login.vue | 229 +++++++++++++------
6 files changed, 529 insertions(+), 84 deletions(-)
create mode 100644 seller/src/views/ForgetPassword.vue
diff --git a/seller/src/api/common.js b/seller/src/api/common.js
index 0b024239..5951ab3f 100644
--- a/seller/src/api/common.js
+++ b/seller/src/api/common.js
@@ -1,4 +1,4 @@
-import { commonUrl, getRequest, uploadFileRequest ,uploadFile} from "@/libs/axios";
+import { commonUrl, getRequest, uploadFileRequest, uploadFile, request} from "@/libs/axios";
// 通过id获取子地区
export const getChildRegion = (id) => {
@@ -25,3 +25,10 @@ export const upLoadFileMethods = (bold) => {
console.log(bold)
return uploadFileRequest(uploadFile, bold);
};
+
+/**
+ * 发送短信验证码
+ */
+export function sendSms (params) {
+ return getRequest(`${commonUrl}/common/common/sms/${params.verificationEnums}/${params.mobile}`,params);
+}
diff --git a/seller/src/api/index.js b/seller/src/api/index.js
index 38e125cc..3c124882 100644
--- a/seller/src/api/index.js
+++ b/seller/src/api/index.js
@@ -37,6 +37,11 @@ export const login = params => {
return postRequestWithNoTokenData("/passport/login/userLogin", params);
};
+// 手机登陆
+export const storeSmsLogin = params => {
+ return postRequestWithNoToken("/passport/login/smsLogin", params);
+};
+
// 登出
export const logout = () => {
return postRequest("/passport/login/logout");
@@ -50,7 +55,10 @@ export const userInfo = params => {
export const userMsg = params => {
return getRequest('/settings/storeSettings', params)
}
-
+//验证短信验证码
+export const validateCode = params => {
+ return postRequestWithNoToken("/passport/login/resetByMobile", params);
+};
// 初始化验证码
export const initCaptcha = params => {
return getRequestWithNoToken("/common/captcha/init", params);
@@ -107,6 +115,10 @@ export const sendCodeEmail = (email, params) => {
export const editEmail = params => {
return postRequest("/email/editEmail", params);
};
+// 忘记密码并修改
+export const forgetAndModify = params => {
+ return postRequest("/passport/login/resetPassword", params);
+};
// 个人中心修改密码
export const changePass = params => {
return postRequest("/passport/login/modifyPass", params);
diff --git a/seller/src/router/index.js b/seller/src/router/index.js
index 176eb936..7ab1a445 100644
--- a/seller/src/router/index.js
+++ b/seller/src/router/index.js
@@ -3,7 +3,7 @@ import ViewUI from 'view-design';
import Util from '../libs/util';
import VueRouter from 'vue-router';
import Cookies from 'js-cookie';
-import {routers} from './router';
+import { routers } from './router';
Vue.use(VueRouter);
@@ -16,10 +16,10 @@ const RouterConfig = {
/**
* 解决重复点击菜单会控制台报错bug
*/
- const routerPush = VueRouter.prototype.push
- VueRouter.prototype.push = function push(location) {
- return routerPush.call(this, location).catch(error=> error)
- }
+const routerPush = VueRouter.prototype.push
+VueRouter.prototype.push = function push(location) {
+ return routerPush.call(this, location).catch(error => error)
+}
export const router = new VueRouter(RouterConfig);
@@ -32,10 +32,15 @@ router.beforeEach((to, from, next) => {
const name = to.name;
if (!Cookies.get('userInfoSeller') && name !== 'login') {
- // 判断是否已经登录且前往的页面不是登录页
- next({
- name: 'login'
- });
+ if (name === 'forgetPassword') {
+ console.log(name)
+ Util.toDefaultPage([...routers], name, router, next);
+ } else {
+ // 判断是否已经登录且前往的页面不是登录页
+ next({
+ name: 'login'
+ });
+ }
} else if (Cookies.get('userInfoSeller') && name === 'login') {
// 判断是否已经登录且前往的是登录页
Util.title();
diff --git a/seller/src/router/router.js b/seller/src/router/router.js
index 61acc146..e47bb194 100644
--- a/seller/src/router/router.js
+++ b/seller/src/router/router.js
@@ -10,6 +10,11 @@ export const loginRouter = {
},
component: () => import("@/views/login.vue")
};
+export const forgetPasswordRouter = {
+ path: "/forgetPassword",
+ name: "forgetPassword",
+ component: () => import("@/views/ForgetPassword.vue")
+};
// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
@@ -193,4 +198,4 @@ export const page500 = {
component: () => import("@/views/error-page/500.vue")
};
// 所有上面定义的路由都要写在下面的routers里
-export const routers = [loginRouter, otherRouter, page500, page403];
+export const routers = [loginRouter, forgetPasswordRouter, otherRouter, page500, page403];
diff --git a/seller/src/views/ForgetPassword.vue b/seller/src/views/ForgetPassword.vue
new file mode 100644
index 00000000..8c706cc8
--- /dev/null
+++ b/seller/src/views/ForgetPassword.vue
@@ -0,0 +1,331 @@
+
+