Commit 89a5bd49 authored by 杨梦雪's avatar 杨梦雪

支付

parent 8c223690
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"dependencies": { "dependencies": {
"axios": "^0.21.4", "axios": "^0.21.4",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"cos-js-sdk-v5": "^1.4.20",
"default-passive-events": "^2.0.0", "default-passive-events": "^2.0.0",
"element-ui": "^2.15.6", "element-ui": "^2.15.6",
"js-cookie": "^3.0.1", "js-cookie": "^3.0.1",
...@@ -3274,6 +3275,14 @@ ...@@ -3274,6 +3275,14 @@
"@xtuc/long": "4.2.2" "@xtuc/long": "4.2.2"
} }
}, },
"node_modules/@xmldom/xmldom": {
"version": "0.8.10",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz",
"integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==",
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/@xtuc/ieee754": { "node_modules/@xtuc/ieee754": {
"version": "1.2.0", "version": "1.2.0",
"integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",
...@@ -5131,6 +5140,14 @@ ...@@ -5131,6 +5140,14 @@
"version": "1.0.3", "version": "1.0.3",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
}, },
"node_modules/cos-js-sdk-v5": {
"version": "1.4.20",
"resolved": "https://registry.npmjs.org/cos-js-sdk-v5/-/cos-js-sdk-v5-1.4.20.tgz",
"integrity": "sha512-cGpmVoKN3iYBtWo8Lwp059fOrT4yyb/+I6fVS++Zyop/ZFJswDRkjnrASViwYd8N+hi3qWVAa6ruvvBsLutEwg==",
"dependencies": {
"@xmldom/xmldom": "^0.8.6"
}
},
"node_modules/cosmiconfig": { "node_modules/cosmiconfig": {
"version": "5.2.1", "version": "5.2.1",
"integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==", "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==",
...@@ -17841,6 +17858,11 @@ ...@@ -17841,6 +17858,11 @@
"@xtuc/long": "4.2.2" "@xtuc/long": "4.2.2"
} }
}, },
"@xmldom/xmldom": {
"version": "0.8.10",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz",
"integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw=="
},
"@xtuc/ieee754": { "@xtuc/ieee754": {
"version": "1.2.0", "version": "1.2.0",
"integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",
...@@ -19312,6 +19334,14 @@ ...@@ -19312,6 +19334,14 @@
"version": "1.0.3", "version": "1.0.3",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
}, },
"cos-js-sdk-v5": {
"version": "1.4.20",
"resolved": "https://registry.npmjs.org/cos-js-sdk-v5/-/cos-js-sdk-v5-1.4.20.tgz",
"integrity": "sha512-cGpmVoKN3iYBtWo8Lwp059fOrT4yyb/+I6fVS++Zyop/ZFJswDRkjnrASViwYd8N+hi3qWVAa6ruvvBsLutEwg==",
"requires": {
"@xmldom/xmldom": "^0.8.6"
}
},
"cosmiconfig": { "cosmiconfig": {
"version": "5.2.1", "version": "5.2.1",
"integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==", "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==",
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"dependencies": { "dependencies": {
"axios": "^0.21.4", "axios": "^0.21.4",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"cos-js-sdk-v5": "^1.4.20",
"default-passive-events": "^2.0.0", "default-passive-events": "^2.0.0",
"element-ui": "^2.15.6", "element-ui": "^2.15.6",
"js-cookie": "^3.0.1", "js-cookie": "^3.0.1",
......
<template> <template>
<el-dialog <el-dialog
title="微信支付"
:visible.sync="dialogVisible"
width="520px"
top="0"
:close-on-click-modal="false" :close-on-click-modal="false"
@open="confirm()" :visible.sync="dialogVisible"
@close="cancelBtn()" @close="cancelBtn()"
@open="confirm()"
title="微信支付"
top="0"
width="520px"
> >
<div class="pay_code"> <div class="pay_code">
<div v-show="isShowqr == 1"> <div v-show="isShowqr == 1">
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</div> </div>
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span class="dialog-footer" slot="footer">
<div class="btn"> <div class="btn">
<el-button @click="updateCode()">刷新二维码</el-button> <el-button @click="updateCode()">刷新二维码</el-button>
<!-- <el-button class="cancel" @click="cancelBtn()">取 消</el-button> --> <!-- <el-button class="cancel" @click="cancelBtn()">取 消</el-button> -->
...@@ -37,8 +37,7 @@ ...@@ -37,8 +37,7 @@
<script> <script>
/* eslint-disable */ /* eslint-disable */
import {getWxConfig} from "r/index/pay"; import {checkAsync, getWxConfig} from "r/index/pay";
import {SERVER_WS_URL} from "config/server";
import QRCode from "qrcodejs2"; import QRCode from "qrcodejs2";
export default { export default {
...@@ -59,6 +58,7 @@ ...@@ -59,6 +58,7 @@
serverTimeoutObj: null, //心跳倒计时 serverTimeoutObj: null, //心跳倒计时
timeoutnum: null, //断开 重连倒计时 timeoutnum: null, //断开 重连倒计时
has_amount: "", has_amount: "",
isSuccess: 0
}; };
}, },
created() { created() {
...@@ -73,29 +73,26 @@ ...@@ -73,29 +73,26 @@
let {data: res} = await getWxConfig({ let {data: res} = await getWxConfig({
pay_type: 3, pay_type: 3,
}); });
// console.log(res);
if (res.code !== 200) { if (res.code !== 200) {
if (res.code == 400801) { if (res.code == 400801) {
return this.cancelBtn(); return this.cancelBtn();
} }
this.isShowqr = 2; this.isShowqr = 2;
this.message = res.message; this.message = res.message;
return; return;
} }
this.isShowqr = 1; this.isShowqr = 1;
console.log(res.code_url);
this.createQrCode(res.code_url); this.createQrCode(res.code_url);
//初始化 websocket 链接 //初始化 websocket 链接
this.initWebSocket(); // this.initWebSocket();
this.checkStatus(3);
}, },
updateCode() { updateCode() {
this.confirm(); this.confirm();
}, },
createQrCode(qrCode) { createQrCode(qrCode) {
this.removeQr(); this.removeQr();
var qrcode = new QRCode(this.$refs.qrCodeUrl, { let qrcode = new QRCode(this.$refs.qrCodeUrl, {
text: qrCode, // 需要转换为二维码的内容 text: qrCode, // 需要转换为二维码的内容
width: 140, width: 140,
height: 140, height: 140,
...@@ -110,7 +107,7 @@ ...@@ -110,7 +107,7 @@
// 获取 父 标签下的所有子节点 // 获取 父 标签下的所有子节点
let pObjs = this.$refs.qrCodeUrl.childNodes; let pObjs = this.$refs.qrCodeUrl.childNodes;
// console.log(pObjs); // console.log(pObjs);
for (var i = pObjs.length - 1; i >= 0; i--) { for (let i = pObjs.length - 1; i >= 0; i--) {
// 一定要倒序,正序是删不干净的,可自行尝试 // 一定要倒序,正序是删不干净的,可自行尝试
this.$refs.qrCodeUrl.removeChild(pObjs[i]); this.$refs.qrCodeUrl.removeChild(pObjs[i]);
} }
...@@ -120,52 +117,28 @@ ...@@ -120,52 +117,28 @@
cancelBtn() { cancelBtn() {
// 关闭时,删除二维码img标签 // 关闭时,删除二维码img标签
this.removeQr(); this.removeQr();
this.closeWebSocket();
this.dialogVisible = false; this.dialogVisible = false;
this.$emit("closeCFSUDialog", this.dialogVisible, false); this.$emit("closeCFSUDialog", this.dialogVisible, this.isSuccess);
}, },
// 初始化 webSocket //订单状态检查跳转界面(成功-跳转到支付成功页面)
initWebSocket() { checkStatus(type) {
if (typeof WebSocket == "undefined") { let order_no = window.localStorage.getItem(
this.$message({ "order_no" + this.$store.state.indexIdentity
showClose: true, )
message: "您的浏览器不支持WebSocket", checkAsync({order_no: order_no, pay_type: type}).then((res) => {
type: "error", if (res.data.code != 200) {
return this.reconnectCheckStatus()
}
//code=200,跳到支付成功页面
this.isSuccess = 1
this.$message.success(res.data.message);
this.cancelBtn()
}); });
} else if (!this.dialogVisible) {
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;
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);
}
}, },
reconnect() {
//重新连接 //重新连接
reconnectCheckStatus() {
let that = this; let that = this;
if (!that.dialogVisible) { if (that.dialogVisible === false) {
return;
}
if (that.lockReconnect) {
return; return;
} }
that.lockReconnect = true; that.lockReconnect = true;
...@@ -173,101 +146,9 @@ ...@@ -173,101 +146,9 @@
that.timeoutnum && clearTimeout(that.timeoutnum); that.timeoutnum && clearTimeout(that.timeoutnum);
that.timeoutnum = setTimeout(function () { that.timeoutnum = setTimeout(function () {
//新连接 //新连接
that.initWebSocket(); that.checkStatus(3);
that.lockReconnect = false; that.lockReconnect = false;
}, 5000); }, 2000);
},
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);
// status=6,跳转到报名成功页面
// this.$emit("getstatus", res.data.status.status);
let code = this.$store.state.indexIdentity;
this.$router.push("/signUp/success?code=" + code);
} else {
//收到服务器信息,心跳重置
this.reset();
}
}
},
// 连接关闭的回调方法
websocketOnclose() {
// console.log("连接关闭的回调方法");
//重连
this.reconnect();
},
// 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常
websocketOnbeforeunload() {
this.closeWebSocket();
// console.log('监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常');
},
// 关闭WebSocket连接
closeWebSocket() {
this.websocket && this.websocket.close();
}, },
}, },
// 页面注销时候调用 避免连接错误 // 页面注销时候调用 避免连接错误
...@@ -282,7 +163,7 @@ ...@@ -282,7 +163,7 @@
}; };
</script> </script>
<style scoped lang="scss"> <style lang="scss" scoped>
.btn { .btn {
text-align: center; text-align: center;
padding-bottom: 24px; padding-bottom: 24px;
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
报名费用 :<span>{{ has_amount }} </span> 报名费用 :<span>{{ has_amount }} </span>
</div> </div>
<div class="btn"> <div class="btn">
<el-button v-if="$store.state.human == 1" @click="paying()" <el-button @click="paying()" v-if="$store.state.human == 1"
>上传缴费截图 >上传缴费截图
</el-button> </el-button>
<el-button v-else @click="paying()">立即支付</el-button> <el-button @click="paying()" v-else>立即支付</el-button>
</div> </div>
</div> </div>
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<div>开户行:工行北京分行海淀西区支行</div> <div>开户行:工行北京分行海淀西区支行</div>
<div>附言/用途:请在附言栏中注明“22069363005+学员姓名”</div> <div>附言/用途:请在附言栏中注明“22069363005+学员姓名”</div>
</div> </div>
<div v-else class="pay_bottom"> <div class="pay_bottom" v-else>
<div class="cc"><span class="starIcon">*</span>注意事项:</div> <div class="cc"><span class="starIcon">*</span>注意事项:</div>
<div> <div>
1、学生支付完成后请不要立即关闭浏览器,等待支付完成返回本页面,以确认支付完成。 1、学生支付完成后请不要立即关闭浏览器,等待支付完成返回本页面,以确认支付完成。
...@@ -101,10 +101,10 @@ ...@@ -101,10 +101,10 @@
</el-dialog> --> </el-dialog> -->
<!-- 提示:打开电脑端后不能切换手机端 --> <!-- 提示:打开电脑端后不能切换手机端 -->
<el-dialog <el-dialog
title="提示" :before-close="handleClose"
:visible.sync="dialogPayingVisible" :visible.sync="dialogPayingVisible"
title="提示"
width="30%" width="30%"
:before-close="handleClose"
> >
<div class="margin1"> <div class="margin1">
如您使用手机报名:点击“确认”后将直接发起微信支付,按照指引完成支付即可。 如您使用手机报名:点击“确认”后将直接发起微信支付,按照指引完成支付即可。
...@@ -119,29 +119,29 @@ ...@@ -119,29 +119,29 @@
2、如因支付失败需再次支付时,务必使用和第一次支付时相同的微信或支付宝账号进行操作。 2、如因支付失败需再次支付时,务必使用和第一次支付时相同的微信或支付宝账号进行操作。
</div> </div>
</div> </div>
<span slot="footer" class="dialog-footer"> <span class="dialog-footer" slot="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 @click="toPaying" type="primary">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<!-- 微信支付宝2选1 --> <!-- 微信支付宝2选1 -->
<el-dialog <el-dialog
title="支付方式" :before-close="handleClose"
:visible.sync="dialogChoose" :visible.sync="dialogChoose"
title="支付方式"
width="600px" width="600px"
: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" @click="toWechat"
alt="" alt=""
@click="toWeichat" src="../../../assets/img/paying/weichat.png"
/> />
<img <img
src="../../../assets/img/paying/paybao.png"
alt=""
@click="toPaybao" @click="toPaybao"
alt=""
src="../../../assets/img/paying/paybao.png"
/> />
</div> </div>
<div class="text_choose">请选择支付方式</div> <div class="text_choose">请选择支付方式</div>
...@@ -154,10 +154,10 @@ ...@@ -154,10 +154,10 @@
></confirm-sign-up> ></confirm-sign-up>
<!-- 上传付款材料 --> <!-- 上传付款材料 -->
<el-dialog <el-dialog
title="银行卡支付" :before-close="handleClose"
:visible.sync="bankDialogVisible" :visible.sync="bankDialogVisible"
title="银行卡支付"
width="30%" width="30%"
:before-close="handleClose"
> >
<div>收款单位:{{ payee }}</div> <div>收款单位:{{ payee }}</div>
<div>账号:{{ bank_idcard }}</div> <div>账号:{{ bank_idcard }}</div>
...@@ -167,63 +167,63 @@ ...@@ -167,63 +167,63 @@
<div class="image_add"> <div class="image_add">
<div class="image_in"> <div class="image_in">
<el-upload <el-upload
:before-upload="beforeAvatarUpload"
:class="{ hide: hideUpload }" :class="{ hide: hideUpload }"
ref="imgUrl"
name="multipartFile"
list-type="picture-card"
:disabled="isUploading || fileList.length >= 1" :disabled="isUploading || fileList.length >= 1"
action="#"
accept=".jpg,.jpeg,.png"
:limit="1"
:file-list="fileList" :file-list="fileList"
:before-upload="beforeAvatarUpload" :http-request="uploadPicture"
:limit="1"
:on-progress="handleUploadProgress" :on-progress="handleUploadProgress"
:on-success="uploadSuccess" :on-success="uploadSuccess"
:http-request="uploadPicture" accept=".jpg,.jpeg,.png"
action="#"
list-type="picture-card"
name="multipartFile"
ref="imgUrl"
> >
<div slot="file" slot-scope="{ file }"> <div slot="file" slot-scope="{ file }">
<div v-for="(item, idx) in fileList" :key="idx"> <div :key="idx" v-for="(item, idx) in fileList">
<img <img
class="el-upload-list__item-thumbnail"
:src="file.url" :src="file.url"
alt="" alt=""
class="el-upload-list__item-thumbnail"
/> />
<span class="el-upload-list__item-actions"> <span class="el-upload-list__item-actions">
<span <span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)" @click="handlePictureCardPreview(file)"
class="el-upload-list__item-preview"
> >
<i class="el-icon-zoom-in"></i> <i class="el-icon-zoom-in"></i>
</span> </span>
<span <span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleDownload(file)" @click="handleDownload(file)"
class="el-upload-list__item-delete"
v-if="!disabled"
> >
<i class="el-icon-download"></i> <i class="el-icon-download"></i>
</span> </span>
<span <span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleRemove(file)" @click="handleRemove(file)"
class="el-upload-list__item-delete"
v-if="!disabled"
> >
<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 class="el-icon-circle-plus" style="font-size: 44px"> </i>
</el-upload> </el-upload>
</div> </div>
<el-dialog :visible.sync="dialogVisible"> <el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="resultPicture" alt=""/> <img :src="resultPicture" alt="" width="100%"/>
</el-dialog> </el-dialog>
</div> </div>
<span slot="footer" class="dialog-footer"> <span class="dialog-footer" slot="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 @click="uploadConfirm" type="primary">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
...@@ -233,14 +233,10 @@ ...@@ -233,14 +233,10 @@
/* 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 {delPayingPic, getAccount, signUpInit,} from "r/index/signUp";
signUpInit,
getAccount,
getBankInfoOss,
delPayingPic,
} from "r/index/signUp";
import {getWxConfig} from "r/index/pay"; import {getWxConfig} from "r/index/pay";
import {upload} from "r/index/network"; import {getSignature,checkAsync} from "r/index/cosUpload";
import COS from "cos-js-sdk-v5";
export default { export default {
name: "Paying", name: "Paying",
...@@ -314,11 +310,15 @@ ...@@ -314,11 +310,15 @@
}); });
}, },
// 子组件触发,关闭确认报名弹框 // 子组件触发,关闭确认报名弹框
closeCFSUDialog(val) { closeCFSUDialog(val,isSuccess) {
console.log(val, "val"); console.log(val, "val");
console.log(isSuccess, "isSuccess");
this.confirmSignUpDialogFu = val; this.confirmSignUpDialogFu = val;
if(isSuccess==1){
this.$emit("getstatus", 6);
}
}, },
toWeichat() { toWechat() {
// this.dialogChoose = false; // this.dialogChoose = false;
this.confirmSignUpDialogFu = true; this.confirmSignUpDialogFu = true;
}, },
...@@ -336,166 +336,18 @@ ...@@ -336,166 +336,18 @@
// return // return
let div = document.createElement("div"); let div = document.createElement("div");
div.innerHTML = form; div.innerHTML = form;
document.body.appendChild(div); document.body.appendChild(div);
document.forms[0].acceptCharset = "GBK"; //保持与支付宝默认编码格式一致,如果不一致将会出现:调试错误,请回到请求来源地. document.forms[0].acceptCharset = "GBK"; //保持与支付宝默认编码格式一致,如果不一致将会出现:调试错误,请回到请求来源地.
// 重新发起请求,错误代码 invalid-signature 错误原因: 验签出错,建议检查签名字符串或签名私钥与应用公钥是否匹配 // 重新发起请求,错误代码 invalid-signature 错误原因: 验签出错,建议检查签名字符串或签名私钥与应用公钥是否匹配
document.forms[0].submit(); // document.forms[0].submit(); //
let alipay_submit = document.getElementById("alipay_submit"); let alipay_submit = document.getElementById("alipay_submit");
div.removeChild(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() { paying() {
console.log(this.$store.state);
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
console.log(code == "3c7e84455750447799e4b70bda5f4493")
if (code == "3c7e84455750447799e4b70bda5f4493") { if (code == "3c7e84455750447799e4b70bda5f4493") {
console.log('1111')
this.toPaying(); this.toPaying();
} else { } else {
this.dialogPayingVisible = true; this.dialogPayingVisible = true;
...@@ -505,13 +357,13 @@ ...@@ -505,13 +357,13 @@
this.commonApi(34) this.commonApi(34)
this.dialogPayingVisible = false; this.dialogPayingVisible = false;
if (this.has_amount == 0) { if (this.has_amount == 0) {
getWxConfig({pay_type: 3}).then((res) => { // getWxConfig({pay_type: 3}).then((res) => {
console.log(res, "signUpInit"); // console.log(res, "signUpInit");
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.err_msg); // this.$message.success(res.data.err_msg);
}); // });
this.$emit("getstatus", 6); this.$emit("getstatus", 6);
} else { } else {
// transfer_account 判断微信支付宝或者银行卡支付 // transfer_account 判断微信支付宝或者银行卡支付
...@@ -519,14 +371,11 @@ ...@@ -519,14 +371,11 @@
this.dialogChoose = true; this.dialogChoose = true;
} else { } else {
this.bankDialogVisible = true; this.bankDialogVisible = true;
console.log(this.fileList);
console.log(this.fileList != []);
if (this.fileList.length >= 1) { if (this.fileList.length >= 1) {
this.hideUpload = true; this.hideUpload = true;
} }
} }
} }
// setTimeout(this.signUpInit(this.status_wx), 1000); // setTimeout(this.signUpInit(this.status_wx), 1000);
}, },
signUpInit() { signUpInit() {
...@@ -543,7 +392,6 @@ ...@@ -543,7 +392,6 @@
this.status = 3; this.status = 3;
if (this.isNexts == 1) { if (this.isNexts == 1) {
if (res.data.examine_status == 1) { if (res.data.examine_status == 1) {
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) {
...@@ -566,7 +414,6 @@ ...@@ -566,7 +414,6 @@
// pay_amount支付金额等于0,直接跳到成功页面 // pay_amount支付金额等于0,直接跳到成功页面
if (res.data.pay_amount == 0) { if (res.data.pay_amount == 0) {
this.type = "success"; this.type = "success";
this.$emit("getstatus", 6); this.$emit("getstatus", 6);
} else { } else {
// transfer_account 判断微信支付宝或者银行卡支付 // transfer_account 判断微信支付宝或者银行卡支付
...@@ -574,8 +421,6 @@ ...@@ -574,8 +421,6 @@
this.dialogChoose = true; this.dialogChoose = true;
} else { } else {
this.bankDialogVisible = true; this.bankDialogVisible = true;
console.log(this.fileList);
console.log(this.fileList != []);
if (this.fileList.length >= 1) { if (this.fileList.length >= 1) {
this.hideUpload = true; this.hideUpload = true;
} }
...@@ -615,7 +460,6 @@ ...@@ -615,7 +460,6 @@
} }
return (isJPG || isPng || isJPEG) && isLt10M; return (isJPG || isPng || isJPEG) && isLt10M;
}, },
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
console.log(file, "11111111"); console.log(file, "11111111");
this.resultPicture = file.url; this.resultPicture = file.url;
...@@ -630,9 +474,6 @@ ...@@ -630,9 +474,6 @@
} }
}, },
uploadSuccess(res, file, fileList) { uploadSuccess(res, file, fileList) {
// console.log(res, "res");
// console.log(file, "file");
// console.log(fileList, "fileList");
this.referForm.achievementPath = res; this.referForm.achievementPath = res;
this.fileList = { this.fileList = {
name: file.name, name: file.name,
...@@ -651,9 +492,8 @@ ...@@ -651,9 +492,8 @@
type: raw.type, type: raw.type,
}; };
this.file_image = image; this.file_image = image;
this.getOssConfigs(this.file_image, params.file); this.getCosConfigs(this.file_image, params.file);
}, },
// 上传截图 // 上传截图
uploadConfirm() { uploadConfirm() {
this.bankDialogVisible = false; this.bankDialogVisible = false;
...@@ -666,62 +506,129 @@ ...@@ -666,62 +506,129 @@
pay_type: 4, pay_type: 4,
}); });
}, },
async getOssConfigs(image, file) { // cos上传
let obj = { async getCosConfigs(image, file) {
url: "", console.log(file)
savefile: "", this.loading = true;
}; await getSignature(3)
await getBankInfoOss({image: image})
.then((res) => { .then((res) => {
console.log(res, "开始上传图片"); console.log(res, "开始上传图片");
let resData = res.data.data
if (res.data.code === 200) { if (res.data.code === 200) {
let oss_url = res.data.config.host; const cos = new COS({
let filename = res.data.config.file; // 必选参数
let formData = new FormData(); getAuthorization: (options, callback) => {
formData.append("OSSAccessKeyId", res.data.config.accessid); callback({
formData.append("policy", res.data.config.policy); TmpSecretId: resData.credentials.tmpSecretId,
formData.append("signature", res.data.config.signature); TmpSecretKey: resData.credentials.tmpSecretKey,
formData.append("filename", res.data.config.file); XCosSecurityToken: resData.credentials.sessionToken,
formData.append("key", res.data.config.savefile); StartTime: resData.startTime, // 时间戳,单位秒,如:1580000000
formData.append("callback", res.data.config.callback); ExpiredTime: resData.expiredTime, // 时间戳,单位秒,如:1580000900
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);
}); });
console.log(resData)
cos.putObject({
Bucket: resData.bucket,
Region: resData.region,
Key: '111/fg.png',
Body: file,
onProgress: (progressData) => {
console.log("上传进度:" + JSON.stringify(progressData));
},
},
(err, data) => {
console.log(data);
if (err) {
console.log(err);
this.loading = false;
this.$message.error('上传失败!')
} else { } else {
this.$message.error(res.data.message); console.log(data);
this.signUploadSuccess('http://' + data.Location);
}
}
);
} else {
this.$message.error(resData.message);
} }
}) })
.catch((err) => { .catch((err) => {
// console.log(err); console.log(err);
// this.getIdCardPic();
}); });
}, },
// cos上传-告诉后端上传成功
async signUploadSuccess(path) {
await getSignature(3).then(res => {
if (res.data.code != 200) {
this.loading = false;
return this.$message.error('上传失败!');
}
this.loading = false;
this.$message.success('上传成功!');
// this.selfInfo.picture_path = path + "?t=" + Date.parse(new Date());
this.$forceUpdate();
}).catch(err => {
this.loading = false;
})
},
// 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) { handleDownload(file) {
// console.log(file,'file22'); // console.log(file,'file22');
......
...@@ -2,49 +2,49 @@ ...@@ -2,49 +2,49 @@
<div class="referInfo"> <div class="referInfo">
<!-- 测试 --> <!-- 测试 -->
<el-form <el-form
ref="referRef"
:model="referForm" :model="referForm"
label-position="top"
class="checkForm"
:rules="referInfoRules" :rules="referInfoRules"
class="checkForm"
label-position="top"
ref="referRef"
> >
<div class="cont_title">个人信息</div> <div class="cont_title">个人信息</div>
<el-row :gutter="20"> <el-row :gutter="20">
<!-- 姓名 --> <!-- 姓名 -->
<el-col :span="12" v-show="configJson.name == 1"> <el-col :span="12" v-show="configJson.name == 1">
<el-form-item <el-form-item
label="姓名"
prop="name"
style="height: 73px"
:rules=" :rules="
configJson.name == 1 ? referInfoRules.name : [{ required: false }] configJson.name == 1 ? referInfoRules.name : [{ required: false }]
" "
label="姓名"
prop="name"
style="height: 73px"
> >
<el-input <el-input
ref="name" clearable
v-model="referForm.name"
placeholder="填写真实姓名" placeholder="填写真实姓名"
ref="name"
size="small" size="small"
clearable v-model="referForm.name"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 性别 --> <!-- 性别 -->
<el-col :span="12" v-show="configJson.gender == 1"> <el-col :span="12" v-show="configJson.gender == 1">
<el-form-item <el-form-item
label="性别"
prop="gender"
style="height: 73px"
:rules=" :rules="
configJson.gender == 1 configJson.gender == 1
? referInfoRules.gender ? referInfoRules.gender
: [{ required: false }] : [{ required: false }]
" "
label="性别"
prop="gender"
style="height: 73px"
> >
<el-radio-group <el-radio-group
v-model="referForm.gender"
ref="gender" ref="gender"
size="small" size="small"
v-model="referForm.gender"
> >
<el-radio :label="0"></el-radio> <el-radio :label="0"></el-radio>
<el-radio :label="1"></el-radio> <el-radio :label="1"></el-radio>
...@@ -54,45 +54,45 @@ ...@@ -54,45 +54,45 @@
<!-- 年龄 --> <!-- 年龄 -->
<el-col :span="12" v-show="configJson.age == 1"> <el-col :span="12" v-show="configJson.age == 1">
<el-form-item <el-form-item
label="年龄"
prop="age"
style="height: 70px"
:rules=" :rules="
configJson.age == 1 ? referInfoRules.age : [{ required: false }] configJson.age == 1 ? referInfoRules.age : [{ required: false }]
" "
label="年龄"
prop="age"
style="height: 70px"
> >
<el-input <el-input
ref="age" clearable
v-model="referForm.age"
placeholder="填写年龄" placeholder="填写年龄"
ref="age"
size="small" size="small"
clearable v-model="referForm.age"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!--国籍--> <!--国籍-->
<el-col :span="12" v-show="configJson.country == 1"> <el-col :span="12" v-show="configJson.country == 1">
<el-form-item <el-form-item
label="国籍"
prop="country"
style="height: 70px"
:rules=" :rules="
configJson.country == 1 configJson.country == 1
? referInfoRules.country ? referInfoRules.country
: [{ required: false }] : [{ required: false }]
" "
label="国籍"
prop="country"
style="height: 70px"
> >
<el-select <el-select
v-model="referForm.country"
placeholder="国籍"
:popper-append-to-body="false" :popper-append-to-body="false"
filterable filterable
placeholder="国籍"
v-model="referForm.country"
> >
<el-option <el-option
v-for="(item, index) in countryList"
:key="index" :key="index"
:label="item.label" :label="item.label"
:value="item.label" :value="item.label"
v-for="(item, index) in countryList"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -142,20 +142,20 @@ ...@@ -142,20 +142,20 @@
<!-- 身份证号 --> <!-- 身份证号 -->
<el-col :span="12" v-show="configJson.idCard == 1"> <el-col :span="12" v-show="configJson.idCard == 1">
<el-form-item <el-form-item
label="身份证号"
prop="id_card"
style="height: 70px"
:rules=" :rules="
configJson.idCard == 1 configJson.idCard == 1
? referInfoRules.idCard ? referInfoRules.idCard
: [{ required: false }] : [{ required: false }]
" "
label="身份证号"
prop="id_card"
style="height: 70px"
> >
<el-input <el-input
ref="id_card"
v-model="referForm.id_card"
placeholder="填写真实身份证号" placeholder="填写真实身份证号"
ref="id_card"
size="small" size="small"
v-model="referForm.id_card"
/> />
</el-form-item> </el-form-item>
...@@ -163,45 +163,45 @@ ...@@ -163,45 +163,45 @@
<!-- 手机号 --> <!-- 手机号 -->
<el-col :span="12" v-show="configJson.phone == 1"> <el-col :span="12" v-show="configJson.phone == 1">
<el-form-item <el-form-item
label="手机号"
style="height: 70px"
:rules=" :rules="
configJson.phone == 1 configJson.phone == 1
? referInfoRules.phone ? referInfoRules.phone
: [{ required: false }] : [{ required: false }]
" "
label="手机号"
style="height: 70px"
> >
<el-input <el-input
v-model="referForm.phone" :disabled="true"
placeholder="请输入手机号" placeholder="请输入手机号"
size="small" size="small"
:disabled="true" v-model="referForm.phone"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 学历 --> <!-- 学历 -->
<el-col :span="12" v-show="configJson.education == 1"> <el-col :span="12" v-show="configJson.education == 1">
<el-form-item <el-form-item
label="学历"
prop="education"
style="height: 70px"
:rules=" :rules="
configJson.education == 1 configJson.education == 1
? referInfoRules.education ? referInfoRules.education
: [{ required: false }] : [{ required: false }]
" "
label="学历"
prop="education"
style="height: 70px"
> >
<el-select <el-select
v-model="referForm.education"
placeholder="请选择学历"
:popper-append-to-body="false" :popper-append-to-body="false"
clearable clearable
placeholder="请选择学历"
v-model="referForm.education"
> >
<el-option <el-option
v-for="(item, index) in EducationArrs"
:key="index" :key="index"
:label="item" :label="item"
:value="item" :value="item"
v-for="(item, index) in EducationArrs"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -210,38 +210,38 @@ ...@@ -210,38 +210,38 @@
<!-- 单位名称 --> <!-- 单位名称 -->
<el-col :span="12" v-show="configJson.unitandIdentity == 1"> <el-col :span="12" v-show="configJson.unitandIdentity == 1">
<el-form-item <el-form-item
label="单位名称及身份"
prop="unit_and_identity"
style="height: 70px"
:rules=" :rules="
configJson.unitandIdentity == 1 configJson.unitandIdentity == 1
? referInfoRules.unit_and_identity ? referInfoRules.unit_and_identity
: [{ required: false }] : [{ required: false }]
" "
label="单位名称及身份"
prop="unit_and_identity"
style="height: 70px"
> >
<el-input <el-input
v-model="referForm.unit_and_identity"
placeholder="请输入单位名称及身份" placeholder="请输入单位名称及身份"
size="small" size="small"
v-model="referForm.unit_and_identity"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 电子邮箱 --> <!-- 电子邮箱 -->
<el-col :span="12" v-show="configJson.email == 1"> <el-col :span="12" v-show="configJson.email == 1">
<el-form-item <el-form-item
label="电子邮箱"
prop="email"
style="height: 73px"
:rules=" :rules="
configJson.email == 1 configJson.email == 1
? referInfoRules.email ? referInfoRules.email
: [{ required: false }] : [{ required: false }]
" "
label="电子邮箱"
prop="email"
style="height: 73px"
> >
<el-input <el-input
v-model="referForm.email"
placeholder="填写电子邮箱" placeholder="填写电子邮箱"
size="small" size="small"
v-model="referForm.email"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -252,68 +252,68 @@ ...@@ -252,68 +252,68 @@
style="height: 73px" style="height: 73px"
> >
<el-input <el-input
v-model="referForm.recommend"
placeholder="填写推荐人或渠道(选填)" placeholder="填写推荐人或渠道(选填)"
size="small" size="small"
v-model="referForm.recommend"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 出生日期 --> <!-- 出生日期 -->
<el-col :span="12" v-show="configJson.birthday == 1"> <el-col :span="12" v-show="configJson.birthday == 1">
<el-form-item <el-form-item
label="出生日期"
prop="birthday"
style="height: 73px"
:rules=" :rules="
configJson.birthday == 1 configJson.birthday == 1
? referInfoRules.birthday ? referInfoRules.birthday
: [{ required: false }] : [{ required: false }]
" "
label="出生日期"
prop="birthday"
style="height: 73px"
> >
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-select <el-select
v-model="bdYear"
placeholder="年"
:popper-append-to-body="false" :popper-append-to-body="false"
placeholder="年"
v-model="bdYear"
> >
<el-option <el-option
v-for="(item, index) in yearArrs"
:key="index" :key="index"
:label="item" :label="item"
:value="item" :value="item"
v-for="(item, index) in yearArrs"
> >
</el-option> </el-option>
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-select <el-select
v-model="bdMonth"
placeholder="月"
:popper-append-to-body="false" :popper-append-to-body="false"
placeholder="月"
v-model="bdMonth"
> >
<el-option <el-option
v-for="(item, index) in monthArrs"
:key="index" :key="index"
:label="item" :label="item"
:value="item" :value="item"
v-for="(item, index) in monthArrs"
> >
</el-option> </el-option>
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-select <el-select
ref="birthday"
v-model="bdDay"
placeholder="日"
:popper-append-to-body="false" :popper-append-to-body="false"
@change="getTime" @change="getTime"
placeholder="日"
ref="birthday"
v-model="bdDay"
> >
<el-option <el-option
v-for="(item, index) in dayArrs"
:key="index" :key="index"
:label="item" :label="item"
:value="item" :value="item"
v-for="(item, index) in dayArrs"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -324,46 +324,46 @@ ...@@ -324,46 +324,46 @@
<!-- 籍贯 --> <!-- 籍贯 -->
<el-col :span="12" v-show="configJson.jiguanCity == 1"> <el-col :span="12" v-show="configJson.jiguanCity == 1">
<el-form-item <el-form-item
label="籍贯"
prop="jiguan_code"
style="height: 73px"
:rules=" :rules="
configJson.jiguanCity == 1 configJson.jiguanCity == 1
? referInfoRules.jiguan_code ? referInfoRules.jiguan_code
: [{ required: false }] : [{ required: false }]
" "
label="籍贯"
prop="jiguan_code"
style="height: 73px"
> >
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<!-- @keyup.enter.native="selsectProvince" --> <!-- @keyup.enter.native="selsectProvince" -->
<el-select <el-select
v-model="jgProvinceCode"
placeholder="省"
:popper-append-to-body="false" :popper-append-to-body="false"
@change="changeProvince(1, $event)" @change="changeProvince(1, $event)"
placeholder="省"
v-model="jgProvinceCode"
> >
<el-option <el-option
v-for="item in selectProvince"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
v-for="item in selectProvince"
> >
</el-option> </el-option>
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-select <el-select
ref="jiguan_code"
v-model="jiguan_city"
placeholder="市"
:popper-append-to-body="false" :popper-append-to-body="false"
@change="getJiguan()" @change="getJiguan()"
placeholder="市"
ref="jiguan_code"
v-model="jiguan_city"
> >
<el-option <el-option
v-for="item in selectCityJiguan"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
v-for="item in selectCityJiguan"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -374,35 +374,35 @@ ...@@ -374,35 +374,35 @@
<!-- 民族 --> <!-- 民族 -->
<el-col :span="12" v-show="configJson.nation == 1"> <el-col :span="12" v-show="configJson.nation == 1">
<el-form-item <el-form-item
label="民族"
prop="nation"
style="height: 73px"
:rules=" :rules="
configJson.nation == 1 configJson.nation == 1
? referInfoRules.nation ? referInfoRules.nation
: [{ required: false }] : [{ required: false }]
" "
label="民族"
prop="nation"
style="height: 73px"
> >
<el-input <el-input
ref="nation" clearable
v-model="referForm.nation"
placeholder="填写民族" placeholder="填写民族"
ref="nation"
size="small" size="small"
clearable v-model="referForm.nation"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 入学年份 --> <!-- 入学年份 -->
<el-col :span="12" v-show="configJson.startSchoolDate == 1"> <el-col :span="12" v-show="configJson.startSchoolDate == 1">
<el-form-item <el-form-item
label="入学年份"
prop="start_school_date"
style="height: 73px"
:rules=" :rules="
configJson.startSchoolDate == 1 configJson.startSchoolDate == 1
? referInfoRules.start_school_date ? referInfoRules.start_school_date
: [{ required: false }] : [{ required: false }]
" "
label="入学年份"
prop="start_school_date"
style="height: 73px"
> >
<el-row :gutter="20"> <el-row :gutter="20">
<!-- <el-col :span="12"> <!-- <el-col :span="12">
...@@ -423,18 +423,18 @@ ...@@ -423,18 +423,18 @@
</el-col> --> </el-col> -->
<!-- <el-col :span="12"> --> <!-- <el-col :span="12"> -->
<el-select <el-select
ref="start_school_date"
v-model="start_year"
placeholder="年份"
clearable
:popper-append-to-body="false" :popper-append-to-body="false"
@change="getyear()" @change="getyear()"
clearable
placeholder="年份"
ref="start_school_date"
v-model="start_year"
> >
<el-option <el-option
v-for="(item, index) in yearArrs"
:key="index" :key="index"
:label="item" :label="item"
:value="item" :value="item"
v-for="(item, index) in yearArrs"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -445,27 +445,27 @@ ...@@ -445,27 +445,27 @@
<!-- 政治面貌 --> <!-- 政治面貌 -->
<el-col :span="12" v-show="configJson.politicalStatus == 1"> <el-col :span="12" v-show="configJson.politicalStatus == 1">
<el-form-item <el-form-item
label="政治面貌"
prop="political_status"
style="height: 73px"
:rules=" :rules="
configJson.politicalStatus == 1 configJson.politicalStatus == 1
? referInfoRules.political_status ? referInfoRules.political_status
: [{ required: false }] : [{ required: false }]
" "
label="政治面貌"
prop="political_status"
style="height: 73px"
> >
<el-select <el-select
ref="political_status"
v-model="referForm.political_status"
placeholder="填写政治面貌"
:popper-append-to-body="false" :popper-append-to-body="false"
clearable clearable
placeholder="填写政治面貌"
ref="political_status"
v-model="referForm.political_status"
> >
<el-option <el-option
v-for="item in political_status"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.name" :value="item.name"
v-for="item in political_status"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -474,26 +474,26 @@ ...@@ -474,26 +474,26 @@
<!-- 在读年级 --> <!-- 在读年级 -->
<el-col :span="12" v-show="configJson.grade == 1"> <el-col :span="12" v-show="configJson.grade == 1">
<el-form-item <el-form-item
label="在读年级"
prop="grade"
style="height: 73px"
:rules=" :rules="
configJson.grade == 1 configJson.grade == 1
? referInfoRules.grade ? referInfoRules.grade
: [{ required: false }] : [{ required: false }]
" "
label="在读年级"
prop="grade"
style="height: 73px"
> >
<el-select <el-select
v-model="referForm.grade"
placeholder="在读年级"
:popper-append-to-body="false" :popper-append-to-body="false"
clearable clearable
placeholder="在读年级"
v-model="referForm.grade"
> >
<el-option <el-option
v-for="(item, index) in gradeArrs"
:key="index" :key="index"
:label="item" :label="item"
:value="item" :value="item"
v-for="(item, index) in gradeArrs"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -503,27 +503,27 @@ ...@@ -503,27 +503,27 @@
<!-- 选科情况 --> <!-- 选科情况 -->
<el-col :span="12" v-show="configJson.electSubjectSituation == 1"> <el-col :span="12" v-show="configJson.electSubjectSituation == 1">
<el-form-item <el-form-item
label="选科情况"
prop="subjectState"
style="height: 73px"
:rules=" :rules="
configJson.electSubjectSituation == 1 configJson.electSubjectSituation == 1
? referInfoRules.subjectState ? referInfoRules.subjectState
: [{ required: false }] : [{ required: false }]
" "
label="选科情况"
prop="subjectState"
style="height: 73px"
> >
<el-select <el-select
v-model="referForm.subjectState"
placeholder="请选科"
:popper-append-to-body="false" :popper-append-to-body="false"
@change="changeSubjectState" @change="changeSubjectState"
clearable clearable
placeholder="请选科"
v-model="referForm.subjectState"
> >
<el-option <el-option
v-for="(item, index) in electSubjectArrs"
:key="index" :key="index"
:label="item" :label="item"
:value="item" :value="item"
v-for="(item, index) in electSubjectArrs"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -532,29 +532,29 @@ ...@@ -532,29 +532,29 @@
<!--已选科--> <!--已选科-->
<el-col :span="12" v-if="configJson.electSubjectSituation == 1&& showSubject == 1"> <el-col :span="12" v-if="configJson.electSubjectSituation == 1&& showSubject == 1">
<el-form-item <el-form-item
label="选科(最多选三科)"
prop="chooseSubject"
style="height: 73px"
:rules=" :rules="
showSubject == 1 showSubject == 1
? referInfoRules.chooseSubject ? referInfoRules.chooseSubject
: [{ required: false }] : [{ required: false }]
" "
label="选科(最多选三科)"
prop="chooseSubject"
style="height: 73px"
> >
<el-select <el-select
v-model="referForm.chooseSubject"
multiple
placeholder="请选科"
:popper-append-to-body="false"
:multiple-limit="3" :multiple-limit="3"
:popper-append-to-body="false"
@change="changeSubjectList" @change="changeSubjectList"
clearable clearable
multiple
placeholder="请选科"
v-model="referForm.chooseSubject"
> >
<el-option <el-option
v-for="(item, index) in SubjectArrs"
:key="index" :key="index"
:label="item" :label="item"
:value="item" :value="item"
v-for="(item, index) in SubjectArrs"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -563,69 +563,69 @@ ...@@ -563,69 +563,69 @@
<!-- 既往病史或过敏史 --> <!-- 既往病史或过敏史 -->
<el-col :span="12" v-show="configJson.pastMedicalHistory == 1&&isOffline==true"> <el-col :span="12" v-show="configJson.pastMedicalHistory == 1&&isOffline==true">
<el-form-item <el-form-item
label="既往病史或过敏史"
prop="past_medical_history"
style="height: 73px"
:rules=" :rules="
(configJson.pastMedicalHistory == 1?true:false)&&isOffline==true (configJson.pastMedicalHistory == 1?true:false)&&isOffline==true
? referInfoRules.clothesSize ? referInfoRules.clothesSize
: [{ required: false }] : [{ required: false }]
" "
label="既往病史或过敏史"
prop="past_medical_history"
style="height: 73px"
> >
<el-input <el-input
ref="code" clearable
v-model="referForm.past_medical_history"
placeholder="填写既往病史或过敏史" placeholder="填写既往病史或过敏史"
ref="code"
size="small" size="small"
clearable v-model="referForm.past_medical_history"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 备注或其它 --> <!-- 备注或其它 -->
<el-col :span="12" v-show="configJson.noteOther == 1&&isOffline==true"> <el-col :span="12" v-show="configJson.noteOther == 1&&isOffline==true">
<el-form-item <el-form-item
label="备注或其它"
prop="clothes_size"
style="height: 73px"
:rules=" :rules="
(configJson.noteOther == 1?true:false)&&isOffline==true (configJson.noteOther == 1?true:false)&&isOffline==true
? referInfoRules.clothesSize ? referInfoRules.clothesSize
: [{ required: false }] : [{ required: false }]
" "
label="备注或其它"
prop="clothes_size"
style="height: 73px"
> >
<el-input <el-input
ref="code" clearable
v-model="referForm.note_other"
placeholder="填写备注或其它" placeholder="填写备注或其它"
ref="code"
size="small" size="small"
clearable v-model="referForm.note_other"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 衣服尺码--> <!-- 衣服尺码-->
<el-col :span="12" v-show="configJson.clothesSize == 1&&isOffline==true"> <el-col :span="12" v-show="configJson.clothesSize == 1&&isOffline==true">
<el-form-item <el-form-item
label="衣服尺码"
prop="clothes_size"
style="height: 73px"
:rules=" :rules="
(configJson.clothesSize == 1?true:false)&&isOffline==true (configJson.clothesSize == 1?true:false)&&isOffline==true
? referInfoRules.clothesSize ? referInfoRules.clothesSize
: [{ required: false }] : [{ required: false }]
" "
label="衣服尺码"
prop="clothes_size"
style="height: 73px"
> >
<el-select <el-select
ref="clothes_size"
v-model="referForm.clothes_size"
placeholder="填写衣服尺码"
:popper-append-to-body="false" :popper-append-to-body="false"
clearable clearable
placeholder="填写衣服尺码"
ref="clothes_size"
v-model="referForm.clothes_size"
> >
<el-option <el-option
v-for="item in clothesSize"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.name" :value="item.name"
v-for="item in clothesSize"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -634,19 +634,19 @@ ...@@ -634,19 +634,19 @@
<!-- 邀请码 --> <!-- 邀请码 -->
<el-col :span="12" v-show="configJson.code == 1"> <el-col :span="12" v-show="configJson.code == 1">
<el-form-item <el-form-item
prop="code"
label="邀请码" label="邀请码"
prop="code"
style="height: 73px" style="height: 73px"
> >
<el-input <el-input
ref="code"
v-model="referForm.code"
placeholder="邀请码"
size="small"
:disabled="isCode" :disabled="isCode"
@change="changeCode" @change="changeCode"
clearable clearable
placeholder="邀请码"
ref="code"
size="small"
v-model="referForm.code"
/> />
</el-form-item> </el-form-item>
<div class="tipsMsg"> <div class="tipsMsg">
...@@ -656,25 +656,25 @@ ...@@ -656,25 +656,25 @@
<!-- 自我介绍 --> <!-- 自我介绍 -->
<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"
label="自我介绍"
style="height:100%"
:rules=" :rules="
configJson.introduceMyself == 1 configJson.introduceMyself == 1
? referInfoRules.introduceMyself ? referInfoRules.introduceMyself
: [{ required: false }] : [{ required: false }]
" "
label="自我介绍"
prop="introduce"
style="height:100%"
> >
<el-input <el-input
ref="code"
v-model="referForm.introduce"
placeholder="自我介绍"
type="textarea"
:rows="6" :rows="6"
@change="changeIntroduce"
maxlength="200" maxlength="200"
placeholder="自我介绍"
ref="code"
show-word-limit
size="small" size="small"
@change="changeIntroduce" type="textarea"
show-word-limit/> v-model="referForm.introduce"/>
</el-form-item> </el-form-item>
<div class="tipsMsg"> <div class="tipsMsg">
用清晰、简洁的语言介绍自己对科学和创新的兴趣、经验和动机,以及为什么希望参加“强国有我”复旦大学信息科学与工程学院青少年科学营 用清晰、简洁的语言介绍自己对科学和创新的兴趣、经验和动机,以及为什么希望参加“强国有我”复旦大学信息科学与工程学院青少年科学营
...@@ -693,40 +693,40 @@ ...@@ -693,40 +693,40 @@
<!-- 紧急联系人 --> <!-- 紧急联系人 -->
<el-col :span="12" v-show="configJson.emergency == 1"> <el-col :span="12" v-show="configJson.emergency == 1">
<el-form-item <el-form-item
label="紧急联系人"
prop="emergency"
:rules=" :rules="
configJson.emergency == 1 configJson.emergency == 1
? referInfoRules.emergency ? referInfoRules.emergency
: [{ required: false }] : [{ required: false }]
" "
label="紧急联系人"
prop="emergency"
> >
<el-input <el-input
ref="code" clearable
v-model="referForm.emergency"
placeholder="填写紧急联系人" placeholder="填写紧急联系人"
ref="code"
size="small" size="small"
clearable v-model="referForm.emergency"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 紧急联系人电话 --> <!-- 紧急联系人电话 -->
<el-col :span="12" v-show="configJson.emergencyPhone == 1"> <el-col :span="12" v-show="configJson.emergencyPhone == 1">
<el-form-item <el-form-item
label="紧急联系人电话"
prop="emergency_phone"
:rules=" :rules="
configJson.emergencyPhone == 1 configJson.emergencyPhone == 1
? referInfoRules.emergency_phone ? referInfoRules.emergency_phone
: [{ required: false }] : [{ required: false }]
" "
label="紧急联系人电话"
prop="emergency_phone"
> >
<el-input <el-input
ref="code" clearable
v-model="referForm.emergency_phone"
placeholder="填写紧急联系人电话" placeholder="填写紧急联系人电话"
ref="code"
size="small" size="small"
clearable v-model="referForm.emergency_phone"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -746,27 +746,27 @@ ...@@ -746,27 +746,27 @@
<div class="school_info" v-show="configJson.school == 1"> <div class="school_info" v-show="configJson.school == 1">
<el-col :span="6"> <el-col :span="6">
<el-form-item <el-form-item
label="就读中学"
prop="school_province"
:rules=" :rules="
configJson.school == 1 configJson.school == 1
? referInfoRules.school_province ? referInfoRules.school_province
: [{ required: false }] : [{ required: false }]
" "
label="就读中学"
prop="school_province"
> >
<el-select <el-select
ref="school_province"
v-model="referForm.school_province"
clearable
placeholder="省"
:popper-append-to-body="false" :popper-append-to-body="false"
@change="changeProvince(2, $event)" @change="changeProvince(2, $event)"
clearable
placeholder="省"
ref="school_province"
v-model="referForm.school_province"
> >
<el-option <el-option
v-for="item in selectProvince"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
v-for="item in selectProvince"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -774,28 +774,28 @@ ...@@ -774,28 +774,28 @@
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item <el-form-item
class="no_label"
label=" "
prop="school_city"
:rules=" :rules="
configJson.school == 1 configJson.school == 1
? referInfoRules.school_city ? referInfoRules.school_city
: [{ required: false }] : [{ required: false }]
" "
class="no_label"
label=" "
prop="school_city"
> >
<el-select <el-select
ref="school_city"
v-model="referForm.school_city"
clearable
placeholder="市"
:popper-append-to-body="false" :popper-append-to-body="false"
@change="changeCity($event)" @change="changeCity($event)"
clearable
placeholder="市"
ref="school_city"
v-model="referForm.school_city"
> >
<el-option <el-option
v-for="item in selectCitySchool"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
v-for="item in selectCitySchool"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -803,28 +803,28 @@ ...@@ -803,28 +803,28 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item
class="no_label"
label=" "
prop="school"
:rules=" :rules="
configJson.school == 1 configJson.school == 1
? referInfoRules.school ? referInfoRules.school
: [{ required: false }] : [{ required: false }]
" "
class="no_label"
label=" "
prop="school"
> >
<el-select <el-select
:popper-append-to-body="false"
clearable
filterable filterable
placeholder="中学"
ref="school" ref="school"
v-model="referForm.school" v-model="referForm.school"
clearable
placeholder="中学"
:popper-append-to-body="false"
> >
<el-option <el-option
v-for="item in selectSchoolList"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
v-for="item in selectSchoolList"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -840,39 +840,39 @@ ...@@ -840,39 +840,39 @@
<el-col :span="12" v-show="configJson.schoolContacts == 1"> <el-col :span="12" v-show="configJson.schoolContacts == 1">
<el-form-item <el-form-item
label="中学联系人"
prop="school_contacts"
:rules=" :rules="
configJson.schoolContacts == 1 configJson.schoolContacts == 1
? referInfoRules.school_contacts ? referInfoRules.school_contacts
: [{ required: false }] : [{ required: false }]
" "
label="中学联系人"
prop="school_contacts"
> >
<el-input <el-input
ref="school_contacts" clearable
v-model="referForm.school_contacts"
placeholder="填写中学联系人" placeholder="填写中学联系人"
ref="school_contacts"
size="small" size="small"
clearable v-model="referForm.school_contacts"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-show="configJson.schoolPhone == 1"> <el-col :span="12" v-show="configJson.schoolPhone == 1">
<el-form-item <el-form-item
label="中学联系人电话(手机)"
prop="school_phone"
:rules=" :rules="
configJson.schoolPhone == 1 configJson.schoolPhone == 1
? referInfoRules.school_phone ? referInfoRules.school_phone
: [{ required: false }] : [{ required: false }]
" "
label="中学联系人电话(手机)"
prop="school_phone"
> >
<el-input <el-input
ref="school_phone" clearable
v-model="referForm.school_phone"
placeholder="填写中学联系人电话(手机)" placeholder="填写中学联系人电话(手机)"
ref="school_phone"
size="small" size="small"
clearable v-model="referForm.school_phone"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -883,10 +883,10 @@ ...@@ -883,10 +883,10 @@
<div v-show="configJson.achievementPath == 1"> <div v-show="configJson.achievementPath == 1">
<div class="cont_title">学习成绩证明材料</div> <div class="cont_title">学习成绩证明材料</div>
<el-form-item <el-form-item
class="bgPic"
label="上传申请资料图片" label="上传申请资料图片"
prop="backgroundPicture" prop="backgroundPicture"
style="height: 100%" style="height: 100%"
class="bgPic"
> >
<div class="bgInfo"> <div class="bgInfo">
1、资料包括:近期校级考试的成绩单、在校期间获得证书等相关证明; 1、资料包括:近期校级考试的成绩单、在校期间获得证书等相关证明;
...@@ -897,46 +897,46 @@ ...@@ -897,46 +897,46 @@
<div class="image_add"> <div class="image_add">
<div class="image_in"> <div class="image_in">
<el-upload <el-upload
ref="imgUrl" :before-upload="beforeAvatarUpload"
name="multipartFile"
list-type="picture-card"
:disabled="isUploading || fileList.length >= 10" :disabled="isUploading || fileList.length >= 10"
action="#"
accept=".jpg,.jpeg,.png"
:limit="10"
:file-list="fileList" :file-list="fileList"
:before-upload="beforeAvatarUpload" :http-request="uploadPicture"
:limit="10"
:on-progress="handleUploadProgress" :on-progress="handleUploadProgress"
:on-success="uploadSuccess" :on-success="uploadSuccess"
:http-request="uploadPicture" accept=".jpg,.jpeg,.png"
action="#"
list-type="picture-card"
name="multipartFile"
ref="imgUrl"
> >
<i style="font-size: 44px" class="el-icon-circle-plus"> </i> <i class="el-icon-circle-plus" style="font-size: 44px"> </i>
<!-- <div class="text">上传材料</div> --> <!-- <div class="text">上传材料</div> -->
<div slot="file" slot-scope="{ file }"> <div slot="file" slot-scope="{ file }">
<div v-for="(item, idx) in fileList" :key="idx"> <div :key="idx" v-for="(item, idx) in fileList">
<img <img
class="el-upload-list__item-thumbnail"
:src="file.url" :src="file.url"
alt="" alt=""
class="el-upload-list__item-thumbnail"
/> />
<span class="el-upload-list__item-actions"> <span class="el-upload-list__item-actions">
<span <span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)" @click="handlePictureCardPreview(file)"
class="el-upload-list__item-preview"
> >
<i class="el-icon-zoom-in"></i> <i class="el-icon-zoom-in"></i>
</span> </span>
<span <span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleDownload(file)" @click="handleDownload(file)"
class="el-upload-list__item-delete"
v-if="!disabled"
> >
<i class="el-icon-download"></i> <i class="el-icon-download"></i>
</span> </span>
<span <span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleRemove(file)" @click="handleRemove(file)"
class="el-upload-list__item-delete"
v-if="!disabled"
> >
<i class="el-icon-delete"></i> <i class="el-icon-delete"></i>
</span> </span>
...@@ -947,7 +947,7 @@ ...@@ -947,7 +947,7 @@
</div> </div>
<el-dialog :visible.sync="dialogVisible"> <el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="resultPicture" alt=""/> <img :src="resultPicture" alt="" width="100%"/>
</el-dialog> </el-dialog>
</div> </div>
</el-form-item> </el-form-item>
...@@ -964,16 +964,9 @@ ...@@ -964,16 +964,9 @@
<script> <script>
/* eslint-disable */ /* eslint-disable */
import {setInviteCode} from "r/index/signUp"; import {delPic, getAccount, getProAndCity, getSchool, setAccount} from "r/index/signUp";
import { import COS from "cos-js-sdk-v5";
getAccount, import {getSignature} from "r/index/cosUpload";
getAchievementOss,
delPic,
setAccount,
getProAndCity,
getSchool,
} from "r/index/signUp";
import {upload} from "r/index/network";
import validator from "common/validator"; import validator from "common/validator";
import area from "config/area"; import area from "config/area";
import cueDialog from "c/index/cueDialog"; import cueDialog from "c/index/cueDialog";
...@@ -1811,61 +1804,128 @@ ...@@ -1811,61 +1804,128 @@
size: raw.size, size: raw.size,
type: raw.type, type: raw.type,
}; };
this.getOssConfigs(image, params.file); this.getCosConfigs(image, params.file);
}, },
async getOssConfigs(image, file) { // cos上传
let obj = { async getCosConfigs(image, file) {
url: "", console.log(file)
savefile: "", this.loading = true;
}; await getSignature(1)
await getAchievementOss({image: image})
.then((res) => { .then((res) => {
// console.log(res, "开始上传图片"); console.log(res, "开始上传图片");
let resData = res.data.data
if (res.data.code === 200) { if (res.data.code === 200) {
let oss_url = res.data.config.host; const cos = new COS({
let filename = res.data.config.file; // 必选参数
let formData = new FormData(); getAuthorization: (options, callback) => {
formData.append("OSSAccessKeyId", res.data.config.accessid); callback({
formData.append("policy", res.data.config.policy); TmpSecretId: resData.credentials.tmpSecretId,
formData.append("signature", res.data.config.signature); TmpSecretKey: resData.credentials.tmpSecretKey,
formData.append("filename", res.data.config.file); XCosSecurityToken: resData.credentials.sessionToken,
formData.append("key", res.data.config.savefile); StartTime: resData.startTime, // 时间戳,单位秒,如:1580000000
formData.append("callback", res.data.config.callback); ExpiredTime: resData.expiredTime, // 时间戳,单位秒,如:1580000900
formData.append("success_action_status", 200);
formData.append("file", file);
// console.log(formData);
upload(oss_url, formData)
.then((ress) => {
// 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();
this.$message.success("上传成功");
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_file_" +
+window.localStorage.getItem("index-phone-all") +
code,
JSON.stringify(this.fileList)
);
})
.catch((err) => {
this.$message.error(err);
}); });
},
});
console.log(resData)
cos.putObject({
Bucket: resData.bucket,
Region: resData.region,
Key: '111/fg.png',
Body: file,
onProgress: (progressData) => {
console.log("上传进度:" + JSON.stringify(progressData));
},
},
(err, data) => {
console.log(data);
if (err) {
console.log(err);
this.loading = false;
this.$message.error('上传失败!')
} else { } else {
this.$message.error(res.data.message); console.log(data);
this.signUploadSuccess('http://' + data.Location);
}
}
);
} else {
this.$message.error(resData.message);
} }
}) })
.catch((err) => { .catch((err) => {
// console.log(err); console.log(err);
// this.getIdCardPic();
}); });
}, },
// cos上传-告诉后端上传成功
async signUploadSuccess(path) {
await getSignature(1).then(res => {
if (res.data.code != 200) {
this.loading = false;
return this.$message.error('上传失败!');
}
this.loading = false;
this.$message.success('上传成功!');
// this.selfInfo.picture_path = path + "?t=" + Date.parse(new Date());
this.$forceUpdate();
}).catch(err => {
this.loading = false;
})
},
// async getOssConfigs(image, file) {
// let obj = {
// url: "",
// savefile: "",
// };
// 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(formData);
// upload(oss_url, formData)
// .then((ress) => {
// // 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();
// this.$message.success("上传成功");
// 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_file_" +
// +window.localStorage.getItem("index-phone-all") +
// code,
// JSON.stringify(this.fileList)
// );
// })
// .catch((err) => {
// this.$message.error(err);
// });
// } else {
// this.$message.error(res.data.message);
// }
// })
// .catch((err) => {
// // console.log(err);
// });
// },
// 下载证明资料图片 // 下载证明资料图片
handleDownload(file) { handleDownload(file) {
// console.log(file,'file22'); // console.log(file,'file22');
...@@ -2068,7 +2128,7 @@ ...@@ -2068,7 +2128,7 @@
}; };
</script> </script>
<style scoped lang="scss"> <style lang="scss" scoped>
@import "a/scss/btn"; @import "a/scss/btn";
@import "a/scss/SignUp/referInfo"; @import "a/scss/SignUp/referInfo";
</style> </style>
...@@ -16,7 +16,6 @@ export function loginCode(data) { ...@@ -16,7 +16,6 @@ export function loginCode(data) {
method: 'post', method: 'post',
url: '/web/code/loginCode', url: '/web/code/loginCode',
params: data params: data
}) })
} }
......
import {request} from "../network";
//cos签名-web直传 1-个人信息上传2-作业上传3-银行缴费截图上传
export function getSignature(index) {
return request({
method: 'get',
url: `/web/download/getSignature/${index}`,
})
}
...@@ -22,6 +22,8 @@ export function PostWorkStudentOss(data) { ...@@ -22,6 +22,8 @@ export function PostWorkStudentOss(data) {
data data
}) })
} }
//下载 //下载
export function downloadTeacherWork(data) { export function downloadTeacherWork(data) {
data['identity'] = store.state.indexIdentity; data['identity'] = store.state.indexIdentity;
...@@ -31,6 +33,7 @@ export function downloadTeacherWork(data) { ...@@ -31,6 +33,7 @@ export function downloadTeacherWork(data) {
params: data params: data
}) })
} }
//删除图片 //删除图片
export function delPic(data) { export function delPic(data) {
data['identity'] = store.state.indexIdentity; data['identity'] = store.state.indexIdentity;
...@@ -50,6 +53,7 @@ export function getStudentWork(data) { ...@@ -50,6 +53,7 @@ export function getStudentWork(data) {
params: data params: data
}) })
} }
// 提交营地作业 // 提交营地作业
export function subStudentWork(data) { export function subStudentWork(data) {
data['identity'] = store.state.indexIdentity; data['identity'] = store.state.indexIdentity;
......
...@@ -12,3 +12,14 @@ export function getWxConfig(data) { ...@@ -12,3 +12,14 @@ export function getWxConfig(data) {
params: data params: data
}) })
} }
//订单状态检查跳转界面(成功-跳转到支付成功页面)
export function checkAsync(data) {
data['identity'] = store.state.indexIdentity;
return request({
method: 'post',
url: '/web/pay/async',
params: data
})
}
...@@ -25,6 +25,7 @@ let state = { ...@@ -25,6 +25,7 @@ let state = {
token: localStorage.getItem("index-token-all") || "", token: localStorage.getItem("index-token-all") || "",
isLogin: localStorage.getItem("isLogin") || "0", // 只有1为已登录 isLogin: localStorage.getItem("isLogin") || "0", // 只有1为已登录
activeIndex: window.localStorage.getItem('index-active-path') || "0", activeIndex: window.localStorage.getItem('index-active-path') || "0",
isToSuccess:0,//订单状态检查跳转界面(成功-跳转到支付成功页面)
}; };
export default new Vuex.Store({ export default new Vuex.Store({
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<!--查看更多--> <!--查看更多-->
<div class="flex-line"> <div class="flex-line">
<div class="line"></div> <div class="line"></div>
<div class="view-more" @click="viewMore">查看更多</div> <div @click="viewMore" class="view-more">查看更多</div>
</div> </div>
<!-- 学生感想和体会 --> <!-- 学生感想和体会 -->
<div> <div>
...@@ -74,9 +74,6 @@ ...@@ -74,9 +74,6 @@
class="reflections_item" v-for="(item, index) in reflectionsList"> class="reflections_item" v-for="(item, index) in reflectionsList">
<div class="item_float"> <div class="item_float">
<div class="item_float_content"> <div class="item_float_content">
<div :key="index2" class="tag" v-for="(item2, index2) in item.tag">
{{item2}}
</div>
<div class="item_name"> <div class="item_name">
<div> <div>
<div class="name"> <div class="name">
...@@ -89,11 +86,18 @@ ...@@ -89,11 +86,18 @@
</div> </div>
</div> </div>
</div> </div>
<div> <div class="reflections_content">
<div class="tags">
<div :key="index2" class="tag" v-for="(item2, index2) in item.tag">
{{item2}}
</div>
</div>
<div class="item_text"> <div class="item_text">
{{item.think}} {{item.think}}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
...@@ -165,7 +169,7 @@ ...@@ -165,7 +169,7 @@
}, },
methods: { methods: {
// 查看更多 // 查看更多
viewMore(){ viewMore() {
this.$router.push('/active'); this.$router.push('/active');
}, },
getHot() { getHot() {
...@@ -174,7 +178,8 @@ ...@@ -174,7 +178,8 @@
return this.$message.error(res.data.msg); return this.$message.error(res.data.msg);
} }
this.activeList = res.data.data; this.activeList = res.data.data;
}).catch(err=>{}) }).catch(err => {
})
}, },
} }
} }
...@@ -229,7 +234,6 @@ ...@@ -229,7 +234,6 @@
} }
.flex-line { .flex-line {
width: 80%;
margin: 15px auto; margin: 15px auto;
display: flex; display: flex;
flex-flow: row; flex-flow: row;
...@@ -245,16 +249,15 @@ ...@@ -245,16 +249,15 @@
font-size: 16px; font-size: 16px;
width: 74px; width: 74px;
margin-left: 40px; margin-left: 40px;
&:hover{
&:hover {
cursor: pointer; cursor: pointer;
/*font-weight: bold;*/
color: var(--all_color); color: var(--all_color);
} }
} }
} }
.reflectionList { .reflectionList {
/*margin-top: 30px;*/
display: flex; display: flex;
flex-flow: wrap; flex-flow: wrap;
font-size: 12px; font-size: 12px;
...@@ -263,12 +266,11 @@ ...@@ -263,12 +266,11 @@
flex-basis: 48%; flex-basis: 48%;
margin: 1.75% 0; margin: 1.75% 0;
background-color: #ffffff; background-color: #ffffff;
height: 10vw;
min-height: 173px; min-height: 173px;
position: relative; position: relative;
width: 200px; width: 200px;
border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;
border: 1px solid #aaaaaa; border: 1px solid #cccccc;
&:nth-child(2n+2) { &:nth-child(2n+2) {
margin: 1.75% 0 1.75% 3.5%; margin: 1.75% 0 1.75% 3.5%;
...@@ -287,15 +289,6 @@ ...@@ -287,15 +289,6 @@
transform: translateY(-50%); transform: translateY(-50%);
} }
.tag {
font-size: 14px;
display: flex;
background-color: #D7D7D7;
padding: 0 9px;
margin-right: 10px;
line-height: 40px;
}
.item_name { .item_name {
line-height: 40px; line-height: 40px;
font-size: 15px; font-size: 15px;
...@@ -305,14 +298,37 @@ ...@@ -305,14 +298,37 @@
} }
.name_line { .name_line {
border-bottom: 2px solid #D7D7D7; border-bottom: 2px solid #409EFF;
}
}
.reflections_content {
margin: 7%;
}
.tags {
display: flex;
padding: 2% 0;
:first-child {
background-color: #FEB370;
} }
:nth-child(2) {
background-color: #409EFF;
color: #ffffff;
}
}
.tag {
font-size: 14px;
padding: 5px 9px;
margin-right: 10px;
border-radius: 4px;
} }
.item_text { .item_text {
font-size: 14px; font-size: 14px;
margin: 7% 3% 3%;
line-height: 24px; line-height: 24px;
white-space: normal; white-space: normal;
overflow: hidden; overflow: hidden;
......
<template> <template>
<div> <div>
<el-dialog <el-dialog
:title="work_name"
:visible.sync="dialogVisible"
width="650px"
top="0"
:before-close="cancelBtn" :before-close="cancelBtn"
:close-on-click-modal="false" :close-on-click-modal="false"
:title="work_name"
:visible.sync="dialogVisible"
@open="open" @open="open"
top="0"
width="650px"
> >
<div class="referHome"> <div class="referHome">
<el-form <el-form
:model="formData" :model="formData"
:rules="referRules" :rules="referRules"
ref="formRef_stu"
label-position="top"
class="readForm" class="readForm"
label-position="top"
ref="formRef_stu"
> >
<!-- 老师布置的作业 --> <!-- 老师布置的作业 -->
<div class="cont_title"> <div class="cont_title">
...@@ -25,26 +25,26 @@ ...@@ -25,26 +25,26 @@
</div> </div>
</div> </div>
<div class="cont_title_2">作业内容</div> <div class="cont_title_2">作业内容</div>
<div v-html="work_contexts" class="cont_info">}</div> <div class="cont_info" v-html="work_contexts">}</div>
<div class="cont_title_2">相关附件</div> <div class="cont_title_2">相关附件</div>
<div class="upload_box"> <div class="upload_box">
<div v-if="teaFileList.length > 0"> <div v-if="teaFileList.length > 0">
<div <div
:key="index"
class="img_list" class="img_list"
v-for="(item, index) in teaFileList" v-for="(item, index) in teaFileList"
:key="index"
> >
<div> <div>
<el-image :src="fileImg"></el-image> <el-image :src="fileImg"></el-image>
<div class="item_name">{{ item.name }}</div> <div class="item_name">{{ item.name }}</div>
<div class="item_remove" @click="downloadStuFile(item.url)"> <div @click="downloadStuFile(item.url)" class="item_remove">
下载 下载
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div v-if="teaFileList.length <= 0" class="img_list"> <div class="img_list" v-if="teaFileList.length <= 0">
<div> <div>
<div class="item_name">暂无相关附件</div> <div class="item_name">暂无相关附件</div>
</div> </div>
...@@ -61,14 +61,14 @@ ...@@ -61,14 +61,14 @@
prop="stu_answer" prop="stu_answer"
> >
<el-input <el-input
:disabled="is_end===false"
:maxlength="300"
placeholder="请输入300字以内的描述"
ref="stu_answer" ref="stu_answer"
show-word-limit
size="small"
type="textarea" type="textarea"
v-model="formData.stu_answer" v-model="formData.stu_answer"
placeholder="请输入300字以内的描述"
size="small"
:maxlength="300"
show-word-limit
:disabled="is_end===false"
/> />
</el-form-item> </el-form-item>
<!-- 上传相关附件 --> <!-- 上传相关附件 -->
...@@ -79,33 +79,29 @@ ...@@ -79,33 +79,29 @@
</div> </div>
<div class="upload_box"> <div class="upload_box">
<div <div
:key="index"
class="img_list" class="img_list"
v-for="(item, index) in stu_fileList" v-for="(item, index) in stu_fileList"
:key="index"
> >
<div> <div>
<el-image class="home_icon" :src="fileImg"></el-image> <el-image :src="fileImg" class="home_icon"></el-image>
<div class="item_name">{{ item.name }}</div> <div class="item_name">{{ item.name }}</div>
<div class="flex"> <div class="flex">
<div <div
@click="handleRemove(item)"
class="item_remove" class="item_remove"
v-show="is_end===true" v-show="is_end===true"
@click="handleRemove(item)"
> >
删除 删除
</div> </div>
<div <div
class="item_remove"
@click="handleCheck(item.url_open)" @click="handleCheck(item.url_open)"
class="item_remove"
> >
查看作业 查看作业
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- <div v-if="stu_fileList.length <= 0" class="img_list">--> <!-- <div v-if="stu_fileList.length <= 0" class="img_list">-->
<!-- <div>--> <!-- <div>-->
...@@ -114,25 +110,25 @@ ...@@ -114,25 +110,25 @@
<!-- </div>--> <!-- </div>-->
<!-- </div>--> <!-- </div>-->
<el-upload <el-upload
v-if="stu_fileList.length < 10 " :before-upload="beforeAvatarUpload"
ref="formData.stu_enclosure_url"
name="multipartFile"
action="#"
:file-list="stu_fileList"
:disabled="isUploading || stu_fileList.length >= 10" :disabled="isUploading || stu_fileList.length >= 10"
:file-list="stu_fileList"
:http-request="uploadPicture"
:limit="10" :limit="10"
list-type="picture-card"
:show-file-list="false" :show-file-list="false"
:before-upload="beforeAvatarUpload" action="#"
:http-request="uploadPicture" list-type="picture-card"
name="multipartFile"
ref="formData.stu_enclosure_url"
v-if="stu_fileList.length < 10 "
> >
<i <i
v-if="!isUploading"
class="el-icon-plus avatar-uploader-icon" class="el-icon-plus avatar-uploader-icon"
v-if="!isUploading"
></i> ></i>
<i <i
v-if="isUploading"
class="el-icon-loading avatar-uploader-icon" class="el-icon-loading avatar-uploader-icon"
v-if="isUploading"
></i> ></i>
</el-upload> </el-upload>
...@@ -181,31 +177,31 @@ ...@@ -181,31 +177,31 @@
</el-form-item> </el-form-item>
</div> --> </div> -->
<!-- 评阅结果 --> <!-- 评阅结果 -->
<div v-if="student_status == 2" style="height: 350px"> <div style="height: 350px" v-if="student_status == 2">
<div class="cont_title"> <div class="cont_title">
<div class="line"></div> <div class="line"></div>
<div class="lf"> <div class="lf">
<span>评阅结果</span> <span>评阅结果</span>
</div> </div>
</div> </div>
<div v-if="this.time_out != 3" class="cont_title_2">导师评分</div> <div class="cont_title_2" v-if="this.time_out != 3">导师评分</div>
<div v-if="this.time_out != 3" class="cont_info">{{ score }}</div> <div class="cont_info" v-if="this.time_out != 3">{{ score }}</div>
<div v-if="this.time_out == 3" class="cont_title_2">导师评语</div> <div class="cont_title_2" v-if="this.time_out == 3">导师评语</div>
<div v-if="this.time_out == 3" v-html="teacher_commment" class="cont_info">}</div> <div class="cont_info" v-html="teacher_commment" v-if="this.time_out == 3">}</div>
<div v-if="this.time_out != 3" class="cont_title_2">相关附件</div> <div class="cont_title_2" v-if="this.time_out != 3">相关附件</div>
<div v-if="this.time_out != 3" class="upload_box"> <div class="upload_box" v-if="this.time_out != 3">
<div v-if="tea_scoreFileList.length > 0"> <div v-if="tea_scoreFileList.length > 0">
<div <div
:key="index"
class="img_list" class="img_list"
v-for="(item, index) in tea_scoreFileList" v-for="(item, index) in tea_scoreFileList"
:key="index"
> >
<div> <div>
<el-image :src="fileImg"></el-image> <el-image :src="fileImg"></el-image>
<div class="item_name">{{ item.name }}</div> <div class="item_name">{{ item.name }}</div>
<div <div
class="item_remove"
@click="downloadScoreFile(item.url)" @click="downloadScoreFile(item.url)"
class="item_remove"
> >
下载 下载
</div> </div>
...@@ -213,16 +209,15 @@ ...@@ -213,16 +209,15 @@
</div> </div>
</div> </div>
<div v-if="tea_scoreFileList.length <= 0" class="img_list"> <div class="img_list" v-if="tea_scoreFileList.length <= 0">
<div> <div>
<div class="item_name">暂无相关附件</div> <div class="item_name">暂无相关附件</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<el-form-item class="btn"> <el-form-item class="btn">
<el-button type="primary" v-preventReClick="1000" @click="confirm" <el-button @click="confirm" type="primary" v-preventReClick="1000"
>提交 >提交
</el-button </el-button
> >
...@@ -232,16 +227,16 @@ ...@@ -232,16 +227,16 @@
</el-dialog> </el-dialog>
<!--查看作业图片 --> <!--查看作业图片 -->
<el-dialog <el-dialog
title="作业"
:visible.sync="dialogVisibleImage"
width="30%"
:before-close="handleImageClose" :before-close="handleImageClose"
:visible.sync="dialogVisibleImage"
append-to-body append-to-body
title="作业"
width="30%"
> >
<el-image <el-image
:lazy='true' :lazy='true'
:src="srcList_url_open"
:preview-src-list="srcList" :preview-src-list="srcList"
:src="srcList_url_open"
></el-image> ></el-image>
</el-dialog> </el-dialog>
</div> </div>
...@@ -249,9 +244,18 @@ ...@@ -249,9 +244,18 @@
</template> </template>
<script> <script>
import {delPic, downloadTeacherWork, getStudentWork, PostWorkStudentOss, subStudentWork,} from "r/index/homework"; import {
delPic,
downloadTeacherWork,
getStudentWork,
PostWorkStudentOss,
subStudentWork
} from "r/index/homework";
import {
getSignature,
} from "r/index/cosUpload";
import fileImg from "@/assets/img/homework/file_img.png"; import fileImg from "@/assets/img/homework/file_img.png";
import {parseTime} from "@/common/utils"; import COS from "cos-js-sdk-v5";
export default { export default {
name: "ReadForm", name: "ReadForm",
...@@ -267,7 +271,7 @@ ...@@ -267,7 +271,7 @@
end_time: [Boolean], //作业截止时间 end_time: [Boolean], //作业截止时间
}, },
data() { data() {
var validateNum = (rule, value, callback) => { const validateNum = (rule, value, callback) => {
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(
...@@ -456,7 +460,6 @@ ...@@ -456,7 +460,6 @@
}); });
}, },
// 成功确认取消,关闭弹框,修改父组件的值 // 成功确认取消,关闭弹框,修改父组件的值
cancelBtnTrue() { cancelBtnTrue() {
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
...@@ -501,7 +504,74 @@ ...@@ -501,7 +504,74 @@
size: raw.size, size: raw.size,
type: raw.type, type: raw.type,
}; };
this.getOssConfigs(image, params.file); this.getCosConfigs(image, params.file);
},
// cos上传
async getCosConfigs(image, file) {
console.log(file)
this.loading = true;
await getSignature(2)
.then((res) => {
console.log(res, "开始上传图片");
let resData = res.data.data
if (res.data.code === 200) {
const cos = new COS({
// 必选参数
getAuthorization: (options, callback) => {
callback({
TmpSecretId: resData.credentials.tmpSecretId,
TmpSecretKey: resData.credentials.tmpSecretKey,
XCosSecurityToken: resData.credentials.sessionToken,
StartTime: resData.startTime, // 时间戳,单位秒,如:1580000000
ExpiredTime: resData.expiredTime, // 时间戳,单位秒,如:1580000900
});
},
});
console.log(resData)
cos.putObject({
Bucket: resData.bucket,
Region: resData.region,
Key: '111/fg.png',
Body: file,
onProgress: (progressData) => {
console.log("上传进度:" + JSON.stringify(progressData));
},
},
(err, data) => {
console.log(data);
if (err) {
console.log(err);
this.loading = false;
this.$message.error('上传失败!')
} else {
console.log(data);
this.signUploadSuccess('http://' + data.Location);
}
}
);
} else {
this.$message.error(resData.message);
}
})
.catch((err) => {
console.log(err);
// this.getIdCardPic();
});
},
// cos上传-告诉后端上传成功
async signUploadSuccess(path) {
await getSignature(2).then(res => {
if (res.data.code != 200) {
this.loading = false;
return this.$message.error('上传失败!');
}
this.loading = false;
this.$message.success('上传成功!');
// this.selfInfo.picture_path = path + "?t=" + Date.parse(new Date());
this.$forceUpdate();
}).catch(err => {
this.loading = false;
})
}, },
async getOssConfigs(image, file) { async getOssConfigs(image, file) {
let obj = { let obj = {
...@@ -759,7 +829,7 @@ ...@@ -759,7 +829,7 @@
}; };
</script> </script>
<style scoped lang="scss"> <style lang="scss" scoped>
@import "a/scss/btn"; @import "a/scss/btn";
@import "a/scss/homework/refer"; @import "a/scss/homework/refer";
......
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