Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
NFT
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
hanfeng zhang
NFT
Commits
d9bad87b
Commit
d9bad87b
authored
Jul 02, 2021
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
f5d2a621
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
74 additions
and
35 deletions
+74
-35
Service.ts
src/service/Service.ts
+24
-7
Dto.ts
src/types/Dto.ts
+1
-1
Login.vue
src/view/Auth/Login/Login.vue
+9
-4
index.vue
src/view/Auth/Login/components/CodeInput/index.vue
+14
-5
const.ts
src/view/Auth/Login/const.ts
+2
-2
index.vue
src/view/Auth/Login/index.vue
+15
-10
PwdFind.vue
src/view/Auth/PwdFind/PwdFind.vue
+3
-2
PwdModify.vue
src/view/Auth/PwdModify/PwdModify.vue
+3
-2
PwdSetting.vue
src/view/Auth/PwdSetting/PwdSetting.vue
+3
-2
No files found.
src/service/Service.ts
View file @
d9bad87b
...
...
@@ -2,17 +2,33 @@
import
axios
,
{
AxiosInstance
}
from
"axios"
const
url
=
{
development
:
'http://172.16.101.135:8001'
,
test
:
''
,
production
:
''
development
:
'http://172.16.101.135:8001'
,
test
:
''
,
production
:
''
}
import
{
Toast
}
from
"vant"
export
class
Service
{
public
service
:
AxiosInstance
;
constructor
(){
public
service
:
AxiosInstance
;
constructor
()
{
this
.
service
=
axios
.
create
({
baseURL
:
process
.
env
.
NODE_ENV
===
'production'
?
url
.
production
:
url
.
development
,
timeout
:
15000
baseURL
:
process
.
env
.
NODE_ENV
===
'production'
?
url
.
production
:
url
.
development
,
timeout
:
15000
,
})
const
get
=
this
.
service
.
get
const
post
=
this
.
service
.
post
const
resolveData
=
(
ret
:
any
)
=>
{
if
(
ret
.
code
===
200
)
return
ret
.
data
;
else
{
Toast
.
fail
(
ret
.
message
)
throw
new
Error
(
ret
.
message
)
}
}
this
.
service
.
get
=
(...
res
)
=>
get
(...
res
).
then
(
ret
=>
resolveData
(
ret
.
data
));
this
.
service
.
post
=
(...
res
)
=>
post
(...
res
).
then
(
ret
=>
resolveData
(
ret
.
data
)).
catch
(
err
=>
{
resolveData
(
err
.
response
.
data
)
});
}
}
\ No newline at end of file
src/types/Dto.ts
View file @
d9bad87b
...
...
@@ -15,7 +15,7 @@ import { PRODUCT_STATUS } from '@/constant/product'
export
interface
LoginDto
{
codetype
:
string
email
?:
string
password
:
string
password
?
:
string
telephone
:
string
verificationCode
:
string
}
...
...
src/view/Auth/Login/Login.vue
View file @
d9bad87b
...
...
@@ -19,8 +19,9 @@
:value=
"code"
:type=
"codeConfig.type"
:handleChange=
"handleCodeChange"
:sendSms=
"sendSms"
:sendVoice=
"sendVoice"
:phone=
"phone"
:sendSmsFunc=
"sendSmsFunc"
:sendVoiceFunc=
"sendVoiceFunc"
:phoneValid=
"phoneValid"
>
</CodeInput>
...
...
@@ -151,7 +152,7 @@ export default Vue.extend({
},
sendVoiceFunc
:
{
type
:
Function
as
PropType
<
tSendVoiceFunc
>
,
required
:
tru
e
,
required
:
fals
e
,
},
loginByCodeFunc
:
{
type
:
Function
as
PropType
<
tLoginByCodeFunc
>
,
...
...
@@ -220,7 +221,11 @@ export default Vue.extend({
const
{
phone
,
code
}
=
this
;
// 调用注册接口
this
.
btnLoading
=
true
;
const
regResult
=
await
this
.
registerFunc
(
phone
,
code
);
try
{
const
regResult
=
await
this
.
registerFunc
(
phone
,
code
);
}
catch
(
err
){
}
this
.
btnLoading
=
false
;
},
async
handleClickLogin
()
{
...
...
src/view/Auth/Login/components/CodeInput/index.vue
View file @
d9bad87b
...
...
@@ -22,7 +22,10 @@
</div>
</
template
>
</Input>
<div
class=
"mt-2 float-right text-sm text-font-blue"
v-if=
"voiceActive"
>
<div
class=
"mt-2 float-right text-sm text-font-blue"
v-if=
"voiceActive && sendVoiceFunc"
>
<div
v-if=
"voiceCount === 60 && !voiceHasSended60Ago"
class=
"flex items-center"
...
...
@@ -63,8 +66,9 @@ export default Vue.extend({
type
:
String
,
handleChange
:
Function
,
maxlength
:
Number
,
sendVoice
:
Function
,
sendSms
:
Function
,
phone
:
String
,
sendSmsFunc
:
Function
,
sendVoiceFunc
:
Function
,
phoneValid
:
Boolean
,
sendSmsAuto
:
{
type
:
Boolean
,
...
...
@@ -93,7 +97,12 @@ export default Vue.extend({
if
(
!
this
.
phoneValid
)
return
;
if
(
this
.
smsLock
===
true
)
return
;
this
.
smsLock
=
true
;
await
this
.
sendSms
();
try
{
await
this
.
sendSmsFunc
(
this
.
phone
);
}
catch
(
err
)
{
this
.
smsLock
=
false
;
return
;
}
this
.
smsCount
--
;
this
.
timerId1
=
window
.
setInterval
(()
=>
{
this
.
smsCount
--
;
...
...
@@ -109,7 +118,7 @@ export default Vue.extend({
if
(
!
this
.
phoneValid
)
return
;
if
(
this
.
voiceLock
===
true
)
return
;
this
.
voiceLock
=
true
;
await
this
.
sendVoice
(
);
await
this
.
sendVoice
Func
(
this
.
phone
);
this
.
voiceCount
--
;
this
.
timerId2
=
window
.
setInterval
(()
=>
{
this
.
voiceCount
--
;
...
...
src/view/Auth/Login/const.ts
View file @
d9bad87b
...
...
@@ -8,11 +8,11 @@ export const phoneConfig = {
}
export
const
codeConfig
=
{
maxLen
:
6
,
maxLen
:
4
,
placeholder
:
"请输入验证码"
,
type
:
'number'
,
validate
(
value
:
string
)
{
return
value
.
length
===
6
;
return
value
.
length
===
4
;
}
}
...
...
src/view/Auth/Login/index.vue
View file @
d9bad87b
...
...
@@ -4,7 +4,6 @@
title=
"欢迎来到乐映"
:accountStatusCheckFunc=
"accountStatusCheckFunc"
:sendSmsFunc=
"sendSmsFunc"
:sendVoiceFunc=
"sendVoiceFunc"
:registerFunc=
"registerFunc"
:loginByCodeFunc=
"loginByCodeFunc"
:loginByPwdFunc=
"loginByPwdFunc"
...
...
@@ -29,19 +28,25 @@ export default Vue.extend({
components
:
{
Login
},
methods
:
{
async
accountStatusCheckFunc
(
phone
:
string
)
{
await
delay
(
1
);
return
eAccountType
.
REG
;
const
isRegisterd
=
await
this
.
$service
.
userService
.
isRegisterd
(
phone
);
if
(
!
isRegisterd
)
{
return
eAccountType
.
NO_REG
;
}
else
{
const
isPwdSet
=
await
this
.
$service
.
userService
.
isPwdSet
(
phone
);
return
isPwdSet
?
eAccountType
.
REG
:
eAccountType
.
NO_REG
;
}
},
async
sendSmsFunc
(
phone
:
string
)
{
await
delay
(
1
);
return
1
;
},
async
sendVoiceFunc
(
phone
:
string
)
{
await
delay
(
1
);
return
1
;
await
this
.
$service
.
userService
.
getVerificationCode
(
phone
,
"1"
);
},
async
registerFunc
(
phone
:
string
,
code
:
string
)
{
await
delay
(
2
);
const
ret
=
await
this
.
$service
.
userService
.
loginAndSign
({
codetype
:
"1"
,
telephone
:
phone
,
verificationCode
:
code
,
});
console
.
log
(
ret
,
"show ret"
);
// 如果注册成功,保存token
const
success
=
false
;
if
(
success
)
{
...
...
src/view/Auth/PwdFind/PwdFind.vue
View file @
d9bad87b
...
...
@@ -17,8 +17,9 @@
:value=
"code"
:type=
"codeConfig.type"
:handleChange=
"handleCodeChange"
:sendSms=
"sendSms"
:sendVoice=
"sendVoice"
:phone=
"phone"
:sendSmsFunc=
"sendSmsFunc"
:sendVoiceFunc=
"sendVoiceFunc"
:phoneValid=
"phoneValid"
>
</CodeInput>
...
...
src/view/Auth/PwdModify/PwdModify.vue
View file @
d9bad87b
...
...
@@ -20,8 +20,9 @@
:value=
"code"
:type=
"codeConfig.type"
:handleChange=
"handleCodeChange"
:sendSms=
"sendSms"
:sendVoice=
"sendVoice"
:phone=
"phone"
:sendSmsFunc=
"sendSmsFunc"
:sendVoiceFunc=
"sendVoiceFunc"
:phoneValid=
"phoneValid"
>
</CodeInput>
...
...
src/view/Auth/PwdSetting/PwdSetting.vue
View file @
d9bad87b
...
...
@@ -9,8 +9,9 @@
:value=
"code"
:type=
"codeConfig.type"
:handleChange=
"handleCodeChange"
:sendSms=
"sendSms"
:sendVoice=
"sendVoice"
:phone=
"phone"
:sendSmsFunc=
"sendSmsFunc"
:sendVoiceFunc=
"sendVoiceFunc"
:phoneValid=
"phoneValid"
:sendSmsAuto=
"true"
/>
...
...
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