feat: 商家端增加修改密码,手机号登录

This commit is contained in:
chc
2023-03-08 10:25:23 +08:00
parent f7a9bff2ba
commit 7d0b3c6908
6 changed files with 529 additions and 84 deletions

View File

@@ -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();

View File

@@ -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];