loginMenu.vue
1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<template>
<div class="login-menu">
<div class="input-box">
<form v-on:submit.prevent="login">
<ul class="login-input-list">
<li>
<input type="text" v-model="username" placeholder="USERNAME" />
</li>
<li>
<input type="password" v-model="password" placeholder="PASSWORD" />
</li>
<li>
<button type="submit">login</button>
</li>
</ul>
</form>
</div>
</div>
</template>
<script>
import axios from 'axios'
export default {
data () {
return {
username: '',
password: ''
}
},
methods: {
login () {
axios
.post('/api/login', {
username: this.username,
password: this.password
})
.then(function (message) {
if (message.data === 'isExist') {
alert('isExist')
}
if (message.data === 'success') {
window.location.href = '/'
}
})
}
}
}
</script>
<style>
.login-menu {
position: absolute;
right: 150px;
top: 200px;
width: 400px;
height: 500px;
background-color: white;
border-radius: 4px;
box-shadow: 0 15px 30px 0 rgba(0, 0, 0, 0.08);
}
.login-menu .input-box {
height: 400px;
margin: 50px 25px 50px 25px;
width: 350px;
display: flex;
justify-content: center;
}
.login-input-list input {
font-size: 20px;
width: 300px;
height: 50px;
border-radius: 5px;
padding-left: 40px;
margin-top: 20px;
box-shadow: 0 10px 10px 0 rgba(0, 0, 0, 0.08);
}
.login-input-list button {
font-size: 20px;
width: 345px;
height: 50px;
border-radius: 5px;
margin-top: 20px;
box-shadow: 0 10px 10px 0 rgba(0, 0, 0, 0.08);
}
.login-input-list button:hover {
cursor: pointer;
}
</style>