Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
campSite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨梦雪
campSite
Commits
97d2bb9c
Commit
97d2bb9c
authored
Oct 16, 2021
by
杨梦雪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
111
parent
b4cc10cd
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
858 additions
and
137 deletions
+858
-137
package-lock.json
package-lock.json
+11
-0
package.json
package.json
+1
-0
src/common/validator.js
src/common/validator.js
+2
-0
src/components/index/SignUp/ConfirmSignUp.vue
src/components/index/SignUp/ConfirmSignUp.vue
+333
-0
src/components/index/SignUp/paying.vue
src/components/index/SignUp/paying.vue
+19
-6
src/components/index/SignUp/referInfo.vue
src/components/index/SignUp/referInfo.vue
+414
-127
src/request/index/network.js
src/request/index/network.js
+62
-3
src/request/index/pay.js
src/request/index/pay.js
+15
-0
src/request/index/signUp.js
src/request/index/signUp.js
+1
-1
No files found.
package-lock.json
View file @
97d2bb9c
...
...
@@ -12,6 +12,7 @@
"core-js"
:
"^3.6.5"
,
"element-ui"
:
"^2.15.6"
,
"node-sass"
:
"^6.0.1"
,
"qrcodejs2"
:
"^0.0.2"
,
"sass"
:
"^1.42.1"
,
"vue"
:
"^2.6.11"
,
"vue-router"
:
"^3.5.1"
,
...
...
@@ -11987,6 +11988,11 @@
"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"
:
{
"version"
:
"6.5.2"
,
"integrity"
:
"sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
,
...
...
@@ -25043,6 +25049,11 @@
"integrity"
:
"sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc="
,
"dev"
:
true
},
"qrcodejs2"
:
{
"version"
:
"0.0.2"
,
"resolved"
:
"https://registry.npmjs.org/qrcodejs2/-/qrcodejs2-0.0.2.tgz"
,
"integrity"
:
"sha1-Rlr+Xjnxn6zsuTLBH3oYYQkUauE="
},
"qs"
:
{
"version"
:
"6.5.2"
,
"integrity"
:
"sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
...
...
package.json
View file @
97d2bb9c
...
...
@@ -12,6 +12,7 @@
"
core-js
"
:
"
^3.6.5
"
,
"
element-ui
"
:
"
^2.15.6
"
,
"
node-sass
"
:
"
^6.0.1
"
,
"
qrcodejs2
"
:
"
^0.0.2
"
,
"
sass
"
:
"
^1.42.1
"
,
"
vue
"
:
"
^2.6.11
"
,
"
vue-router
"
:
"
^3.5.1
"
,
...
...
src/common/validator.js
View file @
97d2bb9c
...
...
@@ -95,4 +95,6 @@ export default {
callback
()
}
},
}
src/components/index/SignUp/ConfirmSignUp.vue
0 → 100644
View file @
97d2bb9c
<
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
>
src/components/index/SignUp/paying.vue
View file @
97d2bb9c
...
...
@@ -36,12 +36,12 @@
</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_time"
>
支付剩余时间
<span>
15分30秒
</span></div>
<div>
¥150
</div>
<div
class=
"pay_img"
>
<img
src=
""
alt=
""
/
>
<div
class=
"qrcode"
ref=
"qrCodeUrl"
></div
>
</div>
<div>
请使用
<span>
微信
</span>
扫一扫,扫描二维码支付
</div>
<div>
手机完成支付后,请等待系统处理,在此之前请勿关闭窗口
</div>
...
...
@@ -51,23 +51,36 @@
<el-button
@
click=
"dialogVisible = false"
>
刷新二维码
</el-button>
</div>
</span>
</el-dialog>
</el-dialog>
-->
<confirm-sign-up
:confirmSignUpDialogFu=
"confirmSignUpDialogFu"
@
closeCFSUDialog=
"closeCFSUDialog"
></confirm-sign-up>
</div>
</
template
>
<
script
>
/* eslint-disable */
import
ConfirmSignUp
from
"
c/index/SignUp/ConfirmSignUp
"
;
export
default
{
name
:
"
Paying
"
,
components
:
{
ConfirmSignUp
,
},
data
()
{
return
{
dialogVisible
:
false
,
confirmSignUpDialogFu
:
false
,
// 控制确认报名弹框的显示与隐藏
};
},
methods
:
{
paying
()
{
this
.
dialogVisible
=
true
;
// 子组件触发,关闭确认报名弹框
closeCFSUDialog
(
val
,
type
)
{
this
.
confirmSignUpDialogFu
=
val
;
if
(
type
)
{
clearInterval
(
this
.
timer
);
}
},
paying
()
{},
},
};
</
script
>
...
...
src/components/index/SignUp/referInfo.vue
View file @
97d2bb9c
...
...
@@ -20,15 +20,15 @@
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"性别"
prop=
"
sex
"
>
<el-radio-group
v-model=
"referForm.
sex
"
size=
"small"
>
<el-form-item
label=
"性别"
prop=
"
gender
"
>
<el-radio-group
v-model=
"referForm.
gender
"
size=
"small"
>
<el-radio
label=
"0"
>
男
</el-radio>
<el-radio
label=
"
2
"
>
女
</el-radio>
<el-radio
label=
"
1
"
>
女
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"身份证号"
prop=
"id_card
"
>
<el-form-item
label=
"身份证号"
prop=
"id_card"
>
<el-input
v-model=
"referForm.id_card"
placeholder=
"填写真实姓名身份证号"
...
...
@@ -37,75 +37,87 @@
/>
</el-form-item>
</el-col>
<
!--
<el-col
:span=
"4
"
>
<
el-col
:span=
"12
"
>
<el-form-item
label=
"出生日期"
prop=
"birthday"
>
<el-select
v-model=
"referForm.birthday"
clearable
placeholder=
"年"
>
<el-option
v-for=
"item in options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<el-row
:gutter=
"20"
>
<el-col
:span=
"8"
>
<el-select
v-model=
"bdYear"
clearable
placeholder=
"年"
>
<el-option
v-for=
"(item, index) in yearArrs"
:key=
"index"
:label=
"item"
:value=
"item"
>
</el-option>
</el-select>
</el-col>
<el-col
:span=
"8"
>
<el-select
v-model=
"bdMonth"
clearable
placeholder=
"月"
>
<el-option
v-for=
"(item, index) in monthArrs"
:key=
"index"
:label=
"item"
:value=
"item"
>
</el-option>
</el-select>
</el-col>
<el-col
:span=
"8"
>
<el-select
v-model=
"bdDay"
clearable
placeholder=
"日"
@
change=
"getTime()"
>
<el-option
v-for=
"(item, index) in dayArrs"
:key=
"index"
:label=
"item"
:value=
"item"
>
</el-option>
</el-select>
</el-col>
</el-row>
</el-form-item>
</el-col>
<el-col
:span=
"4"
>
<el-form-item
label=
" "
>
<el-select
v-model=
"value"
clearable
placeholder=
"月"
>
<el-option
v-for=
"item in options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
-->
<!--
<el-col
:span=
"4"
>
<el-form-item
label=
" "
>
<el-select
v-model=
"value"
clearable
placeholder=
"日"
>
<el-option
v-for=
"item in options"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
-->
<el-col
:span=
"6"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"籍贯"
prop=
"jiguan_code"
>
<el-select
v-model=
"referForm.jiguan_code"
placeholder=
"省"
clearable
@
keyup.enter.native=
"selsectProvince"
@
change=
"changeProvince(1, $event)"
>
<el-option
v-for=
"item in selectProvince"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"6"
>
<el-form-item
label=
" "
prop=
""
>
<el-select
v-model=
"jiguan_city"
clearable
placeholder=
"市"
>
<el-option
v-for=
"item in selectCityJiguan"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
<el-row
:gutter=
"20"
>
<el-col
:span=
"12"
>
<el-select
v-model=
"jgProvinceCode"
placeholder=
"省"
clearable
@
keyup.enter.native=
"selsectProvince"
@
change=
"changeProvince(1, $event)"
>
<el-option
v-for=
"item in selectProvince"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</el-col>
<el-col
:span=
"12"
>
<el-select
v-model=
"jiguan_city"
placeholder=
"市"
@
change=
"getJiguan()"
>
<el-option
v-for=
"item in selectCityJiguan"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</el-col>
</el-row>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
...
...
@@ -119,9 +131,9 @@
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"入学年份(高中)"
prop=
"start_school_date
"
>
<el-form-item
label=
"入学年份(高中)"
prop=
"start_school_date"
>
<el-input
v-model=
"referForm.start
SchoolD
ate"
v-model=
"referForm.start
_school_d
ate"
placeholder=
"填写入学年份(高中)"
size=
"small"
clearable
...
...
@@ -129,7 +141,7 @@
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"政治面貌"
prop=
"political_status
"
>
<el-form-item
label=
"政治面貌"
prop=
"political_status"
>
<el-input
v-model=
"referForm.political_status"
placeholder=
"填写政治面貌"
...
...
@@ -139,7 +151,7 @@
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"手机号"
prop=
"phone
"
>
<el-form-item
label=
"手机号"
prop=
"phone"
>
<el-input
v-model=
"referForm.phone"
placeholder=
"填写手机号"
...
...
@@ -163,7 +175,7 @@
<div
class=
"cont_title"
>
学校信息
</div>
<el-row
:gutter=
"20"
>
<el-col
:span=
"6"
>
<el-form-item
label=
"就读中学"
prop=
"school_province
"
>
<el-form-item
label=
"就读中学"
prop=
"school_province"
>
<el-select
v-model=
"referForm.school_province"
clearable
...
...
@@ -182,7 +194,11 @@
</el-col>
<el-col
:span=
"6"
>
<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
v-for=
"item in selectCitySchool"
:key=
"item.id"
...
...
@@ -207,7 +223,7 @@
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"中学联系人"
clearable
prop=
"school_contacts
"
>
<el-form-item
label=
"中学联系人"
clearable
prop=
"school_contacts"
>
<el-input
v-model=
"referForm.school_contacts"
placeholder=
"填写中学联系人"
...
...
@@ -216,7 +232,7 @@
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"中学联系电话"
clearable
prop=
"school_phone
"
>
<el-form-item
label=
"中学联系电话"
clearable
prop=
"school_phone"
>
<el-input
v-model=
"referForm.school_phone"
placeholder=
"填写中学联系电话"
...
...
@@ -238,11 +254,59 @@
</div>
<div
class=
"image_add"
>
<div
class=
"image_in"
>
<i
style=
"font-size: 44px"
class=
"el-icon-circle-plus"
>
</i>
<div
class=
"text"
>
上传材料
</div>
<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>
<!--
<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>
<img
:src=
"referForm.backgroundPicture"
class=
"avatar"
/>
<el-dialog
:visible.sync=
"dialogVisible"
>
<img
width=
"100%"
:src=
"resultPicture"
alt=
""
/>
</el-dialog>
</div>
</el-form-item>
...
...
@@ -262,19 +326,39 @@ import {
getProAndCity
,
getSchool
,
}
from
"
r/index/signUp
"
;
import
{
upload
}
from
"
r/index/network
"
;
import
validator
from
"
common/validator
"
;
export
default
{
name
:
"
CheckForm
"
,
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
{
isUploading
:
false
,
// 图片上传蒙层
referForm
:
{
name
:
""
,
sex
:
""
,
gender
:
""
,
id_card
:
""
,
birthday
:
""
,
jiguan_code
:
""
,
jiguan_code
:
undefined
,
nation
:
""
,
start_school_date
:
""
,
political_status
:
""
,
...
...
@@ -285,22 +369,30 @@ export default {
school
:
""
,
school_contacts
:
""
,
school_phone
:
""
,
achievementPath
:
""
,
},
schoolName
:
[],
referInfoRules
:
{
name
:
[
{
required
:
true
,
message
:
"
真实姓名不能为空!
"
,
trigger
:
"
blur
"
},
],
sex
:
[{
required
:
true
,
message
:
"
性别不能为空!
"
,
trigger
:
"
change
"
}],
gender
:
[
{
required
:
true
,
message
:
"
性别不能为空!
"
,
trigger
:
"
change
"
},
],
id_card
:
[
{
required
:
true
,
message
:
"
身份证号码不能为空!
"
,
trigger
:
"
blur
"
},
{
validator
:
validator
.
validateid_card
,
trigger
:
"
blur
"
},
],
birthday
:
[
{
required
:
true
,
message
:
"
出生日期不能为空!
"
,
trigger
:
"
change
"
},
// { required: true, message: "出生日期不能为空!", trigger: "change" },
{
required
:
true
,
validator
:
validateContent
,
trigger
:
"
change
"
,
},
],
jiguan_code
:
[
{
required
:
true
,
message
:
"
籍贯不能为空!
"
,
trigger
:
"
change
"
},
{
required
:
true
,
validator
:
validateContents
,
trigger
:
"
change
"
},
],
nation
:
[
{
required
:
true
,
message
:
"
民族不能为空!
"
,
trigger
:
"
blur
"
},
...
...
@@ -309,7 +401,7 @@ export default {
{
required
:
true
,
message
:
"
高中入学年份不能为空!
"
,
trigger
:
"
change
"
,
trigger
:
"
blur
"
,
},
],
political_status
:
[
...
...
@@ -323,14 +415,14 @@ export default {
{
required
:
true
,
message
:
"
邮箱不能为空!
"
,
trigger
:
"
blur
"
},
{
validator
:
validator
.
validateEmail
,
trigger
:
"
blur
"
},
],
schoolprovince
:
[
school
_
province
:
[
{
required
:
true
,
message
:
"
请选择所在学校省份!
"
,
trigger
:
"
change
"
,
},
],
schoolcity
:
[
school
_
city
:
[
{
required
:
true
,
message
:
"
请选择所在学校城市!
"
,
...
...
@@ -351,7 +443,73 @@ export default {
CityName
:
{},
selectCityJiguan
:
[],
selectCitySchool
:
[],
jgProvinceCode
:
""
,
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
()
{
...
...
@@ -360,7 +518,45 @@ export default {
this
.
getSchool
();
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
:
{
//获取近10年的年份
getTenYear
()
{
...
...
@@ -373,7 +569,7 @@ export default {
let
year
=
currentYear
-
i
;
yearArr
.
push
(
year
);
}
console
.
log
(
yearArr
);
console
.
log
(
yearArr
,
"
yearArr
"
);
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
let
year
=
currentYear
-
i
;
rxYearArr
.
push
(
year
);
...
...
@@ -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
({}).
then
((
res
)
=>
{
...
...
@@ -409,13 +617,11 @@ export default {
selectCity
.
push
(
this
.
CityName
[
key
]);
}
}
if
(
type
==
1
)
{
if
(
type
==
1
)
{
this
.
selectCityJiguan
=
selectCity
;
}
else
{
this
.
selectCitySchool
=
selectCity
;
}
else
{
this
.
selectCitySchool
=
selectCity
;
}
},
// 获取学校
...
...
@@ -428,36 +634,117 @@ export default {
this
.
schoolName
=
res
.
data
.
school_list
;
});
},
confirm
()
{
this
.
$refs
[
"
referRef
"
].
validate
((
valid
)
=>
{
if
(
!
valid
)
return
;
setAccount
({
name
:
this
.
formData
.
name
,
sex
:
this
.
formData
.
sex
,
id_card
:
this
.
formData
.
id_card
,
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
"
);
if
(
res
.
data
.
code
!=
200
)
{
return
this
.
$message
.
error
(
res
.
data
.
message
);
}
this
.
$message
.
success
(
"
提交审核成功
"
);
// 跳转到报名
this
.
$router
.
push
(
"
/signUp/check
"
);
// 图片上传成功前钩子
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
()
{
console
.
log
(
1111
);
// console.log(2222)
// this.$refs["referRef"].validate((valid) => {
// console.log(2222)
// if (!valid) return;
setAccount
(
this
.
referForm
).
then
((
res
)
=>
{
console
.
log
(
res
,
"
setAccount
"
);
if
(
res
.
data
.
code
!=
200
)
{
return
this
.
$message
.
error
(
res
.
data
.
message
);
}
this
.
$message
.
success
(
"
提交审核成功
"
);
// 跳转到报名
this
.
$router
.
push
(
"
/signUp/check
"
);
});
// });
},
},
};
...
...
@@ -565,11 +852,11 @@ export default {
line-height
:
24px
;
}
img
{
width
:
160px
;
height
:
160px
;
border-radius
:
4px
;
border
:
2px
dashed
#bcc2ca
;
margin
:
0
10px
10px
0
;
//
width: 160px;
//
height: 160px;
//
border-radius: 4px;
//
border: 2px dashed #bcc2ca;
//
margin: 0 10px 10px 0;
}
}
.el-select
{
...
...
src/request/index/network.js
View file @
97d2bb9c
...
...
@@ -13,6 +13,47 @@ import {
}
from
'
element-ui
'
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
=
[]
...
...
@@ -51,8 +92,7 @@ let loadingInstance = null
export
function
request
(
config
)
{
const
instance
=
axios
.
create
({
baseURL
:
process
.
env
.
NODE_ENV
===
'
development
'
?
DEVELOPMENT_SERVER_URL
:
SERVER_URL
,
DEVELOPMENT_SERVER_URL
:
SERVER_URL
,
timeout
:
60
*
1000
})
instance
.
interceptors
.
request
.
use
(
...
...
@@ -78,7 +118,7 @@ export function request(config) {
const
token
=
localStorage
.
getItem
(
'
index-token
'
)
if
(
token
)
{
// console.log(token)
config
.
headers
.
token
=
token
}
else
{
window
.
localStorage
.
clear
()
...
...
@@ -180,9 +220,28 @@ export function request(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
)
{
return
axios
.
all
(
arrRequest
)
...
...
src/request/index/pay.js
0 → 100644
View file @
97d2bb9c
/* 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
})
}
src/request/index/signUp.js
View file @
97d2bb9c
...
...
@@ -50,7 +50,7 @@ export function getAchievementOss(data) {
return
request
({
method
:
'
post
'
,
url
:
'
/web/signUp/getAchievementOss
'
,
params
:
data
data
})
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment