Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-CloudComputing
/
D_Team_Khuloud
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
최동원
2020-05-26 19:50:19 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8951751baad0ba452843c2d1ed36e498f003d12b
8951751b
1 parent
8e66b6ce
error fix
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
57 deletions
front-end/src/api/index.js
front-end/src/components/LoginForm.vue
front-end/src/components/SignupForm.vue
front-end/src/components/ToolView.vue
front-end/src/store/index.js
front-end/src/api/index.js
View file @
8951751
...
...
@@ -5,11 +5,13 @@ const instance = axios.create({
});
function
registerUser
(
userData
)
{
return
instance
.
post
(
'RegistUser'
,
userData
);
// const url = 'http://localhost:3000/api/signup'
return
axios
.
post
(
'/api/RegistUser'
,
userData
);
}
function
loginUser
(
userData
)
{
return
instance
.
post
(
'login'
,
userData
);
// const url = 'http://localhost:3000/api/login'
return
axios
.
post
(
'/api/login'
,
userData
);
}
export
{
registerUser
,
loginUser
};
\ No newline at end of file
...
...
front-end/src/components/LoginForm.vue
View file @
8951751
...
...
@@ -22,23 +22,10 @@
>
<v-toolbar-title>KhuLoud</v-toolbar-title>
<v-spacer></v-spacer>
<!-- <v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
:href="source"
icon
large
target="_blank"
v-on="on"
>
<v-icon>mdi-code-tags</v-icon>
</v-btn>
</template>
<span>Source</span>
</v-tooltip> -->
</v-toolbar>
<v-card-text>
<v-form
@submit.prevent="submitForm"
>
<v-form >
<v-text-field
label="ID"
name="ID"
...
...
@@ -57,8 +44,7 @@
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<!-- <v-btn color="primary" @click = "$router.push({name: 'RegistUser'})">Regist</v-btn> -->
<v-btn color="primary" :disabled="!id || !password" router :to="{name: 'Main'}" exact>Login</v-btn>
<v-btn color="primary" :disabled="!id || !password" @click="submitForm">Login</v-btn>
</v-card-actions>
</v-card>
</v-col>
...
...
@@ -69,7 +55,7 @@
</template>
<script>
import { loginUser } from '../api/index'
export default {
data() {
...
...
@@ -81,24 +67,27 @@
methods: {
async submitForm(){
try {
const us
d
erData = {
id: this.id,
password
: this.password
const userData = {
user_
id: this.id,
user_pw
: this.password
};
const { data } = await loginUser(userData);
this.$store.commit('setid', data.user.userid);
console.log(data);
this.$store.commit('setId', data.user_id);
this.$router.push('/main');
} catch (error) {
console.log("에러");
console.log(error.response.data);
} finally {
this.initForm();
}
}
},
initForm(){
},
initForm(){
this.id ='';
this.password='';
}
}
},
}
</script>
...
...
front-end/src/components/SignupForm.vue
View file @
8951751
...
...
@@ -24,7 +24,7 @@
<v-spacer></v-spacer>
</v-toolbar>
<v-card-text>
<v-form
@submit.prevent="submitForm"
>
<v-form>
<v-text-field
label="ID"
v-model="id"
...
...
@@ -49,7 +49,6 @@
<v-text-field
label="E-mail"
v-model="email"
:rules="emailRules"
name="Email"
></v-text-field>
...
...
@@ -62,7 +61,7 @@
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" :disabled="!id || !password || !name || !email || !contact" @click
= "$router.push({name: 'Login'})
">Regist</v-btn>
<v-btn color="primary" :disabled="!id || !password || !name || !email || !contact" @click
="submitForm
">Regist</v-btn>
</v-card-actions>
</v-card>
</v-col>
...
...
@@ -73,6 +72,8 @@
</template>
<script>
import { registerUser } from '../api/index'
export default {
data() {
return {
...
...
@@ -86,17 +87,19 @@
methods: {
async submitForm() {
try {
const us
d
erData = {
id: this.id,
password
: this.password,
name: this.name,
email: this.email,
contact
: this.contact
const userData = {
user_
id: this.id,
user_pw
: this.password,
user_
name: this.name,
user_
email: this.email,
user_phone
: this.contact
};
const { data } = await registerUser(userData);
console.log("회원가입 완료");
this.$router.push('/');
} catch (error) {
console.log("에러");
console.log(error.response.data);
} finally{
this.initForm();
...
...
front-end/src/components/ToolView.vue
View file @
8951751
...
...
@@ -4,6 +4,7 @@
v-model="drawer"
:clipped="$vuetify.breakpoint.lgAndUp"
app
v-if="isUserLogin"
>
<v-list dense>
<v-list-item router :to="{name: 'Main'}" exact>
...
...
@@ -88,10 +89,8 @@
color="blue darken-3"
dark
>
<!-- <template v-if="isUserLogin">
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
</template> -->
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<v-app-bar-nav-icon @click.stop="drawer = !drawer" v-if="isUserLogin"></v-app-bar-nav-icon>
<v-toolbar-title
style="width: 300px"
class="ml-0 pl-4"
...
...
@@ -111,32 +110,20 @@
<template v-else>
<div></div>
</template>
<!-- <v-text-field
v-if="isUserLogin"
flat
solo-inverted
hide-details
prepend-inner-icon="mdi-magnify"
label="전체 검색"
class="hidden-sm-and-down"
></v-text-field> -->
<v-spacer></v-spacer>
<template v-if="isUserLogin">
<v-btn icon @click = "logoutUser">
<v-icon>m
id
-login</v-icon>
<v-icon>m
di
-login</v-icon>
</v-btn>
</template>
<template v-else>
<v-btn icon @click = "$router.push({name: 'Login'})">
<v-icon>mdi-login</v-icon>
</v-btn>
<v-btn icon @click
=
"$router.push({name: 'RegistUser'})">
<v-btn icon @click
=
"$router.push({name: 'RegistUser'})">
<v-icon>mdi-account</v-icon>
</v-btn>
</template>
<!-- <v-btn icon @click = "$router.push({name: 'Login'})">
<v-icon>mdi-login</v-icon>
</v-btn> -->
</v-app-bar>
<v-content>
<v-container
...
...
@@ -272,7 +259,7 @@ export default {
}),
computed: {
isUserLogin(){
return this.$store.getters.is
User
Login;
return this.$store.getters.isLogin;
},
},
methods: {
...
...
front-end/src/store/index.js
View file @
8951751
...
...
@@ -9,7 +9,7 @@ export default new Vuex.Store({
},
mutations
:
{
setId
(
state
,
userid
){
state
.
id
=
id
;
state
.
id
=
user
id
;
},
clearid
(
state
){
state
.
id
=
''
;
...
...
Please
register
or
login
to post a comment