Commit 24aa37f5 authored by 杨梦雪's avatar 杨梦雪
parents f070952e 10cbb1a8
...@@ -24,10 +24,12 @@ export default { ...@@ -24,10 +24,12 @@ export default {
created() {}, created() {},
methods: { methods: {
toLogin() { toLogin() {
this.$router.replace({ name: "index-login" }); let code = localStorage.getItem("index-identity");
this.$router.push("/login?code="+code);
}, },
toRegister() { toRegister() {
this.$router.replace({ name: "index-register" }); let code = localStorage.getItem("index-identity");
this.$router.push("/register?code="+code);
}, },
onMouserEnter(val){ onMouserEnter(val){
this.isHover = val; this.isHover = val;
......
...@@ -235,7 +235,8 @@ export default { ...@@ -235,7 +235,8 @@ export default {
this.$emit("closeCFSUDialog", this.dialogVisible, true); this.$emit("closeCFSUDialog", this.dialogVisible, true);
// status=6,跳转到报名成功页面 // status=6,跳转到报名成功页面
// this.$emit("getstatus", res.data.status.status); // this.$emit("getstatus", res.data.status.status);
this.$router.push("/signUp/success"); let code = localStorage.getItem("index-identity");
this.$router.push("/signUp/success?code="+code);
} else { } else {
//收到服务器信息,心跳重置 //收到服务器信息,心跳重置
this.reset(); this.reset();
......
...@@ -68,7 +68,9 @@ export default { ...@@ -68,7 +68,9 @@ export default {
window.localStorage.removeItem("campindex_type"); window.localStorage.removeItem("campindex_type");
// this.$store.state.token = ""; // this.$store.state.token = "";
// 使用编程式导航跳转到登录页面 // 使用编程式导航跳转到登录页面
this.$router.push({ name: "recruit" }); // this.$router.push({ name: "recruit" });
let code = localStorage.getItem("index-identity");
this.$router.replace("/"+code);
}, },
// 点击图片跳转到招生简章页面 // 点击图片跳转到招生简章页面
toRecruit() { toRecruit() {
...@@ -87,7 +89,8 @@ export default { ...@@ -87,7 +89,8 @@ export default {
// window.localStorage.removeItem("order_no"); // window.localStorage.removeItem("order_no");
// window.localStorage.removeItem("campindex_type"); // window.localStorage.removeItem("campindex_type");
// this.$store.state.token = ""; // this.$store.state.token = "";
this.$router.replace({ name: "recruit" }); let code = localStorage.getItem("index-identity");
this.$router.replace("/"+code);
}, },
}, },
}; };
......
...@@ -52,7 +52,8 @@ export default { ...@@ -52,7 +52,8 @@ export default {
if (res.data.code !== 200) return this.$message.error(res.data.message); if (res.data.code !== 200) return this.$message.error(res.data.message);
this.$emit("getstatus", res.data.status); this.$emit("getstatus", res.data.status);
this.$message.success(res.data.message); this.$message.success(res.data.message);
this.$router.push("/signUp/invitation"); let code = localStorage.getItem("index-identity");
this.$router.push("/signUp/invitation?code="+code);
}); });
}, },
getCams() { getCams() {
......
...@@ -964,7 +964,8 @@ export default { ...@@ -964,7 +964,8 @@ export default {
// console.log(3333); // console.log(3333);
this.$emit("getstatus", res.data.status); this.$emit("getstatus", res.data.status);
this.$message.success(res.data.message); this.$message.success(res.data.message);
this.$router.push("/signUp/check"); let code = localStorage.getItem("index-identity");
this.$router.push("/signUp/check?code="+code);
this.referForm = res.data.data; this.referForm = res.data.data;
}); });
}); });
......
...@@ -9,7 +9,8 @@ import indexCamp from './index/camp' ...@@ -9,7 +9,8 @@ import indexCamp from './index/camp'
import { import {
getCam getCam
} from "r/index/login"; } from "r/index/login";
import { Message } from 'element-ui';
Vue.prototype.$message = Message;
Vue.use(VueRouter) Vue.use(VueRouter)
...@@ -76,9 +77,20 @@ router.onError((error) => { ...@@ -76,9 +77,20 @@ router.onError((error) => {
}) })
function checkCam(code, cb) { function checkCam(code, cb) {
if(!code){
Message({
message: "请访问正确的营地链接地址",
type: 'waring'
});
cb && cb(false);
return false;
}
getCam(code).then((res) => { getCam(code).then((res) => {
if (res.data.code != 200) { if (res.data.code != 200) {
this.$store.$message.error(res.data.message); Message({
message: "请访问正确的营地链接地址",
type: 'waring'
});
cb && cb(false); cb && cb(false);
return false; return false;
} }
...@@ -102,6 +114,7 @@ function checkCam(code, cb) { ...@@ -102,6 +114,7 @@ function checkCam(code, cb) {
"doubt_check", "doubt_check",
res.data.audit_individual_information res.data.audit_individual_information
); //是否审核个人资料 ); //是否审核个人资料
store.state.info = res.data;
cb && cb(true); cb && cb(true);
}).catch(() => { }).catch(() => {
cb && cb(false); cb && cb(false);
...@@ -113,37 +126,38 @@ router.beforeEach((to, from, next) => { ...@@ -113,37 +126,38 @@ router.beforeEach((to, from, next) => {
toLogin = "/login", toLogin = "/login",
toRegister = "/register", toRegister = "/register",
toReset = "/reset" toReset = "/reset"
// toRecruit = "/:code"
let token = localStorage.getItem(tokenKey); let token = localStorage.getItem(tokenKey);
let nextUrl = false;
let code = false; let code = false;
document.title = to.meta.title;
if (to.path == toLogin || to.path == toRegister || to.path == toReset) { if (to.path == toLogin || to.path == toRegister || to.path == toReset) {
// nextUrl = false; // nextUrl = false;
code = to.params.code; code = to.params.code ? to.params.code : to.query.code;
checkCam(code, (res) => { checkCam(code, (res) => {
if (res) { if (res) {
nextUrl = false; return next();
} }
}); });
} else if (to.name == "recruit") { } else if (to.name == "recruit") {
code = to.params.code; code = to.params.code;
console.log(code,'code')
to.path == "/:code"
checkCam(code, (res) => { checkCam(code, (res) => {
if (res) { if (res) {
nextUrl = false; return next();
} }
}); });
} else { } else {
if (!token) { if (!token) {
nextUrl = toLogin; return next(toLogin);
} else { } else {
nextUrl = false; code = to.params.code ? to.params.code : to.query.code;
checkCam(code, (res) => {
if (res) {
return next();
}
});
} }
} }
document.title = to.meta.title; // return nextUrl ? next(nextUrl) : next();
return nextUrl ? next(nextUrl) : next();
}) })
// 页面跳转之后页面回滚到顶部 // 页面跳转之后页面回滚到顶部
......
...@@ -15,6 +15,7 @@ let state = { ...@@ -15,6 +15,7 @@ let state = {
token: '', token: '',
showDialog: false, showDialog: false,
dialogType: 0, dialogType: 0,
info:{},
isLogin: localStorage.getItem("isLogin") || "0", // 只有1为已登录 isLogin: localStorage.getItem("isLogin") || "0", // 只有1为已登录
}; };
......
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
}, },
data() { data() {
return { return {
isPosition: 0, // 左侧box是否浮动 isPosition: 0, // 左侧box是否浮动
pageYOffset: 0, // 左侧box浮动时,滚动的高度 pageYOffset: 0, // 左侧box浮动时,滚动的高度
scorllHeight: 0, // 最大滚动高度 scorllHeight: 0, // 最大滚动高度
...@@ -103,13 +103,14 @@ export default { ...@@ -103,13 +103,14 @@ export default {
this.ToSignUp(); this.ToSignUp();
}, },
ToSignUp(index) { ToSignUp(index) {
let code = localStorage.getItem("index-identity");
this.campindex_type = index; this.campindex_type = index;
if (this.campindex_type == 0) { if (this.campindex_type == 0) {
this.$router.push("/signUp/" + this.index_status); this.$router.push("/signUp/" + this.index_status+"?code="+code);
} else if (this.campindex_type == 1) { } else if (this.campindex_type == 1) {
this.$router.push("/homework"); this.$router.push("/homework?code="+code);
} else if (this.campindex_type == 2) { } else if (this.campindex_type == 2) {
this.$router.push("/certificate"); this.$router.push("/certificate?code="+code);
} }
}, },
onResize() { onResize() {
......
<template> <template>
<div class="login-index"> <div class="login-index">
<div class="big-img"> <div class="big-img" @click="toHome">
<img :src="bigImg" /> <img :src="bigImg" />
</div> </div>
<div class="big-right"> <div class="big-right">
...@@ -27,6 +27,12 @@ export default { ...@@ -27,6 +27,12 @@ export default {
this.$emit("getStatus", false); this.$emit("getStatus", false);
}, },
methods: {
toHome() {
let code = localStorage.getItem("index-identity");
this.$router.push("/"+code);
}
},
}; };
</script> </script>
......
...@@ -134,12 +134,14 @@ export default { ...@@ -134,12 +134,14 @@ export default {
methods: { methods: {
// 忘记账号/密码 // 忘记账号/密码
forgetPwd() { forgetPwd() {
this.$router.replace({ name: "index-reset" }); let code = localStorage.getItem("index-identity");
this.$router.push("/reset?code="+code);
}, },
// 去注册 // 去注册
register() { register() {
this.$router.replace({ name: "index-register" }); let code = localStorage.getItem("index-identity");
this.$router.push("/register?code="+code);
}, },
// 改变密码显示状态 // 改变密码显示状态
changePwdStatus() { changePwdStatus() {
...@@ -169,8 +171,8 @@ export default { ...@@ -169,8 +171,8 @@ export default {
res.data.cam.system_color res.data.cam.system_color
); );
// 跳转到报名 // 跳转到报名
this.$router.push({ path: "/signUp/examInfo" }); let code = localStorage.getItem("index-identity");
this.$router.push("/signUp/examInfo?code="+code);
}); });
}); });
}, },
......
...@@ -188,7 +188,8 @@ export default { ...@@ -188,7 +188,8 @@ export default {
methods: { methods: {
// 去注册 // 去注册
toLogin() { toLogin() {
this.$router.replace({ name: "index-login" }); let code = localStorage.getItem("index-identity");
this.$router.push("/login?code="+code);
}, },
// 改变密码显示状态 // 改变密码显示状态
changePwdStatus() { changePwdStatus() {
...@@ -204,7 +205,7 @@ export default { ...@@ -204,7 +205,7 @@ export default {
this.show = false; this.show = false;
this.timer = setInterval(() => { this.timer = setInterval(() => {
if (this.count > 0 && this.count <= timeLag) { if (this.count > 0 && this.count <= timeLag) {
this.count--; this.count--;
} else { } else {
this.show = true; this.show = true;
...@@ -269,7 +270,9 @@ export default { ...@@ -269,7 +270,9 @@ export default {
); );
// 跳转到报名 // 跳转到报名
this.$router.push({ path: "/signUp/examInfo" }); let code = localStorage.getItem("index-identity");
this.$router.push("/signUp/examInfo?code="+code);
}); });
}); });
}, },
......
...@@ -189,7 +189,8 @@ export default { ...@@ -189,7 +189,8 @@ export default {
methods: { methods: {
// 去注册 // 去注册
toLogin() { toLogin() {
this.$router.replace({ name: "index-login" }); let code = localStorage.getItem("index-identity");
this.$router.push("/login?code="+code);
}, },
// 改变密码显示状态 // 改变密码显示状态
changePwdStatus() { changePwdStatus() {
...@@ -259,7 +260,8 @@ export default { ...@@ -259,7 +260,8 @@ export default {
this.$message.success(res.data.message); this.$message.success(res.data.message);
// token存储 // token存储
window.localStorage.setItem("index-token", res.token); window.localStorage.setItem("index-token", res.token);
this.$router.replace({ name: "index-login" }); let code = localStorage.getItem("index-identity");
this.$router.push("/login?code="+code);
}); });
}); });
}, },
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
/* eslint-disable */ /* eslint-disable */
import Header from "@/components/index/Header.vue"; import Header from "@/components/index/Header.vue";
import Footer from "@/components/index/Footer.vue"; import Footer from "@/components/index/Footer.vue";
import { getCam } from "r/index/login";
export default { export default {
name: "recruit", name: "recruit",
...@@ -58,28 +57,12 @@ export default { ...@@ -58,28 +57,12 @@ export default {
}; };
}, },
created() { created() {
this.getCams(); this.info = this.$store.state.info;
},
mounted() {
// 只刷新一次
if (location.href.indexOf("#reloaded") == -1) {
location.href = location.href + "#reloaded";
location.reload();
}
}, },
methods: { methods: {
toLogin() { toLogin() {
this.$router.replace({ name: "index-login" }); let code = localStorage.getItem("index-identity");
}, this.$router.push("/login?code="+code);
getCams() {
getCam(false).then((res) => {
// console.log(res, "res");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.$message.success(res.data.message);
this.info = res.data;
});
}, },
}, },
components: { components: {
......
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