Skip to content
This repository was archived by the owner on Jun 14, 2021. It is now read-only.

Commit f6d29da

Browse files
committed
feat: support sign up
1 parent 9a98852 commit f6d29da

File tree

5 files changed

+67
-3
lines changed

5 files changed

+67
-3
lines changed

src/App.vue

+6
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@
7171
<a-menu-item key="login">
7272
<a-icon type="login" />
7373
<span>Login</span>
74+
<router-link :to="{ name: 'login' }" />
75+
</a-menu-item>
76+
<a-menu-item key="signup">
77+
<a-icon type="user-add" />
78+
<span>Sign Up</span>
79+
<router-link :to="{ name: 'signup' }" />
7480
</a-menu-item>
7581
</template>
7682
</a-menu>

src/components/MetadataList.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
<div v-if="items.length === 0">
1616
<a-empty />
1717
</div>
18-
<waterfall :line-gap="370" :align="'center'" :watch="items">
18+
<waterfall :line-gap="320" :align="'center'" :watch="items">
1919
<waterfall-slot
2020
v-for="item in items"
2121
:key="item.id"
2222
:height="435"
23-
:width="370"
23+
:width="300"
2424
>
2525
<MetadataListVideoCard
2626
:data="item"

src/components/MetadataListVideoCard.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<a-card hoverable style="width: 350px">
2+
<a-card hoverable style="width: 300px">
33
<img
44
alt="cover"
55
class="cover"

src/components/SignUp.vue

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<template>
2+
<div>
3+
<h1>Sign Up</h1>
4+
5+
<div style="max-width: 350px; display: inline-block;">
6+
<a-input v-model="username" placeholder="Username" />
7+
<br /><br />
8+
<a-input v-model="password" type="password" placeholder="Password" @keyup.enter="handleSubmit" />
9+
<br /><br />
10+
<a-input v-model="code" placeholder="Invitation Code" />
11+
<br /><br />
12+
<a-button v-on:click="handleSubmit" type="primary">Sign up</a-button>
13+
</div>
14+
</div>
15+
</template>
16+
17+
<script>
18+
export default {
19+
data: () => {
20+
return {
21+
username: '',
22+
password: '',
23+
code: ''
24+
}
25+
},
26+
27+
methods: {
28+
handleSubmit: function() {
29+
this.axios.post(this.apiHost + '/auth/signup', {
30+
username: this.username,
31+
password: this.password,
32+
code: this.code
33+
}).then((res) => {
34+
res = res.data
35+
36+
if (res.code === 0) {
37+
this.$message.success('Success')
38+
this.$router.push({ name: 'login' })
39+
return
40+
}
41+
42+
this.$message.error(res.msg)
43+
})
44+
}
45+
},
46+
47+
created: () => {
48+
document.title = 'Sign Up | JAVClub'
49+
}
50+
}
51+
</script>

src/main.js

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import SeriesList from './components/SeriesList'
2222
import Profile from './components/Profile'
2323
import Login from './components/Login'
2424
import Admin from './components/Admin'
25+
import SignUp from './components/SignUp'
2526

2627
axios.defaults.withCredentials = true
2728

@@ -100,6 +101,12 @@ const routes = [
100101
path: '/login',
101102
component: Login
102103
}
104+
,
105+
{
106+
name: 'signup',
107+
path: '/signup',
108+
component: SignUp
109+
}
103110
]
104111

105112
const router = new VueRouter({

0 commit comments

Comments
 (0)