Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
CO-OP Search
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kittisak Maneewong
CO-OP Search
Commits
cb96a4e7
Commit
cb96a4e7
authored
Apr 13, 2019
by
Kittisak Maneewong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change login page to dialog
parent
919023ab
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
225 additions
and
35 deletions
+225
-35
app.js
public/js/app.js
+0
-0
Dialog.vue
resources/js/components/Dialog.vue
+21
-0
Snackbar.vue
resources/js/components/Snackbar.vue
+47
-0
Toolbar.vue
resources/js/components/Toolbar.vue
+12
-2
AppLayout.vue
resources/js/layouts/AppLayout.vue
+4
-1
route.js
resources/js/route.js
+2
-0
store.js
resources/js/store.js
+34
-32
Login.vue
resources/js/views/Login.vue
+105
-0
Register.vue
resources/js/views/Register.vue
+0
-0
No files found.
public/js/app.js
View file @
cb96a4e7
This source diff could not be displayed because it is too large. You can
view the blob
instead.
resources/js/components/Dialog.vue
0 → 100644
View file @
cb96a4e7
<
template
>
<v-dialog
v-model=
"dialog"
transition=
"dialog-bottom-transition"
width=
"40%"
>
<slot></slot>
</v-dialog>
</
template
>
<
script
>
export
default
{
computed
:
{
dialog
:
{
get
()
{
return
this
.
$store
.
getters
.
getDialog
},
set
(
value
)
{
this
.
$store
.
commit
(
'setDialog'
,
value
)
}
}
}
}
</
script
>
resources/js/components/Snackbar.vue
0 → 100644
View file @
cb96a4e7
<
template
>
<v-snackbar
v-model=
"show"
:color=
"color"
:timeout=
"6000"
>
{{
text
}}
<v-btn
dark
flat
@
click=
"snackbar = false"
>
ปิด
</v-btn>
</v-snackbar>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
snackbar
:
false
}
},
computed
:
{
show
:
{
get
()
{
return
this
.
$store
.
getters
.
getSnackbar
.
show
},
set
(
value
)
{
this
.
$store
.
commit
(
'setSnackbar'
,
{
show
:
false
,
color
:
null
,
text
:
null
})
}
},
color
()
{
return
this
.
$store
.
getters
.
getSnackbar
.
color
},
text
()
{
return
this
.
$store
.
getters
.
getSnackbar
.
text
}
}
}
</
script
>
resources/js/components/Toolbar.vue
View file @
cb96a4e7
...
@@ -6,8 +6,11 @@
...
@@ -6,8 +6,11 @@
<v-spacer></v-spacer>
<v-spacer></v-spacer>
<v-btn
small=
""
dark
color=
"deep-orange darken-4"
class=
"elevation-0"
@
click=
"$router.push('/employer/login')"
>
สำหรับผู้ประกอบการ
</v-btn>
<v-btn
small=
""
dark
color=
"deep-orange darken-4"
class=
"elevation-0"
@
click=
"$router.push('/employer/login')"
>
สำหรับผู้ประกอบการ
</v-btn>
<v-divider
inset
vertical
></v-divider>
<v-divider
inset
vertical
></v-divider>
<v-btn
round
small
outline
color=
"deep-orange darken-4"
@
click=
"$router.push('/account')"
>
<v-btn
small
outline
color=
"deep-orange darken-4"
@
click
.
stop=
"$store.commit('setDialog', !$store.getters.getDialog)"
>
<v-icon>
person
</v-icon>
เข้าสู่ระบบ / สมัครสมาชิก
<v-icon>
person
</v-icon>
เข้าสู่ระบบ
</v-btn>
<v-btn
small
outline
color=
"deep-orange darken-4"
@
click=
"$router.push('/register')"
>
<v-icon>
account_box
</v-icon>
ลงทะเบียน
</v-btn>
</v-btn>
</v-toolbar>
</v-toolbar>
</v-flex>
</v-flex>
...
@@ -69,12 +72,19 @@
...
@@ -69,12 +72,19 @@
</v-toolbar>
</v-toolbar>
</v-flex>
</v-flex>
</v-layout>
</v-layout>
<login></login>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
Login
from
'../views/Login.vue'
;
import
Register
from
'../views/Register.vue'
;
export
default
{
export
default
{
props
:
[
'page'
],
props
:
[
'page'
],
components
:
{
'login'
:
Login
,
'register'
:
Register
},
data
()
{
data
()
{
return
{
return
{
responsive
:
false
responsive
:
false
...
...
resources/js/layouts/AppLayout.vue
View file @
cb96a4e7
...
@@ -13,16 +13,19 @@
...
@@ -13,16 +13,19 @@
</v-container>
</v-container>
</v-content>
</v-content>
<Footer></Footer>
<Footer></Footer>
<Snackbar></Snackbar>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
Toolbar
from
'../components/Toolbar.vue'
;
import
Toolbar
from
'../components/Toolbar.vue'
;
import
Footer
from
'../components/Footer.vue'
;
import
Footer
from
'../components/Footer.vue'
;
import
Snackbar
from
'../components/Snackbar.vue'
;
export
default
{
export
default
{
components
:
{
components
:
{
Toolbar
,
Toolbar
,
Footer
Footer
,
Snackbar
}
}
}
}
</
script
>
</
script
>
...
...
resources/js/route.js
View file @
cb96a4e7
...
@@ -8,6 +8,8 @@ import EmployerLayout from './layouts/EmployerLayout.vue';
...
@@ -8,6 +8,8 @@ import EmployerLayout from './layouts/EmployerLayout.vue';
import
Home
from
'./views/Home.vue'
;
import
Home
from
'./views/Home.vue'
;
import
Account
from
'./views/Account.vue'
;
import
Account
from
'./views/Account.vue'
;
import
Login
from
'./views/Login.vue'
;
import
Register
from
'./views/Register.vue'
import
LoginEmployer
from
'./views/LoginEmployer.vue'
;
import
LoginEmployer
from
'./views/LoginEmployer.vue'
;
import
PageNotFound
from
'./views/PageNotFound.vue'
;
import
PageNotFound
from
'./views/PageNotFound.vue'
;
import
Addjob
from
'./views/Addjob.vue'
;
import
Addjob
from
'./views/Addjob.vue'
;
...
...
resources/js/store.js
View file @
cb96a4e7
...
@@ -10,9 +10,12 @@ export default new Vuex.Store({
...
@@ -10,9 +10,12 @@ export default new Vuex.Store({
message
:
'Kittisak Maneewong'
,
message
:
'Kittisak Maneewong'
,
jwt
:
localStorage
.
getItem
(
'access_token'
)
||
null
,
jwt
:
localStorage
.
getItem
(
'access_token'
)
||
null
,
jwt_employer
:
localStorage
.
getItem
(
'access_token_employer'
)
||
null
,
jwt_employer
:
localStorage
.
getItem
(
'access_token_employer'
)
||
null
,
loading1
:
false
,
dialog
:
false
,
loading2
:
false
,
snackbar
:
{
error
:
null
show
:
false
,
color
:
null
,
text
:
null
}
},
},
mutations
:
{
mutations
:
{
setJwt
(
state
,
payload
)
{
setJwt
(
state
,
payload
)
{
...
@@ -21,36 +24,38 @@ export default new Vuex.Store({
...
@@ -21,36 +24,38 @@ export default new Vuex.Store({
setJwtEmployer
(
state
,
payload
)
{
setJwtEmployer
(
state
,
payload
)
{
state
.
jwt_employer
=
payload
state
.
jwt_employer
=
payload
},
},
setLoading1
(
state
,
payload
)
{
setDialog
(
state
,
payload
)
{
state
.
loading1
=
payload
state
.
dialog
=
payload
},
setLoading2
(
state
,
payload
)
{
state
.
loading2
=
payload
},
},
set
Erro
r
(
state
,
payload
)
{
set
Snackba
r
(
state
,
payload
)
{
state
.
erro
r
=
payload
state
.
snackba
r
=
payload
}
}
},
},
actions
:
{
actions
:
{
login
({
commit
},
payload
)
{
login
({
commit
},
payload
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
post
(
'api/auth/login'
,
payload
)
axios
.
post
(
'api/auth/login'
,
payload
)
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
payload
.
role
==
1
)
{
if
(
payload
.
role
==
1
)
{
localStorage
.
setItem
(
'access_token'
,
res
.
data
.
token
)
localStorage
.
setItem
(
'access_token'
,
res
.
data
.
token
)
commit
(
'setJwt'
,
res
.
data
.
token
)
commit
(
'setJwt'
,
res
.
data
.
token
)
router
.
push
(
'/'
)
}
else
{
}
else
{
localStorage
.
setItem
(
'access_token_employer'
,
res
.
data
.
token
)
localStorage
.
setItem
(
'access_token_employer'
,
res
.
data
.
token
)
commit
(
'setJwtEmployer'
,
res
.
data
.
token
)
commit
(
'setJwtEmployer'
,
res
.
data
.
token
)
}
}
commit
(
'setSnackbar'
,
{
console
.
log
(
res
)
show
:
true
,
resolve
(
res
)
color
:
'success'
,
})
text
:
'เข้าสู่ระบบสำเร็จ!'
.
catch
(
err
=>
{
console
.
log
(
err
.
response
)
reject
(
err
.
response
)
})
})
commit
(
'setDialog'
,
false
)
console
.
log
(
res
)
resolve
(
res
)
})
.
catch
(
err
=>
{
console
.
log
(
err
.
response
)
reject
(
err
.
response
)
})
})
})
},
},
register
({
commit
},
payload
)
{
register
({
commit
},
payload
)
{
...
@@ -83,14 +88,11 @@ export default new Vuex.Store({
...
@@ -83,14 +88,11 @@ export default new Vuex.Store({
getJwtEmployer
(
state
)
{
getJwtEmployer
(
state
)
{
return
state
.
jwt_employer
;
return
state
.
jwt_employer
;
},
},
getLoading1
(
state
)
{
getDialog
(
state
)
{
return
state
.
loading1
return
state
.
dialog
},
getLoading2
(
state
)
{
return
state
.
loading2
},
},
get
Erro
r
(
state
)
{
get
Snackba
r
(
state
)
{
return
state
.
erro
r
return
state
.
snackba
r
}
}
}
}
});
});
resources/js/views/Login.vue
0 → 100644
View file @
cb96a4e7
<
template
>
<div>
<Dialog>
<v-card>
<v-toolbar
dark
color=
"deep-orange darken-4"
flat
>
<v-toolbar-title>
เข้าสู่ระบบ
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn
icon
@
click=
"$store.commit('setDialog', false)"
>
<v-icon>
close
</v-icon>
</v-btn>
</v-toolbar>
<v-layout
row
wrap
justify-center
>
<v-card-text>
<v-container
grid-list-md
text-xs-center
>
<v-layout
row
wrap
>
<v-flex>
<!--
<v-alert
:value=
"true"
color=
"error"
outline
>
This is a error alert.
</v-alert>
-->
<v-form
@
submit
.
prevent=
"login()"
ref=
"login"
>
<v-text-field
label=
"อีเมล"
color=
"deep-orange darken-4"
type=
"email"
v-model=
"loginData.email_users"
:rules=
"clickLogin ? [rules.required, rules.email] : []"
required
></v-text-field>
<v-text-field
label=
"รหัสผ่าน"
color=
"deep-orange darken-4"
v-model=
"loginData.password"
:append-icon=
"showPassword ? 'visibility' : 'visibility_off'"
:type=
"showPassword ? 'text' : 'password'"
@
click:append=
"showPassword = !showPassword"
:rules=
"clickLogin ? [rules.required] : []"
required
></v-text-field>
<p
class=
"text-xs-right"
><router-link
to=
"/"
class=
"body-2 font-weight-medium"
>
ลืมรหัสผ่าน?
</router-link></p>
<v-btn
color=
"deep-orange darken-4"
large
dark
block
type=
"submit"
>
เข้าสู่ระบบ
</v-btn>
</v-form>
<div
class=
"my-3"
><span
class=
"font-weight-bold"
>
หรือ
</span></div>
<v-btn
color=
"primary"
block
><v-icon>
fab fa-facebook
</v-icon>
เข้าสู่ระบบ Facebook
</v-btn>
<v-btn
color=
"deep-orange"
class=
"white--text"
block
><v-icon>
fab fa-google
</v-icon>
เข้าสู่ระบบ Google
</v-btn>
</v-flex>
</v-layout>
</v-container>
</v-card-text>
</v-layout>
</v-card>
</Dialog>
</div>
</
template
>
<
script
>
import
Dialog
from
'../components/Dialog.vue'
;
export
default
{
components
:
{
Dialog
},
data
()
{
return
{
loginData
:
{
email_users
:
''
,
password
:
''
,
role
:
1
},
showPassword
:
false
,
clickLogin
:
false
,
rules
:
{
required
:
v
=>
!!
v
||
'จำเป็นต้องกรอก'
,
email
:
v
=>
/^
(([^
<>()[
\]\\
.,;:
\s
@"
]
+
(\.[^
<>()[
\]\\
.,;:
\s
@"
]
+
)
*
)
|
(
".+"
))
@
((\[[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}\.[
0-9
]{1,3}
]
)
|
(([
a-zA-Z
\-
0-9
]
+
\.)
+
[
a-zA-Z
]{2,}))
$/
.
test
(
v
)
||
'รูปแบบอีเมลล์ไม่ถูกต้อง'
}
}
},
methods
:
{
login
()
{
this
.
clickLogin
=
true
if
(
this
.
$refs
.
login
.
validate
()
&&
this
.
loginData
.
email_users
!==
''
&&
this
.
loginData
.
password
!==
''
)
{
this
.
$store
.
dispatch
(
'login'
,
this
.
loginData
)
.
then
(
res
=>
{
this
.
clickLogin
=
false
this
.
loginData
=
{
email_users
:
''
,
password
:
''
,
role
:
1
}
})
}
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
a
{
text-decoration
:
none
;
color
:
#000
;
}
</
style
>
resources/js/views/Register.vue
0 → 100644
View file @
cb96a4e7
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