Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue_chat
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hứa Minh Thành
vue_chat
Commits
18bf7b72
Commit
18bf7b72
authored
Dec 25, 2020
by
Hứa Minh Thành
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upload avatar
parent
67ea6321
Pipeline
#1161
canceled with stages
in 0 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
27 deletions
+36
-27
components/elements/menu.vue
+7
-3
pages/regirst/index.vue
+23
-18
store/index.js
+6
-6
No files found.
components/elements/menu.vue
View file @
18bf7b72
...
@@ -9,13 +9,12 @@
...
@@ -9,13 +9,12 @@
</li>
</li>
<li>
<li>
<nuxt-link
to=
"/regirst"
tag=
"a"
>
{{
<nuxt-link
to=
"/regirst"
tag=
"a"
>
{{
!
is
Login
?
"Regirst"
:
"My Page"
!
check
Login
?
"Regirst"
:
"My Page"
}}
</nuxt-link>
}}
</nuxt-link>
</li>
</li>
<li>
<li>
<nuxt-link
to=
"/login"
tag=
"a"
v-if=
"!
is
Login"
>
Login
</nuxt-link>
<nuxt-link
to=
"/login"
tag=
"a"
v-if=
"!
check
Login"
>
Login
</nuxt-link>
<a
href=
"/login"
v-else
@
click
.
prevent=
"logOut()"
>
Logout
</a>
<a
href=
"/login"
v-else
@
click
.
prevent=
"logOut()"
>
Logout
</a>
<!--
<nuxt-link
to=
""
tag=
"a"
"
></nuxt-link>
-->
</li>
</li>
<li>
<li>
<a
href=
""
style=
"pointer-events: none; display: inline-block"
>
Users
</a>
<a
href=
""
style=
"pointer-events: none; display: inline-block"
>
Users
</a>
...
@@ -49,6 +48,11 @@ export default {
...
@@ -49,6 +48,11 @@ export default {
});
});
},
},
},
},
computed
:
{
checkLogin
:
function
()
{
return
(
this
.
$store
.
state
.
user
!==
null
)
?
true
:
false
;
}
},
created
:
function
()
{
created
:
function
()
{
if
(
this
.
$store
.
state
.
user
!==
null
)
{
if
(
this
.
$store
.
state
.
user
!==
null
)
{
this
.
isLogin
=
true
;
this
.
isLogin
=
true
;
...
...
pages/regirst/index.vue
View file @
18bf7b72
...
@@ -11,14 +11,7 @@
...
@@ -11,14 +11,7 @@
@
change=
"previewImage"
@
change=
"previewImage"
class=
"btn btn-success"
class=
"btn btn-success"
/>
/>
<input
<h1>
{{
user
.
title
}}
</h1>
type=
"file"
ref=
"input1"
style=
"display: none"
@
change=
"previewImage"
accept=
"image/*"
/>
<h1>
{{
title
}}
</h1>
</div>
</div>
<!-- Registeration Form -->
<!-- Registeration Form -->
<div
class=
"col-md-7 col-lg-6 ml-auto"
>
<div
class=
"col-md-7 col-lg-6 ml-auto"
>
...
@@ -122,18 +115,15 @@ export default {
...
@@ -122,18 +115,15 @@ export default {
userSignUp
:
function
(
err
)
{
userSignUp
:
function
(
err
)
{
if
(
this
.
user
.
isLogin
)
{
if
(
this
.
user
.
isLogin
)
{
// upload img
// upload img
this
.
onUpload
();
// update info
if
(
this
.
imageData
)
{
this
.
$store
this
.
onUpload
().
then
(
url
=>
{
.
dispatch
(
"updateInfoUser"
,
{
this
.
commonUpdateInfo
();
user
:
this
.
user
,
})
.
then
((
res
)
=>
{
this
.
user
.
email
=
""
;
this
.
user
.
password
=
""
;
this
.
updateShowInfo
();
});
});
}
else
{
}
else
{
this
.
commonUpdateInfo
();
}
}
else
{
// regist
// regist
this
.
$store
this
.
$store
.
dispatch
(
"signUp"
,
{
.
dispatch
(
"signUp"
,
{
...
@@ -159,6 +149,7 @@ export default {
...
@@ -159,6 +149,7 @@ export default {
},
},
// upload image to storage
// upload image to storage
onUpload
()
{
onUpload
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
storageRef
=
firebase
const
storageRef
=
firebase
.
storage
()
.
storage
()
.
ref
(
`
${
this
.
imageData
.
name
}
`
)
.
ref
(
`
${
this
.
imageData
.
name
}
`
)
...
@@ -175,16 +166,30 @@ export default {
...
@@ -175,16 +166,30 @@ export default {
()
=>
{
()
=>
{
this
.
uploadValue
=
100
;
this
.
uploadValue
=
100
;
storageRef
.
snapshot
.
ref
.
getDownloadURL
().
then
((
url
)
=>
{
storageRef
.
snapshot
.
ref
.
getDownloadURL
().
then
((
url
)
=>
{
resolve
(
url
)
this
.
user
.
photoURL
=
url
;
this
.
user
.
photoURL
=
url
;
});
});
}
}
);
);
});
},
},
previewImage
(
event
)
{
previewImage
(
event
)
{
this
.
uploadValue
=
0
;
this
.
uploadValue
=
0
;
this
.
imageData
=
event
.
target
.
files
[
0
];
this
.
imageData
=
event
.
target
.
files
[
0
];
this
.
user
.
photoURL
=
URL
.
createObjectURL
(
this
.
imageData
);
this
.
user
.
photoURL
=
URL
.
createObjectURL
(
this
.
imageData
);
},
},
commonUpdateInfo
()
{
// update info
this
.
$store
.
dispatch
(
"updateInfoUser"
,
{
userUpdate
:
this
.
user
,
})
.
then
((
res
)
=>
{
this
.
user
.
email
=
""
;
this
.
user
.
password
=
""
;
this
.
updateShowInfo
();
});
},
},
},
components
:
{
components
:
{
ValidationObserver
,
ValidationObserver
,
...
...
store/index.js
View file @
18bf7b72
...
@@ -34,13 +34,13 @@ const createStore = () => {
...
@@ -34,13 +34,13 @@ const createStore = () => {
return
auth
.
signInWithEmailAndPassword
(
email
,
password
);
return
auth
.
signInWithEmailAndPassword
(
email
,
password
);
},
},
updateInfoUser
({
commit
},
{
user
})
{
updateInfoUser
({
commit
},
{
user
Update
})
{
return
auth
.
currentUser
.
updateProfile
({
return
auth
.
currentUser
.
updateProfile
({
displayName
:
user
.
name
,
displayName
:
user
Update
.
name
,
email
:
user
.
email
,
email
:
user
Update
.
email
,
photoURL
:
user
.
photoURL
photoURL
:
user
Update
.
photoURL
}).
then
(
function
()
{
}).
then
(
res
=>
{
console
.
log
(
'Updated'
);
// commit('setUser', userUpdate)
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
error
)
console
.
log
(
error
)
});
});
...
...
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