Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
project-www-h5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
project-www-h5
Commits
9afe1cdd
提交
9afe1cdd
authored
4月 26, 2021
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加验证码
上级
0e42d7d1
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
68 行增加
和
36 行删除
+68
-36
base.css
assets/css/base.css
+9
-0
ApplyForm.vue
components/ApplyForm.vue
+52
-14
RightAside.vue
components/RightAside.vue
+0
-2
httpRequest.js
utils/httpRequest.js
+7
-20
没有找到文件。
assets/css/base.css
浏览文件 @
9afe1cdd
...
...
@@ -22,6 +22,15 @@ textarea {
border-radius
:
0
;
font
:
inherit
;
}
::placeholder
{
color
:
#999
;
}
.line-clamp
{
display
:
-webkit-box
;
-webkit-line-clamp
:
2
;
-webkit-box-orient
:
vertical
;
overflow
:
hidden
;
}
.main-layout
{
max-width
:
750px
;
min-height
:
100vh
;
...
...
components/ApplyForm.vue
浏览文件 @
9afe1cdd
...
...
@@ -10,13 +10,20 @@
</div>
<div
class=
"form-item"
>
<select
class=
"form-select"
placeholder=
"请选择项目"
v-model=
"ruleForm.project_id"
>
<option
value=
""
disabled
selected
>
请选择项目
</option>
<option
v-for=
"(item, index) in projectList"
:value=
"item.value"
:key=
"index"
>
{{
item
.
label
}}
</option>
</select>
</div>
<!--
<div
class=
"form-item"
>
<input
type=
"text"
class=
"form-input"
placeholder=
"请输入短信验证码"
maxlength=
"4"
v-model=
"ruleForm.code"
/>
<input
type=
"button"
value=
"获取验证码"
class=
"form-button"
/>
</div>
-->
<div
class=
"form-item"
>
<input
type=
"text"
class=
"form-input"
placeholder=
"请输入短信验证码"
maxlength=
"4"
v-model=
"phoneCode"
/>
<input
type=
"button"
class=
"form-button"
:disabled=
"codeButtonDisabled"
:value=
"buttonText"
@
click=
"onSendCode"
/>
</div>
<div
class=
"form-item"
>
<input
type=
"button"
value=
"立即预约"
class=
"form-button"
@
click=
"onSbumit"
/>
</div>
...
...
@@ -38,12 +45,15 @@ export default {
{
label
:
'教育学硕士'
,
value
:
'1005'
},
{
label
:
'中国未来金融领袖计划'
,
value
:
'1007'
}
],
timer
:
null
phoneCode
:
''
,
codeButtonDisabled
:
false
,
timer
:
null
,
disabledTime
:
60
}
},
computed
:
{
buttonText
()
{
return
'
'
return
this
.
codeButtonDisabled
?
`
${
this
.
disabledTime
}
秒后重发`
:
'获取验证码
'
}
},
methods
:
{
...
...
@@ -56,11 +66,11 @@ export default {
this
.
$notify
(
'请输入正确的手机号'
)
return
}
// if (!this.ruleForm.c
ode) {
//
this.$notify('请输入短信验证码')
//
return
//
}
this
.
handleSubmit
(
)
if
(
!
this
.
phoneC
ode
)
{
this
.
$notify
(
'请输入短信验证码'
)
return
}
this
.
checkPhoneCode
().
then
(
this
.
handleSubmit
)
},
handleSubmit
()
{
api
.
submit
(
this
.
ruleForm
).
then
(
response
=>
{
...
...
@@ -71,15 +81,40 @@ export default {
})
},
// 校验短信验证码
checkPhoneCode
()
{},
checkPhoneCode
()
{
return
api
.
checkCode
({
account
:
this
.
ruleForm
.
phone
,
code
:
this
.
phoneCode
})
},
onSendCode
()
{
if
(
!
this
.
ruleForm
.
phone
||
!
/^1
[
3-9
]\d{9}
$/
.
test
(
this
.
ruleForm
.
phone
))
{
this
.
$notify
(
'请输入正确的手机号'
)
return
}
this
.
sendCode
()
},
// 发送验证码
sendCode
()
{
this
.
setTimer
()
api
.
sendCode
({
account
:
this
.
ruleForm
.
phone
})
.
then
(()
=>
{
this
.
$notify
({
type
:
'success'
,
message
:
'验证码发送成功,注意查收'
})
})
.
catch
(()
=>
{
this
.
clearTimer
()
})
},
setTimer
()
{
this
.
timer
=
setInterval
(()
=>
{},
1000
)
this
.
codeButtonDisabled
=
true
this
.
disabledTime
=
60
this
.
timer
=
setInterval
(()
=>
{
this
.
disabledTime
--
if
(
this
.
disabledTime
<=
0
)
{
this
.
clearTimer
()
}
},
1000
)
},
clearTimer
()
{
this
.
codeButtonDisabled
=
false
this
.
timer
&&
clearInterval
(
this
.
timer
)
}
},
...
...
@@ -113,10 +148,13 @@ export default {
border
:
none
;
}
.form-select
{
position
:
relative
;
padding
:
0
10px
;
width
:
100%
;
height
:
38px
;
background-color
:
#fff
;
background
:
#fff
url('https://webapp-pub.ezijing.com/www/h5/images/icon_arrows.png')
no-repeat
;
background-position
:
right
0
.7em
top
50%
,
0
0
;
background-size
:
30px
30px
;
box-sizing
:
border-box
;
border
:
none
;
}
...
...
components/RightAside.vue
浏览文件 @
9afe1cdd
...
...
@@ -32,8 +32,6 @@
</
template
>
<
script
>
import
ApplyForm
from
'@/components/ApplyForm'
// import { sendCode, checkCode, postNes } from '../plugins/api'
const
MOBILE_REG
=
/^1
(
3
[
0-9
]
|4
[
01456879
]
|5
[
0-35-9
]
|6
[
2567
]
|7
[
0-8
]
|8
[
0-9
]
|9
[
0-35-9
])\d{8}
$/
export
default
{
components
:
{
ApplyForm
},
data
()
{
...
...
utils/httpRequest.js
浏览文件 @
9afe1cdd
import
axios
from
'axios'
import
qs
from
'qs'
import
{
Notify
}
from
'vant'
const
httpRequest
=
axios
.
create
({
baseURL
:
'https://project-api.ezijing.com'
,
...
...
@@ -34,33 +35,19 @@ httpRequest.interceptors.request.use(
httpRequest
.
interceptors
.
response
.
use
(
function
(
response
)
{
const
{
data
}
=
response
if
(
data
.
msg
)
{
if
(
data
.
msg
===
'请先登录'
)
{
window
.
location
.
href
=
`
${
webConf
.
others
.
loginUrl
}
?rd=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
}
}
if
(
parseInt
(
data
.
code
)
===
1
)
{
return
Message
.
error
(
data
.
msg
)
}
if
(
data
.
code
)
{
if
(
data
.
code
===
4001
)
{
window
.
location
.
href
=
`
${
webConf
.
others
.
loginUrl
}
?rd=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
}
return
data
.
message
?
Message
.
error
(
data
.
message
)
:
Message
.
error
(
data
.
msg
)
if
(
parseInt
(
data
.
code
))
{
Notify
(
data
.
msg
)
return
Promise
.
reject
(
data
)
}
return
data
},
function
(
error
)
{
if
(
error
.
response
)
{
const
{
status
,
message
}
=
error
.
response
.
data
// 未登录
if
(
status
===
403
)
{
window
.
location
.
href
=
`
${
webConf
.
others
.
loginUrl
}
?rd=
${
encodeURIComponent
(
window
.
location
.
href
)}
`
}
Message
.
error
(
message
||
error
.
response
.
data
)
const
{
message
}
=
error
.
response
.
data
Notify
(
message
||
error
.
response
.
data
)
return
Promise
.
reject
(
error
.
response
)
}
else
{
Message
.
error
(
error
)
Notify
(
error
)
}
return
Promise
.
reject
(
error
)
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论