Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
d2f140c8
Commit
d2f140c8
authored
Apr 29, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
ce928c61
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
2 deletions
+93
-2
iview-admin/src/components/phone-form/index.js
+2
-0
iview-admin/src/components/phone-form/phone-form.vue
+75
-0
iview-admin/src/view/login/login.vue
+16
-2
No files found.
iview-admin/src/components/phone-form/index.js
0 → 100644
View file @
d2f140c8
import
LoginForm
from
'./phone-form.vue'
export
default
LoginForm
iview-admin/src/components/phone-form/phone-form.vue
0 → 100644
View file @
d2f140c8
<
template
>
<Form
ref=
"loginForm"
:model=
"form"
:rules=
"rules"
@
keydown
.
enter
.
native=
"handleSubmit"
>
<FormItem
prop=
"mobile"
>
<Input
v-model=
"form.mobile"
placeholder=
"请输入手机号"
>
<span
slot=
"prepend"
>
<Icon
:size=
"16"
type=
"ios-person"
></Icon>
</span>
</Input>
</FormItem>
<FormItem
prop=
"vcode"
>
<Input
v-model=
"form.vcode"
placeholder=
"请输入收到的验证码"
>
<span
slot=
"prepend"
>
<Icon
:size=
"14"
type=
"md-lock"
></Icon>
</span>
<span
slot=
"append"
>
<Button
type=
"primary"
>
发送验证码
</Button>
</span>
</Input>
</FormItem>
<FormItem>
<Button
@
click=
"handleSubmit"
type=
"primary"
long
>
登录
</Button>
</FormItem>
</Form>
</
template
>
<
script
>
export
default
{
name
:
'PhoneForm'
,
props
:
{
mobileRules
:
{
type
:
Array
,
default
:
()
=>
{
return
[
{
required
:
true
,
message
:
'电话号码不能为空'
,
trigger
:
'blur'
}
]
}
},
vcodeRules
:
{
type
:
Array
,
default
:
()
=>
{
return
[
{
required
:
true
,
message
:
'验证码不能为空'
,
trigger
:
'blur'
}
]
}
}
},
data
()
{
return
{
form
:
{
mobile
:
''
,
vcode
:
''
}
}
},
computed
:
{
rules
()
{
return
{
userName
:
this
.
mobileRules
,
password
:
this
.
vcodeRules
}
}
},
methods
:
{
handleSubmit
()
{
this
.
$refs
.
loginForm
.
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
$emit
(
'on-success-valid'
,
{
userName
:
this
.
form
.
mobile
,
password
:
this
.
form
.
vcode
})
}
})
}
}
}
</
script
>
iview-admin/src/view/login/login.vue
View file @
d2f140c8
...
...
@@ -6,8 +6,15 @@
<div
class=
"login"
>
<div
class=
"login-con"
>
<Card
icon=
"log-in"
title=
"欢迎登录"
:bordered=
"false"
style=
"border-radius:0px"
>
<p
slot=
"title"
@
click
.
prevent=
"ispasslogin=true"
>
<a
href=
"#"
>
密码登录
</a>
</p>
<p
slot=
"extra"
@
click
.
prevent=
"ispasslogin=false"
>
<a
href=
"#"
>
验证码登录
</a>
</p>
<div
class=
"form-con"
>
<login-form
@
on-success-valid=
"handleSubmit"
></login-form>
<login-form
v-if=
"ispasslogin"
@
on-success-valid=
"handleSubmit"
></login-form>
<MobileForm
v-if=
"!ispasslogin"
@
on-success-valid=
"handleSubmit"
></MobileForm>
<p
class=
"login-tip"
>
注册
</p>
</div>
</Card>
...
...
@@ -17,10 +24,17 @@
<
script
>
import
LoginForm
from
'_c/login-form'
import
MobileForm
from
'_c/phone-form'
import
{
mapActions
}
from
'vuex'
export
default
{
data
(){
return
{
ispasslogin
:
true
}
},
components
:
{
LoginForm
LoginForm
,
MobileForm
},
methods
:
{
...
mapActions
([
...
...
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