Commit 88538974 authored by 杨梦雪's avatar 杨梦雪

2

parent e06d3428
......@@ -70,7 +70,7 @@ export default {
const item = newArr[i];
if (
(doubt_code == 0 && item.status == 1) ||
(doubt_info == 0 && item.status == 2) ||
(doubt_info == 0 && item.status == 2)||
(doubt_check == 0 && item.status == 3)
) {
} else {
......@@ -81,7 +81,7 @@ export default {
},
watch: {
statusNum(val) {
// console.log(val, "statusNum");
console.log(val, "statusNum");
this.status = val;
},
},
......
......@@ -93,7 +93,7 @@ export default {
font-size: 12px;
font-weight: 400;
margin-right: 20px;
color: #333333;
color: #FFFFFF;
text-decoration: none;
img {
width: 15px;
......
......@@ -40,7 +40,7 @@
</template>
<script>
/* eslint-disable */
import Cookie from "js-cookie"
import Cookie from "js-cookie";
import { logout } from "r/index/login";
export default {
......@@ -50,11 +50,14 @@ export default {
isHover: true,
system_logo: window.localStorage.getItem("system_logo"),
isLogin: false,
phone: window.localStorage.getItem("phone"),
phone: window.localStorage.getItem(
"phone" + Cookie.get("index-identity")
),
};
},
created() {
this.isLogin = !!localStorage.getItem("index-token");
let code = Cookie.get("index-identity");
this.isLogin = !!localStorage.getItem("index-token" + code);
},
methods: {
toLogin() {
......
......@@ -60,7 +60,7 @@ export default {
};
},
created() {
this.token = window.localStorage.getItem("index-token");
this.token = window.localStorage.getItem("index-token"+code);
this.has_amount = window.localStorage.getItem("has_amount");
},
methods: {
......@@ -131,7 +131,7 @@ export default {
return;
} else {
if (!this.token || this.token == "") {
this.token = window.localStorage.getItem("index-token");
this.token = window.localStorage.getItem("index-token"+code);
}
let token = this.token;
const wssURL = SERVER_WS_URL + "/order?token=" + token + "&channel=pc";
......
......@@ -30,7 +30,7 @@ export default {
name: "Header",
data() {
return {
phone: window.localStorage.getItem("phone"),
phone: window.localStorage.getItem("phone"+Cookie.get("index-identity")),
system_logo: window.localStorage.getItem("system_logo"),
};
},
......@@ -55,41 +55,13 @@ export default {
// if (res.code !== 200) return this.$message.error(res.message);
// 清除本地缓存除了大学logo
window.localStorage.clear();
// window.localStorage.removeItem("doubt_code");
// window.localStorage.removeItem("doubt_info");
// window.localStorage.removeItem("doubt_check");
// window.localStorage.removeItem("index-identity");
// window.localStorage.removeItem("index-token");
// window.localStorage.removeItem("phone");
// window.localStorage.removeItem("camp_name");
// window.localStorage.removeItem("system_color");
// window.localStorage.removeItem("has_amount");
// window.localStorage.removeItem("campsite_id");
// window.localStorage.removeItem("order_no");
// window.localStorage.removeItem("campindex_type");
// this.$store.state.token = "";
// 使用编程式导航跳转到登录页面
// this.$router.push({ name: "recruit" });
let code = Cookie.get("index-identity");
this.$router.replace("/"+code);
},
// 点击图片跳转到招生简章页面
toRecruit() {
// 清除本地缓存除了大学logo
// window.localStorage.clear();
// window.localStorage.removeItem("doubt_code");
// window.localStorage.removeItem("doubt_info");
// window.localStorage.removeItem("doubt_check");
// window.localStorage.removeItem("index-identity");
// window.localStorage.removeItem("index-token");
// window.localStorage.removeItem("phone");
// window.localStorage.removeItem("camp_name");
// window.localStorage.removeItem("system_color");
// window.localStorage.removeItem("has_amount");
// window.localStorage.removeItem("campsite_id");
// window.localStorage.removeItem("order_no");
// window.localStorage.removeItem("campindex_type");
// this.$store.state.token = "";
let code = Cookie.get("index-identity");
this.$router.replace("/"+code);
},
......
......@@ -33,7 +33,6 @@ export default {
};
},
created() {
// let url = location.href; //把当前页面的地址赋给变量 url
// console.log(url)
// var times = url.split("?"); //分切变量 url 分隔符号为 "?"
......@@ -43,7 +42,7 @@ export default {
// url += "?1"; //把变量 url 的值加入 ?1
// self.location.replace(url); //刷新页面
// }
this.signUpInit()
this.signUpInit();
},
watch: {},
......@@ -146,12 +145,13 @@ export default {
let fileList = [];
fileList = arr.map((item) => {
let obj = {
url: item
url: item,
};
return obj
return obj;
});
const code = Cookie.get("index-identity");
window.localStorage.setItem(
"sign_up_file_" + window.localStorage.getItem("phone"),
"sign_up_file_" + window.localStorage.getItem("phone" + code),
JSON.stringify(fileList)
); //上传的图片
}
......
......@@ -527,8 +527,9 @@ export default {
mounted() {},
created() {
// this.phone = window.localStorage.getItem("phone"); //本地取用户手机号
const code = Cookie.get("index-identity");
let signUpFile = window.localStorage.getItem(
"sign_up_file_" + window.localStorage.getItem("phone")
"sign_up_file_" + window.localStorage.getItem("phone"+code)
);
// console.log(signUpFile)
if (signUpFile && JSON.parse(signUpFile).length > 0) {
......@@ -873,7 +874,7 @@ export default {
// console.log(this.fileList, " this.fileList");
window.localStorage.setItem(
"sign_up_file_" + +window.localStorage.getItem("phone"),
"sign_up_file_" + +window.localStorage.getItem("phone"+code),
JSON.stringify(this.fileList)
);
})
......@@ -917,7 +918,7 @@ export default {
if (item.url == file.url) {
this.fileList.splice(idx, 1);
window.localStorage.setItem(
"sign_up_file_" + window.localStorage.getItem("phone"),
"sign_up_file_" + window.localStorage.getItem("phone"+code),
JSON.stringify(this.fileList)
);
}
......
......@@ -37,7 +37,7 @@ instance.interceptors.request.use(
}
// 调用接口请求添加token认证信息
// let token = localStorage.getItem("index-token");
const token = localStorage.getItem('index-token')
const token = localStorage.getItem('index-token'+code)
//
config.headers.token = token
......@@ -124,10 +124,13 @@ export function request(config) {
) {
return config
}
const token = localStorage.getItem('index-token')
if (token) {
// console.log(token)
const token = localStorage.getItem('index-token'+code)
if (token ) {
// console.log(token,'11')
config.headers.token = token
} else {
window.localStorage.clear()
router.push({
......
......@@ -90,6 +90,8 @@ router.onError((error) => {
})
function checkCam(code, cb) {
// console.log(code, 'code')
// console.log(cb, 'cb')
if (!code) {
Message({
message: "请访问正确的营地链接地址",
......@@ -107,7 +109,8 @@ function checkCam(code, cb) {
cb && cb(false);
return false;
}
code && Cookie.set("index-identity", code);
store.state.indexIdentity = code;
// this.$message.success(res.data.message);
let root = document.querySelector(":root");
root.style.setProperty("--color", res.data.system_color);
......@@ -135,22 +138,22 @@ function checkCam(code, cb) {
}
router.beforeEach((to, from, next) => {
let tokenKey = "index-token",
let
toLogin = "/login",
toRegister = "/register",
toReset = "/reset"
let token = localStorage.getItem(tokenKey);
let code = false;
document.title = to.meta.title;
if (to.path == toLogin || to.path == toRegister || to.path == toReset) {
// nextUrl = false;
code = to.params.code ? to.params.code : to.query.code;
checkCam(code, (res) => {
if (res) {
let token = window.localStorage.getItem("index-token" + code);
console.log(token, "token")
//检查登陆情况
if(token){
next("/"+code);
}else {
if (token) {
next("/" + code);
} else {
return next();
}
}
......@@ -164,16 +167,21 @@ router.beforeEach((to, from, next) => {
});
} else {
code = to.params.code ? to.params.code : to.query.code;
let token = window.localStorage.getItem("index-token" + code);
if (!token) {
console.log(token, 'token')
return next(toLogin);
} else {
code = to.params.code ? to.params.code : to.query.code;
checkCam(code, (res) => {
if (res) {
if(token){
if (token) {
return next();
}else {
next("/"+code);
} else {
next("/" + code);
}
}
});
......
......@@ -13,6 +13,7 @@ let state = {
// 数据
data: [],
token: '',
indexIdentity:"",
showDialog: false,
dialogType: 0,
info:{},
......
......@@ -28,6 +28,7 @@ import Pass from "c/index/SignUp/pass";
import Paying from "c/index/SignUp/paying";
import Success from "c/index/SignUp/success";
import { signUpInit } from "r/index/signUp";
import Cookie from "js-cookie";
export default {
name: "signUp",
......@@ -70,7 +71,7 @@ export default {
deep: true,
},
status(val) {
// console.log(val, "status");
console.log(val, "status");
},
},
methods: {
......@@ -180,12 +181,13 @@ export default {
let fileList = [];
fileList = arr.map((item) => {
let obj = {
url: item
url: item,
};
return obj
return obj;
});
const code = Cookie.get("index-identity");
window.localStorage.setItem(
"sign_up_file_" + window.localStorage.getItem("phone"),
"sign_up_file_" + window.localStorage.getItem("phone" + code),
JSON.stringify(fileList)
); //上传的图片
}
......
......@@ -61,7 +61,7 @@
<script>
/* eslint-disable */
import Cookie from "js-cookie"
import Cookie from "js-cookie";
import { login } from "r/index/login";
import { mobileCheck } from "@/common/utils.js";
......@@ -124,9 +124,6 @@ export default {
},
],
},
};
},
created() {
......@@ -136,13 +133,13 @@ export default {
// 忘记账号/密码
forgetPwd() {
let code = Cookie.get("index-identity");
this.$router.push("/reset?code="+code);
this.$router.push("/reset?code=" + code);
},
// 去注册
register() {
let code = Cookie.get("index-identity");
this.$router.push("/register?code="+code);
this.$router.push("/register?code=" + code);
},
// 改变密码显示状态
changePwdStatus() {
......@@ -161,9 +158,11 @@ export default {
return this.$message.error(res.data.message);
}
// this.$message.success("登录成功");
// 跳转到报名
const code = Cookie.get("index-identity");
// token存储
window.localStorage.setItem("index-token", res.data.token);
window.localStorage.setItem("phone", this.loginForm.phone);
window.localStorage.setItem("index-token" + code, res.data.token);
window.localStorage.setItem("phone" + code, this.loginForm.phone);
// 报名信息
window.localStorage.setItem("camp_name", res.data.cam.name);
//获取主题色
......@@ -171,9 +170,8 @@ export default {
"system_color",
res.data.cam.system_color
);
// 跳转到报名
let code = Cookie.get("index-identity");
this.$router.replace("/signUp/examInfo?code="+code);
this.$router.replace("/signUp/examInfo?code=" + code);
});
});
},
......
......@@ -260,8 +260,8 @@ export default {
// this.$message.success(res.data.message);
// token存储
window.localStorage.setItem("index-token", res.data.token);
window.localStorage.setItem("phone", this.registerForm.phone);
window.localStorage.setItem("index-token"+code, res.data.token);
window.localStorage.setItem("phone"+code, this.registerForm.phone);
// 报名信息
window.localStorage.setItem("camp_name", res.data.cam.name);
//获取主题色
......
......@@ -260,7 +260,7 @@ export default {
}
// this.$message.success(res.data.message);
// token存储
window.localStorage.setItem("index-token", res.token);
window.localStorage.setItem("index-token"+code, res.token);
let code = Cookie.get("index-identity");
this.$router.push("/login?code="+code);
});
......
......@@ -59,6 +59,12 @@ export default {
},
created() {
this.info = this.$store.state.info;
//
// let url = location.href; //把当前页面的地址赋给变量 url
// // console.log(url)
// var times = url.split("?"); //分切变量 url 分隔符号为 "?"
// console.log
},
methods: {
toLogin() {
......
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