Commit 248ce87b authored by wuwangwolihui's avatar wuwangwolihui

营地2.0-路由添加公共query

parent 29dda675
......@@ -72,7 +72,12 @@
methods: {
// 导航栏操作
handleSelect(key, keyPath) {
this.$router.push(key);
this.$router.push({
path: key,
query: {
...this.$store.state.query
}
});
let root = document.querySelector(":root");
root.style.setProperty("--color", "#4FACFE");
// let code = this.$store.state.indexIdentity;
......@@ -91,25 +96,53 @@
},
// 去个人中心
toCenter() {
this.$router.push("/myInfo/signUpList");
this.$router.push({
path: "/myInfo/signUpList",
query: {
...this.$store.state.query
}
});
},
// 立即报名
toSignUp() {
let code = this.$store.state.indexIdentity;
let token = window.localStorage.getItem("index-token-all");
if (!token) {
this.$router.push("/login?code=" + code);
this.$router.push({
path: "/login",
query: {
...this.$store.state.query,
code: code
}
});
} else {
this.$router.push("/signUp/undefined?code=" + code);
this.$router.push({
path: "/signUp/undefined",
query: {
...this.$store.state.query,
code: code
}
});
}
},
// 去登录页
toLogin() {
if (this.type == 1) {
this.$router.push("/baseLogin");
this.$router.push({
path: "/baseLogin",
query: {
...this.$store.state.query,
}
});
} else if (this.type == 2) {
let code = this.$store.state.indexIdentity;
this.$router.push("/login?code=" + code);
this.$router.push({
path: "/login",
query: {
...this.$store.state.query,
code: code
}
});
}
},
// 退出登录
......@@ -135,11 +168,17 @@
await this.$router.replace({
path: "/login",
query: {
...this.$store.state.query,
code: code,
},
});
} else {
await this.$router.replace("/" + code);
await this.$router.replace({
path: "/" + code,
query: {
...this.$store.state.query,
},
});
}
}
if (this.type == 4) {
......@@ -147,18 +186,29 @@
(previousPath == '/home' ||
previousPath == '/active' ||
previousPath.indexOf('/active/') != -1)) {
await this.$router.replace(previousPath);
await this.$router.replace({
path: previousPath,
query: {
...this.$store.state.query,
},
});
} else {
let code = this.$store.state.indexIdentity;
if (this.$store.state.human == 1) {
await this.$router.replace({
path: "/login",
query: {
...this.$store.state.query,
code: code,
},
});
} else {
await this.$router.replace("/" + code);
await this.$router.replace({
path: "/" + code,
query: {
...this.$store.state.query,
},
});
}
}
}
......@@ -171,7 +221,12 @@
toRecruit() {
// 清除本地缓存除了大学logo
let code = this.$store.state.indexIdentity;
this.$router.push("/" + code);
this.$router.push({
path: "/" + code,
query: {
...this.$store.state.query,
}
});
},
},
watch: {
......@@ -201,7 +256,7 @@
align-items: center;
justify-content: space-between;
.image{
.image {
img {
height: 30px;
cursor: pointer;
......
This diff is collapsed.
......@@ -2,12 +2,12 @@
<div class="Header">
<div class="H_content com-container">
<div class="image" @click="toRecruit">
<img :src="system_logo" alt="" />
<img :src="system_logo" alt=""/>
</div>
<div class="right">
<el-dropdown @command="handleCommand" trigger="click">
<div class="el-dropdown-link">
<img src="@/assets/img/default.svg" class="img_user" />
<img src="@/assets/img/default.svg" class="img_user"/>
<span class="phone">{{ phone }}</span>
<i class="el-icon-arrow-down el-icon--right"></i>
</div>
......@@ -25,120 +25,137 @@
</div>
</template>
<script>
/* eslint-disable */
import Cookie from "js-cookie";
import { logout } from "r/index/login";
/* eslint-disable */
import Cookie from "js-cookie";
import {logout} from "r/index/login";
export default {
name: "Header",
data() {
return {
phone: window.localStorage.getItem("index-phone-all"),
system_logo: window.localStorage.getItem(
"system_logo" + this.$store.state.indexIdentity
),
};
},
methods: {
handleCommand(command) {
if (command == 1) {
let code = this.$store.state.indexIdentity;
this.$router.push("/Info/personalInfo?code=" + code);
} else if (command == 2) {
this.logout();
}
export default {
name: "Header",
data() {
return {
phone: window.localStorage.getItem("index-phone-all"),
system_logo: window.localStorage.getItem(
"system_logo" + this.$store.state.indexIdentity
),
};
},
// 退出
async logout() {
const confirmResult = await this.$confirm(`确认退出登录?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnClickModal: false,
type: "warning",
}).catch((err) => err);
if (confirmResult !== "confirm")
return this.$message.info("您取消了退出");
methods: {
handleCommand(command) {
if (command == 1) {
let code = this.$store.state.indexIdentity;
this.$router.push({
path: "/Info/personalInfo",
query: {
...this.$store.state.query,
code: code,
},
});
} else if (command == 2) {
this.logout();
}
},
// 退出
async logout() {
const confirmResult = await this.$confirm(`确认退出登录?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
closeOnClickModal: false,
type: "warning",
}).catch((err) => err);
if (confirmResult !== "confirm")
return this.$message.info("您取消了退出");
// 清除本地缓存除了大学logo
window.localStorage.clear();
let code = this.$store.state.indexIdentity;
if (this.$store.state.human == 1) {
await this.$router.replace({
path: "/login",
// 清除本地缓存除了大学logo
window.localStorage.clear();
let code = this.$store.state.indexIdentity;
if (this.$store.state.human == 1) {
await this.$router.replace({
path: "/login",
query: {
...this.$store.state.query,
code: code,
},
});
} else {
await this.$router.replace({
path: "/" + code,
query: {
...this.$store.state.query,
},
});
}
this.$message.success("退出成功");
await logout({});
},
// 点击图片跳转到招生简章页面
toRecruit() {
// 清除本地缓存除了大学logo
let code = this.$store.state.indexIdentity;
this.$router.replace({
path: "/" + code,
query: {
code: code,
...this.$store.state.query,
},
});
} else {
await this.$router.replace("/" + code);
}
// await this.$router.replace("/" + code);
this.$message.success("退出成功");
await logout({});
},
// 点击图片跳转到招生简章页面
toRecruit() {
// 清除本地缓存除了大学logo
let code = this.$store.state.indexIdentity;
this.$router.replace("/" + code);
},
},
},
};
};
</script>
<style lang="scss" scoped>
@import "a/scss/common";
@import "a/scss/common";
.Header {
font-family: PingFang SC;
height: 80px;
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.12);
.Header {
font-family: PingFang SC;
height: 80px;
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.12);
.H_content {
height: 100%;
display: flex;
flex-flow: row;
align-items: center;
justify-content: space-between;
.H_content {
height: 100%;
display: flex;
flex-flow: row;
align-items: center;
justify-content: space-between;
.image {
img {
// width: 318px;
height: 62px;
}
&:hover {
cursor: pointer;
}
}
.image {
img {
// width: 318px;
height: 62px;
}
.right {
height: 80px;
&:hover {
cursor: pointer;
}
}
::v-deep .el-dropdown {
.right {
height: 80px;
.el-dropdown-link {
::v-deep .el-dropdown {
height: 80px;
display: flex;
flex-flow: row;
align-items: center;
.img_user {
width: 34px;
height: 34px;
background-color: #d8d8d8;
border-radius: 50%;
}
.el-dropdown-link {
height: 80px;
display: flex;
flex-flow: row;
align-items: center;
.phone {
margin: 0 10px 0 12px;
.img_user {
width: 34px;
height: 34px;
background-color: #d8d8d8;
border-radius: 50%;
}
.phone {
margin: 0 10px 0 12px;
}
}
}
&:hover {
cursor: pointer;
&:hover {
cursor: pointer;
}
}
}
}
}
}
</style>
......@@ -17,14 +17,14 @@
// export const SERVER_WS_URL = "wss://apiy.thuers.com"; // websocket
// 测试
// export const SERVER_URL = "https://tgwapi.campcenter.cn/modules-campsite"; // 正式环境
// export const DEVELOPMENT_SERVER_URL = "https://tgwapi.campcenter.cn/modules-campsite"; //开发环境
// export const SERVER_WS_URL = "wss://tgwapi.campcenter.cn"; // websocket
export const SERVER_URL = "https://tgwapi.campcenter.cn/modules-campsite"; // 正式环境
export const DEVELOPMENT_SERVER_URL = "https://tgwapi.campcenter.cn/modules-campsite"; //开发环境
export const SERVER_WS_URL = "wss://tgwapi.campcenter.cn"; // websocket
// 正式
export const SERVER_URL = "https://gwapi.campcenter.cn/modules-campsite"; // 正式环境
export const DEVELOPMENT_SERVER_URL = "https://gwapi.campcenter.cn/modules-campsite"; //开发环境
export const SERVER_WS_URL = "wss://gwapi.campcenter.cn"; // websocket
// export const SERVER_URL = "https://gwapi.campcenter.cn/modules-campsite"; // 正式环境
// export const DEVELOPMENT_SERVER_URL = "https://gwapi.campcenter.cn/modules-campsite"; //开发环境
// export const SERVER_WS_URL = "wss://gwapi.campcenter.cn"; // websocket
// 测试
// export const SERVER_URL = "http:// 8088/modules-campsite"; // 正式环境
......
......@@ -47,34 +47,6 @@ export function request(config) {
})
instance.interceptors.request.use(
(config) => {
// const hotList = '/activityCenter/hotList';
//
// if (config.url.indexOf(hotList) != -1) {
// return config
// }
// const token = localStorage.getItem('index-all-token')
// if (token) {
// config.headers.token = token
// } else {
// window.localStorage.clear()
// router.push({
// path: '/baseLogin',
// query: {
// redirect: router.currentRoute.fullPath
// } // 从哪个页面跳转
// })
// const error = new Error('请登录!')
// return Promise.reject(error)
// }
// if (config.hasLoading) {
// const loadingText = config.loadingText ? config.loadingText : '请求中'
// loadingInstance = Loading.service({
// lock: true,
// fullscreen: true,
// text: loadingText,
// background: 'rgba(0, 0, 0, 0.25)'
// })
// }
return config
},
(error) => {
......@@ -89,7 +61,8 @@ export function request(config) {
router.push({
path: '/baseLogin',
query: {
redirect: router.currentRoute.fullPath
redirect: router.currentRoute.fullPath,
...store.state.query
} // 从哪个页面跳转
})
}
......
......@@ -125,7 +125,8 @@ export function request(config) {
router.push({
path: '/login',
query: {
redirect: router.currentRoute.fullPath
redirect: router.currentRoute.fullPath,
...store.state.query
} // 从哪个页面跳转
})
const error = new Error('请登录!')
......@@ -175,6 +176,9 @@ export function request(config) {
res.data.code == 400003) {
router.push({
path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
})
Notification({
message: res.data.msg,
......@@ -188,6 +192,9 @@ export function request(config) {
store.commit('removeLocalStorage');
router.push({
path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
})
if (!isLogout) {
Notification({
......@@ -203,7 +210,8 @@ export function request(config) {
router.push({
path: '/login',
query: {
redirect: router.currentRoute.fullPath
redirect: router.currentRoute.fullPath,
...store.state.query
} // 从哪个页面跳转
})
}
......@@ -219,6 +227,9 @@ export function request(config) {
if (error.msg == '请登录!') {
router.push({
path: "/login?code=" + store.state.indexIdentity,
query: {
...store.state.query
}
})
}
if (error.response.status == 404) {
......
......@@ -133,6 +133,9 @@ export function request(config) {
} else {
router.push({
path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
})
const error = new Error('请登录!');
return Promise.reject(error);
......@@ -177,6 +180,9 @@ export function request(config) {
res.data.code == 400002) {
router.push({
path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
})
Notification({
message: res.data.msg,
......@@ -190,6 +196,9 @@ export function request(config) {
store.commit('removeLocalStorage');
router.push({
path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
})
if (!isLogout) {
Notification({
......@@ -204,6 +213,9 @@ export function request(config) {
store.commit('removeLocalStorage');
router.push({
path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
})
}
loadingInstance && loadingInstance.close()
......@@ -218,6 +230,9 @@ export function request(config) {
if (error.msg == '请登录!') {
router.push({
path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
})
}
if (error.response.status == 404) {
......
......@@ -13,7 +13,7 @@ let state = {
// 数据
data: [],
indexIdentity: localStorage.getItem("index-identity") || "",
disCode: localStorage.getItem("index-disCode") || "",
disCode: "",
human: 0,//清华人文学院
baseSchool: 0,//基地
configJson: {}, //分营地填写资料字段
......@@ -26,9 +26,7 @@ let state = {
token: localStorage.getItem("index-token-all") || "",
isLogin: localStorage.getItem("isLogin") || "0", // 只有1为已登录
activeIndex: window.localStorage.getItem('index-active-path') || "0",
query:{
disCode: localStorage.getItem("index-disCode") || "",
},
query: {},
};
export default new Vuex.Store({
......
......@@ -26,7 +26,8 @@ export default {
},
setDisCode(state, code) {
state.disCode = code;
window.localStorage.setItem('index-disCode', code);
state.query['disCode'] = code;
// window.localStorage.setItem('index-disCode', code);
},
setActiveIndex(state, path) {
let key = path.split('/')[1] == 'active' ? '/' + path.split('/')[1] : path;
......
<template>
<div class="com-container active-info-container" v-loading="loading">
<el-breadcrumb class="active-breadcrumb" separator="/">
<el-breadcrumb-item :to="{ path: '/active' }">活动中心</el-breadcrumb-item>
<el-breadcrumb-item :to="{ path: '/active',query:{...$store.state.query}}">活动中心</el-breadcrumb-item>
<el-breadcrumb-item>活动详情</el-breadcrumb-item>
</el-breadcrumb>
<div class="active-info card-box">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment