Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
source-trace-manage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenqikuai
source-trace-manage
Commits
cffbfb55
Commit
cffbfb55
authored
Apr 18, 2022
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复错误提示
parent
0f890eea
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
735 additions
and
567 deletions
+735
-567
Api.service.ts
src/service/Api.service.ts
+4
-0
index.ts
src/service/index.ts
+6
-2
TransferPass.vue
src/views/pass/PassList/TransferPass.vue
+0
-3
StepOne.vue
src/views/userCenter/CompanyVerify/StepOne.vue
+69
-38
StepThree.vue
src/views/userCenter/CompanyVerify/StepThree.vue
+18
-15
StepTwo.vue
src/views/userCenter/CompanyVerify/StepTwo.vue
+90
-41
config.ts
src/views/userCenter/EditPassword/config.ts
+3
-2
index.vue
src/views/userCenter/EditPassword/index.vue
+5
-2
config.ts
src/views/userCenter/EditPhone/config.ts
+41
-13
index.vue
src/views/userCenter/EditPhone/index.vue
+153
-135
config.ts
src/views/userCenter/PersonVerify/config.ts
+8
-9
index.vue
src/views/userCenter/PersonVerify/index.vue
+229
-202
config.ts
src/views/userCenter/SetPassword/config.ts
+12
-8
index.vue
src/views/userCenter/SetPassword/index.vue
+97
-97
No files found.
src/service/Api.service.ts
View file @
cffbfb55
...
...
@@ -119,6 +119,8 @@ export function enterBaseInfo(info: object) {
type
:
"post"
,
url
:
GO_URLS
.
basic
,
params
:
info
,
},
{
doNotToastErr
:
true
});
}
...
...
@@ -128,6 +130,8 @@ export function enterBank(info: object) {
type
:
"post"
,
url
:
GO_URLS
.
bank
,
params
:
info
,
},
{
doNotToastErr
:
true
});
}
...
...
src/service/index.ts
View file @
cffbfb55
...
...
@@ -32,7 +32,10 @@ function length(o: any) {
return
count
;
}
// ajax
async
function
$ajax
(
param
:
PostParam
|
GetParam
)
{
async
function
$ajax
(
param
:
PostParam
|
GetParam
,
{
doNotToastErr
}
=
{
doNotToastErr
:
false
}
)
{
try
{
const
type
=
param
.
type
.
toLowerCase
();
const
result
:
AxiosRequestConfig
=
{
...
...
@@ -75,7 +78,8 @@ async function $ajax(param: PostParam | GetParam) {
// ?????? 跳转
return
null
;
}
else
{
if
([
11032
,
11033
,
11097
,
11002
].
indexOf
(
res
.
data
.
code
)
==
-
1
)
{
if
(
doNotToastErr
)
return
res
.
data
;
if
([
11032
,
11033
,
11097
,
11002
,
7000
].
indexOf
(
res
.
data
.
code
)
==
-
1
)
{
ElMessage
(
res
.
data
.
msg
);
return
null
;
}
...
...
src/views/pass/PassList/TransferPass.vue
View file @
cffbfb55
...
...
@@ -209,9 +209,6 @@ export default defineComponent({
padding-right
:
22px
;
}
.el-form-item__content
{
height
:
35px
;
line-height
:
35px
;
.el-input
{
width
:
420px
;
height
:
35px
;
...
...
src/views/userCenter/CompanyVerify/StepOne.vue
View file @
cffbfb55
...
...
@@ -5,23 +5,40 @@
label-position=
"right"
label-width=
"125px"
class=
"form"
:model=
"company"
:rules=
"rules"
ref=
"company"
>
<el-form-item
label=
"企业名称"
class=
"form-item"
>
<el-form-item
label=
"企业名称"
class=
"form-item"
prop=
"name"
:error=
"errors.name"
>
<syDialogInput
class=
"w-full"
v-model:value=
"company.name"
placeholder=
"请输入企业名称"
></syDialogInput>
</el-form-item>
<el-form-item
label=
"证件号"
class=
"form-item"
>
<el-form-item
label=
"证件号"
class=
"form-item"
prop=
"uscd"
:error=
"errors.uscd"
>
<syDialogInput
class=
"w-full"
v-model:value=
"company.uscd"
placeholder=
"请输入统一社会信用代码或组织机构代码"
></syDialogInput>
</el-form-item>
<el-form-item
label=
"法人姓名"
class=
"form-item"
>
<el-form-item
label=
"法人姓名"
class=
"form-item"
prop=
"corporations_name"
:error=
"errors.corporations_name"
>
<syDialogInput
class=
"w-full"
v-model:value=
"company.corporations_name"
...
...
@@ -42,7 +59,13 @@
</
template
>
<
script
lang=
"ts"
>
import
{
enterBaseInfo
}
from
"@/service/Api.service"
;
import
{
ElMessage
,
ElInput
,
ElFormItem
,
ElForm
}
from
"element-plus"
;
import
{
ElMessage
,
ElInput
,
ElFormItem
,
ElForm
,
FormInstance
,
}
from
"element-plus"
;
import
{
syButton
,
syDialogInput
}
from
"cqk-sy-ui"
;
import
{
defineComponent
}
from
"vue"
;
export
default
defineComponent
({
...
...
@@ -55,55 +78,63 @@ export default defineComponent({
},
data
()
{
return
{
errors
:
{
name
:
""
,
uscd
:
""
,
corporations_name
:
""
,
},
company
:
{
name
:
""
,
uscd
:
""
,
corporations_name
:
""
,
},
rules
:
{
name
:
[{
required
:
true
,
message
:
"企业名称不可为空"
}],
uscd
:
[{
required
:
true
,
message
:
"证件号不可为空"
}],
corporations_name
:
[{
required
:
true
,
message
:
"法人姓名不可为空"
}],
},
disabled
:
false
,
};
},
methods
:
{
async
confirm
()
{
if
(
this
.
company
.
name
.
trim
()
===
""
)
{
ElMessage
(
"企业名称不可为空"
);
return
;
}
else
if
(
this
.
company
.
uscd
.
trim
()
===
""
)
{
ElMessage
(
"证件号不可为空"
);
return
;
}
else
if
(
this
.
company
.
corporations_name
.
trim
()
===
""
)
{
ElMessage
(
"法人姓名不可为空"
);
return
;
}
this
.
disabled
=
true
;
const
res
=
await
enterBaseInfo
(
this
.
company
);
if
(
res
&&
res
.
code
===
200
)
{
ElMessage
({
message
:
"企业基本信息录入成功。"
,
type
:
"success"
,
});
this
.
$emit
(
"success"
);
}
else
{
ElMessage
.
error
(
res
?.
msg
)
}
this
.
disabled
=
false
;
const
formEl
=
this
.
$refs
.
company
as
FormInstance
;
formEl
.
validate
(
async
(
isValid
)
=>
{
if
(
!
isValid
)
return
;
this
.
disabled
=
true
;
const
res
=
await
enterBaseInfo
(
this
.
company
);
if
(
res
&&
res
.
code
===
200
)
{
ElMessage
({
message
:
"企业基本信息录入成功。"
,
type
:
"success"
,
});
this
.
$emit
(
"success"
);
}
else
{
if
(
res
?.
msg
)
{
const
config
=
[
{
p
:
/企业/
,
fieldName
:
"name"
},
{
p
:
/
(
证件
)?(
统一社会信
)?
/
,
fieldName
:
"uscd"
},
{
p
:
/姓名/
,
fieldName
:
"corporations_name"
},
]
as
const
;
const
match
=
config
.
find
((
i
)
=>
i
.
p
.
test
(
res
?.
msg
));
match
?
(
this
.
errors
[
match
.
fieldName
]
=
res
.
msg
+
`
${
(
this
.
errors
[
match
.
fieldName
].
slice
(
-
2
)
===
" "
&&
" "
)
||
" "
}
`
)
:
ElMessage
.
error
(
res
?.
msg
);
}
}
this
.
disabled
=
false
;
});
},
},
});
</
script
>
<
style
lang=
"scss"
>
.step-one
{
.el-form-item__label
{
line-height
:
40px
;
}
.el-input__inner
,
.el-input
,
.el-form-item__content
{
height
:
40px
!
important
;
}
}
</
style
>
<
style
lang=
"scss"
></
style
>
<
style
lang=
"scss"
scoped
>
.step-one
{
.title
{
...
...
src/views/userCenter/CompanyVerify/StepThree.vue
View file @
cffbfb55
...
...
@@ -2,19 +2,22 @@
<div
class=
"step-three g-flex-center"
>
<div
class=
"content"
>
<i
class=
"iconfont iconbianzu1"
></i>
<h3>
已成功为您的企业对公账户打款,请输入金额验证。
</h3>
<syDialogInput
placeholder=
"请输入金额"
class=
"assets-input"
v-model:value=
"remitMoney"
></syDialogInput>
<span
class=
"tip"
@
mouseenter=
"showTip = true"
@
mouseleave=
"showTip = false"
>
?
</span
>
<p>
请输入收到的金额您一共有两次机会
</p>
<h3
class=
"font-bold "
>
已成功为您的企业对公账户打款,请输入金额验证。
</h3>
<div
class=
"flex items-center"
>
<syDialogInput
type=
"number"
placeholder=
"请输入金额"
class=
"assets-input"
v-model:value=
"remitMoney"
></syDialogInput>
<span
class=
"tip"
@
mouseenter=
"showTip = true"
@
mouseleave=
"showTip = false"
>
?
</span
>
</div>
<p
class=
" text-sm"
>
请输入收到的金额您一共有两次机会
</p>
<em
v-show=
"showTip === true"
></em>
<div
class=
"tip-msg"
v-show=
"showTip === true"
>
系统会为您公司账户打入一笔金额为0.01-0.09
...
...
@@ -60,8 +63,8 @@ export default defineComponent({
type
:
"success"
,
});
this
.
$emit
(
"success"
);
}
else
{
ElMessage
.
error
(
res
?.
msg
)
}
else
{
ElMessage
.
error
(
res
?.
msg
)
;
}
this
.
disabled
=
false
;
},
...
...
src/views/userCenter/CompanyVerify/StepTwo.vue
View file @
cffbfb55
...
...
@@ -4,38 +4,64 @@
<el-form
label-position=
"right"
label-width=
"120px"
ref=
"form"
:rules=
"rules"
:model=
"account"
class=
"form"
class=
"form
-step2
"
>
<el-form-item
label=
"对公户名"
class=
"form-item"
>
<el-form-item
label=
"对公户名"
class=
"form-item"
prop=
"tp_name"
:error=
"errors.tp_name"
>
<syDialogInput
v-model:value=
"account.tp_name"
placeholder=
"请输入对公户名"
></syDialogInput>
</el-form-item>
<el-form-item
label=
"对公账户"
class=
"form-item"
>
<el-form-item
label=
"对公账户"
class=
"form-item"
prop=
"bank_card"
:error=
"errors.bank_card"
>
<syDialogInput
v-model:value=
"account.bank_card"
placeholder=
"请输入对公银行账户"
></syDialogInput>
</el-form-item>
<!-- 调整部分 -->
<el-form-item
label=
"开户银行"
class=
"form-item"
>
<el-autocomplete
class=
"inline-input"
<el-form-item
label=
"开户银行"
class=
"form-item"
prop=
"bank_name"
:error=
"errors.bank_name"
>
<syAutoComplete
v-model=
"account.bank_name"
:fetch-suggestions=
"querySearch"
placeholder=
"请输入开户银行"
></
el-autoc
omplete>
></
syAutoC
omplete>
</el-form-item>
<!-- 调整部分 -->
<el-form-item
label=
"开户城市"
class=
"form-item"
>
<el-form-item
label=
"开户城市"
class=
"form-item"
prop=
"city"
:error=
"errors.city"
>
<syDialogInput
v-model:value=
"account.city"
placeholder=
"请输入开户城市"
></syDialogInput>
</el-form-item>
<el-form-item
label=
"开户支行"
class=
"form-item"
>
<el-form-item
label=
"开户支行"
class=
"form-item"
prop=
"sub_branch"
:error=
"errors.sub_branch"
>
<syDialogInput
v-model:value=
"account.sub_branch"
placeholder=
"请输入开户支行"
...
...
@@ -55,13 +81,14 @@
<
script
lang=
"ts"
>
import
{
defineComponent
}
from
"vue"
;
import
{
enterBank
}
from
"@/service/Api.service"
;
import
{
GO_URLS
,
syButton
,
syDialogInput
}
from
"cqk-sy-ui"
;
import
{
GO_URLS
,
syButton
,
syDialogInput
,
syAutoComplete
}
from
"cqk-sy-ui"
;
import
{
ElMessage
,
ElFormItem
,
ElForm
,
ElInput
,
ElAutocomplete
,
FormInstance
,
}
from
"element-plus"
;
import
{
$ajax
}
from
"@/service"
;
export
default
defineComponent
({
...
...
@@ -72,10 +99,25 @@ export default defineComponent({
ElInput
,
ElAutocomplete
,
syDialogInput
,
syAutoComplete
,
},
data
()
{
return
{
BankList
:
[]
as
any
,
// 可选银行列表
rules
:
{
tp_name
:
[{
required
:
true
,
message
:
"对公户名不可为空"
}],
// 对公户名
bank_card
:
[{
required
:
true
,
message
:
"对公银行账户不可为空"
}],
// 对公银行账号
bank_name
:
[{
required
:
true
,
message
:
"开户银行不可为空"
}],
// 开户银行
city
:
[{
required
:
true
,
message
:
"开户城市不可为空"
}],
//` 开户城市
sub_branch
:
[{
required
:
true
,
message
:
"开户支行不可为空"
}],
//开户支行
},
errors
:
{
tp_name
:
""
,
// 对公户名
bank_card
:
""
,
// 对公银行账号
bank_name
:
""
,
// 开户银行
city
:
""
,
//` 开户城市
sub_branch
:
""
,
//开户支行
},
account
:
{
tp_name
:
""
,
// 对公户名
bank_card
:
""
,
// 对公银行账号
...
...
@@ -120,37 +162,46 @@ export default defineComponent({
cb
(
results
);
},
// 提交数据
async
confirm
()
{
if
(
this
.
account
.
tp_name
.
trim
()
===
""
)
{
ElMessage
(
"对公户名不可为空"
);
return
;
}
else
if
(
this
.
account
.
bank_card
.
trim
()
===
""
)
{
ElMessage
(
"对公银行账户不可为空"
);
return
;
}
else
if
(
this
.
account
.
bank_name
.
trim
()
===
""
)
{
ElMessage
(
"开户银行不可为空"
);
return
;
}
else
if
(
this
.
account
.
city
.
trim
()
===
""
)
{
ElMessage
(
"开户城市不可为空"
);
return
;
}
else
if
(
this
.
account
.
sub_branch
.
trim
()
===
""
)
{
ElMessage
(
"开户支行不可为空"
);
return
;
}
const
res
=
await
enterBank
(
this
.
account
);
if
(
res
&&
res
.
code
===
200
)
{
ElMessage
({
message
:
"企业银行账户信息录入成功。"
,
type
:
"success"
,
});
this
.
$emit
(
"success"
);
}
else
{
ElMessage
.
error
(
res
?.
msg
)
}
confirm
()
{
const
formEl
=
this
.
$refs
.
form
as
FormInstance
;
formEl
.
validate
(
async
(
isValid
)
=>
{
if
(
!
isValid
)
return
;
const
res
=
await
enterBank
(
this
.
account
);
if
(
res
&&
res
.
code
===
200
)
{
ElMessage
({
message
:
"企业银行账户信息录入成功。"
,
type
:
"success"
,
});
this
.
$emit
(
"success"
);
}
else
{
const
config
=
[
{
p
:
/对公户名/
,
fieldName
:
"tp_name"
},
{
p
:
/对公银行/
,
fieldName
:
"bank_card"
},
{
p
:
/开户银行/
,
fieldName
:
"bank_name"
},
{
p
:
/开户城市/
,
fieldName
:
"city"
},
{
p
:
/开户支行/
,
fieldName
:
"sub_branch"
},
]
as
const
;
if
(
res
?.
msg
)
{
const
match
=
config
.
find
((
i
)
=>
i
.
p
.
test
(
res
.
msg
));
(
match
&&
(
this
.
errors
[
match
.
fieldName
]
=
res
.
msg
+
`
${
this
.
errors
[
match
.
fieldName
].
slice
(
-
2
)
===
" "
?
" "
:
" "
}
`
))
||
ElMessage
.
error
(
res
?.
msg
);
}
}
});
},
},
});
</
script
>
<
style
lang=
"scss"
>
.form-step2
.el-input
{
width
:
610px
;
}
</
style
>
<
style
scoped
lang=
"scss"
>
.title
{
margin-top
:
50px
;
...
...
@@ -161,12 +212,10 @@ export default defineComponent({
color
:
rgba
(
53
,
53
,
53
,
1
);
line-height
:
40px
;
}
.form
{
.form
-step2
{
width
:
900px
;
}
.form
.el-input
{
width
:
610px
;
}
.form-item
{
margin-bottom
:
28px
;
}
...
...
src/views/userCenter/EditPassword/config.ts
View file @
cffbfb55
...
...
@@ -42,6 +42,7 @@ export const generateFormList = (
showLabel
:
true
,
placeholder
:
"请输入6位验证码"
,
label
:
"验证码"
,
maxLen
:
6
,
rule
:
[
{
required
:
true
,
...
...
@@ -79,7 +80,7 @@ export const generateFormList = (
type
:
"primary"
,
},
styles
:
"margin-top: 10px;margin-left: 50px;"
,
async
onSubmit
(
valid
,
data
)
{
async
onSubmit
(
valid
,
data
,
setError
)
{
data
=
{
phone
:
data
.
手机号
,
email
:
data
.
邮箱
,
...
...
@@ -87,7 +88,7 @@ export const generateFormList = (
code
:
data
.
验证码
,
};
if
(
valid
)
{
submit
(
data
);
submit
(
data
,
setError
);
}
},
},
...
...
src/views/userCenter/EditPassword/index.vue
View file @
cffbfb55
...
...
@@ -49,7 +49,10 @@ export default defineComponent({
},
methods
:
{
filterPhone
,
async
confirm
(
data
:
any
)
{
async
confirm
(
data
:
any
,
setError
:
(
fieldName
:
string
,
errorMsg
:
string
)
=>
void
)
{
let
info
=
{};
if
(
globalState
.
userInfos
.
phone
!==
""
)
{
info
=
{
...
...
@@ -74,7 +77,7 @@ export default defineComponent({
});
this
.
$router
.
push
(
"/userCenter"
);
}
else
{
res
?.
msg
&&
ElMessage
.
error
(
res
?
.
msg
);
res
?.
msg
&&
setError
(
"验证码"
,
res
.
msg
);
}
},
},
...
...
src/views/userCenter/EditPhone/config.ts
View file @
cffbfb55
import
{
sendEmail
,
sendSms
}
from
"@/service/Api.service"
;
import
{
filterPhone
}
from
"cqk-sy-ui"
;
import
{
filterPhone
,
phoneReg
}
from
"cqk-sy-ui"
;
import
{
iFormItem
}
from
"cqk-sy-ui/sy/components/BusinessForm"
;
import
{
ElMessage
}
from
"element-plus"
;
...
...
@@ -20,6 +20,12 @@ export const generateStep1FormList = (
placeholder
:
"请输入验证码"
,
maxLen
:
6
,
label
:
"验证码"
,
rule
:
[
{
required
:
true
,
message
:
"请输入验证码"
,
},
],
async
handleClickSendCode
(
roleForm
:
any
,
formEl
)
{
let
res
=
null
;
if
(
data
.
phone
)
{
...
...
@@ -50,13 +56,15 @@ export const generateStep1FormList = (
type
:
"primary"
,
},
styles
:
"margin-top: 10px;margin-left: 50px;"
,
async
onSubmit
(
valid
,
data
)
{
data
=
{
phone
:
data
.
原手机号
,
email
:
data
.
当前邮箱
,
code
:
data
.
验证码
,
};
submit
(
data
);
async
onSubmit
(
valid
,
data
,
setError
)
{
if
(
valid
)
{
data
=
{
phone
:
data
.
原手机号
,
email
:
data
.
当前邮箱
,
code
:
data
.
验证码
,
};
submit
(
data
,
setError
);
}
},
},
]
as
iFormItem
[];
...
...
@@ -70,12 +78,30 @@ export const generateStep2FormList = (submit: any) => {
label
:
"新手机号"
,
placeholder
:
"请输入新手机号"
,
maxLen
:
11
,
rule
:
[
{
pattern
:
phoneReg
,
message
:
"请输入正确的手机号"
,
trigger
:
"blur"
,
},
{
required
:
true
,
message
:
"请输入手机号"
,
trigger
:
"blur"
,
},
],
},
{
type
:
"codeInput"
,
showLabel
:
true
,
placeholder
:
"请输入验证码"
,
maxLen
:
6
,
rule
:
[
{
required
:
true
,
message
:
"请输入验证码"
,
},
],
label
:
"验证码"
,
async
handleClickSendCode
(
roleForm
:
any
,
formEl
)
{
let
res
=
null
;
...
...
@@ -100,11 +126,13 @@ export const generateStep2FormList = (submit: any) => {
},
styles
:
"margin-top: 10px;margin-left: 50px;"
,
async
onSubmit
(
valid
,
data
)
{
data
=
{
phone
:
data
.
新手机号
,
code
:
data
.
验证码
,
};
submit
(
data
);
if
(
valid
)
{
data
=
{
phone
:
data
.
新手机号
,
code
:
data
.
验证码
,
};
submit
(
data
);
}
},
},
]
as
iFormItem
[];
...
...
src/views/userCenter/EditPhone/index.vue
View file @
cffbfb55
<
template
>
<div
class=
"edit-phone"
>
<el-breadcrumb
separator=
"/"
class=
"head-nav"
>
<el-breadcrumb-item
:to=
"
{ path: '/userCenter' }">用户中心
</el-breadcrumb-item>
<el-breadcrumb-item
v-if=
"globalState.userInfos.phone"
>
修改绑定手机
</el-breadcrumb-item>
<el-breadcrumb-item
v-else
>
绑定手机
</el-breadcrumb-item>
</el-breadcrumb>
<p
class=
"title"
v-if=
"globalState.userInfos.phone"
>
修改绑定手机:
</p>
<p
class=
"title"
v-else
>
绑定手机:
</p>
<syBusinessForm
class=
"formlayout1"
v-if=
"!originPass"
:formList=
"setp1FormList"
></syBusinessForm>
<syBusinessForm
v-else
class=
"formlayout1"
:formList=
"setp2FormList"
></syBusinessForm>
</div>
<div
class=
"edit-phone"
>
<el-breadcrumb
separator=
"/"
class=
"head-nav"
>
<el-breadcrumb-item
:to=
"
{ path: '/userCenter' }"
>用户中心
</el-breadcrumb-item
>
<el-breadcrumb-item
v-if=
"globalState.userInfos.phone"
>
修改绑定手机
</el-breadcrumb-item
>
<el-breadcrumb-item
v-else
>
绑定手机
</el-breadcrumb-item>
</el-breadcrumb>
<p
class=
"title"
v-if=
"globalState.userInfos.phone"
>
修改绑定手机:
</p>
<p
class=
"title"
v-else
>
绑定手机:
</p>
<syBusinessForm
class=
"formlayout1"
v-if=
"!originPass"
:formList=
"setp1FormList"
></syBusinessForm>
<syBusinessForm
v-else
class=
"formlayout1"
:formList=
"setp2FormList"
></syBusinessForm>
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
checkOldPhone
,
editPhone
}
from
"@/service/Api.service"
;
import
{
globalState
}
from
"@/store/state"
;
import
{
filterPhone
,
syBusinessForm
}
from
"cqk-sy-ui"
;
import
{
ElMessage
,
ElBreadcrumb
,
ElBreadcrumbItem
}
from
"element-plus"
;
import
{
defineComponent
}
from
"vue"
import
{
defineComponent
}
from
"vue"
;
import
{
generateStep1FormList
,
generateStep2FormList
}
from
"./config"
;
export
default
defineComponent
({
props
:
[
"Infos"
],
components
:
{
ElBreadcrumb
,
ElBreadcrumbItem
,
syBusinessForm
,
},
data
()
{
return
{
originPass
:
false
,
// 显示下个步骤
oldPhone
:
{
phone
:
globalState
.
userInfos
.
phone
,
code
:
""
,
email
:
globalState
.
userInfos
.
email
,
},
tip
:
true
,
newPhone
:
{
phone
:
""
,
code
:
""
,
random_token
:
""
,
},
setp1FormList
:
generateStep1FormList
({
phone
:
globalState
.
userInfos
.
phone
,
email
:
globalState
.
userInfos
.
email
,
},
this
.
confirm
),
setp2FormList
:
generateStep2FormList
(
this
.
confirm
)
};
props
:
[
"Infos"
],
components
:
{
ElBreadcrumb
,
ElBreadcrumbItem
,
syBusinessForm
,
},
data
()
{
return
{
originPass
:
false
,
// 显示下个步骤
oldPhone
:
{
phone
:
globalState
.
userInfos
.
phone
,
code
:
""
,
email
:
globalState
.
userInfos
.
email
,
},
tip
:
true
,
newPhone
:
{
phone
:
""
,
code
:
""
,
random_token
:
""
,
},
setp1FormList
:
generateStep1FormList
(
{
phone
:
globalState
.
userInfos
.
phone
,
email
:
globalState
.
userInfos
.
email
,
},
this
.
confirm
),
setp2FormList
:
generateStep2FormList
(
this
.
confirm
),
};
},
created
()
{
if
(
!
globalState
.
userInfos
.
phone
&&
!
globalState
.
userInfos
.
email
)
{
this
.
$router
.
push
(
"/userCenter"
);
}
},
methods
:
{
filterPhone
,
async
sendCode
()
{
ElMessage
({
message
:
"发送成功"
,
type
:
"success"
,
});
},
created
()
{
if
(
!
globalState
.
userInfos
.
phone
&&
!
globalState
.
userInfos
.
email
)
{
this
.
$router
.
push
(
"/userCenter"
);
async
confirm
(
data
:
any
,
setError
:
(
fieldName
:
string
,
errorMsg
:
string
)
=>
void
)
{
if
(
!
this
.
originPass
)
{
if
(
!
data
.
code
||
data
.
code
.
trim
()
===
""
)
{
// ElMessage("验证码不可为空");
setError
(
"验证码"
,
"验证码不可为空"
);
return
;
}
let
info
=
{};
if
(
globalState
.
userInfos
.
phone
)
{
info
=
{
code
:
data
.
code
,
code_type
:
0
,
phone
:
globalState
.
userInfos
.
phone
,
};
}
else
if
(
globalState
.
userInfos
.
email
)
{
info
=
{
code
:
data
.
code
,
code_type
:
1
,
email
:
globalState
.
userInfos
.
email
,
};
}
const
old
=
await
checkOldPhone
(
info
);
if
(
old
&&
old
.
code
===
200
)
{
ElMessage
({
message
:
"验证成功"
,
type
:
"success"
,
});
this
.
originPass
=
true
;
setTimeout
(()
=>
{
let
that
:
any
;
that
=
this
.
$refs
.
child
;
that
.
start
();
},
100
);
this
.
newPhone
.
random_token
=
old
.
data
.
random_token
;
}
else
{
old
?.
msg
&&
setError
(
"验证码"
,
old
?.
msg
);
}
}
else
{
if
(
data
.
phone
===
""
)
{
setError
(
"新手机号"
,
"新手机号码不可为空"
);
// ElMessage("新手机号码不可为空");
return
;
}
else
if
(
data
.
code
===
""
)
{
setError
(
"验证码"
,
"验证码不可为空"
);
// ElMessage("验证码不可为空");
return
;
}
const
newphone
=
await
editPhone
({
code
:
data
.
code
,
new_phone
:
String
(
data
.
phone
),
random_token
:
this
.
newPhone
.
random_token
,
});
if
(
newphone
&&
newphone
.
code
===
200
)
{
ElMessage
({
message
:
"操作成功"
,
type
:
"success"
,
});
this
.
$router
.
push
(
"/userCenter"
);
}
else
{
newphone
?.
msg
&&
setError
(
"验证码"
,
newphone
.
msg
);
}
}
},
methods
:
{
filterPhone
,
async
sendCode
()
{
ElMessage
({
message
:
"发送成功"
,
type
:
"success"
,
});
},
async
confirm
(
data
:
any
)
{
if
(
!
this
.
originPass
)
{
if
(
data
.
code
.
trim
()
===
""
)
{
ElMessage
(
"验证码不可为空"
);
return
;
}
let
info
=
{};
if
(
globalState
.
userInfos
.
phone
)
{
info
=
{
code
:
data
.
code
,
code_type
:
0
,
phone
:
globalState
.
userInfos
.
phone
,
};
}
else
if
(
globalState
.
userInfos
.
email
)
{
info
=
{
code
:
data
.
code
,
code_type
:
1
,
email
:
globalState
.
userInfos
.
email
,
};
}
const
old
=
await
checkOldPhone
(
info
);
if
(
old
&&
old
.
code
===
200
)
{
ElMessage
({
message
:
"验证成功"
,
type
:
"success"
,
});
this
.
originPass
=
true
;
setTimeout
(()
=>
{
let
that
:
any
;
that
=
this
.
$refs
.
child
;
that
.
start
();
},
100
);
this
.
newPhone
.
random_token
=
old
.
data
.
random_token
;
}
else
{
old
?.
msg
&&
ElMessage
.
error
(
old
?.
msg
)
}
}
else
{
if
(
data
.
phone
===
""
)
{
ElMessage
(
"新手机号码不可为空"
);
return
;
}
else
if
(
data
.
code
===
""
)
{
ElMessage
(
"验证码不可为空"
);
return
;
}
const
newphone
=
await
editPhone
({
code
:
data
.
code
,
new_phone
:
String
(
data
.
phone
),
random_token
:
this
.
newPhone
.
random_token
,
});
if
(
newphone
&&
newphone
.
code
===
200
)
{
ElMessage
({
message
:
"操作成功"
,
type
:
"success"
,
});
this
.
$router
.
push
(
"/userCenter"
);
}
else
{
ElMessage
.
error
(
newphone
?.
msg
)
}
}
},
},
computed
:
{
globalState
()
{
return
globalState
;
},
computed
:
{
globalState
()
{
return
globalState
;
}
}
},
});
</
script
>
<
style
scoped
>
.edit-phone
{
padding
:
16px
;
min-height
:
calc
(
100vh
-
95px
);
min-width
:
1200px
;
background
:
#f8fafb
;
padding
:
16px
;
min-height
:
calc
(
100vh
-
95px
);
min-width
:
1200px
;
background
:
#f8fafb
;
}
.head-nav
{
margin
:
12px
0
40px
47px
;
margin
:
12px
0
40px
47px
;
}
.title
{
margin-left
:
47px
;
font-size
:
20px
;
font-family
:
PingFangSC-Semibold
;
font-weight
:
600
;
color
:
rgba
(
53
,
53
,
53
,
1
);
line-height
:
40px
;
margin-left
:
47px
;
font-size
:
20px
;
font-family
:
PingFangSC-Semibold
;
font-weight
:
600
;
color
:
rgba
(
53
,
53
,
53
,
1
);
line-height
:
40px
;
}
.form
{
width
:
900px
;
width
:
900px
;
}
.form
.el-input
{
width
:
610px
;
width
:
610px
;
}
.form-item
{
margin-bottom
:
28px
;
margin-bottom
:
28px
;
}
.code-item
{
width
:
478px
!important
;
width
:
478px
!important
;
}
.confirm-btn
{
margin-top
:
10px
;
margin-left
:
50px
;
margin-top
:
10px
;
margin-left
:
50px
;
}
</
style
>
<
style
>
.edit-phone
.el-form-item__label
{
margin-right
:
21px
;
margin-right
:
21px
;
}
</
style
>
src/views/userCenter/PersonVerify/config.ts
View file @
cffbfb55
...
...
@@ -32,19 +32,16 @@ export const generateFormList = (submit: any) => {
{
type
:
"input"
,
showLabel
:
true
,
maxLen
:
18
,
label
:
"身份证号"
,
placeholder
:
"请输入您的身份证号"
,
rule
:
[
{
validator
:
checkIdNumber
,
trigger
:
"blur"
},
{
max
:
18
,
},
],
rule
:
[{
validator
:
checkIdNumber
,
trigger
:
"blur"
}],
},
{
type
:
"input"
,
showLabel
:
true
,
placeholder
:
"请输入您的银行卡号"
,
maxLen
:
19
,
label
:
"银行卡号"
,
rule
:
[{
validator
:
checkCard
,
trigger
:
"blur"
}],
},
...
...
@@ -53,6 +50,7 @@ export const generateFormList = (submit: any) => {
showLabel
:
true
,
placeholder
:
"请输入您的银行卡预留手机号"
,
label
:
"银行预留手机号"
,
maxLen
:
11
,
rule
:
[{
validator
:
checkPhone
,
trigger
:
"blur"
}],
async
handleClickSendCode
(
roleForm
:
any
,
formEl
)
{
const
phone
=
roleForm
.
银行预留手机号
;
...
...
@@ -71,6 +69,7 @@ export const generateFormList = (submit: any) => {
type
:
"input"
,
showLabel
:
true
,
placeholder
:
"请输入验证码"
,
maxLen
:
6
,
label
:
"验证码"
,
rule
:
[{
required
:
true
,
message
:
"验证码不能为空"
,
trigger
:
"blur"
}],
},
...
...
@@ -81,8 +80,8 @@ export const generateFormList = (submit: any) => {
type
:
"primary"
,
},
styles
:
"
background-color: #409EFF;
height:38px;margin-top: 10px;margin-left: 50px; padding: 12px 20px;"
,
async
onSubmit
(
valid
,
data
)
{
"height:38px;margin-top: 10px;margin-left: 50px; padding: 12px 20px;"
,
async
onSubmit
(
valid
,
data
,
setError
)
{
data
=
{
name
:
data
.
真实姓名
,
id_card
:
data
.
身份证号
,
...
...
@@ -90,7 +89,7 @@ export const generateFormList = (submit: any) => {
bank_phone
:
data
.
银行预留手机号
,
code
:
data
.
验证码
,
};
submit
(
valid
,
data
);
submit
(
valid
,
data
,
setError
);
},
},
]
as
iFormItem
[];
...
...
src/views/userCenter/PersonVerify/index.vue
View file @
cffbfb55
<
template
>
<div
class=
"person-verify"
>
<el-breadcrumb
separator=
"/"
class=
"head-nav"
>
<el-breadcrumb-item
:to=
"
{ path: '/userCenter' }">用户中心
</el-breadcrumb-item>
<el-breadcrumb-item>
个人认证
</el-breadcrumb-item>
</el-breadcrumb>
<div
class=
"verify-form"
v-if=
"!verstatus"
>
<p
class=
"title"
>
请提交您的实名认证信息:
</p>
<syBusinessForm
:formList=
"formList"
class=
"formlayout1"
></syBusinessForm>
</div>
<div
class=
"verify-success g-flex-center"
v-if=
"verstatus"
>
<div
class=
"success-box"
>
<i
class=
"iconfont icondg"
></i>
<h2>
恭喜你顺利通过个人实名认证
</h2>
<p>
{{
count
}}
s后为您自动返回首页
</p>
<el-button
type=
"primary"
size=
"large"
@
click=
"$router.push('/userCenter')"
style=
"background-color: #409EFF"
>
返回首页
</el-button>
</div>
</div>
<div
class=
"person-verify"
>
<el-breadcrumb
separator=
"/"
class=
"head-nav"
>
<el-breadcrumb-item
:to=
"
{ path: '/userCenter' }"
>用户中心
</el-breadcrumb-item
>
<el-breadcrumb-item>
个人认证
</el-breadcrumb-item>
</el-breadcrumb>
<div
class=
"verify-form"
v-if=
"!verstatus"
>
<p
class=
"title"
>
请提交您的实名认证信息:
</p>
<syBusinessForm
:formList=
"formList"
class=
"formlayout1"
></syBusinessForm>
</div>
<div
class=
"verify-success g-flex-center"
v-if=
"verstatus"
>
<div
class=
"success-box"
>
<i
class=
"iconfont icondg"
></i>
<h2>
恭喜你顺利通过个人实名认证
</h2>
<p>
{{
count
}}
s后为您自动返回首页
</p>
<el-button
type=
"primary"
size=
"large"
@
click=
"$router.push('/userCenter')"
style=
"background-color: #409eff"
>
返回首页
</el-button
>
</div>
</div>
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
ElLoading
,
ElBreadcrumb
,
ElBreadcrumbItem
,
ElButton
,
ElMessage
}
from
"element-plus"
import
{
ElLoading
,
ElBreadcrumb
,
ElBreadcrumbItem
,
ElButton
,
ElMessage
,
}
from
"element-plus"
;
import
{
defineComponent
}
from
"vue"
;
import
{
syBusinessForm
}
from
"cqk-sy-ui"
import
{
syBusinessForm
}
from
"cqk-sy-ui"
;
import
{
generateFormList
}
from
"./config"
;
import
{
get
,
personVerify
}
from
"@/service/Api.service"
;
export
default
defineComponent
({
components
:
{
ElButton
,
ElBreadcrumb
,
syBusinessForm
,
ElBreadcrumbItem
,
},
data
()
{
return
{
verstatus
:
false
,
timer
:
0
,
timer2
:
0
,
count
:
0
,
count2
:
0
,
time
:
20
,
show
:
true
,
loading
:
null
as
any
,
intervalHandle
:
-
1
,
}
components
:
{
ElButton
,
ElBreadcrumb
,
syBusinessForm
,
ElBreadcrumbItem
,
},
data
()
{
return
{
verstatus
:
false
,
timer
:
0
,
timer2
:
0
,
count
:
0
,
count2
:
0
,
time
:
20
,
show
:
true
,
loading
:
null
as
any
,
intervalHandle
:
-
1
,
};
},
computed
:
{
formList
()
{
const
confirm
=
(
this
as
any
).
confirm
;
return
generateFormList
(
confirm
);
},
computed
:
{
formList
()
{
const
confirm
=
(
this
as
any
).
confirm
return
generateFormList
(
confirm
);
}
},
watch
:
{
count
(
val
)
{
if
(
val
===
0
)
this
.
$router
.
push
(
"/userCenter"
);
},
watch
:
{
count
(
val
)
{
if
(
val
===
0
)
this
.
$router
.
push
(
"/userCenter"
);
},
},
methods
:
{
countDowns2
()
{
const
TIME_COUNT
=
60
;
if
(
!
this
.
timer2
)
{
this
.
count2
=
TIME_COUNT
;
this
.
show
=
false
;
this
.
timer2
=
window
.
setInterval
(()
=>
{
if
(
this
.
count2
>
0
&&
this
.
count2
<=
TIME_COUNT
)
{
this
.
count2
--
;
}
else
{
this
.
show
=
true
;
clearInterval
(
this
.
timer2
);
this
.
timer2
=
0
;
}
},
1000
);
}
},
methods
:
{
countDowns2
()
{
const
TIME_COUNT
=
60
;
if
(
!
this
.
timer2
)
{
this
.
count2
=
TIME_COUNT
;
this
.
show
=
false
;
this
.
timer2
=
window
.
setInterval
(()
=>
{
if
(
this
.
count2
>
0
&&
this
.
count2
<=
TIME_COUNT
)
{
this
.
count2
--
;
}
else
{
this
.
show
=
true
;
clearInterval
(
this
.
timer2
);
this
.
timer2
=
0
;
}
},
1000
);
}
},
// 确认提交
async
confirm
(
valid
:
boolean
,
data
:
any
)
{
if
(
valid
)
{
const
res
=
await
personVerify
(
data
);
if
(
res
&&
res
.
code
===
200
)
{
const
date
=
await
get
(
JSON
.
parse
(
String
(
sessionStorage
.
getItem
(
"user"
))).
id
);
if
(
date
)
{
if
(
date
.
data
.
status
!==
1
&&
date
.
data
.
status
!==
2
)
{
ElMessage
(
date
.
data
.
message
);
}
else
if
(
date
.
data
.
status
===
2
)
{
this
.
verstatus
=
true
;
this
.
countDown
();
}
else
if
(
date
.
data
.
status
===
1
)
{
this
.
loading
=
ElLoading
.
service
({
lock
:
true
,
text
:
"认证中"
,
spinner
:
"el-icon-loading"
,
background
:
"rgba(0, 0, 0, 0.7)"
,
});
this
.
intervalHandle
=
window
.
setInterval
(()
=>
{
if
(
this
.
time
>
0
)
{
this
.
time
--
;
this
.
getStatus
();
}
else
{
this
.
loading
.
close
();
clearInterval
(
this
.
intervalHandle
);
ElMessage
(
"认证失败,请重新认证"
);
this
.
$router
.
push
({
path
:
"/userCenter"
,
});
}
},
3000
);
}
}
}
else
{
res
?.
msg
&&
ElMessage
.
error
(
res
.
msg
)
}
}
else
{
ElMessage
(
"认证信息存在错误,请确认!"
);
return
false
;
}
},
async
getStatus
()
{
const
res
=
await
get
(
JSON
.
parse
(
String
(
sessionStorage
.
getItem
(
"user"
))).
id
);
if
(
res
)
{
// 个人认证状态(0:未认证 1:认证中 2:认证成功 3:认证失败
if
(
res
.
data
.
status
===
2
)
{
clearInterval
(
this
.
intervalHandle
);
ElMessage
({
message
:
"恭喜您认证成功"
,
type
:
"success"
,
});
this
.
loading
.
close
();
this
.
countDown
();
}
else
if
(
res
.
data
.
status
===
3
)
{
clearInterval
(
this
.
intervalHandle
);
ElMessage
({
message
:
res
.
data
.
message
,
type
:
"warning"
,
});
this
.
loading
.
close
();
this
.
$router
.
push
({
path
:
"/userCenter"
,
});
// 确认提交
async
confirm
(
valid
:
boolean
,
data
:
any
,
setError
:
(
fieldName
:
string
,
errorMsg
:
string
)
=>
void
)
{
if
(
valid
)
{
const
res
=
await
personVerify
(
data
);
console
.
log
(
res
,
'show res'
)
if
(
res
&&
res
.
code
===
200
)
{
const
date
=
await
get
(
JSON
.
parse
(
String
(
sessionStorage
.
getItem
(
"user"
))).
id
);
if
(
date
)
{
if
(
date
.
data
.
status
!==
1
&&
date
.
data
.
status
!==
2
)
{
ElMessage
(
date
.
data
.
message
);
}
else
if
(
date
.
data
.
status
===
2
)
{
this
.
verstatus
=
true
;
this
.
countDown
();
}
else
if
(
date
.
data
.
status
===
1
)
{
this
.
loading
=
ElLoading
.
service
({
lock
:
true
,
text
:
"认证中"
,
spinner
:
"el-icon-loading"
,
background
:
"rgba(0, 0, 0, 0.7)"
,
});
this
.
intervalHandle
=
window
.
setInterval
(()
=>
{
if
(
this
.
time
>
0
)
{
this
.
time
--
;
this
.
getStatus
();
}
else
{
this
.
loading
.
close
();
clearInterval
(
this
.
intervalHandle
);
ElMessage
(
"认证失败,请重新认证"
);
this
.
$router
.
push
({
path
:
"/userCenter"
,
});
}
},
3000
);
}
},
// 倒计时返回个人中心
countDown
()
{
const
TIME_COUNT
=
3
;
if
(
!
this
.
timer
)
{
this
.
count
=
TIME_COUNT
;
this
.
timer
=
window
.
setInterval
(()
=>
{
if
(
this
.
count
>
0
&&
this
.
count
<=
TIME_COUNT
)
{
this
.
count
--
;
}
else
{
clearInterval
(
this
.
timer
);
this
.
timer
=
0
;
}
},
1000
);
}
},
}
}
else
{
if
(
res
?.
msg
)
{
console
.
log
(
res
)
const
config
=
[
{
p
:
/姓名/
,
fieldName
:
"真实姓名"
},
{
p
:
/身份证/
,
fieldName
:
"身份证号"
},
{
p
:
/银行卡/
,
fieldName
:
"银行卡号"
},
{
p
:
/手机/
,
fieldName
:
"银行预留手机号"
},
{
p
:
/验证码/
,
fieldName
:
"验证码"
},
];
const
match
=
config
.
find
((
i
)
=>
i
.
p
.
test
(
res
.
msg
));
console
.
log
(
match
,
'show match'
)
match
?
setError
(
match
.
fieldName
,
res
.
msg
)
:
ElMessage
.
error
(
res
.
msg
);
}
}
}
else
{
ElMessage
(
"认证信息存在错误,请确认!"
);
return
false
;
}
},
async
getStatus
()
{
const
res
=
await
get
(
JSON
.
parse
(
String
(
sessionStorage
.
getItem
(
"user"
))).
id
);
if
(
res
)
{
// 个人认证状态(0:未认证 1:认证中 2:认证成功 3:认证失败
if
(
res
.
data
.
status
===
2
)
{
clearInterval
(
this
.
intervalHandle
);
ElMessage
({
message
:
"恭喜您认证成功"
,
type
:
"success"
,
});
this
.
loading
.
close
();
this
.
countDown
();
}
else
if
(
res
.
data
.
status
===
3
)
{
clearInterval
(
this
.
intervalHandle
);
ElMessage
({
message
:
res
.
data
.
message
,
type
:
"warning"
,
});
this
.
loading
.
close
();
this
.
$router
.
push
({
path
:
"/userCenter"
,
});
}
}
},
// 倒计时返回个人中心
countDown
()
{
const
TIME_COUNT
=
3
;
if
(
!
this
.
timer
)
{
this
.
count
=
TIME_COUNT
;
this
.
timer
=
window
.
setInterval
(()
=>
{
if
(
this
.
count
>
0
&&
this
.
count
<=
TIME_COUNT
)
{
this
.
count
--
;
}
else
{
clearInterval
(
this
.
timer
);
this
.
timer
=
0
;
}
},
1000
);
}
},
},
});
</
script
>
<
style
scoped
lang=
"scss"
>
.person-verify
{
padding
:
16px
;
min-height
:
calc
(
100vh
-
95px
);
min-width
:
1200px
;
background
:
#f8fafb
;
padding
:
16px
;
min-height
:
calc
(
100vh
-
95px
);
min-width
:
1200px
;
background
:
#f8fafb
;
}
.g-flex-center
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.head-nav
{
position
:
absolute
;
margin
:
12px
0
40px
47px
;
position
:
absolute
;
margin
:
12px
0
40px
47px
;
}
.title
{
margin-top
:
64px
;
margin-left
:
47px
;
font-size
:
20px
;
font-family
:
PingFangSC-Semibold
;
font-weight
:
600
;
color
:
rgba
(
53
,
53
,
53
,
1
);
line-height
:
40px
;
margin-top
:
64px
;
margin-left
:
47px
;
font-size
:
20px
;
font-family
:
PingFangSC-Semibold
;
font-weight
:
600
;
color
:
rgba
(
53
,
53
,
53
,
1
);
line-height
:
40px
;
}
.form
{
width
:
900px
;
width
:
900px
;
}
.code-btn
{
display
:
inline-block
;
margin-left
:
15px
;
display
:
inline-block
;
margin-left
:
15px
;
}
.send-btn
{
width
:
112px
;
width
:
112px
;
}
.form
.el-input
{
width
:
610px
;
width
:
610px
;
}
.form-item
{
margin-bottom
:
28px
;
margin-bottom
:
28px
;
}
.form-code
.el-input
{
width
:
483px
;
width
:
483px
;
}
.confirm-btn
{
margin-top
:
10px
;
margin-left
:
50px
;
margin-top
:
10px
;
margin-left
:
50px
;
}
.verify-success
{
min-height
:
calc
(
100vh
-
95px
);
min-height
:
calc
(
100vh
-
95px
);
}
.success-box
{
text-align
:
center
;
.icondg
{
font-size
:
50px
;
color
:
#27cf72
;
margin-bottom
:
37px
;
}
p
{
height
:
17px
;
font-size
:
12px
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
color
:
#797d84
;
margin-top
:
9px
;
margin-bottom
:
19px
;
line-height
:
17px
;
}
text-align
:
center
;
.icondg
{
font-size
:
50px
;
color
:
#27cf72
;
margin-bottom
:
37px
;
}
p
{
height
:
17px
;
font-size
:
12px
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
color
:
#797d84
;
margin-top
:
9px
;
margin-bottom
:
19px
;
line-height
:
17px
;
}
}
h2
{
margin-top
:
34px
;
font-size
:
18px
;
height
:
25px
;
font-family
:
PingFangSC-Medium
,
PingFang
SC
;
font-weight
:
500
;
color
:
#353535
;
line-height
:
25px
;
margin-top
:
34px
;
font-size
:
18px
;
height
:
25px
;
font-family
:
PingFangSC-Medium
,
PingFang
SC
;
font-weight
:
500
;
color
:
#353535
;
line-height
:
25px
;
}
</
style
>
src/views/userCenter/SetPassword/config.ts
View file @
cffbfb55
...
...
@@ -31,6 +31,7 @@ export const generateFormList = (data: any, confirm: any) => {
showLabel
:
true
,
label
:
"验证码"
,
placeholder
:
"请输入6位验证码"
,
maxLen
:
6
,
rule
:
[
{
required
:
true
,
...
...
@@ -63,15 +64,18 @@ export const generateFormList = (data: any, confirm: any) => {
type
:
"primary"
,
},
styles
:
"
background-color: #409EFF;
height:38px;margin-top: 10px;margin-left: 50px; padding: 12px 20px;"
,
async
onSubmit
(
valid
,
data
)
{
"height:38px;margin-top: 10px;margin-left: 50px; padding: 12px 20px;"
,
async
onSubmit
(
valid
,
data
,
setError
)
{
if
(
valid
)
{
confirm
({
pwd
:
data
.
输入密码
,
code
:
data
.
验证码
,
email
:
data
.
邮箱
,
phone
:
data
.
手机号
,
});
confirm
(
{
pwd
:
data
.
输入密码
,
code
:
data
.
验证码
,
email
:
data
.
邮箱
,
phone
:
data
.
手机号
,
},
setError
);
}
},
},
...
...
src/views/userCenter/SetPassword/index.vue
View file @
cffbfb55
<
template
>
<div
class=
"set-password"
>
<el-breadcrumb
separator=
"/"
class=
"head-nav"
>
<el-breadcrumb-item
:to=
"
{ path: '/userCenter' }">用户中心
</el-breadcrumb-item>
<el-breadcrumb-item>
设置密码
</el-breadcrumb-item>
</el-breadcrumb>
<p
class=
"title"
>
设置登录密码:
</p>
<syBusinessForm
:form-list=
"formList"
class=
"formlayout1"
></syBusinessForm>
</div>
<div
class=
"set-password"
>
<el-breadcrumb
separator=
"/"
class=
"head-nav"
>
<el-breadcrumb-item
:to=
"
{ path: '/userCenter' }"
>用户中心
</el-breadcrumb-item
>
<el-breadcrumb-item>
设置密码
</el-breadcrumb-item>
</el-breadcrumb>
<p
class=
"title"
>
设置登录密码:
</p>
<syBusinessForm
:form-list=
"formList"
class=
"formlayout1"
></syBusinessForm>
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
}
from
"vue"
;
import
{
filterPhone
,
syBusinessForm
}
from
"cqk-sy-ui"
import
{
filterPhone
,
syBusinessForm
}
from
"cqk-sy-ui"
;
import
{
editPassword
}
from
"@/service/Api.service"
;
import
{
globalState
}
from
"@/store/state"
;
import
{
ElMessage
,
ElBreadcrumb
,
ElBreadcrumbItem
,
}
from
"element-plus"
;
import
{
generateFormList
}
from
"./config"
import
{
ElMessage
,
ElBreadcrumb
,
ElBreadcrumbItem
}
from
"element-plus"
;
import
{
generateFormList
}
from
"./config"
;
import
md5
from
"js-md5"
;
export
default
defineComponent
({
components
:
{
ElBreadcrumb
,
ElBreadcrumbItem
,
syBusinessForm
components
:
{
ElBreadcrumb
,
ElBreadcrumbItem
,
syBusinessForm
,
},
data
()
{
return
{
passwordForm
:
{
phone
:
globalState
.
userInfos
.
phone
,
email
:
globalState
.
userInfos
.
email
,
pwd
:
""
,
code
:
""
,
},
formList
:
generateFormList
(
{
phone
:
globalState
.
userInfos
.
phone
,
email
:
globalState
.
userInfos
.
email
,
},
this
.
confirm
),
};
},
created
()
{
if
(
!
globalState
.
userInfos
.
phone
&&
!
globalState
.
userInfos
.
email
)
{
this
.
$router
.
push
(
"/userCenter"
);
}
},
methods
:
{
filterPhone
,
// 验证码发送成功的回调
async
sendCode
()
{
ElMessage
({
message
:
"发送成功"
,
type
:
"success"
,
});
},
data
()
{
return
{
passwordForm
:
{
phone
:
globalState
.
userInfos
.
phone
,
email
:
globalState
.
userInfos
.
email
,
pwd
:
""
,
code
:
""
,
},
formList
:
generateFormList
({
phone
:
globalState
.
userInfos
.
phone
,
email
:
globalState
.
userInfos
.
email
,
},
this
.
confirm
)
async
confirm
(
data
:
any
,
setError
:
(
fieldName
:
string
,
errorMsg
:
string
)
=>
void
)
{
// 密码格式校验
let
info
=
{};
if
(
globalState
.
userInfos
.
phone
!==
""
)
{
info
=
{
phone
:
data
.
phone
,
code_type
:
0
,
pwd
:
md5
(
String
(
data
.
pwd
)
+
md5
(
String
(
data
.
pwd
.
length
)))
,
code
:
data
.
code
,
};
},
created
()
{
if
(
!
globalState
.
userInfos
.
phone
&&
!
globalState
.
userInfos
.
email
)
{
this
.
$router
.
push
(
"/userCenter"
);
}
},
methods
:
{
filterPhone
,
// 验证码发送成功的回调
async
sendCode
()
{
ElMessage
({
message
:
"发送成功"
,
type
:
"success"
,
});
},
async
confirm
(
data
:
any
)
{
// 密码格式校验
let
info
=
{};
if
(
globalState
.
userInfos
.
phone
!==
""
)
{
info
=
{
phone
:
data
.
phone
,
code_type
:
0
,
pwd
:
md5
(
String
(
data
.
pwd
)
+
md5
(
String
(
data
.
pwd
.
length
))
),
code
:
data
.
code
,
};
}
else
if
(
globalState
.
userInfos
.
email
!==
""
)
{
info
=
{
email
:
data
.
email
,
pwd
:
md5
(
String
(
data
.
pwd
)
+
md5
(
String
(
data
.
pwd
.
length
))
),
code
:
data
.
code
,
code_type
:
1
,
};
}
}
else
if
(
globalState
.
userInfos
.
email
!==
""
)
{
info
=
{
email
:
data
.
email
,
pwd
:
md5
(
String
(
data
.
pwd
)
+
md5
(
String
(
data
.
pwd
.
length
))),
code
:
data
.
code
,
code_type
:
1
,
};
}
const
res
=
await
editPassword
(
info
);
if
(
res
&&
res
.
code
===
200
)
{
ElMessage
({
message
:
"密码设置成功"
,
type
:
"success"
,
});
const
res
=
await
editPassword
(
info
);
if
(
res
&&
res
.
code
===
200
)
{
ElMessage
({
message
:
"密码设置成功"
,
type
:
"success"
,
});
this
.
$router
.
push
(
"/userCenter"
);
}
else
{
res
?.
msg
&&
ElMessage
.
error
(
res
?.
msg
)
}
},
this
.
$router
.
push
(
"/userCenter"
);
}
else
{
res
?.
msg
&&
setError
(
"验证码"
,
res
?.
msg
);
}
},
},
});
</
script
>
<
style
scoped
>
.set-password
{
padding
:
16px
;
min-height
:
calc
(
100vh
-
95px
);
min-width
:
1200px
;
background
:
#f8fafb
;
padding
:
16px
;
min-height
:
calc
(
100vh
-
95px
);
min-width
:
1200px
;
background
:
#f8fafb
;
}
.head-nav
{
margin
:
12px
0
40px
47px
;
margin
:
12px
0
40px
47px
;
}
.title
{
margin-left
:
47px
;
font-size
:
20px
;
font-family
:
PingFangSC-Semibold
;
font-weight
:
600
;
color
:
rgba
(
53
,
53
,
53
,
1
);
line-height
:
40px
;
margin-left
:
47px
;
font-size
:
20px
;
font-family
:
PingFangSC-Semibold
;
font-weight
:
600
;
color
:
rgba
(
53
,
53
,
53
,
1
);
line-height
:
40px
;
}
.form
{
width
:
900px
;
width
:
900px
;
}
.form
.el-input
{
width
:
610px
;
width
:
610px
;
}
.form-code
.el-input
{
width
:
480px
;
width
:
480px
;
}
.form-item
{
margin-bottom
:
28px
;
margin-bottom
:
28px
;
}
.confirm-btn
{
margin-top
:
10px
;
margin-left
:
50px
;
margin-top
:
10px
;
margin-left
:
50px
;
}
</
style
>
<
style
>
.set-password
.el-form-item__label
{
margin-right
:
21px
;
margin-right
:
21px
;
}
</
style
>
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