Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
html
/
poolin_app
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5c645564
authored
Feb 11, 2018
by
zhanghui1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
a0a5d7a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
31 deletions
+94
-31
src/components/ucenter/index.vue
+7
-4
src/components/ucenter/signUpEmail.vue
+72
-8
src/store/index.js
+15
-19
No files found.
src/components/ucenter/index.vue
View file @
5c645564
...
...
@@ -32,12 +32,14 @@
<button
@
click=
"goLogin"
:disabled=
"showLoading"
:isLoading=
"showLoading"
>
{{
showLoading
?
''
:
'登录'
}}
</button>
<div
class=
"clearfix"
>
<a
class=
"left"
@
click=
"switchLogin"
>
{{
useMail
?
'使用手机号登录'
:
'使用邮箱登录'
}}
</a>
<router-link
class=
"right"
to=
"/sign-up-mobile"
>
注册
</router-link>
<router-link
class=
"right"
v-show=
"!useMail"
to=
"/sign-up-mobile"
>
注册
</router-link>
<router-link
class=
"right"
v-show=
"useMail"
to=
"/sign-up-email"
>
注册
</router-link>
</div>
</div>
</div>
</
template
>
<
script
>
window
.
config
=
{
appName
:
"Blockin Account"
,
baseUrl
:
"https://ucdev1212.blockin.com"
,
locale
:
"zh-cn"
,
user
:
null
};
import
{
mapState
}
from
'vuex'
import
countryInfo
from
'./country_info.json'
import
captcha
from
'./captcha.vue'
...
...
@@ -108,7 +110,7 @@ export default {
email
=
this
.
form
.
email
;
const
{
data
:
accountResponse
}
=
await
this
.
$axios
.
post
(
this
.
UC_BASEURL
+
'/auth/api'
+
api
[
'post-login-start'
],
{
.
post
(
this
.
UC_BASEURL
+
'/auth/api'
+
api
[
'post-login-start'
],
{
captcha
:
this
.
showEmailCaptcha
?
this
.
form
.
captcha
:
''
,
// todo: 登录验证码
email
,
type
:
'email'
...
...
@@ -154,7 +156,7 @@ export default {
email
=
this
.
form
.
country
+
'|'
+
this
.
form
.
email
;
const
{
data
:
accountResponse
}
=
await
this
.
$axios
.
post
(
apiDomain
+
'/auth/api'
+
api
[
'post-login-start'
],
{
.
post
(
this
.
UC_BASEURL
+
'/auth/api'
+
api
[
'post-login-start'
],
{
captcha
:
this
.
showMobileCaptcha
?
this
.
form
.
captcha
:
''
,
// todo: 登录验证码
email
,
type
:
'mobile'
...
...
@@ -174,7 +176,7 @@ export default {
}
const
{
data
:
passwordResponse
}
=
await
this
.
$axios
.
post
(
apiDomain
+
'/auth/api'
+
api
[
'post-login-password'
],
{
.
post
(
this
.
UC_BASEURL
+
'/auth/api'
+
api
[
'post-login-password'
],
{
password
:
this
.
form
.
password
});
...
...
@@ -214,6 +216,7 @@ export default {
switchLogin
()
{
this
.
useMail
=
!
this
.
useMail
;
this
.
form
.
email
=
''
;
this
.
form
.
password
=
''
;
if
(
this
.
useMail
)
{
localStorage
.
setItem
(
'login-type'
,
'email'
);
this
.
showEmailCaptcha
=
false
;
...
...
src/components/ucenter/signUpEmail.vue
View file @
5c645564
<
template
>
<div>
邮箱注册页
</div>
<div
class=
"page reg"
>
<div
class=
"page-header"
>
<div
class=
"l"
@
click=
"goBack"
><span
class=
"icon-back"
><i
class=
"iconfont icon-fanhui"
></i></span></div>
<div
class=
"c"
>
注册
</div>
<div
class=
"r"
@
click=
"goLogin"
><span
class=
"txt abs-right"
>
登录
</span></div>
</div>
<div
class=
"page-content"
>
<div
v-if=
"step===1"
>
<h2
class=
"f-tac c-blue2 fs36 pt80 pb60"
>
使用邮箱地址注册
</h2>
<div
class=
"form-content"
>
<el-form
:model=
"regForm"
ref=
"regForm"
label-width=
"0px"
>
<el-form-item
prop=
"email"
label=
""
:rules=
"[
{ required: true, message: '请输入邮箱地址', trigger: 'blur' },{ type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur,change' }]">
<el-input
v-model=
"regForm.email"
placeholder=
"输入邮箱"
><i
slot=
"prefix"
class=
"iconfont icon-email"
></i></el-input>
</el-form-item>
<captcha
v-show=
"showEmailCaptcha"
:captcha=
"regForm.captcha"
ref=
"captchaEmail"
@
dispatchCaptcha=
"getCaptchaValue"
></captcha>
<el-form-item>
<div
class=
"btn-group full mt100"
>
<el-button
type=
"primary"
round
@
click=
"submitForm('regForm')"
>
提交
</el-button>
</div>
<!--
<div
class=
"f-tac"
>
<router-link
to=
""
class=
"c-blue1"
>
使用手机号注册>>
</router-link>
</div>
-->
</el-form-item>
</el-form>
</div>
</div>
<div
v-if=
"step===2"
>
123123
</div>
</div>
</div>
</
template
>
<
script
>
export
default
{
data
(){
return
{}
}
}
</
script
>
\ No newline at end of file
import
captcha
from
'@/components/ucenter/captcha'
export
default
{
name
:
'rega'
,
data
()
{
return
{
regForm
:
{
email
:
''
},
step
:
1
}
},
components
:{
captcha
,
},
mounted
()
{
},
methods
:
{
submitForm
(
formName
)
{
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
$router
.
replace
(
'/jump'
)
}
else
{
console
.
log
(
'error submit!!'
);
return
false
;
}
});
},
goBack
()
{
this
.
$router
.
go
(
-
1
)
},
goLogin
()
{
this
.
$router
.
replace
(
"/login"
)
}
},
}
</
script
>
<
style
>
</
style
>
src/store/index.js
View file @
5c645564
import
Vue
from
'vue'
;
import
Vuex
from
'vuex'
;
import
{
api
}
from
'@/components/ucenter/helpers.js'
;
import
axios
from
'axios'
;
import
{
api
}
from
'@/components/ucenter/helpers.js'
;
Vue
.
use
(
Vuex
);
import
dictionaries
from
'@/utils/dictionaries.js'
;
//字典
...
...
@@ -62,7 +63,7 @@ const mutations = {
},
FETCH_USER_SUCCESS
(
state
,
{
user
})
{
window
.
config
.
user
=
user
;
//
window.config.user = user;
state
.
user
=
user
;
},
...
...
@@ -81,20 +82,20 @@ const getters = {
user
:
state
=>
{
return
state
.
user
},
check
:
state
=>
{
let
hasLogged
=
state
.
user
&&
Boolean
(
state
.
user
.
uid
);
if
(
!
hasLogged
)
{
hasLogged
=
Boolean
(
JSON
.
parse
(
window
.
config
.
register
));
}
return
hasLogged
;
}
//
check: state => {
//
let hasLogged = state.user && Boolean(state.user.uid);
//
if (!hasLogged) {
//
hasLogged = Boolean(JSON.parse(window.config.register));
//
}
//
return hasLogged;
//
}
}
const
actions
=
{
async
fetchUser
({
commit
})
{
async
fetchUser
({
commit
})
{
try
{
const
{
data
}
=
await
axios
.
get
(
config
.
apiDomain
+
api
[
'get-userinfo'
]);
.
get
(
state
.
UC_BASEURL
+
'/auth/api'
+
api
[
'get-userinfo'
]);
if
(
data
.
err_no
)
{
throw
new
Error
(
'get userinfo fail'
);
...
...
@@ -109,19 +110,14 @@ const actions = {
}
},
updateUser
({
commit
},
payload
)
{
updateUser
({
commit
},
payload
)
{
commit
(
'UPDATE_USER'
,
payload
)
},
async
logout
({
commit
})
{
async
logout
({
commit
})
{
try
{
await
axios
.
get
(
'/logout'
)
}
catch
(
e
)
{}
commit
(
'LOGOUT'
)
}
}
...
...
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