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

111

parent 86acea80
......@@ -19,6 +19,18 @@ export function getCam(code) {
params: data
})
}
export function getCamInfo(code) {
let data = {};
data['identity'] = code ? code : store.state.indexIdentity;
if (!data['identity']) {
return false;
}
return request({
method: 'get',
url: '/web/auth/getCamInfo',
params: data
})
}
// 登录
export function login(data) {
data['identity'] = store.state.indexIdentity;
......
......@@ -182,9 +182,26 @@ export function request(config) {
instance.interceptors.response.use(
(res) => {
console.log(res)
console.log(res, '11111')
console.log(res.data.code, 'res.data.code')
if (res.data.code == 400034 ||
res.data.code == 400035 ||
res.data.code == 400001 ||
res.data.code == 400002 ||
res.data.code == 400003) {
if (res.data.code == 400023||res.data.code == 400001) {
router.push({
path: '/' + store.state.indexIdentity,
})
Notification({
message: res.data.message,
duration: 1000,
});
return
}
if (res.data.code == 400023 ) {
console.log(store.state.indexIdentity, 'store.state.indexIdentity')
let code = store.state.indexIdentity;
......@@ -209,7 +226,12 @@ export function request(config) {
path: '/' + store.state.indexIdentity,
})
return this.$message.error(res.data.message);
Notification({
message: res.data.message,
duration: 3000,
});
return
}
if (res.data.code == 400003) {
let code = this.$store.state.indexIdentity;
......@@ -237,16 +259,17 @@ export function request(config) {
redirect: router.currentRoute.fullPath
} // 从哪个页面跳转
})
} else if (
res.data.code == 400801 ||
res.data.code == 400910 ||
res.data.code == 4002132 ||
res.data.code == 40068
) {
store.state.showDialog = true
store.state.dialogType = 1
}
// else if (
// res.data.code == 400801 ||
// res.data.code == 400910 ||
// res.data.code == 4002132 ||
// res.data.code == 40068
// ) {
// store.state.showDialog = true
// store.state.dialogType = 1
// }
loadingInstance && loadingInstance.close()
setTimeout(() => {
allowRequest(reqList, res.config.url)
......
......@@ -7,7 +7,8 @@ import store from '@/store'
import indexLogin from './index/login'
import indexCamp from './index/camp'
import {
getCam
getCam,
getCamInfo
} from "r/index/login";
import {
Message
......@@ -97,31 +98,29 @@ function checkCam(code, cb) {
console.log(code, 'code')
if (!code) {
Message({
message: "请访问正确的营地链接地址",
message: "请访问正确的营地链接地址1",
type: 'waring'
});
cb && cb(false);
return false;
}
getCam(code).then((res) => {
// if (res.data.code != 200) {
// Message({
// message: "请访问正确的营地链接地址",
// type: 'waring'
// });
//40003
if (res.data.code == 400034 || res.data.code == 400035 || res.data.code == 400001 || res.data.code == 400002 || res.data.code == 400003) {
Message({
message: res.data.message,
type: 'waring'
});
cb && cb(false);
return false;
}
// if (res.data.code == 400034 || res.data.code == 400035 || res.data.code == 400001 || res.data.code == 400002 || res.data.code == 400003) {
// Message({
// message: res.data.message,
// type: 'waring'
// });
// cb && cb(false);
// return false;
// }
// }
// this.$message.success(res.data.message);
let root = document.querySelector(":root");
root.style.setProperty("--color", res.data.system_color);
root.style.setProperty("--bk_pic", res.data.background_picture); //当前营地的背景图
......@@ -159,6 +158,7 @@ router.beforeEach((to, from, next) => {
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")
//检查登陆情况
......
......@@ -14,8 +14,8 @@ let state = {
data: [],
token: '',
indexIdentity:"",
showDialog: false,
dialogType: 0,
// showDialog: false,
// dialogType: 0,
info:{},
isLogin: localStorage.getItem("isLogin") || "0", // 只有1为已登录
};
......
......@@ -19,22 +19,22 @@
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item prop="code">
<!-- <el-form-item prop="code">
<img class="img_l" src="@/assets/img/reset/code.png" alt="" />
<el-input
v-model="registerForm.code"
placeholder="请输入短信验证码"
maxlength="20"
autocomplete="off"
></el-input>
></el-input> -->
<!-- 短信验证码 -->
<div class="phoneCode">
<!-- <div class="phoneCode">
<span class="code" v-show="show" @click="getCode"
>获取验证码</span
>
<span v-show="!show" class="count">{{ count }} s</span>
</div>
</el-form-item>
</el-form-item> -->
<el-form-item prop="password">
<img class="img_l" src="@/assets/img/reset/password.png" alt="" />
<el-input
......@@ -103,9 +103,9 @@ export default {
return {
inputType: "",
// 手机验证短信
show: true,
count: "",
timer: null,
// show: true,
// count: "",
// timer: null,
isShowPwd: true, // 控制密码显示隐藏
registerForm: {
phone: "",
......@@ -130,10 +130,10 @@ export default {
},
],
// 对验证码进行校验
code: [
{ required: true, message: "请输入验证码", trigger: "blur" },
{ min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur" },
],
// code: [
// { required: true, message: "请输入验证码", trigger: "blur" },
// { min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur" },
// ],
// 对密码进行校验
password: [
{
......@@ -197,50 +197,50 @@ export default {
this.isShowPwd = !this.isShowPwd;
},
// 定时器倒计时
intervalHandle(startTime, endTime) {
// 时间差
const timeLag = intervalTime(startTime, endTime);
console.log(timeLag);
if (!this.timer) {
this.count = timeLag;
this.show = false;
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= timeLag) {
this.count--;
} else {
this.show = true;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
}
},
// intervalHandle(startTime, endTime) {
// // 时间差
// const timeLag = intervalTime(startTime, endTime);
// console.log(timeLag);
// if (!this.timer) {
// this.count = timeLag;
// this.show = false;
// this.timer = setInterval(() => {
// if (this.count > 0 && this.count <= timeLag) {
// this.count--;
// } else {
// this.show = true;
// clearInterval(this.timer);
// this.timer = null;
// }
// }, 1000);
// }
// },
// 获取手机验证短信
getCode() {
if (!this.registerForm.phone) {
return this.$message.error("请输入手机号");
}
// 接口获得验证码
registerCode({
phone: this.registerForm.phone,
}).then((res) => {
console.log(res);
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.$message.success(res.data.message);
// getCode() {
// if (!this.registerForm.phone) {
// return this.$message.error("请输入手机号");
// }
// // 接口获得验证码
// registerCode({
// phone: this.registerForm.phone,
// }).then((res) => {
// console.log(res);
// if (res.data.code != 200) {
// return this.$message.error(res.data.message);
// }
// this.$message.success(res.data.message);
window.localStorage.setItem(
"register_code_time",
res.data.data.now * 1000
);
window.localStorage.setItem(
"register_code_phone",
this.registerForm.phone
);
this.intervalHandle(new Date(), res.data.data.now * 1000);
});
},
// window.localStorage.setItem(
// "register_code_time",
// res.data.data.now * 1000
// );
// window.localStorage.setItem(
// "register_code_phone",
// this.registerForm.phone
// );
// this.intervalHandle(new Date(), res.data.data.now * 1000);
// });
// },
// 表单验证
submitForm() {
......@@ -248,7 +248,7 @@ export default {
if (!valid) return;
setAccountInfo({
phone: this.registerForm.phone,
code: this.registerForm.code,
// code: this.registerForm.code,
password: this.registerForm.password,
rq_password: this.registerForm.rq_password,
}).then((res) => {
......
......@@ -49,7 +49,10 @@
import Cookie from "js-cookie";
import Header from "@/components/index/Header.vue";
import Footer from "@/components/index/Footer.vue";
import {
getCamInfo
} from "r/index/login";
export default {
name: "recruit",
data() {
......@@ -59,6 +62,25 @@ export default {
},
created() {
this.info = this.$store.state.info;
let code =this.$store.state.indexIdentity
getCamInfo(code).then((res) => {
console.log(res, '33333')
// if (res.data.code == 400034 ||
// res.data.code == 400035 ||
// res.data.code == 400001 ||
// res.data.code == 400002 ||
// res.data.code == 400003) {
// Notification({
// message: res.data.message,
// duration: 1000,
// });
// cb && cb(false);
return false;
// }
})
},
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