Commit 279944cb authored by wuwangwolihui's avatar wuwangwolihui

营地2.0-整合修改

parent 6ddceae6
...@@ -69,12 +69,12 @@ ...@@ -69,12 +69,12 @@
}, },
// 下拉菜单操作 // 下拉菜单操作
handleCommand(command) { handleCommand(command) {
if (command == 2) {
this.logout();
}
if (command == 1) { if (command == 1) {
this.toCenter(); this.toCenter();
} }
if (command == 2) {
this.logout();
}
}, },
// 去个人中心 // 去个人中心
toCenter() { toCenter() {
...@@ -107,42 +107,13 @@ ...@@ -107,42 +107,13 @@
closeOnClickModal: false, closeOnClickModal: false,
type: "warning", type: "warning",
}).catch((err) => err); }).catch((err) => err);
if (confirmResult !== "confirm") if (confirmResult !== "confirm") {
return this.$message.info("您取消了退出"); return this.$message.info("您取消了退出");
// 清除本地缓存除了大学logo }
if (this.type == 1) { // 清除本地缓存 除了特殊缓存
// 清除所有缓存 this.$store.commit('removeLocalStorage');
window.localStorage.clear(); if (this.type == 2) {
this.isLogin = false;
} else if (this.type == 2) {
// this.reload()
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.removeItem("doubt_code" + code);
window.localStorage.removeItem("doubt_info" + code);
window.localStorage.removeItem("doubt_check" + code);
window.localStorage.removeItem("camp_name" + code);
window.localStorage.removeItem("system_color" + code);
window.localStorage.removeItem("system_logo" + code);
window.localStorage.removeItem("has_amount" + code);
window.localStorage.removeItem("campsite_id" + code);
window.localStorage.removeItem("order_no" + code);
window.localStorage.removeItem("campindex_type" + code);
window.localStorage.removeItem("bk_pic" + code);
window.localStorage.removeItem("examine_status" + code);
window.localStorage.removeItem("examine_reason" + code);
window.localStorage.removeItem("sign_up_file_18355151517" + window.localStorage.getItem("phone" + code) + code);
window.localStorage.removeItem("schoolName" + code);
window.localStorage.removeItem("camp_statement" + code);
window.localStorage.removeItem("transfer_account" + code);
window.localStorage.removeItem("payee" + code);
window.localStorage.removeItem("bank_first" + code);
window.localStorage.removeItem("bank_idcard" + code);
window.localStorage.removeItem("bank_info" + window.localStorage.getItem("phone" + code) + code);
window.localStorage.removeItem("index-token-all");
window.localStorage.removeItem("index-phone-all");
this.isLogin = false;
// this.reload()
if (this.$store.state.human == 1) { if (this.$store.state.human == 1) {
await this.$router.replace({ await this.$router.replace({
path: "/login", path: "/login",
...@@ -154,8 +125,9 @@ ...@@ -154,8 +125,9 @@
await this.$router.replace("/" + code); await this.$router.replace("/" + code);
} }
} }
this.isLogin = false;
this.$message.success("退出成功"); this.$message.success("退出成功");
await logout({}); // await logout({});
}, },
// 鼠标移入事件 // 鼠标移入事件
onMouserEnter(val) { onMouserEnter(val) {
......
...@@ -52,14 +52,12 @@ export default { ...@@ -52,14 +52,12 @@ export default {
"system_logo" + this.$store.state.indexIdentity "system_logo" + this.$store.state.indexIdentity
), ),
isLogin: false, isLogin: false,
phone: window.localStorage.getItem( phone: window.localStorage.getItem("index-phone-all"),
"phone" + this.$store.state.indexIdentity
),
}; };
}, },
created() { created() {
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
this.isLogin = !!localStorage.getItem("index-token" + code); this.isLogin = !!localStorage.getItem("index-token-all");
}, },
methods: { methods: {
toLogin() { toLogin() {
...@@ -97,8 +95,8 @@ export default { ...@@ -97,8 +95,8 @@ export default {
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);
window.localStorage.removeItem("index-token" + code); window.localStorage.removeItem("index-token-all");
window.localStorage.removeItem("phone" + code); window.localStorage.removeItem("index-phone-all");
window.localStorage.removeItem("camp_name" + code); window.localStorage.removeItem("camp_name" + code);
window.localStorage.removeItem("system_color" + code); window.localStorage.removeItem("system_color" + code);
window.localStorage.removeItem("system_logo" + code); window.localStorage.removeItem("system_logo" + code);
...@@ -110,8 +108,8 @@ export default { ...@@ -110,8 +108,8 @@ export default {
window.localStorage.removeItem("examine_status" + code); window.localStorage.removeItem("examine_status" + code);
window.localStorage.removeItem("examine_reason" + code); window.localStorage.removeItem("examine_reason" + code);
window.localStorage.removeItem( window.localStorage.removeItem(
"sign_up_file_18355151517" + "sign_up_file_" +
window.localStorage.getItem("phone" + code) + window.localStorage.getItem("index-phone-all") +
code code
); );
window.localStorage.removeItem("schoolName" + code); window.localStorage.removeItem("schoolName" + code);
...@@ -121,7 +119,7 @@ export default { ...@@ -121,7 +119,7 @@ export default {
window.localStorage.removeItem("bank_first" + code); window.localStorage.removeItem("bank_first" + code);
window.localStorage.removeItem("bank_idcard" + code); window.localStorage.removeItem("bank_idcard" + code);
window.localStorage.removeItem( window.localStorage.removeItem(
"bank_info" + window.localStorage.getItem("phone" + code) + code "bank_info" + window.localStorage.getItem("index-phone-all") + code
); );
this.isLogin = false; this.isLogin = false;
this.reload() this.reload()
......
...@@ -30,9 +30,7 @@ export default { ...@@ -30,9 +30,7 @@ export default {
name: "Header", name: "Header",
data() { data() {
return { return {
phone: window.localStorage.getItem( phone: window.localStorage.getItem("index-phone-all"),
"phone" + this.$store.state.indexIdentity
),
system_logo: window.localStorage.getItem( system_logo: window.localStorage.getItem(
"system_logo" + this.$store.state.indexIdentity "system_logo" + this.$store.state.indexIdentity
), ),
......
<template> <template>
<el-dialog <el-dialog
title="微信支付" title="微信支付"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
...@@ -36,286 +36,287 @@ ...@@ -36,286 +36,287 @@
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
import { getWxConfig } from "r/index/pay"; import {getWxConfig} from "r/index/pay";
import { SERVER_WS_URL } from "config/server"; import {SERVER_WS_URL} from "config/server";
import QRCode from "qrcodejs2"; import QRCode from "qrcodejs2";
export default {
name: "ConfirmSignUp",
props: {
confirmSignUpDialogFu: Boolean,
},
data() {
return {
dialogVisible: this.confirmSignUpDialogFu,
message: "",
isShowqr: 0, // 展示支付二维码
token: "",
websocket: null, //websocket连接
lockReconnect: false, //是否真正建立连接
timeout: 28 * 1000, //30秒一次心跳
timeoutObj: null, //心跳心跳倒计时
serverTimeoutObj: null, //心跳倒计时
timeoutnum: null, //断开 重连倒计时
has_amount: "",
};
},
created() {
this.token = window.localStorage.getItem(
"index-token" + this.$store.state.indexIdentity
);
this.has_amount = window.localStorage.getItem(
"has_amount" + this.$store.state.indexIdentity
);
},
methods: {
async confirm() {
// console.log(SERVER_WS_URL);
let { data: res } = await getWxConfig({
pay_type: 3,
});
// console.log(res);
if (res.code !== 200) { export default {
if (res.code == 400801) { name: "ConfirmSignUp",
return this.cancelBtn(); props: {
} confirmSignUpDialogFu: Boolean,
this.isShowqr = 2;
this.message = res.message;
return;
}
this.isShowqr = 1;
console.log(res.code_url);
this.createQrCode(res.code_url);
//初始化 websocket 链接
this.initWebSocket();
}, },
updateCode() { data() {
this.confirm(); return {
dialogVisible: this.confirmSignUpDialogFu,
message: "",
isShowqr: 0, // 展示支付二维码
token: "",
websocket: null, //websocket连接
lockReconnect: false, //是否真正建立连接
timeout: 28 * 1000, //30秒一次心跳
timeoutObj: null, //心跳心跳倒计时
serverTimeoutObj: null, //心跳倒计时
timeoutnum: null, //断开 重连倒计时
has_amount: "",
};
}, },
createQrCode(qrCode) { created() {
this.removeQr(); this.token = window.localStorage.getItem("index-token-all");
var qrcode = new QRCode(this.$refs.qrCodeUrl, { this.has_amount = window.localStorage.getItem(
text: qrCode, // 需要转换为二维码的内容 "has_amount" + this.$store.state.indexIdentity
width: 140, );
height: 140,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H,
});
}, },
// 删除二维码img标签 methods: {
removeQr() { async confirm() {
if (this.$refs.qrCodeUrl) { // console.log(SERVER_WS_URL);
// 获取 父 标签下的所有子节点 let {data: res} = await getWxConfig({
let pObjs = this.$refs.qrCodeUrl.childNodes; pay_type: 3,
// console.log(pObjs); });
for (var i = pObjs.length - 1; i >= 0; i--) { // console.log(res);
// 一定要倒序,正序是删不干净的,可自行尝试
this.$refs.qrCodeUrl.removeChild(pObjs[i]); if (res.code !== 200) {
if (res.code == 400801) {
return this.cancelBtn();
}
this.isShowqr = 2;
this.message = res.message;
return;
} }
} this.isShowqr = 1;
}, console.log(res.code_url);
// 确认,关闭弹框,修改父组件的值 this.createQrCode(res.code_url);
cancelBtn() { //初始化 websocket 链接
// 关闭时,删除二维码img标签 this.initWebSocket();
this.removeQr(); },
this.closeWebSocket(); updateCode() {
this.dialogVisible = false; this.confirm();
this.$emit("closeCFSUDialog", this.dialogVisible, false); },
}, createQrCode(qrCode) {
// 初始化 webSocket this.removeQr();
initWebSocket() { var qrcode = new QRCode(this.$refs.qrCodeUrl, {
if (typeof WebSocket == "undefined") { text: qrCode, // 需要转换为二维码的内容
this.$message({ width: 140,
showClose: true, height: 140,
message: "您的浏览器不支持WebSocket", colorDark: "#000000",
type: "error", colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H,
}); });
} else if (!this.dialogVisible) { },
return; // 删除二维码img标签
} else { removeQr() {
let code = this.$store.state.indexIdentity; if (this.$refs.qrCodeUrl) {
if (!this.token || this.token == "") { // 获取 父 标签下的所有子节点
this.token = window.localStorage.getItem("index-token" + code); let pObjs = this.$refs.qrCodeUrl.childNodes;
// console.log(pObjs);
for (var i = pObjs.length - 1; i >= 0; i--) {
// 一定要倒序,正序是删不干净的,可自行尝试
this.$refs.qrCodeUrl.removeChild(pObjs[i]);
}
} }
let token = this.token; },
const wssURL = SERVER_WS_URL + "/order?token=" + token + "&channel=pc"; // 确认,关闭弹框,修改父组件的值
this.websocket = new WebSocket(wssURL); cancelBtn() {
// console.log(this.websocket) // 关闭时,删除二维码img标签
// 连接发生错误的回调方法 this.removeQr();
this.websocket.onerror = this.websocketOnerror; this.closeWebSocket();
// 连接成功建立的回调方法 this.dialogVisible = false;
this.websocket.onopen = this.websocketOnopen; this.$emit("closeCFSUDialog", this.dialogVisible, false);
// 接收到消息的回调方法 },
this.websocket.onmessage = this.websocketOnmessage; // 初始化 webSocket
// 连接关闭的回调方法 initWebSocket() {
this.websocket.onclose = this.websocketOnclose; if (typeof WebSocket == "undefined") {
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。 this.$message({
this.websocket.onbeforeunload = this.websocketOnbeforeunload; showClose: true,
// this.websocketSend(); message: "您的浏览器不支持WebSocket",
// setTimeout(() => { type: "error",
// this.websocketSend(); });
// }, 1000); } else if (!this.dialogVisible) {
} return;
},
reconnect() {
//重新连接
let that = this;
if (!that.dialogVisible) {
return;
}
if (that.lockReconnect) {
return;
}
that.lockReconnect = true;
//没连接上会一直重连,设置延迟避免请求过多
that.timeoutnum && clearTimeout(that.timeoutnum);
that.timeoutnum = setTimeout(function () {
//新连接
that.initWebSocket();
that.lockReconnect = false;
}, 5000);
},
reset() {
//重置心跳
let that = this;
//清除时间
clearTimeout(that.timeoutObj);
clearTimeout(that.serverTimeoutObj);
//重启心跳
that.start();
},
start() {
//开启心跳
let self = this;
self.timeoutObj && clearTimeout(self.timeoutObj);
self.serverTimeoutObj && clearTimeout(self.serverTimeoutObj);
self.timeoutObj = setTimeout(function () {
//这里发送一个心跳,后端收到后,返回一个心跳消息,
if (self.websocket.readyState == 1) {
//如果连接正常
self.websocket.send("heartCheck");
} else { } else {
//否则重连 let code = this.$store.state.indexIdentity;
self.reconnect(); if (!this.token || this.token == "") {
this.token = window.localStorage.getItem("index-token-all");
}
let token = this.token;
const wssURL = SERVER_WS_URL + "/order?token=" + token + "&channel=pc";
this.websocket = new WebSocket(wssURL);
// console.log(this.websocket)
// 连接发生错误的回调方法
this.websocket.onerror = this.websocketOnerror;
// 连接成功建立的回调方法
this.websocket.onopen = this.websocketOnopen;
// 接收到消息的回调方法
this.websocket.onmessage = this.websocketOnmessage;
// 连接关闭的回调方法
this.websocket.onclose = this.websocketOnclose;
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
this.websocket.onbeforeunload = this.websocketOnbeforeunload;
// this.websocketSend();
// setTimeout(() => {
// this.websocketSend();
// }, 1000);
} }
self.serverTimeoutObj = setTimeout(function () { },
//超时关闭 reconnect() {
self.websocket.close(); //重新连接
let that = this;
if (!that.dialogVisible) {
return;
}
if (that.lockReconnect) {
return;
}
that.lockReconnect = true;
//没连接上会一直重连,设置延迟避免请求过多
that.timeoutnum && clearTimeout(that.timeoutnum);
that.timeoutnum = setTimeout(function () {
//新连接
that.initWebSocket();
that.lockReconnect = false;
}, 5000);
},
reset() {
//重置心跳
let that = this;
//清除时间
clearTimeout(that.timeoutObj);
clearTimeout(that.serverTimeoutObj);
//重启心跳
that.start();
},
start() {
//开启心跳
let self = this;
self.timeoutObj && clearTimeout(self.timeoutObj);
self.serverTimeoutObj && clearTimeout(self.serverTimeoutObj);
self.timeoutObj = setTimeout(function () {
//这里发送一个心跳,后端收到后,返回一个心跳消息,
if (self.websocket.readyState == 1) {
//如果连接正常
self.websocket.send("heartCheck");
} else {
//否则重连
self.reconnect();
}
self.serverTimeoutObj = setTimeout(function () {
//超时关闭
self.websocket.close();
}, self.timeout);
}, self.timeout); }, self.timeout);
}, self.timeout); },
}, // 连接发生错误的回调方法
// 连接发生错误的回调方法 websocketOnerror() {
websocketOnerror() { this.$message.error("WebSocket连接发生错误");
this.$message.error("WebSocket连接发生错误"); //重连
//重连 this.reconnect();
this.reconnect(); },
}, // 连接成功建立的回调方法
// 连接成功建立的回调方法 websocketOnopen() {
websocketOnopen() { this.websocketSend();
this.websocketSend(); // console.log("连接成功建立的回调方法");
// console.log("连接成功建立的回调方法"); //开启心跳
//开启心跳 this.start();
this.start(); },
}, websocketSend() {
websocketSend() { //数据发送
//数据发送 let sendData = {
let sendData = { order_no: window.localStorage.getItem(
order_no: window.localStorage.getItem( "order_no" + this.$store.state.indexIdentity
"order_no" + this.$store.state.indexIdentity ),
), cam_id: window.localStorage.getItem(
cam_id: window.localStorage.getItem( "campsite_id" + this.$store.state.indexIdentity
"campsite_id" + this.$store.state.indexIdentity ),
), token: this.token,
token: this.token, };
}; this.websocket.send(JSON.stringify(sendData));
this.websocket.send(JSON.stringify(sendData)); },
}, // 接收到消息的回调方法
// 接收到消息的回调方法 websocketOnmessage(event) {
websocketOnmessage(event) { console.log(event, "event");
console.log(event, "event"); if (event.data !== "Opened") {
if (event.data !== "Opened") { //const data = JSON.parse(event.data);
//const data = JSON.parse(event.data); // console.log("接收到消息的回调方法", event.data);
// console.log("接收到消息的回调方法", event.data); if (event.data == 1) {
if (event.data == 1) { this.lockReconnect = false;
this.lockReconnect = false;
this.closeWebSocket(); this.closeWebSocket();
this.dialogVisible = false; this.dialogVisible = false;
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);
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
this.$router.push("/signUp/success?code=" + code); this.$router.push("/signUp/success?code=" + code);
} else { } else {
//收到服务器信息,心跳重置 //收到服务器信息,心跳重置
this.reset(); this.reset();
}
} }
} },
}, // 连接关闭的回调方法
// 连接关闭的回调方法 websocketOnclose() {
websocketOnclose() { // console.log("连接关闭的回调方法");
// console.log("连接关闭的回调方法"); //重连
//重连 this.reconnect();
this.reconnect(); },
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常
websocketOnbeforeunload() {
this.closeWebSocket();
// console.log('监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常');
},
// 关闭WebSocket连接
closeWebSocket() {
this.websocket && this.websocket.close();
},
}, },
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常 // 页面注销时候调用 避免连接错误
websocketOnbeforeunload() { // destroyed() {
this.closeWebSocket(); // this.closeWebSocket();
// console.log('监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常'); // },
watch: {
confirmSignUpDialogFu() {
this.dialogVisible = this.confirmSignUpDialogFu;
},
}, },
// 关闭WebSocket连接 };
closeWebSocket() {
this.websocket && this.websocket.close();
},
},
// 页面注销时候调用 避免连接错误
// destroyed() {
// this.closeWebSocket();
// },
watch: {
confirmSignUpDialogFu() {
this.dialogVisible = this.confirmSignUpDialogFu;
},
},
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.btn { .btn {
text-align: center; text-align: center;
padding-bottom: 24px; padding-bottom: 24px;
} }
.el-button {
width: 200px;
height: 50px;
background: var(--color);
border-radius: 4px;
opacity: 0.8;
line-height: 50px;
text-align: center;
color: #fff;
font-size: 16px;
padding: 0;
}
.pay_code {
text-align: center;
.money { .el-button {
font-size: 20px; width: 200px;
font-weight: 500; height: 50px;
color: var(--color); background: var(--color);
line-height: 24px; border-radius: 4px;
opacity: 0.8;
line-height: 50px;
text-align: center;
color: #fff;
font-size: 16px;
padding: 0;
} }
}
.img_qr { .pay_code {
width: 140px; text-align: center;
height: 140px;
padding: 10px; .money {
// border: 1px solid #000; font-size: 20px;
margin: 0 auto; font-weight: 500;
} color: var(--color);
line-height: 24px;
}
}
.img_qr {
width: 140px;
height: 140px;
padding: 10px;
// border: 1px solid #000;
margin: 0 auto;
}
</style> </style>
...@@ -33,9 +33,7 @@ export default { ...@@ -33,9 +33,7 @@ export default {
name: "Header", name: "Header",
data() { data() {
return { return {
phone: window.localStorage.getItem( phone: window.localStorage.getItem("index-phone-all"),
"phone" + this.$store.state.indexIdentity
),
system_logo: window.localStorage.getItem( system_logo: window.localStorage.getItem(
"system_logo" + this.$store.state.indexIdentity "system_logo" + this.$store.state.indexIdentity
), ),
......
...@@ -8,218 +8,214 @@ ...@@ -8,218 +8,214 @@
<!-- {{!this.examine_status == 1}} --> <!-- {{!this.examine_status == 1}} -->
<div v-if="!this.examine_status == 1||!this.examine_status == 2">同学你好,你的报名资料已提交</div> <div v-if="!this.examine_status == 1||!this.examine_status == 2">同学你好,你的报名资料已提交</div>
<div v-if="!this.examine_status == 1||!this.examine_status == 2"> <div v-if="!this.examine_status == 1||!this.examine_status == 2">
请等待工作人员审核,审核结果将于24小时内发布,请留意网站。 请等待工作人员审核,审核结果将于24小时内发布,请留意网站。
</div> </div>
<div v-if="this.examine_status == 1"> <div v-if="this.examine_status == 1">
同学你好,你的材料已经通过审核,请点击“下一步”完成报名 同学你好,你的材料已经通过审核,请点击“下一步”完成报名
</div> </div>
<div v-if="this.examine_status == 2">同学你好,你的申请材料未能通过审核。原因是:{{ this.examine_reason }}</div> <div v-if="this.examine_status == 2">同学你好,你的申请材料未能通过审核。原因是:{{ this.examine_reason }}</div>
<div class="btn" v-show="this.examine_status == 2"> <div class="btn" v-show="this.examine_status == 2">
<el-button @click="Lasting()">上一步 </el-button> <el-button @click="Lasting()">上一步</el-button>
</div> </div>
<div class="btn" v-show="this.examine_status == 1"> <div class="btn" v-show="this.examine_status == 1">
<el-button @click="paying()">下一步 </el-button> <el-button @click="paying()">下一步</el-button>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
import { signUpInit, signBack } from "r/index/signUp"; import {signUpInit, signBack} from "r/index/signUp";
export default {
name: "Pass",
data() {
return {
examine_status: window.localStorage.getItem(
"examine_status" + this.$store.state.indexIdentity
),
examine_reason: window.localStorage.getItem(
"examine_reason" + this.$store.state.indexIdentity
),
signBackStatus: "",
status_val: "",
status: "",
};
},
created() {
this.signUpInit(this.status_val);
},
watch: {}, export default {
methods: { name: "Pass",
Lasting() { data() {
signBack({}).then((res) => { return {
console.log(res, "signBack"); examine_status: window.localStorage.getItem(
if (res.data.code != 200) { "examine_status" + this.$store.state.indexIdentity
return this.$message.error(res.data.message); ),
} examine_reason: window.localStorage.getItem(
// console.log(res.data.status, "signBack.status"); "examine_reason" + this.$store.state.indexIdentity
this.signBackStatus = res.data.status; ),
this.$emit("getstatus", res.data.status); signBackStatus: "",
this.$message.success(res.data.message); status_val: "",
}); status: "",
};
}, },
paying() { created() {
this.$emit("is_next", 1); this.signUpInit(this.status_val);
// console.log(is_next);
}, },
signUpInit(status_val) {
// console.log(status_val, "11111");
// console.log(isNexts, "2222"); watch: {},
signUpInit({}).then((res) => { methods: {
console.log(res, "signUpInit"); Lasting() {
if (res.data.code != 200) { signBack({}).then((res) => {
if (res.data.code == 400001) { console.log(res, "signBack");
this.status = 6; if (res.data.code != 200) {
this.type = "success"; return this.$message.error(res.data.message);
} }
return this.$message.error(res.data.message); // console.log(res.data.status, "signBack.status");
} this.signBackStatus = res.data.status;
this.status = res.data.status; this.$emit("getstatus", res.data.status);
console.log(this.status, "11111"); this.$message.success(res.data.message);
// 点击下一步传值给status,更新 });
if (status_val != null) { },
this.status = status_val; paying() {
} else { this.$emit("is_next", 1);
this.status = res.data.status; // console.log(is_next);
// console.log(this.status, "11111"); },
} signUpInit(status_val) {
// doubt_code,doubt_info,doubt_check。0为不填写,1为填写 // console.log(status_val, "11111");
if (this.status == 0) {
this.type = "examInfo"; // console.log(isNexts, "2222");
} else if (this.status == 1) { signUpInit({}).then((res) => {
// 是否填写邀请码 console.log(res, "signUpInit");
if (this.doubt_code == 0) { if (res.data.code != 200) {
this.type = "referInfo"; if (res.data.code == 400001) {
this.status = 2; this.status = 6;
} else { this.type = "success";
this.type = "invitation"; }
this.status = 1; return this.$message.error(res.data.message);
} }
} else if (this.status == 2) { this.status = res.data.status;
console.log(this.doubt_info, "doubt_info"); console.log(this.status, "11111");
// 是否填写个人资料 // 点击下一步传值给status,更新
if (this.doubt_info == 0) { if (status_val != null) {
this.type = "check"; this.status = status_val;
this.status = 3;
} else { } else {
this.type = "referInfo"; this.status = res.data.status;
this.status = 2; // console.log(this.status, "11111");
} }
} else if (this.status == 3) { // doubt_code,doubt_info,doubt_check。0为不填写,1为填写
// 是否审核个人资料 if (this.status == 0) {
if (this.doubt_check == 0) { this.type = "examInfo";
this.type = "pay"; } else if (this.status == 1) {
this.status = 4; // 是否填写邀请码
} else { if (this.doubt_code == 0) {
this.type = "referInfo";
this.status = 2;
} else {
this.type = "invitation";
this.status = 1;
}
} else if (this.status == 2) {
console.log(this.doubt_info, "doubt_info");
// 是否填写个人资料
if (this.doubt_info == 0) {
this.type = "check";
this.status = 3;
} else {
this.type = "referInfo";
this.status = 2;
}
} else if (this.status == 3) {
// 是否审核个人资料
if (this.doubt_check == 0) {
this.type = "pay";
this.status = 4;
} else {
this.type = "check";
this.status = 3;
}
} else if (this.status == 4) {
this.type = "check"; this.type = "check";
this.status = 3; this.status = 3;
} // console.log(this.status, "this.status ");
} else if (this.status == 4) { // console.log(this.isNexts ,'this.isNexts ')
this.type = "check";
this.status = 3;
// console.log(this.status, "this.status ");
// console.log(this.isNexts ,'this.isNexts ')
if (this.isNexts == 1) { if (this.isNexts == 1) {
// console.log(11111); // console.log(11111);
if (res.data.examine_status == 1) { if (res.data.examine_status == 1) {
console.log(333); console.log(333);
this.type = "pay"; this.type = "pay";
this.status = 4; this.status = 4;
} else if (res.data.examine_status == 2) { } else if (res.data.examine_status == 2) {
this.type = "referInfo"; this.type = "referInfo";
this.status = 2; this.status = 2;
// return this.$message.error(res.data.examine_reason); // return this.$message.error(res.data.examine_reason);
}
} }
} else if (this.status == 5) {
this.type = "pay";
} else if (this.status == 6) {
this.type = "success";
} }
} else if (this.status == 5) { this.$emit("getStatus", this.type);
this.type = "pay";
} else if (this.status == 6) {
this.type = "success";
}
this.$emit("getStatus", this.type);
const code = this.$store.state.indexIdentity;
//订单支付金额
window.localStorage.setItem("has_amount" + code, res.data.has_amount);
window.localStorage.setItem("campsite_id" + code, res.data.campsite_id);
window.localStorage.setItem("order_no" + code, res.data.order_no);
this.examine_status = res.data.examine_status;
window.localStorage.setItem(
"examine_status" + code,
res.data.examine_status
); //返回错误原因
window.localStorage.setItem(
"examine_reason" + code,
res.data.examine_reason
); //资料审核状态
// window.localStorage.setItem("achievement_path", res.data.achievement_path); //上传的图片
const aPath = res.data.achievement_path;
if (aPath) {
let arr = aPath.split(",");
let fileList = [];
fileList = arr.map((item) => {
let obj = {
url: item,
};
return obj;
});
const code = this.$store.state.indexIdentity; const code = this.$store.state.indexIdentity;
window.localStorage.setItem( //订单支付金额
"sign_up_file_" + window.localStorage.getItem("phone" + code), window.localStorage.setItem("has_amount" + code, res.data.has_amount);
JSON.stringify(fileList) window.localStorage.setItem("campsite_id" + code, res.data.campsite_id);
); //上传的图片 window.localStorage.setItem("order_no" + code, res.data.order_no);
} this.examine_status = res.data.examine_status;
}); window.localStorage.setItem("examine_status" + code, res.data.examine_status); //返回错误原因
window.localStorage.setItem("examine_reason" + code, res.data.examine_reason); //资料审核状态
const aPath = res.data.achievement_path;
if (aPath) {
let arr = aPath.split(",");
let fileList = [];
fileList = arr.map((item) => {
let obj = {
url: item,
};
return obj;
});
const code = this.$store.state.indexIdentity;
window.localStorage.setItem("sign_up_file_" + window.localStorage.getItem("index-phone-all"), JSON.stringify(fileList)); //上传的图片
}
});
},
}, },
}, };
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "a/scss/btn"; @import "a/scss/btn";
@import "a/scss/index"; @import "a/scss/index";
@import "a/style"; @import "a/style";
@font-face {
font-family: "icomoon"; @font-face {
src: url("../../../assets/fonts/icomoon.eot?dcunb6"); font-family: "icomoon";
src: url("../../../assets/fonts/icomoon.eot?dcunb6#iefix") src: url("../../../assets/fonts/icomoon.eot?dcunb6");
format("embedded-opentype"), src: url("../../../assets/fonts/icomoon.eot?dcunb6#iefix") format("embedded-opentype"),
url("../../../assets/fonts/icomoon.ttf?dcunb6") format("truetype"), url("../../../assets/fonts/icomoon.ttf?dcunb6") format("truetype"),
url("../../../assets/fonts/icomoon.woff?dcunb6") format("woff"), url("../../../assets/fonts/icomoon.woff?dcunb6") format("woff"),
url("../../../assets/fonts/icomoon.svg?dcunb6#icomoon") format("svg"); url("../../../assets/fonts/icomoon.svg?dcunb6#icomoon") format("svg");
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
font-display: block; font-display: block;
} }
.btn { .btn {
padding-bottom: 0 !important; padding-bottom: 0 !important;
} }
.pass {
padding: 0 56px 65px 56px; .pass {
.p_content { padding: 0 56px 65px 56px;
i {
font-size: 100px; .p_content {
color: var(--color); i {
} font-size: 100px;
div { color: var(--color);
text-align: center; }
font-size: 16px;
font-weight: 500; div {
color: #666666; text-align: center;
line-height: 18px; font-size: 16px;
} font-weight: 500;
:nth-child(2) { color: #666666;
margin: 24px 0; line-height: 18px;
} }
:nth-child(3) {
margin: 0 0 50px 0; :nth-child(2) {
margin: 24px 0;
}
:nth-child(3) {
margin: 0 0 50px 0;
}
} }
} }
}
</style> </style>
<template> <template>
<div class="paying"> <div class="paying">
<div>
<span class="pay_titile">报名信息</span>
<div class="pay_top">
<div>营地名称:{{ camp_name }}</div>
<div>真实姓名:{{ personalInfo.name }}</div>
<div>身份证号:{{ personalInfo.id_card }}</div>
<!-- <div>缴费时间:{{ personalInfo.create_time }}</div> -->
<div>报名费用: {{ has_amount }}</div>
</div>
<div class="line"></div>
<div class="pay-money flex">
<div> <div>
报名费用 :<span>{{ has_amount }} </span> <span class="pay_titile">报名信息</span>
</div> <div class="pay_top">
<div class="btn"> <div>营地名称:{{ camp_name }}</div>
<el-button v-if="$store.state.human == 1" @click="paying()" <div>真实姓名:{{ personalInfo.name }}</div>
>上传缴费截图 <div>身份证号:{{ personalInfo.id_card }}</div>
</el-button> <!-- <div>缴费时间:{{ personalInfo.create_time }}</div> -->
<el-button v-else @click="paying()">立即支付 </el-button> <div>报名费用: {{ has_amount }}</div>
</div> </div>
</div> <div class="line"></div>
<div class="pay-money flex">
<div>
报名费用 :<span>{{ has_amount }} </span>
</div>
<div class="btn">
<el-button v-if="$store.state.human == 1" @click="paying()"
>上传缴费截图
</el-button>
<el-button v-else @click="paying()">立即支付</el-button>
</div>
</div>
<div> <div>
<!-- 清华大学人文学院 “中国现当代文学经典研读”学分课程 --> <!-- 清华大学人文学院 “中国现当代文学经典研读”学分课程 -->
<div <div
class="pay_bottom" class="pay_bottom"
v-if=" v-if="
$store.state.human == 1 && $store.state.human == 1 &&
$store.state.indexIdentity == '6c6884d1c83040ee8ca17736a8d67b93' $store.state.indexIdentity == '6c6884d1c83040ee8ca17736a8d67b93'
" "
> >
<div class="cc"><span class="starIcon">*</span>注意事项:</div> <div class="cc"><span class="starIcon">*</span>注意事项:</div>
<div> <div>
请参照清华大学人文学院“中国现当代文学经典研读”学分课程简章中缴费方式。 请参照清华大学人文学院“中国现当代文学经典研读”学分课程简章中缴费方式。
<span class="cc">汇款或扫码支付后请务必保留付款截图</span> <span class="cc">汇款或扫码支付后请务必保留付款截图</span>
</div> </div>
<div> <div>
1、银行转账汇款时,请在附言/用途栏中注明 "21069363022 +学员姓名"。 1、银行转账汇款时,请在附言/用途栏中注明 "21069363022 +学员姓名"。
</div> </div>
<div>2、扫码支付时,请在备注栏中注明“学员姓名”。</div> <div>2、扫码支付时,请在备注栏中注明“学员姓名”。</div>
<div>3、未满18岁的学员,缴费请由家长支付。</div> <div>3、未满18岁的学员,缴费请由家长支付。</div>
</div> </div>
<!-- 清华历史课“中国历史通解”(第二期)学分课程 --> <!-- 清华历史课“中国历史通解”(第二期)学分课程 -->
<div <div
class="pay_bottom" class="pay_bottom"
v-else-if=" v-else-if="
$store.state.human == 1 && $store.state.human == 1 &&
$store.state.indexIdentity == '479205eb2dbf48fcbbeaee710a9b9d24' $store.state.indexIdentity == '479205eb2dbf48fcbbeaee710a9b9d24'
" "
> >
<div class="cc"><span class="starIcon">*</span>注意事项:</div> <div class="cc"><span class="starIcon">*</span>注意事项:</div>
<div>1、支付成功后请务必保留付款截图。</div> <div>1、支付成功后请务必保留付款截图。</div>
<div> <div>
2、银行转账汇款时,请在附言/用途栏中注明“22069363005+学员姓名”。 2、银行转账汇款时,请在附言/用途栏中注明“22069363005+学员姓名”。
</div> </div>
<div>3、未满18岁的学员,缴费请由家长支付。</div> <div>3、未满18岁的学员,缴费请由家长支付。</div>
<div class="cc" style="margin-top: 10px"> <div class="cc" style="margin-top: 10px">
<span class="starIcon">*</span>汇款信息: <span class="starIcon">*</span>汇款信息:
</div> </div>
<div>收款单位:清华大学</div> <div>收款单位:清华大学</div>
<div>帐号:0200004509089131550</div> <div>帐号:0200004509089131550</div>
<div>开户行:工行北京分行海淀西区支行</div> <div>开户行:工行北京分行海淀西区支行</div>
<div>附言/用途:请在附言栏中注明“22069363005+学员姓名”</div> <div>附言/用途:请在附言栏中注明“22069363005+学员姓名”</div>
</div>
<div v-else class="pay_bottom">
<div class="cc"><span class="starIcon">*</span>注意事项:</div>
<div>
1、学生支付完成后请不要立即关闭浏览器,等待支付完成返回本页面,以确认支付完成。
</div>
<div>
2、支付确认后,将不能再修改姓名和身份证号,请在支付前核对信息。
</div>
<div>
3、如果在完成支付后,状态许久未更新为“报名成功”,请仔细核查自己支付账号是否已扣费。
</div>
<div>
4、对于多次缴费的学生,除生效一笔之外其他重复支付的费用会在缴费结束阶段统一退费。
</div>
<!-- <div>5、网上缴费如有问题,请致电项目组工作人员:XXX-XXXXXXXXX。</div> -->
</div>
</div>
</div> </div>
<div v-else class="pay_bottom"> <!-- 支付扫码框 -->
<div class="cc"><span class="starIcon">*</span>注意事项:</div> <!-- <el-dialog title="微信支付" :visible.sync="dialogVisible" width="20%">
<div> <div class="pay_code">
1、学生支付完成后请不要立即关闭浏览器,等待支付完成返回本页面,以确认支付完成。 <div class="pay_time">支付剩余时间<span>15分30秒</span></div>
</div> <div>¥150</div>
<div> <div class="pay_img">
2、支付确认后,将不能再修改姓名和身份证号,请在支付前核对信息。 <div class="qrcode" ref="qrCodeUrl"></div>
</div> </div>
<div> <div>请使用<span>微信</span>扫一扫,扫描二维码支付</div>
3、如果在完成支付后,状态许久未更新为“报名成功”,请仔细核查自己支付账号是否已扣费。 <div>手机完成支付后,请等待系统处理,在此之前请勿关闭窗口</div>
</div>
<div>
4、对于多次缴费的学生,除生效一笔之外其他重复支付的费用会在缴费结束阶段统一退费。
</div> </div>
<!-- <div>5、网上缴费如有问题,请致电项目组工作人员:XXX-XXXXXXXXX。</div> --> <span slot="footer" class="dialog-footer">
</div> <div class="btn">
</div> <el-button @click="dialogVisible = false">刷新二维码</el-button>
</div> </div>
<!-- 支付扫码框 --> </span>
<!-- <el-dialog title="微信支付" :visible.sync="dialogVisible" width="20%"> </el-dialog> -->
<div class="pay_code"> <!-- 提示:打开电脑端后不能切换手机端 -->
<div class="pay_time">支付剩余时间<span>15分30秒</span></div> <el-dialog
<div>¥150</div> title="提示"
<div class="pay_img"> :visible.sync="dialogPayingVisible"
<div class="qrcode" ref="qrCodeUrl"></div> width="30%"
</div> :before-close="handleClose"
<div>请使用<span>微信</span>扫一扫,扫描二维码支付</div> >
<div>手机完成支付后,请等待系统处理,在此之前请勿关闭窗口</div> <div class="margin1">
</div> 如您使用手机报名:点击“确认”后将直接发起微信支付,按照指引完成支付即可。
<span slot="footer" class="dialog-footer"> </div>
<div class="btn"> <div class="margin1">
<el-button @click="dialogVisible = false">刷新二维码</el-button> 如您使用电脑报名:点击“确认”后系统将出现支付二维码,使用手机微信或支付宝扫码,按照指引完成支付即可。
</div> </div>
</span> <div>
</el-dialog> --> <div>为保障支付顺利,请注意:</div>
<!-- 提示:打开电脑端后不能切换手机端 --> <div>1、请确保支付账户余额充足。</div>
<el-dialog <div>
title="提示" 2、如因支付失败需再次支付时,务必使用和第一次支付时相同的微信或支付宝账号进行操作。
:visible.sync="dialogPayingVisible" </div>
width="30%" </div>
:before-close="handleClose" <span slot="footer" class="dialog-footer">
>
<div class="margin1">
如您使用手机报名:点击“确认”后将直接发起微信支付,按照指引完成支付即可。
</div>
<div class="margin1">
如您使用电脑报名:点击“确认”后系统将出现支付二维码,使用手机微信或支付宝扫码,按照指引完成支付即可。
</div>
<div>
<div>为保障支付顺利,请注意:</div>
<div>1、请确保支付账户余额充足。</div>
<div>
2、如因支付失败需再次支付时,务必使用和第一次支付时相同的微信或支付宝账号进行操作。
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogPayingVisible = false">取 消</el-button> <el-button @click="dialogPayingVisible = false">取 消</el-button>
<el-button type="primary" @click="toPaying">确 定</el-button> <el-button type="primary" @click="toPaying">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<!-- 微信支付宝2选1 --> <!-- 微信支付宝2选1 -->
<el-dialog <el-dialog
title="支付方式" title="支付方式"
:visible.sync="dialogChoose" :visible.sync="dialogChoose"
width="600px" width="600px"
:before-close="handleClose" :before-close="handleClose"
> >
<div class="choose"> <div class="choose">
<div class="flex img_choose"> <div class="flex img_choose">
<img <img
src="../../../assets/img/paying/weichat.png" src="../../../assets/img/paying/weichat.png"
alt="" alt=""
@click="toWeichat" @click="toWeichat"
/> />
<img <img
src="../../../assets/img/paying/paybao.png" src="../../../assets/img/paying/paybao.png"
alt="" alt=""
@click="toPaybao" @click="toPaybao"
/> />
</div> </div>
<div class="text_choose">请选择支付方式</div> <div class="text_choose">请选择支付方式</div>
</div> </div>
</el-dialog> </el-dialog>
<!-- 微信支付 --> <!-- 微信支付 -->
<confirm-sign-up <confirm-sign-up
:confirmSignUpDialogFu="confirmSignUpDialogFu" :confirmSignUpDialogFu="confirmSignUpDialogFu"
@closeCFSUDialog="closeCFSUDialog" @closeCFSUDialog="closeCFSUDialog"
></confirm-sign-up> ></confirm-sign-up>
<!-- 上传付款材料 --> <!-- 上传付款材料 -->
<el-dialog <el-dialog
title="银行卡支付" title="银行卡支付"
:visible.sync="bankDialogVisible" :visible.sync="bankDialogVisible"
width="30%" width="30%"
:before-close="handleClose" :before-close="handleClose"
> >
<div>收款单位:{{ payee }}</div> <div>收款单位:{{ payee }}</div>
<div>账号:{{ bank_idcard }}</div> <div>账号:{{ bank_idcard }}</div>
<div>开户行:{{ bank_first }}</div> <div>开户行:{{ bank_first }}</div>
<div>上传转账截图</div> <div>上传转账截图</div>
<div class="image_add"> <div class="image_add">
<div class="image_in"> <div class="image_in">
<el-upload <el-upload
:class="{ hide: hideUpload }" :class="{ hide: hideUpload }"
ref="imgUrl" ref="imgUrl"
name="multipartFile" name="multipartFile"
list-type="picture-card" list-type="picture-card"
:disabled="isUploading || fileList.length >= 1" :disabled="isUploading || fileList.length >= 1"
action="#" action="#"
accept=".jpg,.jpeg,.png" accept=".jpg,.jpeg,.png"
:limit="1" :limit="1"
:file-list="fileList" :file-list="fileList"
:before-upload="beforeAvatarUpload" :before-upload="beforeAvatarUpload"
:on-progress="handleUploadProgress" :on-progress="handleUploadProgress"
:on-success="uploadSuccess" :on-success="uploadSuccess"
:http-request="uploadPicture" :http-request="uploadPicture"
> >
<div slot="file" slot-scope="{ file }"> <div slot="file" slot-scope="{ file }">
<div v-for="(item, idx) in fileList" :key="idx"> <div v-for="(item, idx) in fileList" :key="idx">
<img <img
class="el-upload-list__item-thumbnail" class="el-upload-list__item-thumbnail"
:src="file.url" :src="file.url"
alt="" alt=""
/> />
<span class="el-upload-list__item-actions"> <span class="el-upload-list__item-actions">
<span <span
class="el-upload-list__item-preview" class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)" @click="handlePictureCardPreview(file)"
> >
<i class="el-icon-zoom-in"></i> <i class="el-icon-zoom-in"></i>
</span> </span>
<span <span
v-if="!disabled" v-if="!disabled"
class="el-upload-list__item-delete" class="el-upload-list__item-delete"
@click="handleDownload(file)" @click="handleDownload(file)"
> >
<i class="el-icon-download"></i> <i class="el-icon-download"></i>
</span> </span>
<span <span
v-if="!disabled" v-if="!disabled"
class="el-upload-list__item-delete" class="el-upload-list__item-delete"
@click="handleRemove(file)" @click="handleRemove(file)"
> >
<i class="el-icon-delete"></i> <i class="el-icon-delete"></i>
</span> </span>
</span> </span>
</div> </div>
</div> </div>
<i style="font-size: 44px" class="el-icon-circle-plus"> </i> <i style="font-size: 44px" class="el-icon-circle-plus"> </i>
</el-upload> </el-upload>
</div> </div>
<el-dialog :visible.sync="dialogVisible"> <el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="resultPicture" alt="" /> <img width="100%" :src="resultPicture" alt=""/>
</el-dialog> </el-dialog>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="bankDialogVisible = false">取 消</el-button> <el-button @click="bankDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="uploadConfirm">确 定</el-button> <el-button type="primary" @click="uploadConfirm">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
import ConfirmSignUp from "c/index/SignUp/ConfirmSignUp"; import ConfirmSignUp from "c/index/SignUp/ConfirmSignUp";
import { SERVER_WS_URL } from "@/config/server"; import {SERVER_WS_URL} from "@/config/server";
import { import {
signUpInit, signUpInit,
getAccount, getAccount,
getBankInfoOss, getBankInfoOss,
delPayingPic, delPayingPic,
} from "r/index/signUp"; } from "r/index/signUp";
import { getWxConfig } from "r/index/pay"; import {getWxConfig} from "r/index/pay";
import { upload } from "r/index/network"; import {upload} from "r/index/network";
export default { export default {
name: "Paying", name: "Paying",
components: { components: {
ConfirmSignUp, ConfirmSignUp,
}, },
data() { data() {
return { return {
dialogPayingVisible: false, //支付时候tip dialogPayingVisible: false, //支付时候tip
dialogChoose: false, //付款方式选择 dialogChoose: false, //付款方式选择
confirmSignUpDialogFu: false, // 控制确认报名弹框的显示与隐藏 confirmSignUpDialogFu: false, // 控制确认报名弹框的显示与隐藏
bankDialogVisible: false, //上传银行截图弹框的显示与隐藏 bankDialogVisible: false, //上传银行截图弹框的显示与隐藏
personalInfo: {}, personalInfo: {},
camp_name: "", //营地名称 camp_name: "", //营地名称
has_amount: "", //支付金额 has_amount: "", //支付金额
status: "", //状态 status: "", //状态
status_wx: "", //状态 status_wx: "", //状态
type: "", //状态 type: "", //状态
//支付状态判断 //支付状态判断
transfer_account: window.localStorage.getItem( transfer_account: window.localStorage.getItem(
"transfer_account" + this.$store.state.indexIdentity "transfer_account" + this.$store.state.indexIdentity
), ),
payee: window.localStorage.getItem( payee: window.localStorage.getItem(
"payee" + this.$store.state.indexIdentity "payee" + this.$store.state.indexIdentity
), ),
bank_first: window.localStorage.getItem( bank_first: window.localStorage.getItem(
"bank_first" + this.$store.state.indexIdentity "bank_first" + this.$store.state.indexIdentity
), ),
bank_idcard: window.localStorage.getItem( bank_idcard: window.localStorage.getItem(
"bank_idcard" + this.$store.state.indexIdentity "bank_idcard" + this.$store.state.indexIdentity
), ),
isUploading: false, // 图片上传蒙层 isUploading: false, // 图片上传蒙层
dialogVisible: false, dialogVisible: false,
fileList: [], fileList: [],
file: "", file: "",
file_image: {}, file_image: {},
resultPicture: "", resultPicture: "",
disabled: false, //限制输入框 disabled: false, //限制输入框
hideUpload: false, hideUpload: false,
limitCount: 1, limitCount: 1,
isBank_infoFile:false, isBank_infoFile: false,
};
},
created() {
const code = this.$store.state.indexIdentity;
this.camp_name = window.localStorage.getItem("camp_name" + code);
this.has_amount = window.localStorage.getItem("has_amount" + code);
// 已上传的银行付款图片
let bank_infoFile = window.localStorage.getItem(
"bank_info" + window.localStorage.getItem("index-phone-all") + code
);
JSON.parse(bank_infoFile).map((i) => {
if (i.url != '') {
this.isBank_infoFile = true
}
})
if (bank_infoFile && this.isBank_infoFile == true && JSON.parse(bank_infoFile).length > 0) {
console.log(JSON.parse(bank_infoFile));
this.fileList = JSON.parse(bank_infoFile);
}
this.getAccount();
this.commonApi(33)
},
methods: {
handleClose(done) {
this.$confirm("确认关闭?")
.then((_) => {
done();
})
.catch((_) => {
});
},
// 子组件触发,关闭确认报名弹框
closeCFSUDialog(val) {
console.log(val, "val");
this.confirmSignUpDialogFu = val;
},
toWeichat() {
// this.dialogChoose = false;
this.confirmSignUpDialogFu = true;
},
toPaybao() {
getWxConfig({
pay_type: 2,
}).then((res) => {
console.log(res, "getWxConfig");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
/* 此处form就是后台返回接收到的数据 */
let form = res.data.data;
console.log(form);
// return
let div = document.createElement("div");
div.innerHTML = form;
document.body.appendChild(div);
document.forms[0].acceptCharset = "GBK"; //保持与支付宝默认编码格式一致,如果不一致将会出现:调试错误,请回到请求来源地.
// 重新发起请求,错误代码 invalid-signature 错误原因: 验签出错,建议检查签名字符串或签名私钥与应用公钥是否匹配
document.forms[0].submit(); //
let alipay_submit = document.getElementById("alipay_submit");
div.removeChild(alipay_submit);
//初始化 websocket 链接
this.initWebSocket();
});
},
// 初始化 webSocket
initWebSocket() {
if (typeof WebSocket == "undefined") {
this.$message({
showClose: true,
message: "您的浏览器不支持WebSocket",
type: "error",
});
} else if (!this.dialogChoose) {
return;
} else {
let code = this.$store.state.indexIdentity;
if (!this.token || this.token == "") {
this.token = window.localStorage.getItem("index-token-all");
}
let token = this.token;
var wssURL = SERVER_WS_URL + "/order?token=" + token + "&channel=pc";
console.log(wssURL);
this.websocket = new WebSocket(wssURL);
console.log(this.websocket);
// 连接发生错误的回调方法
this.websocket.onerror = this.websocketOnerror;
// 连接成功建立的回调方法
this.websocket.onopen = this.websocketOnopen;
// 接收到消息的回调方法
this.websocket.onmessage = this.websocketOnmessage;
// 连接关闭的回调方法
this.websocket.onclose = this.websocketOnclose;
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
this.websocket.onbeforeunload = this.websocketOnbeforeunload;
// this.websocketSend();
// setTimeout(() => {
// this.websocketSend();
// }, 1000);
}
},
reconnect() {
//重新连接
let that = this;
if (!that.dialogChoose) {
return;
}
if (that.lockReconnect) {
return;
}
that.lockReconnect = true;
//没连接上会一直重连,设置延迟避免请求过多
that.timeoutnum && clearTimeout(that.timeoutnum);
that.timeoutnum = setTimeout(function () {
//新连接
that.initWebSocket();
that.lockReconnect = false;
}, 5000);
},
reset() {
//重置心跳
let that = this;
//清除时间
clearTimeout(that.timeoutObj);
clearTimeout(that.serverTimeoutObj);
//重启心跳
that.start();
},
start() {
//开启心跳
let self = this;
self.timeoutObj && clearTimeout(self.timeoutObj);
self.serverTimeoutObj && clearTimeout(self.serverTimeoutObj);
self.timeoutObj = setTimeout(function () {
//这里发送一个心跳,后端收到后,返回一个心跳消息,
if (self.websocket.readyState == 1) {
//如果连接正常
self.websocket.send("heartCheck");
} else {
//否则重连
self.reconnect();
}
self.serverTimeoutObj = setTimeout(function () {
//超时关闭
self.websocket.close();
}, self.timeout);
}, self.timeout);
},
// 连接发生错误的回调方法
websocketOnerror() {
this.$message.error("WebSocket连接发生错误");
//重连
this.reconnect();
},
// 连接成功建立的回调方法
websocketOnopen() {
this.websocketSend();
// console.log("连接成功建立的回调方法");
//开启心跳
this.start();
},
websocketSend() {
//数据发送
let sendData = {
order_no: window.localStorage.getItem(
"order_no" + this.$store.state.indexIdentity
),
cam_id: window.localStorage.getItem(
"campsite_id" + this.$store.state.indexIdentity
),
token: this.token,
};
this.websocket.send(JSON.stringify(sendData));
},
// 接收到消息的回调方法
websocketOnmessage(event) {
console.log(event, "event");
if (event.data !== "Opened") {
//const data = JSON.parse(event.data);
// console.log("接收到消息的回调方法", event.data);
if (event.data == 1) {
this.lockReconnect = false;
this.closeWebSocket();
// this.dialogVisible = false;
// this.$emit("closeCFSUDialog", this.dialogVisible, true);
} else {
//收到服务器信息,心跳重置
this.reset();
}
}
},
// 连接关闭的回调方法
websocketOnclose() {
// console.log("连接关闭的回调方法");
//重连
this.reconnect();
},
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常
websocketOnbeforeunload() {
this.closeWebSocket();
// console.log('监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常');
},
// 关闭WebSocket连接
closeWebSocket() {
this.websocket && this.websocket.close();
},
// 立即支付-按钮
paying() {
console.log(this.$store.state);
let code = this.$store.state.indexIdentity;
console.log(code == "3c7e84455750447799e4b70bda5f4493")
if (code == "3c7e84455750447799e4b70bda5f4493") {
console.log('1111')
this.toPaying();
} else {
this.dialogPayingVisible = true;
}
},
toPaying() {
this.commonApi(34)
this.dialogPayingVisible = false;
if (this.has_amount == 0) {
getWxConfig({pay_type: 3}).then((res) => {
console.log(res, "signUpInit");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.$message.success(res.data.err_msg);
});
this.$emit("getstatus", 6);
} else {
// transfer_account 判断微信支付宝或者银行卡支付
if (this.transfer_account == 0) {
this.dialogChoose = true;
} else {
this.bankDialogVisible = true;
console.log(this.fileList);
console.log(this.fileList != []);
if (this.fileList.length >= 1) {
this.hideUpload = true;
}
}
}
// setTimeout(this.signUpInit(this.status_wx), 1000);
},
signUpInit() {
signUpInit({}).then((res) => {
console.log(res, "signUpInit");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.status = res.data.status;
// return;
// 点击下一步传值给status,更新
if (this.status == 4) {
this.type = "check";
this.status = 3;
if (this.isNexts == 1) {
if (res.data.examine_status == 1) {
console.log(333);
this.type = "pay";
this.status = 4;
} else if (res.data.examine_status == 2) {
this.type = "referInfo";
this.status = 2;
}
}
if (res.data.pay_amount == 0) {
getWxConfig({pay_type: 3}).then((res) => {
console.log(res, "signUpInit");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.$message.success(res.data.err_msg);
});
}
// pay_amount支付金额等于0,直接跳到成功页面
} else if (this.status == 5) {
this.type = "pay";
// pay_amount支付金额等于0,直接跳到成功页面
if (res.data.pay_amount == 0) {
this.type = "success";
this.$emit("getstatus", 6);
} else {
// transfer_account 判断微信支付宝或者银行卡支付
if (this.transfer_account == 0) {
this.dialogChoose = true;
} else {
this.bankDialogVisible = true;
console.log(this.fileList);
console.log(this.fileList != []);
if (this.fileList.length >= 1) {
this.hideUpload = true;
}
}
}
}
// else if (this.status == 6) {
// this.type = "success";
// }
this.$emit("getstatus", res.data.status);
});
},
getAccount() {
getAccount({}).then((res) => {
// console.log(res, "getAccount");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.personalInfo = res.data.info;
// this.personalInfo.create_time = parseTime(res.data.info.create_time);
});
},
// 图片上传成功前钩子
beforeAvatarUpload(file) {
// console.log(file, "beforeImage");
const isJPG = file.type === "image/jpg";
const isPng = file.type === "image/png";
const isJPEG = file.type === "image/jpeg";
const isLt10M = file.size / 1024 / 1024 < 10;
// console.log(isLt10M)
if (!isJPG && !isPng && !isJPEG) {
this.$message.info("上传图片只能是 JPG,JPEG或png 格式!");
}
if (!isLt10M) {
this.$message.info("上传图片大小不能超过 10MB!");
}
return (isJPG || isPng || isJPEG) && isLt10M;
},
handlePictureCardPreview(file) {
console.log(file, "11111111");
this.resultPicture = file.url;
this.dialogVisible = true;
},
// 文件上传中处理
handleUploadProgress(event, file, fileList) {
// console.log(fileList);
this.isUploading = true;
if (this.fileList.length < 1) {
return this.$message.info("超过上传数量");
}
},
uploadSuccess(res, file, fileList) {
// console.log(res, "res");
// console.log(file, "file");
// console.log(fileList, "fileList");
this.referForm.achievementPath = res;
this.fileList = {
name: file.name,
url: res,
};
this.$refs["imgUrl"].clearFiles(); //上传成功之后清除历史记录
},
uploadPicture(params) {
// console.log("已经准备好上传图片", params);
this.file = params.file;
let raw = params.file;
let image = {
name: raw.name,
size: raw.size,
type: raw.type,
};
this.file_image = image;
this.getOssConfigs(this.file_image, params.file);
},
// 上传截图
uploadConfirm() {
this.bankDialogVisible = false;
// this.$message.success("你的支付信息已提交,请留意短信通知。");
// this.getOssConfigs(this.file_image, this.file);
},
async changeStatus() {
// console.log(SERVER_WS_URL);
let {data: res} = await getWxConfig({
pay_type: 4,
});
},
async getOssConfigs(image, file) {
let obj = {
url: "",
savefile: "",
};
await getBankInfoOss({image: image})
.then((res) => {
console.log(res, "开始上传图片");
if (res.data.code === 200) {
let oss_url = res.data.config.host;
let filename = res.data.config.file;
let formData = new FormData();
formData.append("OSSAccessKeyId", res.data.config.accessid);
formData.append("policy", res.data.config.policy);
formData.append("signature", res.data.config.signature);
formData.append("filename", res.data.config.file);
formData.append("key", res.data.config.savefile);
formData.append("callback", res.data.config.callback);
formData.append("success_action_status", 200);
formData.append("file", file);
// console.log(formData);
upload(oss_url, formData)
.then((ress) => {
console.log(555555555);
console.log(ress, "ress");
if (ress.data.code != 200) {
return this.$message.error(ress.data.message);
}
this.resultPicture = filename + "?t=" + Date.parse(new Date());
// this.$forceUpdate();
obj = {
url: ress.data.picture_path,
savefile: res.data.config.savefile,
};
this.fileList.push(obj);
let code = this.$store.state.indexIdentity;
window.localStorage.setItem("sign_up_payfile_" + window.localStorage.getItem("index-phone-all") + code, JSON.stringify(this.fileList));
this.$message.success({
message:
"您已上传成功,等待短信通知,审核通过后登录报名网址。",
duration: 5000,
});
this.changeStatus();
this.hideUpload = this.fileList.length >= this.limitCount;
})
.catch((err) => {
this.$message.error(err);
});
} else {
this.$message.error(res.data.message);
}
})
.catch((err) => {
// console.log(err);
});
},
// 下载证明资料图片
handleDownload(file) {
// console.log(file,'file22');
window.location.href = file.url;
},
//删除图片
handleRemove(file) {
console.log(file, "file");
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let getfile = file.url;
// console.log(savefile.match(/^(?:[^\/]|\/\/)*/),'222222');//获取域名
let str = getfile.split(
"https://yingdi-bank-info.oss-cn-beijing.aliyuncs.com/"
); //https://yingdi-achievement.oss-cn-beijing.aliyuncs.com/进行分割,
let savefile = str[1];
delPayingPic({object: savefile}).then((res) => {
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.fileList.forEach((item, idx) => {
if (item.url == file.url) {
this.fileList.splice(idx, 1);
let code = this.$store.state.indexIdentity;
window.localStorage.setItem("sign_up_payfile_" + window.localStorage.getItem("index-phone-all") + code, JSON.stringify(this.fileList));
this.$message.success("删除成功");
this.hideUpload = this.fileList.length >= this.limitCount;
window.localStorage.removeItem(
"bank_info" +
window.localStorage.getItem("index-phone-all") +
code
);
}
});
// console.log(this.fileList);
});
})
.catch((err) => {
this.$message({
type: "info",
message: "取消删除",
});
});
},
},
}; };
}, </script>
created() {
const code = this.$store.state.indexIdentity; <style lang="scss" scoped>
this.camp_name = window.localStorage.getItem("camp_name" + code); @import "a/scss/btn";
this.has_amount = window.localStorage.getItem("has_amount" + code);
// 已上传的银行付款图片 .btn {
let bank_infoFile = window.localStorage.getItem( padding-bottom: 0 !important;
"bank_info" + window.localStorage.getItem("phone" + code) + code }
);
JSON.parse(bank_infoFile).map((i)=>{ .flex {
if(i.url!=''){ display: flex;
this.isBank_infoFile=true }
}
}) .margin1 {
if (bank_infoFile &&this.isBank_infoFile==true&& JSON.parse(bank_infoFile).length > 0) { margin-bottom: 1rem;
console.log(JSON.parse(bank_infoFile));
this.fileList = JSON.parse(bank_infoFile);
} }
this.getAccount();
this.commonApi(33) ::v-deep .hide {
}, .el-upload--picture-card {
methods: { display: none;
handleClose(done) {
this.$confirm("确认关闭?")
.then((_) => {
done();
})
.catch((_) => {});
},
// 子组件触发,关闭确认报名弹框
closeCFSUDialog(val) {
console.log(val, "val");
this.confirmSignUpDialogFu = val;
},
toWeichat() {
// this.dialogChoose = false;
this.confirmSignUpDialogFu = true;
},
toPaybao() {
getWxConfig({
pay_type: 2,
}).then((res) => {
console.log(res, "getWxConfig");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
} }
/* 此处form就是后台返回接收到的数据 */
let form = res.data.data; .el-upload-list__item div {
console.log(form); height: 100%;
// return
let div = document.createElement("div");
div.innerHTML = form;
document.body.appendChild(div);
document.forms[0].acceptCharset = "GBK"; //保持与支付宝默认编码格式一致,如果不一致将会出现:调试错误,请回到请求来源地.
// 重新发起请求,错误代码 invalid-signature 错误原因: 验签出错,建议检查签名字符串或签名私钥与应用公钥是否匹配
document.forms[0].submit(); //
let alipay_submit = document.getElementById("alipay_submit");
div.removeChild(alipay_submit);
//初始化 websocket 链接
this.initWebSocket();
});
},
// 初始化 webSocket
initWebSocket() {
if (typeof WebSocket == "undefined") {
this.$message({
showClose: true,
message: "您的浏览器不支持WebSocket",
type: "error",
});
} else if (!this.dialogChoose) {
return;
} else {
let code = this.$store.state.indexIdentity;
if (!this.token || this.token == "") {
this.token = window.localStorage.getItem("index-token" + code);
} }
let token = this.token; }
var wssURL = SERVER_WS_URL + "/order?token=" + token + "&channel=pc";
console.log(wssURL); .paying {
this.websocket = new WebSocket(wssURL); padding: 0 56px 65px 56px;
console.log(this.websocket);
// 连接发生错误的回调方法 .pay_titile {
this.websocket.onerror = this.websocketOnerror; font-size: 18px;
// 连接成功建立的回调方法 font-weight: 500;
this.websocket.onopen = this.websocketOnopen; color: #12141c;
// 接收到消息的回调方法 line-height: 18px;
this.websocket.onmessage = this.websocketOnmessage;
// 连接关闭的回调方法
this.websocket.onclose = this.websocketOnclose;
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
this.websocket.onbeforeunload = this.websocketOnbeforeunload;
// this.websocketSend();
// setTimeout(() => {
// this.websocketSend();
// }, 1000);
}
},
reconnect() {
//重新连接
let that = this;
if (!that.dialogChoose) {
return;
}
if (that.lockReconnect) {
return;
}
that.lockReconnect = true;
//没连接上会一直重连,设置延迟避免请求过多
that.timeoutnum && clearTimeout(that.timeoutnum);
that.timeoutnum = setTimeout(function () {
//新连接
that.initWebSocket();
that.lockReconnect = false;
}, 5000);
},
reset() {
//重置心跳
let that = this;
//清除时间
clearTimeout(that.timeoutObj);
clearTimeout(that.serverTimeoutObj);
//重启心跳
that.start();
},
start() {
//开启心跳
let self = this;
self.timeoutObj && clearTimeout(self.timeoutObj);
self.serverTimeoutObj && clearTimeout(self.serverTimeoutObj);
self.timeoutObj = setTimeout(function () {
//这里发送一个心跳,后端收到后,返回一个心跳消息,
if (self.websocket.readyState == 1) {
//如果连接正常
self.websocket.send("heartCheck");
} else {
//否则重连
self.reconnect();
} }
self.serverTimeoutObj = setTimeout(function () {
//超时关闭 .pay_top {
self.websocket.close(); margin: 24px 0;
}, self.timeout);
}, self.timeout); div {
}, font-size: 14px;
// 连接发生错误的回调方法 font-weight: 500;
websocketOnerror() { color: #12141c;
this.$message.error("WebSocket连接发生错误"); line-height: 32px;
//重连 }
this.reconnect();
},
// 连接成功建立的回调方法
websocketOnopen() {
this.websocketSend();
// console.log("连接成功建立的回调方法");
//开启心跳
this.start();
},
websocketSend() {
//数据发送
let sendData = {
order_no: window.localStorage.getItem(
"order_no" + this.$store.state.indexIdentity
),
cam_id: window.localStorage.getItem(
"campsite_id" + this.$store.state.indexIdentity
),
token: this.token,
};
this.websocket.send(JSON.stringify(sendData));
},
// 接收到消息的回调方法
websocketOnmessage(event) {
console.log(event, "event");
if (event.data !== "Opened") {
//const data = JSON.parse(event.data);
// console.log("接收到消息的回调方法", event.data);
if (event.data == 1) {
this.lockReconnect = false;
this.closeWebSocket();
// this.dialogVisible = false;
// this.$emit("closeCFSUDialog", this.dialogVisible, true);
} else {
//收到服务器信息,心跳重置
this.reset();
} }
}
}, .line {
// 连接关闭的回调方法 height: 1px;
websocketOnclose() { border-bottom: 1px solid #d1d1d1;
// console.log("连接关闭的回调方法");
//重连
this.reconnect();
},
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常
websocketOnbeforeunload() {
this.closeWebSocket();
// console.log('监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常');
},
// 关闭WebSocket连接
closeWebSocket() {
this.websocket && this.websocket.close();
},
// 立即支付-按钮
paying() {
console.log(this.$store.state);
let code = this.$store.state.indexIdentity;
console.log(code == "3c7e84455750447799e4b70bda5f4493")
if (code == "3c7e84455750447799e4b70bda5f4493") {
console.log('1111')
this.toPaying();
} else {
this.dialogPayingVisible = true;
}
},
toPaying() {
this.commonApi(34)
this.dialogPayingVisible = false;
if (this.has_amount == 0) {
getWxConfig({ pay_type: 3 }).then((res) => {
console.log(res, "signUpInit");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.$message.success(res.data.err_msg);
});
this.$emit("getstatus", 6);
} else {
// transfer_account 判断微信支付宝或者银行卡支付
if (this.transfer_account == 0) {
this.dialogChoose = true;
} else {
this.bankDialogVisible = true;
console.log(this.fileList);
console.log(this.fileList != []);
if (this.fileList.length >= 1) {
this.hideUpload = true;
}
} }
}
.pay-money {
// setTimeout(this.signUpInit(this.status_wx), 1000); font-size: 18px;
}, font-weight: 500;
signUpInit() { color: #12141c;
signUpInit({}).then((res) => { line-height: 24px;
console.log(res, "signUpInit"); justify-content: space-between;
if (res.data.code != 200) { margin: 43px 0 0 0;
return this.$message.error(res.data.message);
span {
color: #60194a;
}
} }
this.status = res.data.status;
// return; .pay_bottom {
// 点击下一步传值给status,更新 font-size: 12px;
if (this.status == 4) { font-weight: 500;
this.type = "check"; color: #999999;
this.status = 3; line-height: 21px;
if (this.isNexts == 1) {
if (res.data.examine_status == 1) { .cc {
console.log(333); font-weight: 600;
this.type = "pay"; color: black;
this.status = 4;
} else if (res.data.examine_status == 2) {
this.type = "referInfo";
this.status = 2;
} }
}
if (res.data.pay_amount == 0) { .starIcon {
getWxConfig({ pay_type: 3 }).then((res) => { color: red;
console.log(res, "signUpInit");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.$message.success(res.data.err_msg);
});
}
// pay_amount支付金额等于0,直接跳到成功页面
} else if (this.status == 5) {
this.type = "pay";
// pay_amount支付金额等于0,直接跳到成功页面
if (res.data.pay_amount == 0) {
this.type = "success";
this.$emit("getstatus", 6);
} else {
// transfer_account 判断微信支付宝或者银行卡支付
if (this.transfer_account == 0) {
this.dialogChoose = true;
} else {
this.bankDialogVisible = true;
console.log(this.fileList);
console.log(this.fileList != []);
if (this.fileList.length >= 1) {
this.hideUpload = true;
}
} }
}
}
// else if (this.status == 6) {
// this.type = "success";
// }
this.$emit("getstatus", res.data.status);
});
},
getAccount() {
getAccount({}).then((res) => {
// console.log(res, "getAccount");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
} }
this.personalInfo = res.data.info; }
// this.personalInfo.create_time = parseTime(res.data.info.create_time);
}); .choose {
}, text-align: center;
// 图片上传成功前钩子 .img_choose {
beforeAvatarUpload(file) { justify-content: space-around;
// console.log(file, "beforeImage");
const isJPG = file.type === "image/jpg"; img {
const isPng = file.type === "image/png"; width: 38%;
const isJPEG = file.type === "image/jpeg"; cursor: pointer;
const isLt10M = file.size / 1024 / 1024 < 10;
// console.log(isLt10M)
if (!isJPG && !isPng && !isJPEG) {
this.$message.info("上传图片只能是 JPG,JPEG或png 格式!");
}
if (!isLt10M) {
this.$message.info("上传图片大小不能超过 10MB!");
}
return (isJPG || isPng || isJPEG) && isLt10M;
},
handlePictureCardPreview(file) {
console.log(file, "11111111");
this.resultPicture = file.url;
this.dialogVisible = true;
},
// 文件上传中处理
handleUploadProgress(event, file, fileList) {
// console.log(fileList);
this.isUploading = true;
if (this.fileList.length < 1) {
return this.$message.info("超过上传数量");
}
},
uploadSuccess(res, file, fileList) {
// console.log(res, "res");
// console.log(file, "file");
// console.log(fileList, "fileList");
this.referForm.achievementPath = res;
this.fileList = {
name: file.name,
url: res,
};
this.$refs["imgUrl"].clearFiles(); //上传成功之后清除历史记录
},
uploadPicture(params) {
// console.log("已经准备好上传图片", params);
this.file = params.file;
let raw = params.file;
let image = {
name: raw.name,
size: raw.size,
type: raw.type,
};
this.file_image = image;
this.getOssConfigs(this.file_image, params.file);
},
// 上传截图
uploadConfirm() {
this.bankDialogVisible = false;
// this.$message.success("你的支付信息已提交,请留意短信通知。");
// this.getOssConfigs(this.file_image, this.file);
},
async changeStatus() {
// console.log(SERVER_WS_URL);
let { data: res } = await getWxConfig({
pay_type: 4,
});
},
async getOssConfigs(image, file) {
let obj = {
url: "",
savefile: "",
};
await getBankInfoOss({ image: image })
.then((res) => {
console.log(res, "开始上传图片");
if (res.data.code === 200) {
let oss_url = res.data.config.host;
let filename = res.data.config.file;
let formData = new FormData();
formData.append("OSSAccessKeyId", res.data.config.accessid);
formData.append("policy", res.data.config.policy);
formData.append("signature", res.data.config.signature);
formData.append("filename", res.data.config.file);
formData.append("key", res.data.config.savefile);
formData.append("callback", res.data.config.callback);
formData.append("success_action_status", 200);
formData.append("file", file);
// console.log(formData);
upload(oss_url, formData)
.then((ress) => {
console.log(555555555);
console.log(ress, "ress");
if (ress.data.code != 200) {
return this.$message.error(ress.data.message);
}
this.resultPicture = filename + "?t=" + Date.parse(new Date());
// this.$forceUpdate();
obj = {
url: ress.data.picture_path,
savefile: res.data.config.savefile,
};
this.fileList.push(obj);
let code = this.$store.state.indexIdentity;
window.localStorage.setItem(
"sign_up_payfile_" +
+window.localStorage.getItem("phone" + code) +
code,
JSON.stringify(this.fileList)
);
this.$message.success({
message:
"您已上传成功,等待短信通知,审核通过后登录报名网址。",
duration: 5000,
});
this.changeStatus();
this.hideUpload = this.fileList.length >= this.limitCount;
})
.catch((err) => {
this.$message.error(err);
});
} else {
this.$message.error(res.data.message);
}
})
.catch((err) => {
// console.log(err);
});
},
// 下载证明资料图片
handleDownload(file) {
// console.log(file,'file22');
window.location.href = file.url;
},
//删除图片
handleRemove(file) {
console.log(file, "file");
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let getfile = file.url;
// console.log(savefile.match(/^(?:[^\/]|\/\/)*/),'222222');//获取域名
let str = getfile.split(
"https://yingdi-bank-info.oss-cn-beijing.aliyuncs.com/"
); //https://yingdi-achievement.oss-cn-beijing.aliyuncs.com/进行分割,
// console.log(str, "str");
let savefile = str[1];
// console.log(savefile, "savefile");
delPayingPic({ object: savefile }).then((res) => {
// console.log(res, "delpic");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
} }
this.fileList.forEach((item, idx) => { }
// console.log(item.url == file.url);
if (item.url == file.url) {
this.fileList.splice(idx, 1);
let code = this.$store.state.indexIdentity;
window.localStorage.setItem(
"sign_up_payfile_" +
window.localStorage.getItem("phone" + code) +
code,
JSON.stringify(this.fileList)
);
this.$message.success("删除成功");
this.hideUpload = this.fileList.length >= this.limitCount;
window.localStorage.removeItem(
"bank_info" +
window.localStorage.getItem("phone" + code) +
code
);
}
});
// console.log(this.fileList);
});
})
.catch((err) => {
this.$message({
type: "info",
message: "取消删除",
});
});
},
},
};
</script>
<style lang="scss" scoped> .text_choose {
@import "a/scss/btn"; font-size: 15px;
.btn { margin: 20px 0 50px 0;
padding-bottom: 0 !important; }
}
.flex { .btn .el-button {
display: flex; width: 120px !important;
} }
.margin1 {
margin-bottom: 1rem;
}
::v-deep .hide {
.el-upload--picture-card {
display: none;
}
.el-upload-list__item div {
height: 100%;
}
}
.paying {
padding: 0 56px 65px 56px;
.pay_titile {
font-size: 18px;
font-weight: 500;
color: #12141c;
line-height: 18px;
}
.pay_top {
margin: 24px 0;
div {
font-size: 14px;
font-weight: 500;
color: #12141c;
line-height: 32px;
}
}
.line {
height: 1px;
border-bottom: 1px solid #d1d1d1;
}
.pay-money {
font-size: 18px;
font-weight: 500;
color: #12141c;
line-height: 24px;
justify-content: space-between;
margin: 43px 0 0 0;
span {
color: #60194a;
}
}
.pay_bottom {
font-size: 12px;
font-weight: 500;
color: #999999;
line-height: 21px;
.cc {
font-weight: 600;
color: black;
}
.starIcon {
color: red;
}
}
}
.choose {
text-align: center;
.img_choose {
justify-content: space-around;
img {
width: 38%;
cursor: pointer;
} }
}
// .pay_code {
.text_choose { // text-align: center;
font-size: 15px; // :nth-child(1) {
margin: 20px 0 50px 0; // font-size: 14px;
} // font-weight: 500;
.btn .el-button { // color: #12141c;
width: 120px !important; // line-height: 14px;
} // span {
} // font-size: 13px !important;
// .pay_code { // color: var(--color);
// text-align: center; // }
// :nth-child(1) { // }
// font-size: 14px; // :nth-child(2) {
// font-weight: 500; // font-size: 14px;
// color: #12141c; // font-weight: 500;
// line-height: 14px; // color: var(--color);
// span { // line-height: 24px;
// font-size: 13px !important; // }
// color: var(--color); // :nth-child(4) {
// } // font-size: 14px;
// } // font-weight: 500;
// :nth-child(2) { // color: #333333;
// font-size: 14px; // line-height: 16px;
// font-weight: 500; // span {
// color: var(--color); // font-size: 17px !important;
// line-height: 24px; // color: var(--color);
// } // }
// :nth-child(4) { // }
// font-size: 14px; // :nth-child(5) {
// font-weight: 500; // font-size: 12px;
// color: #333333; // font-weight: 500;
// line-height: 16px; // color: #666666;
// span { // line-height: 12px;
// font-size: 17px !important; // }
// color: var(--color); // }
// }
// }
// :nth-child(5) {
// font-size: 12px;
// font-weight: 500;
// color: #666666;
// line-height: 12px;
// }
// }
</style> </style>
...@@ -654,7 +654,7 @@ ...@@ -654,7 +654,7 @@
</div> </div>
</el-col> </el-col>
<!-- 自我介绍 --> <!-- 自我介绍 -->
<el-col :span="12" v-show="configJson.introduceMyself == 1" > <el-col :span="12" v-show="configJson.introduceMyself == 1">
<el-form-item <el-form-item
prop="introduce" prop="introduce"
label="自我介绍" label="自我介绍"
...@@ -1388,11 +1388,11 @@ ...@@ -1388,11 +1388,11 @@
}, },
created() { created() {
const code = this.$store.state.indexIdentity; const code = this.$store.state.indexIdentity;
this.referForm.phone = window.localStorage.getItem("phone" + code); //本地取用户手机号 this.referForm.phone = window.localStorage.getItem("index-phone-all"); //本地取用户手机号
this.referForm.email = window.localStorage.getItem("email" + code); //本地取用户邮箱 this.referForm.email = window.localStorage.getItem("email" + code); //本地取用户邮箱
// console.log(this.referForm.email, " this.referForm.email"); // console.log(this.referForm.email, " this.referForm.email");
let signUpFile = window.localStorage.getItem( let signUpFile = window.localStorage.getItem(
"sign_up_file_" + window.localStorage.getItem("phone" + code) + code "sign_up_file_" + window.localStorage.getItem("index-phone-all") + code
); );
// console.log(signUpFile); // console.log(signUpFile);
if (signUpFile && JSON.parse(signUpFile).length > 0) { if (signUpFile && JSON.parse(signUpFile).length > 0) {
...@@ -1737,8 +1737,7 @@ ...@@ -1737,8 +1737,7 @@
this.schoolName = res.data.school_list; this.schoolName = res.data.school_list;
// console.log( this.schoolName) // console.log( this.schoolName)
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.setItem( window.localStorage.setItem("schoolName" + code,
"schoolName" + code,
JSON.stringify(res.data.list) JSON.stringify(res.data.list)
); );
for (let key in this.schoolName) { for (let key in this.schoolName) {
...@@ -1850,9 +1849,8 @@ ...@@ -1850,9 +1849,8 @@
}; };
this.fileList.push(obj); this.fileList.push(obj);
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.setItem( window.localStorage.setItem("sign_up_file_" +
"sign_up_file_" + +window.localStorage.getItem("index-phone-all") +
+window.localStorage.getItem("phone" + code) +
code, code,
JSON.stringify(this.fileList) JSON.stringify(this.fileList)
); );
...@@ -1900,9 +1898,8 @@ ...@@ -1900,9 +1898,8 @@
if (item.url == file.url) { if (item.url == file.url) {
this.fileList.splice(idx, 1); this.fileList.splice(idx, 1);
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.setItem( window.localStorage.setItem("sign_up_file_" +
"sign_up_file_" + window.localStorage.getItem("index-phone-all") +
window.localStorage.getItem("phone" + code) +
code, code,
JSON.stringify(this.fileList) JSON.stringify(this.fileList)
); );
......
/* eslint-disable */ /* eslint-disable */
import {request} from './network'; import {request} from '../network';
// 获取label列表-搜索模块 // 获取label列表-搜索模块
export function LabelType(data) { export function LabelType(data) {
......
/* eslint-disable */ /* eslint-disable */
import {request} from './network' import {request} from '../network'
// 登录 // 登录
export function login(data) { export function login(data) {
......
/* eslint-disable */ /* eslint-disable */
import {request} from '../network';
import {
request
} from './network'
// 通过邮箱验证码注册 // 通过邮箱验证码注册
export function registerEmailCode(data) { export function registerEmailCode(data) {
......
/* eslint-disable */ /* eslint-disable */
import { import {request} from '../network';
request import store from '@/store';
} from './network'
import store from '@/store'
// 添加地址 // 添加地址
......
/* eslint-disable */ /* eslint-disable */
import { import {request} from '../network';
request import store from '@/store';
} from './network'
import store from '@/store'
// 获取营地作业列表 // 获取营地作业列表
......
/* eslint-disable */ /* eslint-disable */
import { import {request} from '../network';
request import store from '@/store';
} from './network'
import store from '@/store'
// 获取资料(个人信息)
export function getAccountInfo(data) {
// 获取资料(个人信息) data['identity'] = store.state.indexIdentity;
export function getAccountInfo(data) { return request({
data['identity'] = store.state.indexIdentity; method: 'post',
return request({ url: '/web/signUp/getAccountInfo',
method: 'post', data
url: '/web/signUp/getAccountInfo', })
data }
})
} // 保存个人资料
// 保存个人资料 export function setAccountInfo(data) {
export function setAccountInfo(data) { data['identity'] = store.state.indexIdentity;
data['identity'] = store.state.indexIdentity; return request({
return request({ method: 'post',
method: 'post', url: '/web/signUp/setAccountInfo',
url: '/web/signUp/setAccountInfo', data
data })
}) }
}
\ No newline at end of file
/* eslint-disable */ /* eslint-disable */
import { import {request} from '../network';
request import store from '@/store';
} from './network'
import store from '@/store'
//登录前获取营地主题 //登录前获取营地主题
export function getCam(code) { export function getCam(code) {
......
...@@ -15,7 +15,6 @@ import { ...@@ -15,7 +15,6 @@ import {
} from 'element-ui' } from 'element-ui'
import router from '@/router' import router from '@/router'
const instance = axios.create({ const instance = axios.create({
baseURL: DEVELOPMENT_SERVER_URL, baseURL: DEVELOPMENT_SERVER_URL,
timeout: 60000, timeout: 60000,
...@@ -105,8 +104,7 @@ export function request(config) { ...@@ -105,8 +104,7 @@ export function request(config) {
const changePassCode = '/web/auth/changePassCode'; const changePassCode = '/web/auth/changePassCode';
const loginOut = '/web/auth/loginOut'; const loginOut = '/web/auth/loginOut';
const setLog = '/web/auth/setLog'; const setLog = '/web/auth/setLog';
if ( if ((config.url.indexOf(loginUrl) != -1 && config.url.indexOf(loginOut) == -1) ||
(config.url.indexOf(loginUrl) != -1 && config.url.indexOf(loginOut) == -1) ||
config.url.indexOf(setAccountInfo) != -1 || config.url.indexOf(setAccountInfo) != -1 ||
config.url.indexOf(passMsgOld) != -1 || config.url.indexOf(passMsgOld) != -1 ||
config.url.indexOf(getCam) != -1 || config.url.indexOf(getCam) != -1 ||
...@@ -116,15 +114,10 @@ export function request(config) { ...@@ -116,15 +114,10 @@ export function request(config) {
config.url.indexOf(passwordEmailCode) != -1 || config.url.indexOf(passwordEmailCode) != -1 ||
config.url.indexOf(changePassCode) != -1 || config.url.indexOf(changePassCode) != -1 ||
config.url.indexOf(passwordCode) != -1 || config.url.indexOf(passwordCode) != -1 ||
config.url.indexOf(setLog) != -1 config.url.indexOf(setLog) != -1) {
) {
return config return config
} }
// const token = localStorage.getItem('index-token' + store.state.indexIdentity)
const token = localStorage.getItem('index-token-all'); const token = localStorage.getItem('index-token-all');
if (token) { if (token) {
config.headers.token = token; config.headers.token = token;
} else { } else {
...@@ -189,34 +182,9 @@ export function request(config) { ...@@ -189,34 +182,9 @@ export function request(config) {
return return
} }
if (res.data.code == 400023) { if (res.data.code == 400023) {
console.log(res)
let code = store.state.indexIdentity;
let isLogout = res.config.url == '/web/auth/loginOut'; let isLogout = res.config.url == '/web/auth/loginOut';
window.localStorage.removeItem("doubt_code" + code); // 清除本地缓存 除了特殊缓存
window.localStorage.removeItem("doubt_info" + code); store.commit('removeLocalStorage');
window.localStorage.removeItem("doubt_check" + code);
window.localStorage.removeItem("camp_name" + code);
window.localStorage.removeItem("system_color" + code);
window.localStorage.removeItem("system_logo" + code);
window.localStorage.removeItem("has_amount" + code);
window.localStorage.removeItem("campsite_id" + code);
window.localStorage.removeItem("order_no" + code);
window.localStorage.removeItem("campindex_type" + code);
window.localStorage.removeItem("bk_pic" + code);
window.localStorage.removeItem("examine_status" + code);
window.localStorage.removeItem("examine_reason" + code);
window.localStorage.removeItem("sign_up_file_18355151517" + window.localStorage.getItem("phone" + code) + code);
window.localStorage.removeItem("schoolName" + code);
window.localStorage.removeItem("restet_code_time" + code);
window.localStorage.removeItem("camp_statement" + code)
window.localStorage.removeItem("transfer_account" + code);
window.localStorage.removeItem("payee" + code);
window.localStorage.removeItem("bank_first" + code);
window.localStorage.removeItem("bank_idcard" + code);
window.localStorage.removeItem("bank_info" + window.localStorage.getItem("phone" + code) + code);
window.localStorage.removeItem("index-token-all");
window.localStorage.removeItem("index-phone-all");
router.push({ router.push({
path: '/' + store.state.indexIdentity, path: '/' + store.state.indexIdentity,
}) })
...@@ -229,35 +197,8 @@ export function request(config) { ...@@ -229,35 +197,8 @@ export function request(config) {
return return
} }
if (res.data.code == 400003) { if (res.data.code == 400003) {
let code = this.$store.state.indexIdentity; // 清除本地缓存 除了特殊缓存
window.localStorage.removeItem("doubt_code" + code); store.commit('removeLocalStorage');
window.localStorage.removeItem("doubt_info" + code);
window.localStorage.removeItem("doubt_check" + code);
window.localStorage.removeItem("camp_name" + code);
window.localStorage.removeItem("system_color" + code);
window.localStorage.removeItem("system_logo" + code);
window.localStorage.removeItem("has_amount" + code);
window.localStorage.removeItem("campsite_id" + code);
window.localStorage.removeItem("order_no" + code);
window.localStorage.removeItem("campindex_type" + code);
window.localStorage.removeItem("bk_pic" + code);
window.localStorage.removeItem("examine_status" + code);
window.localStorage.removeItem("examine_reason" + code);
window.localStorage.removeItem(
"sign_up_file_18355151517" +
window.localStorage.getItem("phone" + code) +
code
);
window.localStorage.removeItem("schoolName" + code);
window.localStorage.removeItem("transfer_account" + code);
window.localStorage.removeItem("payee" + code);
window.localStorage.removeItem("bank_first" + code);
window.localStorage.removeItem("bank_idcard" + code);
window.localStorage.removeItem(
"bank_info" + window.localStorage.getItem("phone" + code) + code
);
window.localStorage.removeItem("index-token-all");
window.localStorage.removeItem("index-phone-all");
router.push({ router.push({
path: '/login', path: '/login',
query: { query: {
......
/* eslint-disable */ /* eslint-disable */
import { import {request} from '../network';
request import store from '@/store';
} from './network'
import store from '@/store'
// 报名初始化 // 报名初始化
......
/* eslint-disable */ /* eslint-disable */
import { import {request} from '../network';
request import store from '@/store';
} from './network'
import store from '@/store'
// 通过邮箱验证码注册 // 通过邮箱验证码注册
export function registerEmailCode(data) { export function registerEmailCode(data) {
......
/* eslint-disable */ /* eslint-disable */
import { import {request} from '../network';
request import store from '@/store';
} from './network'
import store from '@/store'
// 报名初始化 // 报名初始化
export function signUpInit(data) { export function signUpInit(data) {
......
/* eslint-disable */
import axios from 'axios'
import store from '@/store'
import qs from 'qs'
import {tansParams} from '@/store/common.js'
import {
SERVER_URL,
DEVELOPMENT_SERVER_URL
} from '@/config/server'
import {
Notification,
Message,
Loading
} from 'element-ui'
import router from '@/router'
const instance = axios.create({
baseURL: DEVELOPMENT_SERVER_URL,
timeout: 60000,
method: "post",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
withCredentials: false,
});
instance.interceptors.request.use(
(config) => {
if (config.method === "post" && !config.notQs) {
config.data = qs.stringify(config.data);
}
if (config.url.indexOf(SERVER_URL) === -1) {
config.headers["Content-Type"] = "multipart/form-data";
} else {
config.headers["Content-Type"] = "application/x-www-form-urlencoded";
}
// 调用接口请求添加token认证信息
const token = localStorage.getItem('index-token-all');
config.headers.token = token
if (token) config.headers.authorization = token;
return config;
},
(error) => {
return Promise.reject(error);
}
);
export default instance;
// 正在进行中的请求列表
const reqList = []
/**
* 阻止重复请求
* @param {array} reqList - 请求缓存列表
* @param {string} url - 当前请求地址
* @param {function} cancel - 请求中断函数
* @param {string} errorMessage - 请求中断时需要显示的错误信息
*/
const stopRepeatRequest = function (reqList, url, cancel, errorMessage) {
const errorMsg = errorMessage || ''
for (let i = 0; i < reqList.length; i++) {
if (reqList[i] === url) {
// cancel(errorMsg);
return
}
}
reqList.push(url)
}
/**
* 允许某个请求可以继续进行
* @param {array} reqList 全部请求列表
* @param {string} url 请求地址
*/
const allowRequest = function (reqList, url) {
for (let i = 0; i < reqList.length; i++) {
if (reqList[i] === url) {
reqList.splice(i, 1)
break
}
}
}
let loadingInstance = null
export function request(config) {
const instance = axios.create({
baseURL: process.env.NODE_ENV === 'development' ?
DEVELOPMENT_SERVER_URL : SERVER_URL,
timeout: 60 * 1000
})
instance.interceptors.request.use(
(config) => {
const loginUrl = '/web/auth/login';
const setAccountInfo = '/web/register/setAccountInfo';
const passMsgOld = '/web/auth/changePassOld';
const getCam = '/web/auth/getCam';
const LoginCode = '/web/code/loginCode';
const registerCode = '/web/code/registerCode';
const registerEmailCode = 'web/code/registerEmailCode';
const passwordEmailCode = 'web/code/passwordEmailCode';
const passwordCode = '/web/code/passwordCode';
const changePassCode = '/web/auth/changePassCode';
const loginOut = '/web/auth/loginOut';
const setLog = '/web/auth/setLog';
const LabelType = '/activity/labelType';
const HotList = '/activityCenter/hotList';
const GetActiveInfo = '/activityCenter/detail/';
if ((config.url.indexOf(loginUrl) != -1 && config.url.indexOf(loginOut) == -1) ||
config.url.indexOf(setAccountInfo) != -1 ||
config.url.indexOf(passMsgOld) != -1 ||
config.url.indexOf(getCam) != -1 ||
config.url.indexOf(LoginCode) != -1 ||
config.url.indexOf(registerCode) != -1 ||
config.url.indexOf(registerEmailCode) != -1 ||
config.url.indexOf(passwordEmailCode) != -1 ||
config.url.indexOf(changePassCode) != -1 ||
config.url.indexOf(passwordCode) != -1 ||
config.url.indexOf(setLog) != -1 ||
config.url.indexOf(LabelType) != -1 ||
config.url.indexOf(HotList) != -1 ||
config.url.indexOf(GetActiveInfo) != -1) {
return config
}
const token = localStorage.getItem('index-token-all');
if (token) {
config.headers.token = token;
} else {
router.push({
path: '/login',
query: {
redirect: router.currentRoute.fullPath
} // 从哪个页面跳转
})
const error = new Error('请登录!')
return Promise.reject(error)
}
let cancel
// 设置cancelToken对象
config.cancelToken = new axios.CancelToken(function (c) {
cancel = c
})
if (
config.url.indexOf('/web/config/getUniversity') == -1 &&
config.url.indexOf('/web/config/getProfession') == -1
) {
// 阻止重复请求。当上个请求未完成时,相同的请求不会进行
stopRepeatRequest(
reqList,
config.url,
cancel,
`${config.url} 请求被中断`
)
}
if (config.hasLoading) {
const loadingText = config.loadingText ? config.loadingText : '请求中'
loadingInstance = Loading.service({
lock: true,
fullscreen: true,
text: loadingText,
background: 'rgba(0, 0, 0, 0.25)'
})
}
return config
},
(error) => {
return Promise.reject(error)
}
)
instance.interceptors.response.use(
(res) => {
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) {
let isLogout = res.config.url == '/web/auth/loginOut';
// 清除本地缓存 除了特殊缓存
store.commit('removeLocalStorage');
router.push({
path: '/' + store.state.indexIdentity,
})
if (!isLogout) {
Notification({
message: res.data.message,
duration: 3000,
});
}
return
}
if (res.data.code == 400003) {
// 清除本地缓存 除了特殊缓存
store.commit('removeLocalStorage');
router.push({
path: '/login',
query: {
redirect: router.currentRoute.fullPath
} // 从哪个页面跳转
})
}
loadingInstance && loadingInstance.close()
setTimeout(() => {
allowRequest(reqList, res.config.url)
}, 1000)
return res
},
(error) => {
console.log(error, 'err')
Message.closeAll()
if (error.message == '请登录!') {
router.push({
path: "/login?code=" + store.state.indexIdentity,
})
}
if (error.response.status == 404) {
Notification({
message: "营地报名已关闭",
duration: 3000,
});
}
if (axios.isCancel(error)) {
console.log(error.message)
} else {
// 增加延迟,相同请求不得在短时间内重复发送
setTimeout(() => {
console.log(error)
allowRequest(reqList, error.config.url)
}, 1000)
}
loadingInstance && loadingInstance.close()
return Promise.reject(error)
}
)
return instance(config)
}
/**
* axios:upload 文件上传方法
* @param url
* @param data
* @returns {Promise}
*/
export function upload(url, data = {}) {
return new Promise((resolve, reject) => {
axios.post(url, data).then(
(response) => {
resolve(response);
},
(err) => {
reject(err);
}
);
});
}
// 通用下载方法
export function download(url, params, filename) {
console.log(url, params, filename)
return instance.post(url, params, {
transformRequest: [
params => {
return tansParams(params);
}
],
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
responseType: "blob"
})
.then(data => {
const content = data;
const blob = new Blob([content]);
if ("download" in document.createElement("a")) {
const elink = document.createElement("a");
elink.download = filename;
elink.style.display = "none";
elink.href = URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
URL.revokeObjectURL(elink.href);
document.body.removeChild(elink);
} else {
navigator.msSaveBlob(blob, filename);
}
})
.catch(r => {
console.error(r);
});
}
// 合并多个请求
export function allRequest(arrRequest) {
return axios.all(arrRequest)
}
...@@ -153,16 +153,13 @@ function checkCam(code, cb) { ...@@ -153,16 +153,13 @@ function checkCam(code, cb) {
window.localStorage.setItem("bk_pic" + code, res.data.background_picture); window.localStorage.setItem("bk_pic" + code, res.data.background_picture);
//当前营地logo //当前营地logo
window.localStorage.setItem("system_logo" + code, res.data.system_logo); window.localStorage.setItem("system_logo" + code, res.data.system_logo);
window.localStorage.setItem( window.localStorage.setItem("doubt_code" + code,
"doubt_code" + code,
res.data.fill_individual_Invitationcode res.data.fill_individual_Invitationcode
); //是否填写邀请码 ); //是否填写邀请码
window.localStorage.setItem( window.localStorage.setItem("doubt_info" + code,
"doubt_info" + code,
res.data.fill_individual_information res.data.fill_individual_information
); //是否填写个人资料 ); //是否填写个人资料
window.localStorage.setItem( window.localStorage.setItem("doubt_check" + code,
"doubt_check" + code,
res.data.audit_individual_information res.data.audit_individual_information
); //是否审核个人资料 ); //是否审核个人资料
// 判断使用微信二维码付款/上传转账截图 // 判断使用微信二维码付款/上传转账截图
......
...@@ -31,4 +31,17 @@ export default { ...@@ -31,4 +31,17 @@ export default {
state.fullPath = path; state.fullPath = path;
window.localStorage.setItem('index-fullPath', path); window.localStorage.setItem('index-fullPath', path);
}, },
removeLocalStorage(state){
for (let key in window.localStorage) {
if (key.indexOf('email') == -1 &&
key.indexOf('multiform') == -1 &&
key.indexOf('register_code_time') == -1 &&
key.indexOf('restet_code_phone') == -1 &&
key.indexOf('restet_code_time') == -1 &&
key.indexOf('index-active-path') == -1 &&
key.indexOf('index-fullPath') == -1) {
window.localStorage.removeItem(key);
}
}
},
}; };
...@@ -265,8 +265,7 @@ ...@@ -265,8 +265,7 @@
this.$message.success(res.data.message); this.$message.success(res.data.message);
this.codeTime = res.data.data.now * 1000; this.codeTime = res.data.data.now * 1000;
// console.log(this.codeTime) // console.log(this.codeTime)
window.localStorage.setItem( window.localStorage.setItem("register_code_time",
"register_code_time",
res.data.data.now * 1000 res.data.data.now * 1000
); );
this.intervalHandle(new Date(), res.data.data.now * 1000); this.intervalHandle(new Date(), res.data.data.now * 1000);
......
...@@ -263,8 +263,7 @@ ...@@ -263,8 +263,7 @@
this.$message.success(res.data.message); this.$message.success(res.data.message);
this.codeTime = res.data.data.now * 1000; this.codeTime = res.data.data.now * 1000;
// console.log(this.codeTime) // console.log(this.codeTime)
window.localStorage.setItem( window.localStorage.setItem("restet_code_time" ,
"restet_code_time" ,
res.data.data.now * 1000 res.data.data.now * 1000
); );
this.intervalHandle(new Date(), res.data.data.now * 1000); this.intervalHandle(new Date(), res.data.data.now * 1000);
...@@ -288,8 +287,7 @@ ...@@ -288,8 +287,7 @@
} }
this.$message.success(res.data.message); this.$message.success(res.data.message);
// token存储 // token存储
window.localStorage.setItem( window.localStorage.setItem("restet_code_phone" ,
"restet_code_phone" ,
this.resetForm.phone this.resetForm.phone
); );
this.$router.replace("/baseLogin"); this.$router.replace("/baseLogin");
......
...@@ -534,11 +534,11 @@ export default { ...@@ -534,11 +534,11 @@ export default {
mounted() {}, mounted() {},
created() { created() {
const code = this.$store.state.indexIdentity; const code = this.$store.state.indexIdentity;
this.referForm.phone = window.localStorage.getItem("phone" + code); //本地取用户手机号 this.referForm.phone = window.localStorage.getItem("index-phone-all"); //本地取用户手机号
this.referForm.email = window.localStorage.getItem("email" + code); //本地取用户邮箱 this.referForm.email = window.localStorage.getItem("email" + code); //本地取用户邮箱
console.log(this.referForm.email, " this.referForm.email"); console.log(this.referForm.email, " this.referForm.email");
let signUpFile = window.localStorage.getItem( let signUpFile = window.localStorage.getItem(
"sign_up_file_" + window.localStorage.getItem("phone" + code) + code "sign_up_file_" + window.localStorage.getItem("index-phone-all") + code
); );
// console.log(signUpFile); // console.log(signUpFile);
if (signUpFile && JSON.parse(signUpFile).length > 0) { if (signUpFile && JSON.parse(signUpFile).length > 0) {
...@@ -791,8 +791,7 @@ export default { ...@@ -791,8 +791,7 @@ export default {
if (res.data.code === 200) { if (res.data.code === 200) {
this.schoolName = res.data.school_list; this.schoolName = res.data.school_list;
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.setItem( window.localStorage.setItem("schoolName" + code,
"schoolName" + code,
JSON.stringify(res.data.list) JSON.stringify(res.data.list)
); );
for (let key in this.schoolName) { for (let key in this.schoolName) {
......
...@@ -208,8 +208,7 @@ ...@@ -208,8 +208,7 @@
); );
if (!camp_statement) { if (!camp_statement) {
this.dialogVisible = true; //营地通知列表弹窗 this.dialogVisible = true; //营地通知列表弹窗
window.localStorage.setItem( window.localStorage.setItem("camp_statement" + this.$store.state.indexIdentity,
"camp_statement" + this.$store.state.indexIdentity,
"1" "1"
); );
} }
...@@ -354,15 +353,12 @@ ...@@ -354,15 +353,12 @@
window.localStorage.setItem("has_amount" + code, res.data.has_amount); window.localStorage.setItem("has_amount" + code, res.data.has_amount);
window.localStorage.setItem("campsite_id" + code, res.data.campsite_id); window.localStorage.setItem("campsite_id" + code, res.data.campsite_id);
window.localStorage.setItem("order_no" + code, res.data.order_no); window.localStorage.setItem("order_no" + code, res.data.order_no);
window.localStorage.setItem( window.localStorage.setItem("examine_status" + code,
"examine_status" + code,
res.data.examine_status res.data.examine_status
); //返回错误原因 ); //返回错误原因
window.localStorage.setItem( window.localStorage.setItem("examine_reason" + code,
"examine_reason" + code,
res.data.examine_reason res.data.examine_reason
); //资料审核状态 ); //资料审核状态
// window.localStorage.setItem("achievement_path", res.data.achievement_path); //上传的图片
const aPath = res.data.achievement_path; const aPath = res.data.achievement_path;
if (aPath) { if (aPath) {
let arr = aPath.split(","); let arr = aPath.split(",");
...@@ -374,9 +370,8 @@ ...@@ -374,9 +370,8 @@
return obj; return obj;
}); });
// let code = this.$store.state.indexIdentity; // let code = this.$store.state.indexIdentity;
window.localStorage.setItem( window.localStorage.setItem("sign_up_file_" +
"sign_up_file_" + window.localStorage.getItem("index-phone-all") +
window.localStorage.getItem("phone" + code) +
code, code,
JSON.stringify(fileList) JSON.stringify(fileList)
); //上传的图片 ); //上传的图片
...@@ -397,13 +392,11 @@ ...@@ -397,13 +392,11 @@
// console.log(fileList) // console.log(fileList)
// console.log(JSON.stringify(fileList)) // console.log(JSON.stringify(fileList))
// let code = this.$store.state.indexIdentity; // let code = this.$store.state.indexIdentity;
window.localStorage.setItem( window.localStorage.setItem("bank_info" + window.localStorage.getItem("index-phone-all") + code,
"bank_info" + window.localStorage.getItem("phone" + code) + code,
JSON.stringify(fileList) JSON.stringify(fileList)
); //上传的图片 ); //上传的图片
} else { } else {
window.localStorage.setItem( window.localStorage.setItem("bank_info" + window.localStorage.getItem("index-phone-all") + code,
"bank_info" + window.localStorage.getItem("phone" + code) + code,
"[]" "[]"
); );
} }
......
...@@ -271,7 +271,7 @@ ...@@ -271,7 +271,7 @@
console.log(value, "value"); console.log(value, "value");
// let code = this.$store.state.indexIdentity; // let code = this.$store.state.indexIdentity;
// this.formData.stu_enclosure_url = window.localStorage.getItem( // this.formData.stu_enclosure_url = window.localStorage.getItem(
// "student_file_" + window.localStorage.getItem("phone" + code) + code // "student_file_" + window.localStorage.getItem("index-phone-all") + code
// ); // );
// console.log( // console.log(
// this.stu_fileList,' this.stu_fileList' // this.stu_fileList,' this.stu_fileList'
...@@ -327,12 +327,10 @@ ...@@ -327,12 +327,10 @@
}; };
}, },
created() { created() {
// console.log(this.formData.stu_enclosure_url);
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
let stu_fileListoss = window.localStorage.getItem( let stu_fileListoss = window.localStorage.getItem(
"student_file_" + window.localStorage.getItem("phone" + code) + code "student_file_" + window.localStorage.getItem("index-phone-all") + code
); );
console.log(stu_fileListoss);
if (stu_fileListoss && JSON.parse(stu_fileListoss).length > 0) { if (stu_fileListoss && JSON.parse(stu_fileListoss).length > 0) {
this.stu_fileListoss = JSON.parse(stu_fileListoss); this.stu_fileListoss = JSON.parse(stu_fileListoss);
} }
...@@ -352,7 +350,6 @@ ...@@ -352,7 +350,6 @@
//老师作业展示 //老师作业展示
getTeachList() { getTeachList() {
let url = this.enclosure_urls; let url = this.enclosure_urls;
// console.log(this.enclosure_urls);
if (this.enclosure_urls) { if (this.enclosure_urls) {
let arr = url.split(","); let arr = url.split(",");
arr.forEach((item) => { arr.forEach((item) => {
...@@ -368,16 +365,7 @@ ...@@ -368,16 +365,7 @@
}, },
// 下载老师附件 // 下载老师附件
downloadStuFile(url) { downloadStuFile(url) {
// this.download(
// "http://api.campcenter.cn/web/download/downloadTeacherWork",
// {
// enclosure_url: url,
// identity: this.$store.state.indexIdentity
// },
// ""
// );
downloadTeacherWork({enclosure_url: url}).then((res) => { downloadTeacherWork({enclosure_url: url}).then((res) => {
// console.log(res, "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);
} }
...@@ -394,7 +382,6 @@ ...@@ -394,7 +382,6 @@
// 下载老师评分结果 // 下载老师评分结果
downloadScoreFile(url) { downloadScoreFile(url) {
downloadTeacherWork({enclosure_url: url}).then((res) => { downloadTeacherWork({enclosure_url: url}).then((res) => {
// console.log(res, "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);
} }
...@@ -410,13 +397,8 @@ ...@@ -410,13 +397,8 @@
}, },
// 学生作业回显 // 学生作业回显
getStudentWork(student_status) { getStudentWork(student_status) {
// console.log(student_status, "student_status");
let stu_work_num = this.work_nums; let stu_work_num = this.work_nums;
// console.log(stu_work_num);
// console.log(this.formData);
// return
getStudentWork({teacher_id: stu_work_num}).then((res) => { getStudentWork({teacher_id: stu_work_num}).then((res) => {
// console.log(res, "getStudentWork");
if (res.data.code != 200) { if (res.data.code != 200) {
return this.$message.error(res.data.message); return this.$message.error(res.data.message);
} }
...@@ -424,10 +406,8 @@ ...@@ -424,10 +406,8 @@
if (student_status == 1) { if (student_status == 1) {
// 学生已提交 // 学生已提交
this.formData.stu_answer = res.data.data.stu_answer; this.formData.stu_answer = res.data.data.stu_answer;
// console.log(this.formData);
//学生的已经提交的相关附件 //学生的已经提交的相关附件
this.formData.stu_enclosure_url = res.data.data.stu_enclosure_url; this.formData.stu_enclosure_url = res.data.data.stu_enclosure_url;
console.log(this.formData.stu_enclosure_url)
let gotfileList = res.data.data.work; let gotfileList = res.data.data.work;
if (gotfileList) { if (gotfileList) {
this.stu_fileList = gotfileList.map((item) => { this.stu_fileList = gotfileList.map((item) => {
...@@ -438,14 +418,11 @@ ...@@ -438,14 +418,11 @@
type: item.type, type: item.type,
}; };
}); });
//
this.fileList = gotfileList.map((item) => { this.fileList = gotfileList.map((item) => {
return { return {
url_open: item.url_open, url_open: item.url_open,
}; };
}); });
console.log(this.stu_fileList);
console.log(this.fileList);
} }
this.$forceUpdate(); this.$forceUpdate();
} else if (student_status == 2) { } else if (student_status == 2) {
...@@ -464,11 +441,9 @@ ...@@ -464,11 +441,9 @@
} }
this.score = res.data.data.score; //老师评分 this.score = res.data.data.score; //老师评分
this.teacher_commment = res.data.data.teacher_commment; //老师评语 this.teacher_commment = res.data.data.teacher_commment; //老师评语
// console.log(res.data.data.teacher_commment, " this.teacher_commment");
let scoreFileList = res.data.data.teacher_url; let scoreFileList = res.data.data.teacher_url;
if (scoreFileList) { if (scoreFileList) {
let arr = scoreFileList.split(","); let arr = scoreFileList.split(",");
// console.log(arr, "arr");
this.tea_scoreFileList = arr.map((item) => { this.tea_scoreFileList = arr.map((item) => {
return { return {
name: item.split("workforstudent/")[1], name: item.split("workforstudent/")[1],
...@@ -486,7 +461,7 @@ ...@@ -486,7 +461,7 @@
cancelBtnTrue() { cancelBtnTrue() {
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.removeItem( window.localStorage.removeItem(
"student_file_" + window.localStorage.getItem("phone" + code) + code "student_file_" + window.localStorage.getItem("index-phone-all") + code
); );
this.stu_fileList = []; this.stu_fileList = [];
this.stu_fileListoss = ""; this.stu_fileListoss = "";
...@@ -501,10 +476,9 @@ ...@@ -501,10 +476,9 @@
cancelBtn() { cancelBtn() {
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.removeItem( window.localStorage.removeItem(
"student_file_" + window.localStorage.getItem("phone" + code) + code "student_file_" + window.localStorage.getItem("index-phone-all") + code
); );
this.stu_fileList = []; this.stu_fileList = [];
this.stu_fileListoss = ""; this.stu_fileListoss = "";
this.teaFileList = []; this.teaFileList = [];
this.dialogVisible = false; this.dialogVisible = false;
...@@ -520,10 +494,7 @@ ...@@ -520,10 +494,7 @@
}, },
uploadPicture(params) { uploadPicture(params) {
this.isUploading = true; this.isUploading = true;
// console.log("已经准备好上传图片", params);
this.file = params.file; this.file = params.file;
// console.log(this.file, "1111");
console.log(this.file, "1111");
let raw = params.file; let raw = params.file;
let image = { let image = {
name: raw.name, name: raw.name,
...@@ -542,7 +513,6 @@ ...@@ -542,7 +513,6 @@
teacher_id: this.work_nums, teacher_id: this.work_nums,
}) })
.then((res) => { .then((res) => {
// console.log(res, "开始上传图片");
if (res.data.code === 200) { if (res.data.code === 200) {
let oss_url = res.data.config.host; let oss_url = res.data.config.host;
let filename = res.data.config.file; let filename = res.data.config.file;
...@@ -555,12 +525,10 @@ ...@@ -555,12 +525,10 @@
formData.append("callback", res.data.config.callback); formData.append("callback", res.data.config.callback);
formData.append("success_action_status", 200); formData.append("success_action_status", 200);
formData.append("file", file); formData.append("file", file);
// console.log(formData);
this.upload(oss_url, formData) this.upload(oss_url, formData)
.then((ress) => { .then((ress) => {
console.log(ress, "ress"); console.log(ress, "ress");
if (ress.data.code != 200) { if (ress.data.code != 200) {
// console.log(ress, "ress");
this.isUploading = false; this.isUploading = false;
return this.$message.error(ress.data.message); return this.$message.error(ress.data.message);
} }
...@@ -572,27 +540,20 @@ ...@@ -572,27 +540,20 @@
savefile: res.data.config.savefile, savefile: res.data.config.savefile,
name: res.data.config.savefile.split("/work/")[1], name: res.data.config.savefile.split("/work/")[1],
}; };
console.log(this.stu_fileList, "this.stu_fileList");
this.stu_fileList.push(obj); this.stu_fileList.push(obj);
this.fileList.push(obj); this.fileList.push(obj);
console.log(this.fileList, 'this.fileList')
this.stu_fileListoss = this.stu_fileList this.stu_fileListoss = this.stu_fileList
.map((item) => { .map((item) => {
return item.url_open; return item.url_open;
}) })
.join(","); .join(",");
console.log(this.stu_fileListoss, "stu_fileListoss");
// this.formData.stu_enclosure_url = this.stu_fileListoss;
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
console.log(typeof (this.stu_fileListoss)) window.localStorage.setItem("student_file_" +
window.localStorage.setItem( +window.localStorage.getItem("index-phone-all") +
"student_file_" +
+window.localStorage.getItem("phone" + code) +
code, code,
JSON.stringify(this.stu_fileListoss) JSON.stringify(this.stu_fileListoss)
); );
console.log('student_file_')
this.isUploading = false; this.isUploading = false;
}) })
.catch((err) => { .catch((err) => {
...@@ -606,7 +567,6 @@ ...@@ -606,7 +567,6 @@
}) })
.catch((err) => { .catch((err) => {
this.isUploading = false; this.isUploading = false;
// console.log(err);
}); });
}, },
// 下载证明资料图片 // 下载证明资料图片
...@@ -640,7 +600,7 @@ ...@@ -640,7 +600,7 @@
if (item.url_open == file.url_open) { if (item.url_open == file.url_open) {
this.stu_fileList.splice(idx, 1); this.stu_fileList.splice(idx, 1);
// this.fileList.splice(idx, 1); // this.fileList.splice(idx, 1);
console.log( this.fileList); console.log(this.fileList);
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
this.stu_fileListoss = this.stu_fileList this.stu_fileListoss = this.stu_fileList
.map(function (item, index) { .map(function (item, index) {
...@@ -650,9 +610,8 @@ ...@@ -650,9 +610,8 @@
console.log(this.stu_fileListoss); console.log(this.stu_fileListoss);
console.log(this.stu_fileList); console.log(this.stu_fileList);
this.$message.success(res.data.message); this.$message.success(res.data.message);
window.localStorage.setItem( window.localStorage.setItem("student_file_" +
"student_file_" + window.localStorage.getItem("index-phone-all") +
window.localStorage.getItem("phone" + code) +
code, code,
this.stu_fileListoss this.stu_fileListoss
); );
...@@ -698,10 +657,10 @@ ...@@ -698,10 +657,10 @@
.substring(url.lastIndexOf(".") + 1, url.length) .substring(url.lastIndexOf(".") + 1, url.length)
.split("?")[0]; .split("?")[0];
let isWord = onlineViewType.find((type) => type === fileTypeName); let isWord = onlineViewType.find((type) => type === fileTypeName);
console.log(isWord,'isWord') console.log(isWord, 'isWord')
if (isWord=='ppt'||isWord=='pptx') { if (isWord == 'ppt' || isWord == 'pptx') {
url = "http://view.officeapps.live.com/op/view.aspx?src=" + url; url = "http://view.officeapps.live.com/op/view.aspx?src=" + url;
}else { } else {
url = url; url = url;
} }
window.open(url, "_blank"); window.open(url, "_blank");
......
<template> <template>
<div class="container"> <div class="container">
<div class="title_Login"> <div class="title_Login">
<div v-if="changeLogin == 1"> <div v-if="changeLogin == 1">
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
:prop="changeLogin == 2 ? 'code' : ''" :prop="changeLogin == 2 ? 'code' : ''"
ref="code" ref="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="loginForm.code" v-model="loginForm.code"
placeholder="请输入短信验证码" placeholder="请输入短信验证码"
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
<!-- 短信验证码 --> <!-- 短信验证码 -->
<div class="phoneCode"> <div class="phoneCode">
<span class="code" v-show="showCode" @click="getCode" <span class="code" v-show="showCode" @click="getCode"
>获取验证码</span >获取验证码</span
> >
<span v-show="!showCode" class="count">{{ count }} s</span> <span v-show="!showCode" class="count">{{ count }} s</span>
</div> </div>
...@@ -110,353 +110,371 @@ ...@@ -110,353 +110,371 @@
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
import Cookie from "js-cookie"; import Cookie from "js-cookie";
import { login, loginCode } from "r/index/login"; import {login, loginCode} from "r/index/login";
import { mobileCheck } from "@/common/utils.js"; import {mobileCheck} from "@/common/utils.js";
import { intervalTime } from "store/time"; import {intervalTime} from "store/time";
export default { export default {
name: "index-login", name: "index-login",
data() { data() {
return { return {
isShowPwd: true, // 控制密码显示隐藏 isShowPwd: true, // 控制密码显示隐藏
// 手机验证短信 // 手机验证短信
showCode: true, showCode: true,
count: "", count: "",
timer: null, timer: null,
codeTime: "", //手机验证码倒计时时间 codeTime: "", //手机验证码倒计时时间
loginForm: { loginForm: {
phone: null, phone: null,
password: null, password: null,
code: null, code: null,
}, },
// 表单验证规则对象 // 表单验证规则对象
loginFormRules: { loginFormRules: {
// 对手机号进行校验 // 对手机号进行校验
phone: [ phone: [
{ required: true, message: "请输入手机号", trigger: "blur" }, {required: true, message: "请输入手机号", trigger: "blur"},
{ {
validator: function (rule, value, callback) { validator: function (rule, value, callback) {
if (mobileCheck(value) === false) { if (mobileCheck(value) === false) {
callback(new Error("请输入正确的手机号")); callback(new Error("请输入正确的手机号"));
} else { } else {
callback(); callback();
} }
},
trigger: "blur",
}, },
trigger: "blur", ],
}, // 对密码进行校验
], password: [
// 对密码进行校验 {
password: [ required: true,
{ message: "请输入密码",
required: true, transform: (value) => value,
message: "请输入密码", trigger: "blur",
transform: (value) => value,
trigger: "blur",
},
{
type: "string",
message: "请输入不包含空格的字符",
trigger: "blur",
transform(value) {
if (value && value.indexOf(" ") === -1) {
return value;
} else {
return false;
}
}, },
}, {
{ type: "string",
trigger: "blur", message: "请输入不包含空格的字符",
validator: (rule, value, callback) => { trigger: "blur",
var passwordreg = /^[a-zA-Z0-9]{6,12}$/; transform(value) {
// /(?=.*\d)(?=.*[a-zA-Z]).{6,12}/; if (value && value.indexOf(" ") === -1) {
if (!passwordreg.test(value)) { return value;
callback(new Error("请输入6-12位,包含数字/字母,")); } else {
} else { return false;
callback(); }
} },
}, },
}, {
], trigger: "blur",
// 对验证码进行校验 validator: (rule, value, callback) => {
code: [ var passwordreg = /^[a-zA-Z0-9]{6,12}$/;
{ required: true, message: "请输入验证码", trigger: "blur" }, // /(?=.*\d)(?=.*[a-zA-Z]).{6,12}/;
{ min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur" }, if (!passwordreg.test(value)) {
], callback(new Error("请输入6-12位,包含数字/字母,"));
}, } else {
changeLogin: 2, callback();
}; }
}, },
created() { },
this.$emit("getStatus", false); ],
const code = this.$store.state.indexIdentity; // 对验证码进行校验
const endTime = window.localStorage.getItem("login_code_time" + code); code: [
{required: true, message: "请输入验证码", trigger: "blur"},
{min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur"},
],
},
changeLogin: 2,
};
},
created() {
this.$emit("getStatus", false);
const code = this.$store.state.indexIdentity;
const endTime = window.localStorage.getItem("login_code_time" + code);
if (endTime && Number(endTime) > new Date().getTime()) { if (endTime && Number(endTime) > new Date().getTime()) {
this.loginForm.phone = phone; this.loginForm.phone = phone;
this.intervalHandle(new Date(), Number(endTime)); this.intervalHandle(new Date(), Number(endTime));
}
this.commonApi(31)
},
methods: {
// 定时器倒计时
intervalHandle(startTime, endTime) {
// 时间差
const timeLag = intervalTime(startTime, endTime);
console.log(timeLag);
if (!this.timer) {
this.count = timeLag - 1;
this.showCode = false;
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= timeLag) {
this.count--;
} else {
this.showCode = true;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
} }
this.commonApi(31)
}, },
// 获取手机验证短信 methods: {
getCode() { // 定时器倒计时
if (!this.loginForm.phone) { intervalHandle(startTime, endTime) {
return this.$message.error("请输入手机号"); // 时间差
} const timeLag = intervalTime(startTime, endTime);
// if (!this.codeTime) { console.log(timeLag);
// return this.$message.error("您已经获取验证码,请去邮箱中进行查看"); if (!this.timer) {
// } this.count = timeLag - 1;
// 接口获得验证码 this.showCode = false;
loginCode({ this.timer = setInterval(() => {
phone: this.loginForm.phone, if (this.count > 0 && this.count <= timeLag) {
}).then((res) => { this.count--;
console.log(res, "passwordCode"); } else {
if (res.data.code != 200) { this.showCode = true;
return this.$message.error(res.data.message); clearInterval(this.timer);
this.timer = null;
}
}, 1000);
} }
this.$message.success(res.data.message); },
this.codeTime = res.data.data.now * 1000; // 获取手机验证短信
// console.log(this.codeTime) getCode() {
let code = this.$store.state.indexIdentity; if (!this.loginForm.phone) {
window.localStorage.setItem( return this.$message.error("请输入手机号");
"login_code_time" + code,
res.data.data.now * 1000
);
this.intervalHandle(new Date(), res.data.data.now * 1000);
});
},
// 忘记账号/密码
forgetPwd() {
let code = this.$store.state.indexIdentity;
this.$router.push("/reset?code=" + code);
},
// 去注册
register() {
let code = this.$store.state.indexIdentity;
this.$router.push("/register?code=" + code);
},
// 改变密码显示状态
changePwdStatus() {
this.isShowPwd = !this.isShowPwd;
},
toLogin() {
this.loginForm = {};
this.changeLogin = 1;
this.$nextTick(() => {
this.$refs["loginFormRef"].clearValidate();
});
},
toCodeLogin() {
this.loginForm = {};
this.changeLogin = 2;
this.$nextTick(() => {
this.$refs["loginFormRef"].clearValidate();
});
},
// 登录
submitForm() {
this.$refs["loginFormRef"].validate((valid) => {
if (!valid) return;
let obj = {};
if (this.changeLogin == 1) {
obj.phone = this.loginForm.phone;
obj.password = this.loginForm.password;
} else {
obj.phone = this.loginForm.phone;
obj.code = this.loginForm.code;
} }
console.log(obj); // if (!this.codeTime) {
login(obj).then((res) => { // return this.$message.error("您已经获取验证码,请去邮箱中进行查看");
console.log(res, "login"); // }
// 接口获得验证码
loginCode({
phone: this.loginForm.phone,
}).then((res) => {
console.log(res, "passwordCode");
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("登录成功"); this.$message.success(res.data.message);
// 跳转到报名 this.codeTime = res.data.data.now * 1000;
const code = this.$store.state.indexIdentity; // console.log(this.codeTime)
// token存储 let code = this.$store.state.indexIdentity;
window.localStorage.setItem("index-token" + code, res.data.token);
window.localStorage.setItem("phone" + code, this.loginForm.phone);
window.localStorage.setItem("email" + code, res.data.email);
// 报名信息
window.localStorage.setItem("camp_name" + code, res.data.cam.name);
//获取主题色
window.localStorage.setItem( window.localStorage.setItem(
"system_color" + code, "login_code_time" + code,
res.data.cam.system_color res.data.data.now * 1000
); );
this.$router.replace("/signUp/examInfo?code=" + code); this.intervalHandle(new Date(), res.data.data.now * 1000);
});
},
// 忘记账号/密码
forgetPwd() {
let code = this.$store.state.indexIdentity;
this.$router.push("/reset?code=" + code);
},
// 去注册
register() {
let code = this.$store.state.indexIdentity;
this.$router.push("/register?code=" + code);
},
// 改变密码显示状态
changePwdStatus() {
this.isShowPwd = !this.isShowPwd;
},
toLogin() {
this.loginForm = {};
this.changeLogin = 1;
this.$nextTick(() => {
this.$refs["loginFormRef"].clearValidate();
});
},
toCodeLogin() {
this.loginForm = {};
this.changeLogin = 2;
this.$nextTick(() => {
this.$refs["loginFormRef"].clearValidate();
});
},
// 登录
submitForm() {
this.$refs["loginFormRef"].validate((valid) => {
if (!valid) return;
let obj = {};
if (this.changeLogin == 1) {
obj.phone = this.loginForm.phone;
obj.password = this.loginForm.password;
} else {
obj.phone = this.loginForm.phone;
obj.code = this.loginForm.code;
}
console.log(obj);
login(obj).then((res) => {
console.log(res, "login");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
// this.$message.success("登录成功");
// 跳转到报名
const code = this.$store.state.indexIdentity;
// token存储
window.localStorage.setItem("index-token-all", res.data.token);
window.localStorage.setItem("index-phone-all", this.loginForm.phone);
window.localStorage.setItem("email" + code, res.data.email);
// 报名信息
window.localStorage.setItem("camp_name" + code, res.data.cam.name);
//获取主题色
window.localStorage.setItem("system_color" + code,
res.data.cam.system_color
);
this.$router.replace("/signUp/examInfo?code=" + code);
});
}); });
}); },
}, },
}, };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.flex { .flex {
display: flex; display: flex;
}
.container {
height: 440px;
background: #ffffff;
box-shadow: 0px 1px 18px 0px rgba(0, 0, 0, 0.06);
border-radius: 8px;
padding: 40px 60px;
margin-top: 0;
overflow: hidden;
.title_Login {
position: relative;
margin: 19px 0 0 0;
text-align: center;
.title {
height: 20px;
font-size: 16px;
font-weight: 500;
color: var(--color);
line-height: 20px;
text-align: right;
}
.change_login {
font-size: 22px;
margin-top: 32px;
color: black;
text-align: center;
}
} }
.el-form { .container {
margin-top: 60px; height: 440px;
.el-form-item { background: #ffffff;
box-shadow: 0px 1px 18px 0px rgba(0, 0, 0, 0.06);
border-radius: 8px;
padding: 40px 60px;
margin-top: 0;
overflow: hidden;
.title_Login {
position: relative; position: relative;
margin-bottom: 30px; margin: 19px 0 0 0;
&:last-child { text-align: center;
margin: 0;
}
.phoneCode {
position: absolute;
z-index: 999;
top: 50%;
right: 25px;
transform: translate(0, -50%);
cursor: pointer;
.code { .title {
font-size: 14px; height: 20px;
font-weight: 600; font-size: 16px;
color: var(--color); font-weight: 500;
} color: var(--color);
} line-height: 20px;
img.img_l { text-align: right;
position: absolute;
left: 25px;
top: 50%;
transform: translate(-50%, -50%);
z-index: 1000;
}
img.img_r {
position: absolute;
right: 15px;
top: 50%;
transform: translate(0, -50%);
z-index: 1000;
}
::v-deep .el-input__inner {
height: 50px;
line-height: 50px;
padding: 0 10px 0 50px;
border-radius: 0;
color: #4d4d4d;
border: 0;
border-bottom: 2px solid #d9d9d9;
&:focus {
border-bottom-color: var(--color);
}
}
::v-deep .el-form-item__error {
color: #e0823d;
} }
.el-button {
width: 100%; .change_login {
height: 60px; font-size: 22px;
background: var(--color); margin-top: 32px;
border-radius: 4px; color: black;
opacity: 0.8;
line-height: 50px;
text-align: center; text-align: center;
color: #fff;
font-size: 16px;
padding: 0;
margin: 30px 0 0 0;
border: none;
} }
} }
.box {
height: 18px; .el-form {
// display: block; margin-top: 60px;
display: flex;
flex-direction: column; .el-form-item {
.fl { position: relative;
float: right; margin-bottom: 30px;
height: 18px;
line-height: 18px; &:last-child {
color: #999999; margin: 0;
margin-top: -10px; }
cursor: pointer;
&:hover { .phoneCode {
color: var(--color); position: absolute;
text-decoration: underline; z-index: 999;
top: 50%;
right: 25px;
transform: translate(0, -50%);
cursor: pointer;
.code {
font-size: 14px;
font-weight: 600;
color: var(--color);
}
}
img.img_l {
position: absolute;
left: 25px;
top: 50%;
transform: translate(-50%, -50%);
z-index: 1000;
}
img.img_r {
position: absolute;
right: 15px;
top: 50%;
transform: translate(0, -50%);
z-index: 1000;
}
::v-deep .el-input__inner {
height: 50px;
line-height: 50px;
padding: 0 10px 0 50px;
border-radius: 0;
color: #4d4d4d;
border: 0;
border-bottom: 2px solid #d9d9d9;
&:focus {
border-bottom-color: var(--color);
}
}
::v-deep .el-form-item__error {
color: #e0823d;
}
.el-button {
width: 100%;
height: 60px;
background: var(--color);
border-radius: 4px;
opacity: 0.8;
line-height: 50px;
text-align: center;
color: #fff;
font-size: 16px;
padding: 0;
margin: 30px 0 0 0;
border: none;
} }
} }
.fr {
float: left; .box {
height: 18px; height: 18px;
line-height: 18px; // display: block;
color: #999999; display: flex;
margin-top: -10px; flex-direction: column;
cursor: pointer;
&:hover { .fl {
color: var(--color); float: right;
text-decoration: underline; height: 18px;
line-height: 18px;
color: #999999;
margin-top: -10px;
cursor: pointer;
&:hover {
color: var(--color);
text-decoration: underline;
}
}
.fr {
float: left;
height: 18px;
line-height: 18px;
color: #999999;
margin-top: -10px;
cursor: pointer;
&:hover {
color: var(--color);
text-decoration: underline;
}
}
.fc {
font-size: 4px;
float: right;
// height: 18px;
line-height: 18px;
color: #999999;
margin-top: 10px;
// cursor: pointer;
// &:hover {
// color: #563279;
// text-decoration: underline;
// }
} }
}
.fc {
font-size: 4px;
float: right;
// height: 18px;
line-height: 18px;
color: #999999;
margin-top: 10px;
// cursor: pointer;
// &:hover {
// color: #563279;
// text-decoration: underline;
// }
} }
} }
} }
}
</style> </style>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
class="demo-registerForm" class="demo-registerForm"
> >
<el-form-item prop="phone"> <el-form-item prop="phone">
<img class="img_l" src="@/assets/img/reset/username.png" alt="" /> <img class="img_l" src="@/assets/img/reset/username.png" alt=""/>
<el-input <el-input
v-model="registerForm.phone" v-model="registerForm.phone"
placeholder="请输入手机号" placeholder="请输入手机号"
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
></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="请输入短信验证码"
...@@ -37,31 +37,31 @@ ...@@ -37,31 +37,31 @@
></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="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="6" maxlength="6"
></el-input> --> ></el-input> -->
<!-- 短信验证码 --> <!-- 短信验证码 -->
<div class="phoneCode"> <div class="phoneCode">
<span class="code" v-show="showCode" @click="getCode" <span class="code" v-show="showCode" @click="getCode"
>获取验证码</span >获取验证码</span
> >
<span v-show="!showCode" class="count">{{ count }} s</span> <span v-show="!showCode" 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
v-model="registerForm.password" v-model="registerForm.password"
maxlength="20" maxlength="20"
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
/> --> /> -->
</el-form-item> </el-form-item>
<el-form-item prop="rq_password"> <el-form-item prop="rq_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
v-model="registerForm.rq_password" v-model="registerForm.rq_password"
placeholder="请再次输入登录密码" placeholder="请再次输入登录密码"
...@@ -106,366 +106,365 @@ ...@@ -106,366 +106,365 @@
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
// 请求接口 // 请求接口
import { import {
registerCode, registerCode,
setAccountInfo, setAccountInfo,
registerEmailCode, registerEmailCode,
} from "r/index/register"; } from "r/index/register";
import { mobileCheck, checkStrong } from "@/common/utils.js"; import {mobileCheck, checkStrong} from "@/common/utils.js";
import validator from "common/validator"; import validator from "common/validator";
import { intervalTime } from "store/time"; import {intervalTime} from "store/time";
export default { export default {
name: "index-register", name: "index-register",
data() { data() {
const pwdCheck = async (rule, value, callback) => { const pwdCheck = async (rule, value, callback) => {
if (value !== this.registerForm.password) { if (value !== this.registerForm.password) {
callback(new Error("两次输入的密码不一致")); callback(new Error("两次输入的密码不一致"));
} else { } else {
callback(); callback();
} }
}; };
return { return {
inputType: "", inputType: "",
// 手机验证短信 // 手机验证短信
showCode: true, showCode: true,
count: "", count: "",
timer: null, timer: null,
codeTime: "", //手机验证码倒计时时间 codeTime: "", //手机验证码倒计时时间
isShowPwd: true, // 控制密码显示隐藏 isShowPwd: true, // 控制密码显示隐藏
registerForm: { registerForm: {
phone: "", phone: "",
// email: "", // email: "",
code: "", code: "",
password: "", password: "",
rq_password: "", rq_password: "",
}, },
// 表单验证规则对象 // 表单验证规则对象
registerRules: { registerRules: {
// 对手机号进行校验 // 对手机号进行校验
phone: [ phone: [
{ required: true, message: "请输入手机号", trigger: "blur" }, {required: true, message: "请输入手机号", trigger: "blur"},
{ {
validator: function (rule, value, callback) { validator: function (rule, value, callback) {
if (mobileCheck(value) === false) { if (mobileCheck(value) === false) {
callback(new Error("请输入正确的手机号")); callback(new Error("请输入正确的手机号"));
} else { } else {
callback(); callback();
} }
},
trigger: "blur",
}, },
trigger: "blur", ],
}, // 对邮箱验证
], // email: [
// 对邮箱验证 // { required: true, message: "请输入邮箱", trigger: "blur" },
// email: [ // {
// { required: true, message: "请输入邮箱", trigger: "blur" }, // validator: validator.validateEmail,
// { // trigger: "blur",
// validator: validator.validateEmail, // },
// trigger: "blur", // ],
// }, // 对验证码进行校验
// ], code: [
// 对验证码进行校验 {required: true, message: "请输入验证码", trigger: "blur"},
code: [ {min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur"},
{ required: true, message: "请输入验证码", trigger: "blur" }, ],
{ min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur" }, // 对密码进行校验
], password: [
// 对密码进行校验 {
password: [ required: true,
{ message: "请输入密码",
required: true, transform: (value) => value,
message: "请输入密码", trigger: "blur",
transform: (value) => value,
trigger: "blur",
},
{
type: "string",
message: "请输入不包含空格的字符",
trigger: "blur",
transform(value) {
if (value && value.indexOf(" ") === -1) {
return value;
} else {
return false;
}
}, },
}, {
{ type: "string",
trigger: "blur", message: "请输入不包含空格的字符",
validator: (rule, value, callback) => { trigger: "blur",
var passwordreg = /^[a-zA-Z0-9]{6,12}$/; transform(value) {
// /(?=.*\d)(?=.*[a-zA-Z]).{6,12}/; if (value && value.indexOf(" ") === -1) {
if (!passwordreg.test(value)) { return value;
callback(new Error("请输入6-12位,包含数字/字母,")); } else {
} else { return false;
callback(); }
} },
}, },
}, {
], trigger: "blur",
// 对密码进行校验 validator: (rule, value, callback) => {
rq_password: [ var passwordreg = /^[a-zA-Z0-9]{6,12}$/;
{ required: true, message: "请输入确认密码", trigger: "blur" }, // /(?=.*\d)(?=.*[a-zA-Z]).{6,12}/;
{ if (!passwordreg.test(value)) {
validator: pwdCheck, callback(new Error("请输入6-12位,包含数字/字母,"));
trigger: "blur", } else {
}, callback();
], }
}, },
}; },
}, ],
created() { // 对密码进行校验
const code = this.$store.state.indexIdentity; rq_password: [
const endTime = window.localStorage.getItem("register_code_time" + code); {required: true, message: "请输入确认密码", trigger: "blur"},
{
if (endTime && Number(endTime) > new Date().getTime()) { validator: pwdCheck,
this.resetForm.phone = phone; trigger: "blur",
this.intervalHandle(new Date(), Number(endTime)); },
} ],
this.commonApi(30) },
}, };
methods: {
// 去注册
toLogin() {
let code = this.$store.state.indexIdentity;
this.$router.push("/login?code=" + code);
},
// 改变密码显示状态
changePwdStatus() {
this.isShowPwd = !this.isShowPwd;
}, },
// 定时器倒计时 created() {
intervalHandle(startTime, endTime) { const code = this.$store.state.indexIdentity;
// 时间差 const endTime = window.localStorage.getItem("register_code_time" + code);
const timeLag = intervalTime(startTime, endTime);
console.log(timeLag); if (endTime && Number(endTime) > new Date().getTime()) {
if (!this.timer) { this.resetForm.phone = phone;
this.count = timeLag - 1; this.intervalHandle(new Date(), Number(endTime));
this.showCode = false;
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= timeLag) {
this.count--;
} else {
this.showCode = true;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
} }
this.commonApi(30)
}, },
// 获取手机验证短信 methods: {
getCode() { // 去注册
if (!this.registerForm.phone) { toLogin() {
return this.$message.error("请输入邮箱");
}
// if (!this.codeTime) {
// return this.$message.error("您已经获取验证码,请去邮箱中进行查看");
// }
// 接口获得验证码
registerCode({
phone: this.registerForm.phone,
}).then((res) => {
console.log(res, "passwordCode");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.$message.success(res.data.message);
this.codeTime = res.data.data.now * 1000;
// console.log(this.codeTime)
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.setItem( this.$router.push("/login?code=" + code);
"register_code_time" + code, },
res.data.data.now * 1000 // 改变密码显示状态
); changePwdStatus() {
this.intervalHandle(new Date(), res.data.data.now * 1000); this.isShowPwd = !this.isShowPwd;
}); },
}, // 定时器倒计时
intervalHandle(startTime, endTime) {
// 表单验证 // 时间差
submitForm() { const timeLag = intervalTime(startTime, endTime);
this.$refs["registerFormRef"].validate((valid) => { console.log(timeLag);
if (!valid) return; if (!this.timer) {
setAccountInfo({ this.count = timeLag - 1;
this.showCode = false;
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= timeLag) {
this.count--;
} else {
this.showCode = true;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
}
},
// 获取手机验证短信
getCode() {
if (!this.registerForm.phone) {
return this.$message.error("请输入邮箱");
}
// if (!this.codeTime) {
// return this.$message.error("您已经获取验证码,请去邮箱中进行查看");
// }
// 接口获得验证码
registerCode({
phone: this.registerForm.phone, phone: this.registerForm.phone,
// email: this.registerForm.email,
code: this.registerForm.code,
password: this.registerForm.password,
rq_password: this.registerForm.rq_password,
}).then((res) => { }).then((res) => {
console.log(res); console.log(res, "passwordCode");
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);
this.codeTime = res.data.data.now * 1000;
// console.log(this.codeTime)
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
// token存储 window.localStorage.setItem("register_code_time" + code,
window.localStorage.setItem("index-token" + code, res.data.token); res.data.data.now * 1000
window.localStorage.setItem("phone" + code, this.registerForm.phone);
// window.localStorage.setItem("email" + code, this.registerForm.email);
// 报名信息
window.localStorage.setItem("camp_name" + code, res.data.cam.name);
//获取主题色
window.localStorage.setItem(
"system_color" + code,
res.data.cam.system_color
); );
this.intervalHandle(new Date(), res.data.data.now * 1000);
});
},
// 跳转到报名 // 表单验证
submitForm() {
this.$router.replace("/signUp/examInfo?code=" + code); this.$refs["registerFormRef"].validate((valid) => {
if (!valid) return;
setAccountInfo({
phone: this.registerForm.phone,
// email: this.registerForm.email,
code: this.registerForm.code,
password: this.registerForm.password,
rq_password: this.registerForm.rq_password,
}).then((res) => {
console.log(res);
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
// this.$message.success(res.data.message);
let code = this.$store.state.indexIdentity;
// token存储
window.localStorage.setItem("index-token-all", res.data.token);
window.localStorage.setItem("index-phone-all", this.registerForm.phone);
// window.localStorage.setItem("email" + code, this.registerForm.email);
// 报名信息
window.localStorage.setItem("camp_name" + code, res.data.cam.name);
//获取主题色
window.localStorage.setItem("system_color" + code,
res.data.cam.system_color
);
// 跳转到报名
this.$router.replace("/signUp/examInfo?code=" + code);
});
}); });
}); },
}, },
}, };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
// 注册输入 // 注册输入
.container { .container {
background: #ffffff; background: #ffffff;
box-shadow: 0px 1px 18px 0px rgba(0, 0, 0, 0.06); box-shadow: 0px 1px 18px 0px rgba(0, 0, 0, 0.06);
border-radius: 8px; border-radius: 8px;
padding: 40px 60px; padding: 40px 60px;
margin-top: 0; margin-top: 0;
overflow: hidden; overflow: hidden;
.title { .title {
// margin: 19px 0 6px 0; // margin: 19px 0 6px 0;
// width: 132px; // width: 132px;
height: 20px; height: 20px;
font-size: 22px; font-size: 22px;
font-weight: 500; font-weight: 500;
color: var(--color); color: var(--color);
line-height: 20px; line-height: 20px;
} }
// .line {
// width: 103px;
// height: 3px;
// background: var(--color);
// border-radius: 2px;
// }
::v-deep .el-form {
margin-top: 60px;
.el-form-item { // .line {
position: relative; // width: 103px;
margin-bottom: 30px; // height: 3px;
// background: var(--color);
// border-radius: 2px;
// }
&:last-child { ::v-deep .el-form {
margin: 0; margin-top: 60px;
}
.el-form-item__content { .el-form-item {
position: relative; position: relative;
margin-bottom: 30px;
.phoneCode { &:last-child {
position: absolute; margin: 0;
z-index: 999; }
top: 50%;
right: 25px;
transform: translate(0, -50%);
cursor: pointer;
.code { .el-form-item__content {
font-size: 14px; position: relative;
font-weight: 600;
color: var(--color); .phoneCode {
position: absolute;
z-index: 999;
top: 50%;
right: 25px;
transform: translate(0, -50%);
cursor: pointer;
.code {
font-size: 14px;
font-weight: 600;
color: var(--color);
}
} }
}
img.img_l { img.img_l {
position: absolute; position: absolute;
left: 25px; left: 25px;
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
z-index: 1000; z-index: 1000;
} }
img.img_r { img.img_r {
position: absolute; position: absolute;
right: 15px; right: 15px;
top: 50%; top: 50%;
transform: translate(0, -50%); transform: translate(0, -50%);
z-index: 1000; z-index: 1000;
} }
.el-input__inner { .el-input__inner {
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;
padding: 0 10px 0 50px; padding: 0 10px 0 50px;
border-radius: 0; border-radius: 0;
color: #4d4d4d; color: #4d4d4d;
border: 0; border: 0;
border-bottom: 2px solid #d9d9d9; border-bottom: 2px solid #d9d9d9;
&:focus { &:focus {
border-bottom-color: var(--color); border-bottom-color: var(--color);
}
} }
}
.el-form-item__error { .el-form-item__error {
color: #e0823d; color: #e0823d;
} }
.el-button { .el-button {
width: 100%; width: 100%;
height: 60px; height: 60px;
background: var(--color); background: var(--color);
border-radius: 4px; border-radius: 4px;
opacity: 0.8; opacity: 0.8;
line-height: 50px; line-height: 50px;
text-align: center; text-align: center;
color: #fff; color: #fff;
font-size: 16px; font-size: 16px;
padding: 0; padding: 0;
margin: 30px 0 0 0; margin: 30px 0 0 0;
border: none; border: none;
}
} }
} }
}
.box { .box {
height: 18px;
display: block;
.fr {
// float: left;
text-align: center;
height: 18px; height: 18px;
line-height: 18px; display: block;
color: #999999;
margin-top: -10px; .fr {
cursor: pointer; // float: left;
&:hover { text-align: center;
color: var(--color); height: 18px;
text-decoration: underline; line-height: 18px;
color: #999999;
margin-top: -10px;
cursor: pointer;
&:hover {
color: var(--color);
text-decoration: underline;
}
} }
} }
} }
} }
}
@media screen and (max-width: 1601px) { @media screen and (max-width: 1601px) {
.container { .container {
right: 18%; right: 18%;
}
} }
}
@media screen and (max-width: 1501px) { @media screen and (max-width: 1501px) {
.container { .container {
right: 16%; right: 16%;
}
} }
}
@media screen and (max-width: 1401px) { @media screen and (max-width: 1401px) {
.container { .container {
right: 14%; right: 14%;
}
} }
}
</style> </style>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
class="demo-resetForm" class="demo-resetForm"
> >
<el-form-item prop="phone"> <el-form-item prop="phone">
<img class="img_l" src="@/assets/img/reset/username.png" alt="" /> <img class="img_l" src="@/assets/img/reset/username.png" alt=""/>
<el-input <el-input
v-model="resetForm.phone" v-model="resetForm.phone"
placeholder="请输入手机号" placeholder="请输入手机号"
...@@ -23,11 +23,11 @@ ...@@ -23,11 +23,11 @@
<el-input <el-input
v-model="resetForm.email" v-model="resetForm.email"
placeholder="请输入邮箱" placeholder="请输入邮箱"
></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="resetForm.code" v-model="resetForm.code"
placeholder="请输入短信验证码" placeholder="请输入短信验证码"
...@@ -47,18 +47,18 @@ ...@@ -47,18 +47,18 @@
v-model="resetForm.code" v-model="resetForm.code"
placeholder="请输入邮箱验证码" placeholder="请输入邮箱验证码"
maxlength="6" maxlength="6"
></el-input> --> ></el-input> -->
<!-- 短信验证码 --> <!-- 短信验证码 -->
<div class="phoneCode"> <div class="phoneCode">
<span class="code" v-show="showCode" @click="getCode" <span class="code" v-show="showCode" @click="getCode"
>获取验证码</span >获取验证码</span
> >
<span v-show="!showCode" class="count">{{ count }} s</span> <span v-show="!showCode" 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
v-model="resetForm.password" v-model="resetForm.password"
maxlength="20" maxlength="20"
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
/> --> /> -->
</el-form-item> </el-form-item>
<el-form-item prop="rq_password"> <el-form-item prop="rq_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
v-model="resetForm.rq_password" v-model="resetForm.rq_password"
placeholder="请再次输入新的登录密码" placeholder="请再次输入新的登录密码"
...@@ -102,353 +102,348 @@ ...@@ -102,353 +102,348 @@
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
// 请求接口 // 请求接口
import { passwordCode } from "r/index/register"; import {passwordCode} from "r/index/register";
import { changePassCode } from "r/index/login"; import {changePassCode} from "r/index/login";
import { mobileCheck } from "@/common/utils.js"; import {mobileCheck} from "@/common/utils.js";
import { intervalTime } from "store/time"; import {intervalTime} from "store/time";
import validator from "common/validator"; import validator from "common/validator";
export default { export default {
name: "index-reset", name: "index-reset",
data() { data() {
const pwdCheck = async (rule, value, callback) => { const pwdCheck = async (rule, value, callback) => {
if (value !== this.resetForm.password) { if (value !== this.resetForm.password) {
callback(new Error("两次输入的密码不一致")); callback(new Error("两次输入的密码不一致"));
} else { } else {
callback(); callback();
} }
}; };
return { return {
// 手机验证短信 // 手机验证短信
showCode: true, showCode: true,
count: "", count: "",
timer: null, timer: null,
codeTime: "", //手机验证码倒计时时间 codeTime: "", //手机验证码倒计时时间
isShowPwd: true, // 控制密码显示隐藏 isShowPwd: true, // 控制密码显示隐藏
resetForm: { resetForm: {
phone: "", phone: "",
// email: "", // email: "",
code: "", code: "",
password: "", password: "",
rq_password: "", rq_password: "",
}, },
// 表单验证规则对象 // 表单验证规则对象
resetRules: { resetRules: {
// 对手机号进行校验 // 对手机号进行校验
phone: [ phone: [
{ required: true, message: "请输入手机号", trigger: "blur" }, {required: true, message: "请输入手机号", trigger: "blur"},
{ {
validator: function (rule, value, callback) { validator: function (rule, value, callback) {
if (mobileCheck(value) === false) { if (mobileCheck(value) === false) {
callback(new Error("请输入正确的手机号")); callback(new Error("请输入正确的手机号"));
} else { } else {
callback(); callback();
} }
},
trigger: "blur",
}, },
trigger: "blur", ],
}, // 对邮箱验证
], // email: [
// 对邮箱验证 // { required: true, message: "请输入邮箱", trigger: "blur" },
// email: [ // {
// { required: true, message: "请输入邮箱", trigger: "blur" }, // validator: validator.validateEmail,
// { // trigger: "blur",
// validator: validator.validateEmail, // },
// trigger: "blur", // ],
// }, // 对验证码进行校验
// ], code: [
// 对验证码进行校验 {required: true, message: "请输入验证码", trigger: "blur"},
code: [ {min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur"},
{ required: true, message: "请输入验证码", trigger: "blur" }, ],
{ min: 6, max: 20, message: "请输入正确的验证码", trigger: "blur" }, // 对密码进行校验
], password: [
// 对密码进行校验 {
password: [ required: true,
{ message: "请输入密码",
required: true, transform: (value) => value,
message: "请输入密码", trigger: "blur",
transform: (value) => value,
trigger: "blur",
},
{
type: "string",
message: "请输入不包含空格的字符",
trigger: "blur",
transform(value) {
if (value && value.indexOf(" ") === -1) {
return value;
} else {
return false;
}
}, },
}, {
{ type: "string",
trigger: "blur", message: "请输入不包含空格的字符",
validator: (rule, value, callback) => { trigger: "blur",
var passwordreg = /^[a-zA-Z0-9]{6,12}$/; transform(value) {
// /(?=.*\d)(?=.*[a-zA-Z]).{6,12}/; if (value && value.indexOf(" ") === -1) {
if (!passwordreg.test(value)) { return value;
callback(new Error("请输入6-12位,包含数字/字母,")); } else {
} else { return false;
callback(); }
} },
}, },
}, {
], trigger: "blur",
// 对密码进行校验 validator: (rule, value, callback) => {
rq_password: [ var passwordreg = /^[a-zA-Z0-9]{6,12}$/;
{ required: true, message: "请输入确认密码", trigger: "blur" }, // /(?=.*\d)(?=.*[a-zA-Z]).{6,12}/;
{ if (!passwordreg.test(value)) {
validator: pwdCheck, callback(new Error("请输入6-12位,包含数字/字母,"));
trigger: "blur", } else {
}, callback();
], }
}, },
}; },
}, ],
created() { // 对密码进行校验
const code = this.$store.state.indexIdentity; rq_password: [
const endTime = window.localStorage.getItem("restet_code_time" + code); {required: true, message: "请输入确认密码", trigger: "blur"},
const phone = window.localStorage.getItem("restet_code_phone" + code); {
if (endTime && Number(endTime) > new Date().getTime()) { validator: pwdCheck,
this.resetForm.phone = phone; trigger: "blur",
this.intervalHandle(new Date(), Number(endTime)); },
} ],
}, },
methods: { };
// 去注册
toLogin() {
let code = this.$store.state.indexIdentity;
this.$router.push("/login?code=" + code);
},
// 改变密码显示状态
changePwdStatus() {
this.isShowPwd = !this.isShowPwd;
}, },
// 定时器倒计时 created() {
intervalHandle(startTime, endTime) { const code = this.$store.state.indexIdentity;
// 时间差 const endTime = window.localStorage.getItem("restet_code_time" + code);
const timeLag = intervalTime(startTime, endTime); const phone = window.localStorage.getItem("restet_code_phone" + code);
console.log(timeLag); if (endTime && Number(endTime) > new Date().getTime()) {
if (!this.timer) { this.resetForm.phone = phone;
this.count = timeLag - 1; this.intervalHandle(new Date(), Number(endTime));
this.showCode = false;
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= timeLag) {
this.count--;
} else {
this.showCode = true;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
} }
}, },
// 获取手机验证短信 methods: {
getCode() { // 去注册
if (!this.resetForm.phone) { toLogin() {
return this.$message.error("请输入手机号");
}
// if (!this.codeTime) {
// return this.$message.error("您已经获取验证码,请去邮箱中进行查看");
// }
// 接口获得验证码
passwordCode({
phone: this.resetForm.phone,
// email: this.resetForm.email,
}).then((res) => {
console.log(res, "passwordCode");
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.$message.success(res.data.message);
this.codeTime = res.data.data.now * 1000;
// console.log(this.codeTime)
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
window.localStorage.setItem( this.$router.push("/login?code=" + code);
"restet_code_time" + code, },
res.data.data.now * 1000 // 改变密码显示状态
); changePwdStatus() {
this.intervalHandle(new Date(), res.data.data.now * 1000); this.isShowPwd = !this.isShowPwd;
}); },
}, // 定时器倒计时
intervalHandle(startTime, endTime) {
// 表单验证 // 时间差
submitForm() { const timeLag = intervalTime(startTime, endTime);
this.$refs["resetFormRef"].validate((valid) => { console.log(timeLag);
if (!valid) return; if (!this.timer) {
changePassCode({ this.count = timeLag - 1;
this.showCode = false;
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= timeLag) {
this.count--;
} else {
this.showCode = true;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
}
},
// 获取手机验证短信
getCode() {
if (!this.resetForm.phone) {
return this.$message.error("请输入手机号");
}
// if (!this.codeTime) {
// return this.$message.error("您已经获取验证码,请去邮箱中进行查看");
// }
// 接口获得验证码
passwordCode({
phone: this.resetForm.phone, phone: this.resetForm.phone,
email: this.resetForm.email, // email: this.resetForm.email,
code: this.resetForm.code,
password: this.resetForm.password,
rq_password: this.resetForm.rq_password,
}).then((res) => { }).then((res) => {
console.log(res); console.log(res, "passwordCode");
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);
// token存储 this.codeTime = res.data.data.now * 1000;
// console.log(this.codeTime)
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
// window.localStorage.setItem("index-token" + code, res.token); window.localStorage.setItem("restet_code_time" + code,
window.localStorage.setItem( res.data.data.now * 1000
"restet_code_phone" + code,
this.resetForm.phone
); );
this.$router.replace("/login?code=" + code); this.intervalHandle(new Date(), res.data.data.now * 1000);
}); });
}); },
// 表单验证
submitForm() {
this.$refs["resetFormRef"].validate((valid) => {
if (!valid) return;
changePassCode({
phone: this.resetForm.phone,
email: this.resetForm.email,
code: this.resetForm.code,
password: this.resetForm.password,
rq_password: this.resetForm.rq_password,
}).then((res) => {
console.log(res);
if (res.data.code != 200) {
return this.$message.error(res.data.message);
}
this.$message.success(res.data.message);
// token存储
let code = this.$store.state.indexIdentity;
window.localStorage.setItem("restet_code_phone" + code, this.resetForm.phone);
this.$router.replace("/login?code=" + code);
});
});
},
}, },
}, };
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
// 注册输入 // 注册输入
.container { .container {
background: #ffffff; background: #ffffff;
box-shadow: 0px 1px 18px 0px rgba(0, 0, 0, 0.06); box-shadow: 0px 1px 18px 0px rgba(0, 0, 0, 0.06);
border-radius: 8px; border-radius: 8px;
padding: 40px 60px; padding: 40px 60px;
margin-top: 0; margin-top: 0;
overflow: hidden; overflow: hidden;
.title { .title {
// margin: 19px 0 6px 0; // margin: 19px 0 6px 0;
// width: 132px; // width: 132px;
height: 20px; height: 20px;
font-size: 22px; font-size: 22px;
font-weight: 500; font-weight: 500;
color: var(--color); color: var(--color);
line-height: 20px; line-height: 20px;
text-align: center; text-align: center;
} }
// .line { // .line {
// width: 83px; // width: 83px;
// height: 3px; // height: 3px;
// background: var(--color); // background: var(--color);
// border-radius: 2px; // border-radius: 2px;
// } // }
::v-deep .el-form { ::v-deep .el-form {
margin-top: 60px; margin-top: 60px;
.el-form-item { .el-form-item {
position: relative; position: relative;
margin-bottom: 30px; margin-bottom: 30px;
&:last-child { &:last-child {
margin: 0; margin: 0;
} }
.el-form-item__content { .el-form-item__content {
position: relative; position: relative;
.phoneCode { .phoneCode {
position: absolute; position: absolute;
z-index: 999; z-index: 999;
top: 50%; top: 50%;
right: 25px; right: 25px;
transform: translate(0, -50%); transform: translate(0, -50%);
cursor: pointer; cursor: pointer;
.code { .code {
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
color: var(--color); color: var(--color);
}
} }
}
img.img_l { img.img_l {
position: absolute; position: absolute;
left: 25px; left: 25px;
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
z-index: 1000; z-index: 1000;
} }
img.img_r { img.img_r {
position: absolute; position: absolute;
right: 15px; right: 15px;
top: 50%; top: 50%;
transform: translate(0, -50%); transform: translate(0, -50%);
z-index: 1000; z-index: 1000;
} }
.el-input__inner { .el-input__inner {
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;
padding: 0 10px 0 50px; padding: 0 10px 0 50px;
border-radius: 0; border-radius: 0;
color: #4d4d4d; color: #4d4d4d;
border: 0; border: 0;
border-bottom: 2px solid #d9d9d9; border-bottom: 2px solid #d9d9d9;
&:focus { &:focus {
border-bottom-color: var(--color); border-bottom-color: var(--color);
}
} }
}
.el-form-item__error { .el-form-item__error {
color: #e0823d; color: #e0823d;
} }
.el-button { .el-button {
width: 100%; width: 100%;
height: 60px; height: 60px;
background: var(--color); background: var(--color);
border-radius: 4px; border-radius: 4px;
opacity: 0.8; opacity: 0.8;
line-height: 50px; line-height: 50px;
text-align: center; text-align: center;
color: #fff; color: #fff;
font-size: 16px; font-size: 16px;
padding: 0; padding: 0;
margin: 30px 0 0 0; margin: 30px 0 0 0;
}
} }
} }
}
.box { .box {
height: 18px;
display: block;
.fr {
// float: left;
text-align: center;
height: 18px; height: 18px;
line-height: 18px; display: block;
color: #999999;
margin-top: -10px;
cursor: pointer;
&:hover { .fr {
color: var(--color); // float: left;
text-decoration: underline; text-align: center;
height: 18px;
line-height: 18px;
color: #999999;
margin-top: -10px;
cursor: pointer;
&:hover {
color: var(--color);
text-decoration: underline;
}
} }
} }
} }
} }
}
@media screen and (max-width: 1601px) { @media screen and (max-width: 1601px) {
.container { .container {
right: 18%; right: 18%;
}
} }
}
@media screen and (max-width: 1501px) { @media screen and (max-width: 1501px) {
.container { .container {
right: 16%; right: 16%;
}
} }
}
@media screen and (max-width: 1401px) { @media screen and (max-width: 1401px) {
.container { .container {
right: 14%; right: 14%;
}
} }
}
</style> </style>
...@@ -85,8 +85,7 @@ ...@@ -85,8 +85,7 @@
methods: { methods: {
toLogin() { toLogin() {
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
// console.log(window.localStorage.getItem("index-token"+code),'1111') if (!window.localStorage.getItem("index-token-all")) {
if (!window.localStorage.getItem("index-token" + code)) {
this.$router.push("/login?code=" + code); this.$router.push("/login?code=" + code);
} else { } else {
this.$router.push("/signUp/examInfo?code=" + code); this.$router.push("/signUp/examInfo?code=" + code);
......
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