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