Commit 248ce87b authored by wuwangwolihui's avatar wuwangwolihui

营地2.0-路由添加公共query

parent 29dda675
...@@ -72,7 +72,12 @@ ...@@ -72,7 +72,12 @@
methods: { methods: {
// 导航栏操作 // 导航栏操作
handleSelect(key, keyPath) { handleSelect(key, keyPath) {
this.$router.push(key); this.$router.push({
path: key,
query: {
...this.$store.state.query
}
});
let root = document.querySelector(":root"); let root = document.querySelector(":root");
root.style.setProperty("--color", "#4FACFE"); root.style.setProperty("--color", "#4FACFE");
// let code = this.$store.state.indexIdentity; // let code = this.$store.state.indexIdentity;
...@@ -91,25 +96,53 @@ ...@@ -91,25 +96,53 @@
}, },
// 去个人中心 // 去个人中心
toCenter() { toCenter() {
this.$router.push("/myInfo/signUpList"); this.$router.push({
path: "/myInfo/signUpList",
query: {
...this.$store.state.query
}
});
}, },
// 立即报名 // 立即报名
toSignUp() { toSignUp() {
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
let token = window.localStorage.getItem("index-token-all"); let token = window.localStorage.getItem("index-token-all");
if (!token) { if (!token) {
this.$router.push("/login?code=" + code); this.$router.push({
path: "/login",
query: {
...this.$store.state.query,
code: code
}
});
} else { } else {
this.$router.push("/signUp/undefined?code=" + code); this.$router.push({
path: "/signUp/undefined",
query: {
...this.$store.state.query,
code: code
}
});
} }
}, },
// 去登录页 // 去登录页
toLogin() { toLogin() {
if (this.type == 1) { if (this.type == 1) {
this.$router.push("/baseLogin"); this.$router.push({
path: "/baseLogin",
query: {
...this.$store.state.query,
}
});
} else if (this.type == 2) { } else if (this.type == 2) {
let code = this.$store.state.indexIdentity; 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 @@ ...@@ -135,11 +168,17 @@
await this.$router.replace({ await this.$router.replace({
path: "/login", path: "/login",
query: { query: {
...this.$store.state.query,
code: code, code: code,
}, },
}); });
} else { } else {
await this.$router.replace("/" + code); await this.$router.replace({
path: "/" + code,
query: {
...this.$store.state.query,
},
});
} }
} }
if (this.type == 4) { if (this.type == 4) {
...@@ -147,18 +186,29 @@ ...@@ -147,18 +186,29 @@
(previousPath == '/home' || (previousPath == '/home' ||
previousPath == '/active' || previousPath == '/active' ||
previousPath.indexOf('/active/') != -1)) { previousPath.indexOf('/active/') != -1)) {
await this.$router.replace(previousPath); await this.$router.replace({
path: previousPath,
query: {
...this.$store.state.query,
},
});
} else { } else {
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
if (this.$store.state.human == 1) { if (this.$store.state.human == 1) {
await this.$router.replace({ await this.$router.replace({
path: "/login", path: "/login",
query: { query: {
...this.$store.state.query,
code: code, code: code,
}, },
}); });
} else { } else {
await this.$router.replace("/" + code); await this.$router.replace({
path: "/" + code,
query: {
...this.$store.state.query,
},
});
} }
} }
} }
...@@ -171,7 +221,12 @@ ...@@ -171,7 +221,12 @@
toRecruit() { toRecruit() {
// 清除本地缓存除了大学logo // 清除本地缓存除了大学logo
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
this.$router.push("/" + code); this.$router.push({
path: "/" + code,
query: {
...this.$store.state.query,
}
});
}, },
}, },
watch: { watch: {
...@@ -201,7 +256,7 @@ ...@@ -201,7 +256,7 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.image{ .image {
img { img {
height: 30px; height: 30px;
cursor: pointer; cursor: pointer;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="Header"> <div class="Header">
<div class="H_content com-container"> <div class="H_content com-container">
<div class="image"> <div class="image">
<img :src="system_logo" alt="" /> <img :src="system_logo" alt=""/>
</div> </div>
<div class="right" v-if="!isLogin"> <div class="right" v-if="!isLogin">
<span <span
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<div class="right alreadyLogin" v-else> <div class="right alreadyLogin" v-else>
<el-dropdown @command="handleCommand" trigger="click"> <el-dropdown @command="handleCommand" trigger="click">
<div class="el-dropdown-link"> <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> <span class="phone">{{ phone }}</span>
<i class="el-icon-arrow-down el-icon--right"></i> <i class="el-icon-arrow-down el-icon--right"></i>
</div> </div>
...@@ -40,10 +40,10 @@ ...@@ -40,10 +40,10 @@
</div> </div>
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
import { logout } from "r/index/login"; import {logout} from "r/index/login";
export default { export default {
name: "Header", name: "Header",
data() { data() {
return { return {
...@@ -74,11 +74,23 @@ export default { ...@@ -74,11 +74,23 @@ export default {
}, },
toCenter() { toCenter() {
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
this.$router.replace("/signUp/undefined?code=" + code); this.$router.replace({
path: "/signUp/undefined",
query: {
...this.$store.state.query,
code: code
}
});
}, },
toRegister() { toRegister() {
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
this.$router.push("/register?code=" + code); this.$router.push({
path: "/register",
query: {
...this.$store.state.query,
code: code
}
});
}, },
async logout() { async logout() {
const confirmResult = await this.$confirm(`确认退出登录?`, "提示", { const confirmResult = await this.$confirm(`确认退出登录?`, "提示", {
...@@ -128,12 +140,18 @@ export default { ...@@ -128,12 +140,18 @@ export default {
await this.$router.replace({ await this.$router.replace({
path: "/login", path: "/login",
query: { query: {
...this.$store.state.query,
code: code, code: code,
}, },
}); });
} else { } else {
console.log(code) console.log(code)
await this.$router.replace("/" + code); await this.$router.replace({
path: "/" + code,
query: {
...this.$store.state.query,
},
});
} }
this.$message.success("退出成功"); this.$message.success("退出成功");
...@@ -145,15 +163,20 @@ export default { ...@@ -145,15 +163,20 @@ export default {
toRecruit() { toRecruit() {
// 清除本地缓存除了大学logo // 清除本地缓存除了大学logo
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
this.$router.replace("/" + code); this.$router.replace({
path: "/" + code,
query: {
...this.$store.state.query,
}, },
});
}, },
}; },
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "a/scss/common"; @import "a/scss/common";
.Header { .Header {
font-family: PingFang SC; font-family: PingFang SC;
height: 80px; height: 80px;
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.12); box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.12);
...@@ -222,5 +245,5 @@ export default { ...@@ -222,5 +245,5 @@ export default {
} }
} }
} }
} }
</style> </style>
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
<div class="Header"> <div class="Header">
<div class="H_content com-container"> <div class="H_content com-container">
<div class="image" @click="toRecruit"> <div class="image" @click="toRecruit">
<img :src="system_logo" alt="" /> <img :src="system_logo" alt=""/>
</div> </div>
<div class="right"> <div class="right">
<el-dropdown @command="handleCommand" trigger="click"> <el-dropdown @command="handleCommand" trigger="click">
<div class="el-dropdown-link"> <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> <span class="phone">{{ phone }}</span>
<i class="el-icon-arrow-down el-icon--right"></i> <i class="el-icon-arrow-down el-icon--right"></i>
</div> </div>
...@@ -25,11 +25,11 @@ ...@@ -25,11 +25,11 @@
</div> </div>
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
import Cookie from "js-cookie"; import Cookie from "js-cookie";
import { logout } from "r/index/login"; import {logout} from "r/index/login";
export default { export default {
name: "Header", name: "Header",
data() { data() {
return { return {
...@@ -43,7 +43,13 @@ export default { ...@@ -43,7 +43,13 @@ export default {
handleCommand(command) { handleCommand(command) {
if (command == 1) { if (command == 1) {
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
this.$router.push("/Info/personalInfo?code=" + code); this.$router.push({
path: "/Info/personalInfo",
query: {
...this.$store.state.query,
code: code,
},
});
} else if (command == 2) { } else if (command == 2) {
this.logout(); this.logout();
} }
...@@ -66,13 +72,18 @@ export default { ...@@ -66,13 +72,18 @@ export default {
await this.$router.replace({ await this.$router.replace({
path: "/login", path: "/login",
query: { query: {
...this.$store.state.query,
code: code, code: code,
}, },
}); });
} else { } else {
await this.$router.replace("/" + code); await this.$router.replace({
path: "/" + code,
query: {
...this.$store.state.query,
},
});
} }
// await this.$router.replace("/" + code);
this.$message.success("退出成功"); this.$message.success("退出成功");
await logout({}); await logout({});
}, },
...@@ -80,15 +91,20 @@ export default { ...@@ -80,15 +91,20 @@ export default {
toRecruit() { toRecruit() {
// 清除本地缓存除了大学logo // 清除本地缓存除了大学logo
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
this.$router.replace("/" + code); this.$router.replace({
path: "/" + code,
query: {
...this.$store.state.query,
},
});
}, },
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "a/scss/common"; @import "a/scss/common";
.Header { .Header {
font-family: PingFang SC; font-family: PingFang SC;
height: 80px; height: 80px;
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.12); box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.12);
...@@ -105,6 +121,7 @@ export default { ...@@ -105,6 +121,7 @@ export default {
// width: 318px; // width: 318px;
height: 62px; height: 62px;
} }
&:hover { &:hover {
cursor: pointer; cursor: pointer;
} }
...@@ -140,5 +157,5 @@ export default { ...@@ -140,5 +157,5 @@ export default {
} }
} }
} }
} }
</style> </style>
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
// export const SERVER_WS_URL = "wss://apiy.thuers.com"; // websocket // export const SERVER_WS_URL = "wss://apiy.thuers.com"; // websocket
// 测试 // 测试
// export const SERVER_URL = "https://tgwapi.campcenter.cn/modules-campsite"; // 正式环境 export const SERVER_URL = "https://tgwapi.campcenter.cn/modules-campsite"; // 正式环境
// export const DEVELOPMENT_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_WS_URL = "wss://tgwapi.campcenter.cn"; // websocket
// 正式 // 正式
export const SERVER_URL = "https://gwapi.campcenter.cn/modules-campsite"; // 正式环境 // export const SERVER_URL = "https://gwapi.campcenter.cn/modules-campsite"; // 正式环境
export const DEVELOPMENT_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_WS_URL = "wss://gwapi.campcenter.cn"; // websocket
// 测试 // 测试
// export const SERVER_URL = "http:// 8088/modules-campsite"; // 正式环境 // export const SERVER_URL = "http:// 8088/modules-campsite"; // 正式环境
......
...@@ -47,34 +47,6 @@ export function request(config) { ...@@ -47,34 +47,6 @@ export function request(config) {
}) })
instance.interceptors.request.use( instance.interceptors.request.use(
(config) => { (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 return config
}, },
(error) => { (error) => {
...@@ -89,7 +61,8 @@ export function request(config) { ...@@ -89,7 +61,8 @@ export function request(config) {
router.push({ router.push({
path: '/baseLogin', path: '/baseLogin',
query: { query: {
redirect: router.currentRoute.fullPath redirect: router.currentRoute.fullPath,
...store.state.query
} // 从哪个页面跳转 } // 从哪个页面跳转
}) })
} }
......
...@@ -125,7 +125,8 @@ export function request(config) { ...@@ -125,7 +125,8 @@ export function request(config) {
router.push({ router.push({
path: '/login', path: '/login',
query: { query: {
redirect: router.currentRoute.fullPath redirect: router.currentRoute.fullPath,
...store.state.query
} // 从哪个页面跳转 } // 从哪个页面跳转
}) })
const error = new Error('请登录!') const error = new Error('请登录!')
...@@ -175,6 +176,9 @@ export function request(config) { ...@@ -175,6 +176,9 @@ export function request(config) {
res.data.code == 400003) { res.data.code == 400003) {
router.push({ router.push({
path: '/' + store.state.indexIdentity, path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
}) })
Notification({ Notification({
message: res.data.msg, message: res.data.msg,
...@@ -188,6 +192,9 @@ export function request(config) { ...@@ -188,6 +192,9 @@ export function request(config) {
store.commit('removeLocalStorage'); store.commit('removeLocalStorage');
router.push({ router.push({
path: '/' + store.state.indexIdentity, path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
}) })
if (!isLogout) { if (!isLogout) {
Notification({ Notification({
...@@ -203,7 +210,8 @@ export function request(config) { ...@@ -203,7 +210,8 @@ export function request(config) {
router.push({ router.push({
path: '/login', path: '/login',
query: { query: {
redirect: router.currentRoute.fullPath redirect: router.currentRoute.fullPath,
...store.state.query
} // 从哪个页面跳转 } // 从哪个页面跳转
}) })
} }
...@@ -219,6 +227,9 @@ export function request(config) { ...@@ -219,6 +227,9 @@ export function request(config) {
if (error.msg == '请登录!') { if (error.msg == '请登录!') {
router.push({ router.push({
path: "/login?code=" + store.state.indexIdentity, path: "/login?code=" + store.state.indexIdentity,
query: {
...store.state.query
}
}) })
} }
if (error.response.status == 404) { if (error.response.status == 404) {
......
...@@ -133,6 +133,9 @@ export function request(config) { ...@@ -133,6 +133,9 @@ export function request(config) {
} else { } else {
router.push({ router.push({
path: '/' + store.state.indexIdentity, path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
}) })
const error = new Error('请登录!'); const error = new Error('请登录!');
return Promise.reject(error); return Promise.reject(error);
...@@ -177,6 +180,9 @@ export function request(config) { ...@@ -177,6 +180,9 @@ export function request(config) {
res.data.code == 400002) { res.data.code == 400002) {
router.push({ router.push({
path: '/' + store.state.indexIdentity, path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
}) })
Notification({ Notification({
message: res.data.msg, message: res.data.msg,
...@@ -190,6 +196,9 @@ export function request(config) { ...@@ -190,6 +196,9 @@ export function request(config) {
store.commit('removeLocalStorage'); store.commit('removeLocalStorage');
router.push({ router.push({
path: '/' + store.state.indexIdentity, path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
}) })
if (!isLogout) { if (!isLogout) {
Notification({ Notification({
...@@ -204,6 +213,9 @@ export function request(config) { ...@@ -204,6 +213,9 @@ export function request(config) {
store.commit('removeLocalStorage'); store.commit('removeLocalStorage');
router.push({ router.push({
path: '/' + store.state.indexIdentity, path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
}) })
} }
loadingInstance && loadingInstance.close() loadingInstance && loadingInstance.close()
...@@ -218,6 +230,9 @@ export function request(config) { ...@@ -218,6 +230,9 @@ export function request(config) {
if (error.msg == '请登录!') { if (error.msg == '请登录!') {
router.push({ router.push({
path: '/' + store.state.indexIdentity, path: '/' + store.state.indexIdentity,
query: {
...store.state.query
}
}) })
} }
if (error.response.status == 404) { if (error.response.status == 404) {
......
...@@ -13,7 +13,7 @@ let state = { ...@@ -13,7 +13,7 @@ let state = {
// 数据 // 数据
data: [], data: [],
indexIdentity: localStorage.getItem("index-identity") || "", indexIdentity: localStorage.getItem("index-identity") || "",
disCode: localStorage.getItem("index-disCode") || "", disCode: "",
human: 0,//清华人文学院 human: 0,//清华人文学院
baseSchool: 0,//基地 baseSchool: 0,//基地
configJson: {}, //分营地填写资料字段 configJson: {}, //分营地填写资料字段
...@@ -26,9 +26,7 @@ let state = { ...@@ -26,9 +26,7 @@ let state = {
token: localStorage.getItem("index-token-all") || "", token: localStorage.getItem("index-token-all") || "",
isLogin: localStorage.getItem("isLogin") || "0", // 只有1为已登录 isLogin: localStorage.getItem("isLogin") || "0", // 只有1为已登录
activeIndex: window.localStorage.getItem('index-active-path') || "0", activeIndex: window.localStorage.getItem('index-active-path') || "0",
query:{ query: {},
disCode: localStorage.getItem("index-disCode") || "",
},
}; };
export default new Vuex.Store({ export default new Vuex.Store({
......
...@@ -26,7 +26,8 @@ export default { ...@@ -26,7 +26,8 @@ export default {
}, },
setDisCode(state, code) { setDisCode(state, code) {
state.disCode = code; state.disCode = code;
window.localStorage.setItem('index-disCode', code); state.query['disCode'] = code;
// window.localStorage.setItem('index-disCode', code);
}, },
setActiveIndex(state, path) { setActiveIndex(state, path) {
let key = path.split('/')[1] == 'active' ? '/' + path.split('/')[1] : path; let key = path.split('/')[1] == 'active' ? '/' + path.split('/')[1] : path;
......
<template> <template>
<div class="com-container active-info-container" v-loading="loading"> <div class="com-container active-info-container" v-loading="loading">
<el-breadcrumb class="active-breadcrumb" separator="/"> <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-item>活动详情</el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
<div class="active-info card-box"> <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