Commit 97d2bb9c authored by 杨梦雪's avatar 杨梦雪

111

parent b4cc10cd
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"core-js": "^3.6.5", "core-js": "^3.6.5",
"element-ui": "^2.15.6", "element-ui": "^2.15.6",
"node-sass": "^6.0.1", "node-sass": "^6.0.1",
"qrcodejs2": "^0.0.2",
"sass": "^1.42.1", "sass": "^1.42.1",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.5.1", "vue-router": "^3.5.1",
...@@ -11987,6 +11988,11 @@ ...@@ -11987,6 +11988,11 @@
"teleport": ">=0.2.0" "teleport": ">=0.2.0"
} }
}, },
"node_modules/qrcodejs2": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/qrcodejs2/-/qrcodejs2-0.0.2.tgz",
"integrity": "sha1-Rlr+Xjnxn6zsuTLBH3oYYQkUauE="
},
"node_modules/qs": { "node_modules/qs": {
"version": "6.5.2", "version": "6.5.2",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
...@@ -25043,6 +25049,11 @@ ...@@ -25043,6 +25049,11 @@
"integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=",
"dev": true "dev": true
}, },
"qrcodejs2": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/qrcodejs2/-/qrcodejs2-0.0.2.tgz",
"integrity": "sha1-Rlr+Xjnxn6zsuTLBH3oYYQkUauE="
},
"qs": { "qs": {
"version": "6.5.2", "version": "6.5.2",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"core-js": "^3.6.5", "core-js": "^3.6.5",
"element-ui": "^2.15.6", "element-ui": "^2.15.6",
"node-sass": "^6.0.1", "node-sass": "^6.0.1",
"qrcodejs2": "^0.0.2",
"sass": "^1.42.1", "sass": "^1.42.1",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.5.1", "vue-router": "^3.5.1",
......
...@@ -95,4 +95,6 @@ export default { ...@@ -95,4 +95,6 @@ export default {
callback() callback()
} }
}, },
} }
<template>
<el-dialog
title="微信支付"
:visible.sync="dialogVisible"
width="520px"
top="0"
:close-on-click-modal="false"
@open="confirm()"
>
<div class="pay_code">
<div v-if="isShowqr">
<div class="pay_time">支付剩余时间<span>15分30秒</span></div>
<div>¥150</div>
<div class="img_qr">
<div class="qrcode" ref="qrCodeUrl"></div>
</div>
<div>请使用<span>微信</span>扫一扫,扫描二维码支付</div>
<div>手机完成支付后,请等待系统处理,在此之前请勿关闭窗口</div>
</div>
<div v-if="!isShowqr">
<div class="info_2" style="color: #000; font-size: 18px">
<i class="el-icon-warning"></i>{{ message }}
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<div class="btn">
<el-button @click="dialogVisible = false">刷新二维码</el-button>
<el-button class="cancel" @click="cancelBtn()">取 消</el-button>
</div>
</span>
</el-dialog>
</template>
<script>
/* eslint-disable */
import { getWxConfig } from "r/index/pay.js";
import { SERVER_WS_URL } from "config/server";
import QRCode from "qrcodejs2";
export default {
name: "ConfirmSignUp",
props: {
confirmSignUpDialogFu: Boolean,
},
data() {
return {
dialogVisible: this.confirmSignUpDialogFu,
message: "",
isShowqr: true, // 展示支付二维码
token: "",
websocket: null, //websocket连接
lockReconnect: false, //是否真正建立连接
timeout: 28 * 1000, //30秒一次心跳
timeoutObj: null, //心跳心跳倒计时
serverTimeoutObj: null, //心跳倒计时
timeoutnum: null, //断开 重连倒计时
};
},
created() {
this.token = window.localStorage.getItem("index-token");
},
methods: {
async confirm() {
let { data: res } = await getWxConfig({
exam_uuid: this.examuuid,
pay_type: 1,
});
console.log(res);
if (res.code !== 200) {
if (res.code == 400801) {
return this.cancelBtn();
}
this.message = res.message;
this.isShowqr = false;
return;
}
this.isShowqr = true;
this.createQrCode(res.code_url);
//初始化 websocket 链接
this.initWebSocket();
},
createQrCode(qrCode) {
var qrcode = new QRCode(this.$refs.qrCodeUrl, {
text: qrCode, // 需要转换为二维码的内容
width: 120,
height: 120,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H,
});
},
// 确认,关闭弹框,修改父组件的值
cancelBtn() {
// 关闭时,删除二维码img标签
if (this.$refs.qrCodeUrl) {
// 获取 父 标签下的所有子节点
let pObjs = this.$refs.qrCodeUrl.childNodes;
console.log(pObjs);
for (var i = pObjs.length - 1; i >= 0; i--) {
// 一定要倒序,正序是删不干净的,可自行尝试
this.$refs.qrCodeUrl.removeChild(pObjs[i]);
}
}
this.closeWebSocket();
this.dialogVisible = false;
this.$emit("closeCFSUDialog", this.dialogVisible, false);
},
// 初始化 webSocket
initWebSocket() {
if (typeof WebSocket == "undefined") {
this.$message({
showClose: true,
message: "您的浏览器不支持WebSocket",
type: "error",
});
} else if (!this.dialogVisible) {
return;
} else {
if (!this.token || this.token == "") {
this.token = window.localStorage.getItem("index-token");
}
const wssURL =
SERVER_WS_URL + "/city?token=" + this.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);
}
},
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 {
//否则重连
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"),
exam_uuid: window.localStorage.getItem("exam_uuid"),
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);
this.$router.replace({ name: "applysuccess" });
} else {
//收到服务器信息,心跳重置
this.reset();
}
}
},
// 连接关闭的回调方法
websocketOnclose() {
console.log("连接关闭的回调方法");
//重连
this.reconnect();
},
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常
websocketOnbeforeunload() {
this.closeWebSocket();
// console.log('监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常');
},
// 关闭WebSocket连接
closeWebSocket() {
this.websocket && this.websocket.close();
},
},
// 页面注销时候调用 避免连接错误
// destroyed() {
// this.closeWebSocket();
// },
watch: {
confirmSignUpDialogFu() {
this.dialogVisible = this.confirmSignUpDialogFu;
},
},
};
</script>
<style scoped lang="scss">
.pay_code {
text-align: center;
:nth-child(1) {
font-size: 14px;
font-weight: 500;
color: #12141c;
line-height: 14px;
span {
font-size: 13px !important;
color: #60194a;
}
}
:nth-child(2) {
font-size: 14px;
font-weight: 500;
color: #60194a;
line-height: 24px;
}
:nth-child(4) {
font-size: 14px;
font-weight: 500;
color: #333333;
line-height: 16px;
span {
font-size: 17px !important;
color: #60194a;
}
}
:nth-child(5) {
font-size: 12px;
font-weight: 500;
color: #666666;
line-height: 12px;
}
}
// .info_2 {
// text-align: center;
// margin: 10px 0;
// line-height: 30px !important;
// .el-icon-warning {
// font-size: 30px;
// vertical-align: bottom;
// margin-right: 10px;
// color: #ee7602;
// }
// }
// .img_qr {
// width: 140px;
// height: 140px;
// padding: 10px;
// border: 1px solid #000;
// margin: 0 auto;
// img {
// width: 120px;
// height: 120px;
// }
// }
// ::v-deep .el-dialog__body {
// padding: 0 !important;
// }
// ::v-deep .el-icon-close:before {
// content: "";
// }
// ::v-deep .el-dialog__footer {
// padding: 30px 40px !important;
// text-align: center;
// .el-button {
// margin: 0 !important;
// }
// }
</style>
...@@ -36,12 +36,12 @@ ...@@ -36,12 +36,12 @@
</div> </div>
</div> </div>
<!-- 支付扫码框 --> <!-- 支付扫码框 -->
<el-dialog title="微信支付" :visible.sync="dialogVisible" width="20%"> <!-- <el-dialog title="微信支付" :visible.sync="dialogVisible" width="20%">
<div class="pay_code"> <div class="pay_code">
<div class="pay_time">支付剩余时间<span>15分30秒</span></div> <div class="pay_time">支付剩余时间<span>15分30秒</span></div>
<div>¥150</div> <div>¥150</div>
<div class="pay_img"> <div class="pay_img">
<img src="" alt="" /> <div class="qrcode" ref="qrCodeUrl"></div>
</div> </div>
<div>请使用<span>微信</span>扫一扫,扫描二维码支付</div> <div>请使用<span>微信</span>扫一扫,扫描二维码支付</div>
<div>手机完成支付后,请等待系统处理,在此之前请勿关闭窗口</div> <div>手机完成支付后,请等待系统处理,在此之前请勿关闭窗口</div>
...@@ -51,23 +51,36 @@ ...@@ -51,23 +51,36 @@
<el-button @click="dialogVisible = false">刷新二维码</el-button> <el-button @click="dialogVisible = false">刷新二维码</el-button>
</div> </div>
</span> </span>
</el-dialog> </el-dialog> -->
<confirm-sign-up
:confirmSignUpDialogFu="confirmSignUpDialogFu"
@closeCFSUDialog="closeCFSUDialog"
></confirm-sign-up>
</div> </div>
</template> </template>
<script> <script>
/* eslint-disable */ /* eslint-disable */
import ConfirmSignUp from "c/index/SignUp/ConfirmSignUp";
export default { export default {
name: "Paying", name: "Paying",
components: {
ConfirmSignUp,
},
data() { data() {
return { return {
dialogVisible: false, confirmSignUpDialogFu: false, // 控制确认报名弹框的显示与隐藏
}; };
}, },
methods: { methods: {
paying() { // 子组件触发,关闭确认报名弹框
this.dialogVisible = true; closeCFSUDialog(val, type) {
this.confirmSignUpDialogFu = val;
if (type) {
clearInterval(this.timer);
}
}, },
paying() {},
}, },
}; };
</script> </script>
......
...@@ -20,15 +20,15 @@ ...@@ -20,15 +20,15 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="性别" prop="sex"> <el-form-item label="性别" prop="gender">
<el-radio-group v-model="referForm.sex" size="small"> <el-radio-group v-model="referForm.gender" size="small">
<el-radio label="0"></el-radio> <el-radio label="0"></el-radio>
<el-radio label="2"></el-radio> <el-radio label="1"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="身份证号" prop="id_card "> <el-form-item label="身份证号" prop="id_card">
<el-input <el-input
v-model="referForm.id_card" v-model="referForm.id_card"
placeholder="填写真实姓名身份证号" placeholder="填写真实姓名身份证号"
...@@ -37,49 +37,57 @@ ...@@ -37,49 +37,57 @@
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="4"> <el-col :span="12">
<el-form-item label="出生日期" prop="birthday"> <el-form-item label="出生日期" prop="birthday">
<el-select v-model="referForm.birthday" clearable placeholder="年"> <el-row :gutter="20">
<el-col :span="8">
<el-select v-model="bdYear" clearable placeholder="年">
<el-option <el-option
v-for="item in options" v-for="(item, index) in yearArrs"
:key="item.value" :key="index"
:label="item.label" :label="item"
:value="item.value" :value="item"
> >
</el-option> </el-option>
</el-select> </el-select>
</el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="8">
<el-form-item label=" "> <el-select v-model="bdMonth" clearable placeholder="月">
<el-select v-model="value" clearable placeholder="月">
<el-option <el-option
v-for="item in options" v-for="(item, index) in monthArrs"
:key="item.value" :key="index"
:label="item.label" :label="item"
:value="item.value" :value="item"
> >
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-col>
</el-col> --> <el-col :span="8">
<!-- <el-col :span="4"> <el-select
<el-form-item label=" "> v-model="bdDay"
<el-select v-model="value" clearable placeholder="日"> clearable
placeholder="日"
@change="getTime()"
>
<el-option <el-option
v-for="item in options" v-for="(item, index) in dayArrs"
:key="item.value" :key="index"
:label="item.label" :label="item"
:value="item.value" :value="item"
> >
</el-option> </el-option>
</el-select> </el-select>
</el-col>
</el-row>
</el-form-item> </el-form-item>
</el-col> --> </el-col>
<el-col :span="6">
<el-col :span="12">
<el-form-item label="籍贯" prop="jiguan_code"> <el-form-item label="籍贯" prop="jiguan_code">
<el-row :gutter="20">
<el-col :span="12">
<el-select <el-select
v-model="referForm.jiguan_code" v-model="jgProvinceCode"
placeholder="省" placeholder="省"
clearable clearable
@keyup.enter.native="selsectProvince" @keyup.enter.native="selsectProvince"
...@@ -93,11 +101,13 @@ ...@@ -93,11 +101,13 @@
> >
</el-option> </el-option>
</el-select> </el-select>
</el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="12">
<el-form-item label=" " prop=""> <el-select
<el-select v-model="jiguan_city" clearable placeholder="市"> v-model="jiguan_city"
placeholder="市"
@change="getJiguan()"
>
<el-option <el-option
v-for="item in selectCityJiguan" v-for="item in selectCityJiguan"
:key="item.id" :key="item.id"
...@@ -106,6 +116,8 @@ ...@@ -106,6 +116,8 @@
> >
</el-option> </el-option>
</el-select> </el-select>
</el-col>
</el-row>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -119,9 +131,9 @@ ...@@ -119,9 +131,9 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="入学年份(高中)" prop="start_school_date "> <el-form-item label="入学年份(高中)" prop="start_school_date">
<el-input <el-input
v-model="referForm.startSchoolDate" v-model="referForm.start_school_date"
placeholder="填写入学年份(高中)" placeholder="填写入学年份(高中)"
size="small" size="small"
clearable clearable
...@@ -129,7 +141,7 @@ ...@@ -129,7 +141,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="政治面貌" prop="political_status "> <el-form-item label="政治面貌" prop="political_status">
<el-input <el-input
v-model="referForm.political_status" v-model="referForm.political_status"
placeholder="填写政治面貌" placeholder="填写政治面貌"
...@@ -139,7 +151,7 @@ ...@@ -139,7 +151,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="手机号" prop="phone "> <el-form-item label="手机号" prop="phone">
<el-input <el-input
v-model="referForm.phone" v-model="referForm.phone"
placeholder="填写手机号" placeholder="填写手机号"
...@@ -163,7 +175,7 @@ ...@@ -163,7 +175,7 @@
<div class="cont_title">学校信息</div> <div class="cont_title">学校信息</div>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="就读中学" prop="school_province "> <el-form-item label="就读中学" prop="school_province">
<el-select <el-select
v-model="referForm.school_province" v-model="referForm.school_province"
clearable clearable
...@@ -182,7 +194,11 @@ ...@@ -182,7 +194,11 @@
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label=" " prop="school_city"> <el-form-item label=" " prop="school_city">
<el-select v-model="referForm.school_city" clearable placeholder="市"> <el-select
v-model="referForm.school_city"
clearable
placeholder="市"
>
<el-option <el-option
v-for="item in selectCitySchool" v-for="item in selectCitySchool"
:key="item.id" :key="item.id"
...@@ -207,7 +223,7 @@ ...@@ -207,7 +223,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="中学联系人" clearable prop="school_contacts "> <el-form-item label="中学联系人" clearable prop="school_contacts">
<el-input <el-input
v-model="referForm.school_contacts" v-model="referForm.school_contacts"
placeholder="填写中学联系人" placeholder="填写中学联系人"
...@@ -216,7 +232,7 @@ ...@@ -216,7 +232,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="中学联系电话" clearable prop="school_phone "> <el-form-item label="中学联系电话" clearable prop="school_phone">
<el-input <el-input
v-model="referForm.school_phone" v-model="referForm.school_phone"
placeholder="填写中学联系电话" placeholder="填写中学联系电话"
...@@ -238,11 +254,59 @@ ...@@ -238,11 +254,59 @@
</div> </div>
<div class="image_add"> <div class="image_add">
<div class="image_in"> <div class="image_in">
<el-upload
ref="imgUrl"
name="multipartFile"
list-type="picture-card"
:auto-upload="true"
:disabled="isUploading"
action="#"
accept=".jpg,.jpeg,.png"
:limit="1"
:headers="header"
:file-list="fileList"
:before-upload="beforeAvatarUpload"
:on-progress="handleUploadProgress"
:on-success="uploadSuccess"
:http-request="uploadPicture"
>
<i style="font-size: 44px" class="el-icon-circle-plus"> </i> <i style="font-size: 44px" class="el-icon-circle-plus"> </i>
<div class="text">上传材料</div> <!-- <div class="text">上传材料</div> -->
<div slot="file" slot-scope="{ file }">
<img
class="el-upload-list__item-thumbnail"
:src="file.url"
alt=""
/>
<span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in"></i>
</span>
<!-- <span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleDownload(file)"
>
<i class="el-icon-download"></i>
</span>
<span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<i class="el-icon-delete"></i>
</span> -->
</span>
</div>
</el-upload>
</div> </div>
<img :src="referForm.backgroundPicture" class="avatar" /> <el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="resultPicture" alt="" />
</el-dialog>
</div> </div>
</el-form-item> </el-form-item>
...@@ -262,19 +326,39 @@ import { ...@@ -262,19 +326,39 @@ import {
getProAndCity, getProAndCity,
getSchool, getSchool,
} from "r/index/signUp"; } from "r/index/signUp";
import { upload } from "r/index/network";
import validator from "common/validator"; import validator from "common/validator";
export default { export default {
name: "CheckForm", name: "CheckForm",
data() { data() {
let validateContent = (rule, value, callback) => {
// console.log(rule, value, callback);
// console.log(this.referForm.birthday);
if (!this.referForm.birthday) {
callback(new Error("出生日期不能为空!"));
} else {
callback();
}
};
let validateContents = (rule, value, callback) => {
// console.log(rule, value, callback);
// console.log(this.referForm.jiguan_code);
if (!this.referForm.jiguan_code) {
callback(new Error("籍贯不能为空!"));
} else {
callback();
}
};
return { return {
isUploading: false, // 图片上传蒙层
referForm: { referForm: {
name: "", name: "",
sex: "", gender: "",
id_card: "", id_card: "",
birthday: "", birthday: "",
jiguan_code: "", jiguan_code: undefined,
nation: "", nation: "",
start_school_date: "", start_school_date: "",
political_status: "", political_status: "",
...@@ -285,22 +369,30 @@ export default { ...@@ -285,22 +369,30 @@ export default {
school: "", school: "",
school_contacts: "", school_contacts: "",
school_phone: "", school_phone: "",
achievementPath: "",
}, },
schoolName: [], schoolName: [],
referInfoRules: { referInfoRules: {
name: [ name: [
{ required: true, message: "真实姓名不能为空!", trigger: "blur" }, { required: true, message: "真实姓名不能为空!", trigger: "blur" },
], ],
sex: [{ required: true, message: "性别不能为空!", trigger: "change" }], gender: [
{ required: true, message: "性别不能为空!", trigger: "change" },
],
id_card: [ id_card: [
{ required: true, message: "身份证号码不能为空!", trigger: "blur" }, { required: true, message: "身份证号码不能为空!", trigger: "blur" },
{ validator: validator.validateid_card, trigger: "blur" }, { validator: validator.validateid_card, trigger: "blur" },
], ],
birthday: [ birthday: [
{ required: true, message: "出生日期不能为空!", trigger: "change" }, // { required: true, message: "出生日期不能为空!", trigger: "change" },
{
required: true,
validator: validateContent,
trigger: "change",
},
], ],
jiguan_code: [ jiguan_code: [
{ required: true, message: "籍贯不能为空!", trigger: "change" }, { required: true, validator: validateContents, trigger: "change" },
], ],
nation: [ nation: [
{ required: true, message: "民族不能为空!", trigger: "blur" }, { required: true, message: "民族不能为空!", trigger: "blur" },
...@@ -309,7 +401,7 @@ export default { ...@@ -309,7 +401,7 @@ export default {
{ {
required: true, required: true,
message: "高中入学年份不能为空!", message: "高中入学年份不能为空!",
trigger: "change", trigger: "blur",
}, },
], ],
political_status: [ political_status: [
...@@ -323,14 +415,14 @@ export default { ...@@ -323,14 +415,14 @@ export default {
{ required: true, message: "邮箱不能为空!", trigger: "blur" }, { required: true, message: "邮箱不能为空!", trigger: "blur" },
{ validator: validator.validateEmail, trigger: "blur" }, { validator: validator.validateEmail, trigger: "blur" },
], ],
schoolprovince: [ school_province: [
{ {
required: true, required: true,
message: "请选择所在学校省份!", message: "请选择所在学校省份!",
trigger: "change", trigger: "change",
}, },
], ],
schoolcity: [ school_city: [
{ {
required: true, required: true,
message: "请选择所在学校城市!", message: "请选择所在学校城市!",
...@@ -351,7 +443,73 @@ export default { ...@@ -351,7 +443,73 @@ export default {
CityName: {}, CityName: {},
selectCityJiguan: [], selectCityJiguan: [],
selectCitySchool: [], selectCitySchool: [],
jgProvinceCode: "",
jiguan_city: null, jiguan_city: null,
yearArrs: [], //生日涉及的近10年的年份
monthArrs: [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
],
dayArrs: [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
],
bdYear: "", //选择的生日年份
bdMonth: "", //选择的生日月份
bdDay: "", //选择的生日日期
// 图片上传接口
imgUrlAction: process.env.VUE_APP_BASE_API + "getAchievementOss",
headers: {
Authorization: "Bearer " + getToken(),
},
// 上传的图片
dialogImageUrl: "",
dialogVisible: false,
picList: [],
fileList: [],
resultPicture: "",
dialogVisible: false,
disabled: false,
}; };
}, },
created() { created() {
...@@ -360,7 +518,45 @@ export default { ...@@ -360,7 +518,45 @@ export default {
this.getSchool(); this.getSchool();
this.getTenYear(); this.getTenYear();
}, },
watch: {
self(val) {
for (var k in val) {
if (val[k] == null || !val[k]) {
val[k] = this.referForm[k];
}
}
this.selfInfo = val;
// 身份证号存在,根据身份证号自动识别男女
// if (this.selfInfo.id_card && this.selfInfo.id_card !== "") {
// if (this.selfInfo.id_card.slice(-2, -1) % 2 == 0) {
// this.selfInfo.sex = 1;
// this.sex = 1;
// } else {
// this.selfInfo.sex = 0;
// this.sex = 0;
// }
// }
if (val.birthday && val.birthday !== "") {
//出生日期
this.bdYear = val.birthday.slice(0, 4); //前4位取年
this.bdMonth = val.birthday.slice(4, 6); //中2位取月
this.bdDay = val.birthday.slice(6, 8); //后2位取日
}
if (
val.jiguan_code &&
val.jiguan_code !== "" &&
val.jiguan_code !== "00"
) {
//籍贯
console.log(val.jiguan_code, "val.jiguan_code+++++");
this.jgProvinceCode = Number(val.jiguan_code.slice(0, 2)); //前2位取省份
console.log(this.jgProvinceCode, "val.jiguan_code+++++");
this.selectJgProvince(this.jgProvinceCode, "1");
this.jgCityCode = Number(val.jiguan_code.slice(2, 6)); //后4位取城市
console.log(this.jgCityCode, "val.jiguan_code+++++");
}
},
},
methods: { methods: {
//获取近10年的年份 //获取近10年的年份
getTenYear() { getTenYear() {
...@@ -373,7 +569,7 @@ export default { ...@@ -373,7 +569,7 @@ export default {
let year = currentYear - i; let year = currentYear - i;
yearArr.push(year); yearArr.push(year);
} }
console.log(yearArr); console.log(yearArr, "yearArr");
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {
let year = currentYear - i; let year = currentYear - i;
rxYearArr.push(year); rxYearArr.push(year);
...@@ -390,6 +586,18 @@ export default { ...@@ -390,6 +586,18 @@ export default {
} }
}); });
}, },
getTime() {
this.referForm.birthday =
this.bdYear.toString() +
this.bdMonth.toString() +
this.bdDay.toString(); //组装出生日期
// console.log(this.referForm.birthday);
},
getJiguan() {
this.referForm.jiguan_code =
this.jgProvinceCode.toString() + this.jiguan_city.toString();
// console.log(this.referForm.jiguan_code);
},
// 获取省份城市 // 获取省份城市
getProAndCity() { getProAndCity() {
getProAndCity({}).then((res) => { getProAndCity({}).then((res) => {
...@@ -409,13 +617,11 @@ export default { ...@@ -409,13 +617,11 @@ export default {
selectCity.push(this.CityName[key]); selectCity.push(this.CityName[key]);
} }
} }
if(type == 1){ if (type == 1) {
this.selectCityJiguan = selectCity; this.selectCityJiguan = selectCity;
}else{ } else {
this.selectCitySchool = selectCity; this.selectCitySchool = selectCity;
} }
}, },
// 获取学校 // 获取学校
...@@ -428,26 +634,107 @@ export default { ...@@ -428,26 +634,107 @@ export default {
this.schoolName = res.data.school_list; this.schoolName = res.data.school_list;
}); });
}, },
// 图片上传成功前钩子
beforeAvatarUpload(file) {
// console.log(file, "22");
const isJPG = file.type === "image/jpg";
const isPng = file.type === "image/png";
const isJPEG = file.type === "image/jpeg";
const isLt20M = file.size / 1024 / 1024 < 30;
if (file == null) {
if (!isJPG && !isPng && !isJPEG) {
this.$message.info("上传图片只能是 JPG,JPEG或png 格式!");
}
if (!isLt20M) {
this.$message.info("上传图片大小不能超过 20MB!");
}
return (isJPG || isPng || isJPEG) && isLt20M;
}
},
handlePictureCardPreview(file) {
this.resultPicture = file.url;
this.dialogVisible = true;
},
// 文件上传中处理
handleUploadProgress(event, file, fileList) {
this.isUploading = true;
},
uploadSuccess(res, file) {
console.log(res, "111");
this.referForm.achievementPath = res;
this.fileList[0] = {
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.getOssConfigs(image, params.file);
},
async getOssConfigs(image, file) {
await getAchievementOss({ 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("已经上传上");
upload(oss_url, formData)
.then((ress) => {
if (ress.data.code == 200) {
console.log(ress, "上传照返回数据");
this.resultPicture =
filename + "?t=" + Date.parse(new Date());
this.$forceUpdate();
this.$message.success("上传成功");
} else {
this.$message.error(ress.data.message);
}
})
.catch((err) => {
this.$message.error(err);
});
} else {
this.$message.error(res.data.message);
}
})
.catch((err) => {
console.log(err);
});
},
imgPreview() {
// console.log(11);
this.resultPicture = this.addBanner.bannerUrl;
this.dialogVisible = true;
},
confirm() { confirm() {
this.$refs["referRef"].validate((valid) => { console.log(1111);
if (!valid) return; // console.log(2222)
setAccount({ // this.$refs["referRef"].validate((valid) => {
name: this.formData.name, // console.log(2222)
sex: this.formData.sex, // if (!valid) return;
id_card: this.formData.id_card, setAccount(this.referForm).then((res) => {
birthday: this.formData.birthday,
jiguan_code: this.formData.jiguan_code,
nation: this.formData.nation,
start_school_date: this.formData.start_school_date,
political_status: this.formData.political_status,
phone: this.formData.phone,
email: this.formData.email,
schoolprovince: this.formData.schoolprovince,
schoolcity: this.formData.schoolcity,
school: this.formData.school,
school_contacts: this.formData.school_contacts,
school_phone: this.formData.school_phone,
}).then((res) => {
console.log(res, "setAccount"); console.log(res, "setAccount");
if (res.data.code != 200) { if (res.data.code != 200) {
return this.$message.error(res.data.message); return this.$message.error(res.data.message);
...@@ -457,7 +744,7 @@ export default { ...@@ -457,7 +744,7 @@ export default {
// 跳转到报名 // 跳转到报名
this.$router.push("/signUp/check"); this.$router.push("/signUp/check");
}); });
}); // });
}, },
}, },
}; };
...@@ -565,11 +852,11 @@ export default { ...@@ -565,11 +852,11 @@ export default {
line-height: 24px; line-height: 24px;
} }
img { img {
width: 160px; // width: 160px;
height: 160px; // height: 160px;
border-radius: 4px; // border-radius: 4px;
border: 2px dashed #bcc2ca; // border: 2px dashed #bcc2ca;
margin: 0 10px 10px 0; // margin: 0 10px 10px 0;
} }
} }
.el-select { .el-select {
......
...@@ -13,6 +13,47 @@ import { ...@@ -13,6 +13,47 @@ import {
} from 'element-ui' } from 'element-ui'
import router from '@/router' import router from '@/router'
const instance = axios.create({
baseURL: SERVER_URL,
timeout: 60000,
method: "post",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
instance.interceptors.request.use(
(config) => {
console.log(config);
if (config.method === "post" && !config.notQs) {
config.data = qs.stringify(config.data);
}
if (config.url.indexOf(SERVER_URL) === -1) {
console.log("upload");
config.headers["Content-Type"] = "multipart/form-data";
} else {
config.headers["Content-Type"] = "application/x-www-form-urlencoded";
}
// 调用接口请求添加token认证信息
let token = localStorage.getItem("index-token");
if (token) config.headers.authorization = token;
return config;
},
(error) => {
return Promise.reject(error);
}
);
instance.interceptors.response.use(
(response) => {
return response.data;
},
(error) => {
return Promise.reject(error);
}
);
export default instance;
// 正在进行中的请求列表 // 正在进行中的请求列表
const reqList = [] const reqList = []
...@@ -51,8 +92,7 @@ let loadingInstance = null ...@@ -51,8 +92,7 @@ let loadingInstance = null
export function request(config) { export function request(config) {
const instance = axios.create({ const instance = axios.create({
baseURL: process.env.NODE_ENV === 'development' ? baseURL: process.env.NODE_ENV === 'development' ?
DEVELOPMENT_SERVER_URL : DEVELOPMENT_SERVER_URL : SERVER_URL,
SERVER_URL,
timeout: 60 * 1000 timeout: 60 * 1000
}) })
instance.interceptors.request.use( instance.interceptors.request.use(
...@@ -180,9 +220,28 @@ export function request(config) { ...@@ -180,9 +220,28 @@ export function request(config) {
} }
) )
return instance(config) 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 allRequest(arrRequest) { export function allRequest(arrRequest) {
return axios.all(arrRequest) return axios.all(arrRequest)
......
/* eslint-disable */
import {
request
} from './network'
const identity = localStorage.getItem('index-identity')
// 报名初始化
export function getWxConfig(data) {
data['identity'] = identity;
return request({
method: 'post',
url: '/web/pay/getWxPreselectionConfig',
params: data
})
}
...@@ -50,7 +50,7 @@ export function getAchievementOss(data) { ...@@ -50,7 +50,7 @@ export function getAchievementOss(data) {
return request({ return request({
method: 'post', method: 'post',
url: '/web/signUp/getAchievementOss', url: '/web/signUp/getAchievementOss',
params: data data
}) })
} }
......
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