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

111

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