diff --git a/src/layouts/header/index.vue b/src/layouts/header/index.vue
index 930f241..0031c5e 100644
--- a/src/layouts/header/index.vue
+++ b/src/layouts/header/index.vue
@@ -54,7 +54,7 @@ export default {
},
computed: {
...mapState("user", [
- "avatar", "userName", "title", "logoUrl", "customer", "customerName"
+ "avatar", "userName", "title", "logoUrl", "customer", "customerName", 'fromClient'
])
},
mounted() {
@@ -66,10 +66,15 @@ export default {
"setTitle", "setLogoUrl", "setAvatar", "setUserName"
]),
loginout() { // 退出登录
- this.$router.push("/login");
localStorage.clear();
sessionStorage.clear();
- location.reload();
+ // 从学生端登录的就返回学生端,否则,直接刷新回到登录页面
+ if (this.fromClient) {
+ location.href = `${location.origin}/student`
+ // location.href = `http://192.168.31.125:8082/#/index/list`
+ } else {
+ location.reload()
+ }
},
getSystemDetail() { // 获取系统logo
this.$get(this.api.logoDetail).then(res => {
diff --git a/src/pages/account/login/index.vue b/src/pages/account/login/index.vue
index 5447b2a..9dd3b5d 100644
--- a/src/pages/account/login/index.vue
+++ b/src/pages/account/login/index.vue
@@ -109,7 +109,7 @@ export default {
},
methods: {
...mapMutations("user", [
- "SET_ROLENAME"
+ "SET_ROLENAME", 'SET_FROM'
]),
...mapActions("user", [
"setCustomer", "setCustomerName"
@@ -134,6 +134,7 @@ export default {
this.getVerImg();
this.loginForm.code = "";
util.local.set(Setting.tokenKey, res.data.token, Setting.tokenExpires);
+ this.SET_FROM(false)
this.getRole()
this.queryCustomer()
}).catch(res => {})
diff --git a/src/pages/account/redirect/index.vue b/src/pages/account/redirect/index.vue
new file mode 100644
index 0000000..0ef488e
--- /dev/null
+++ b/src/pages/account/redirect/index.vue
@@ -0,0 +1,49 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 1a95288..bcbb53f 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -6,9 +6,9 @@ import { get } from "@/plugins/requests/index.js";
import api from "@/api";
import util from "@/libs/util";
import BasicLayout from "@/layouts/home";
+import store from '@/store'
Vue.use(Router);
-
const createRouter = () => new Router({
mode: Setting.routerMode,
base: process.env.BASE_URL,
@@ -282,11 +282,15 @@ router.beforeEach(function(to, from, next) {
getPermission();
}
} else {
- if (to.path !== "/login") {
- next({
- path: "/login",
- query: { redirect: to.path }
- });
+ if (to.path !== "/login" && to.path !== '/redirect') {
+ if (store.state.user.fromClient) {
+ location.href = `${location.origin}/student`
+ } else {
+ next({
+ path: "/login",
+ query: { redirect: to.path }
+ });
+ }
}
}
// 根据路由元信息设置文档标题
diff --git a/src/router/routes.js b/src/router/routes.js
index 790529a..acd1ade 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -30,6 +30,11 @@ const frameOut = [
},
component: () => import("@/pages/account/login")
},
+ {
+ path: "/redirect",
+ name: "redirect",
+ component: () => import("@/pages/account/redirect")
+ },
{
path: "/setting/person",
name: "person",
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 78709e0..ca8c32a 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -19,7 +19,8 @@ export default {
userName: "",
roleId: "",
dataTime: "",
- roleName: ''
+ roleName: '',
+ fromClient: false // 是否从学生端登录
},
mutations: {
SET_INFO: (state, info) => {
@@ -49,6 +50,9 @@ export default {
},
SET_ROLENAME: (state, roleName) => {
state.roleName = roleName
+ },
+ SET_FROM: (state, fromClient) => {
+ state.fromClient = fromClient
}
},
actions: {