1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-30 06:28:31 +09:00
misskey/src/client/app/mobile/views/pages/welcome.vue

167 lines
3.5 KiB
Vue
Raw Normal View History

2018-02-22 03:11:24 +09:00
<template>
2018-02-22 05:05:19 +09:00
<div class="welcome">
2018-04-27 19:12:15 +09:00
<div>
2018-06-14 07:22:50 +09:00
<img :src="$store.state.device.darkmode ? 'assets/title.dark.svg' : 'assets/title.light.svg'" alt="Misskey">
2018-04-27 19:12:15 +09:00
<div class="form">
2018-06-14 07:22:50 +09:00
<form @submit.prevent="onSubmit">
<ui-input v-model="username" type="text" pattern="^[a-zA-Z0-9_]+$" placeholder="ユーザー名" autofocus required @change="onUsernameChange">
<span>ユーザー名</span>
<span slot="prefix">@</span>
<span slot="suffix">@{{ host }}</span>
</ui-input>
<ui-input v-model="password" type="password" placeholder="パスワード" required>
<span>パスワード</span>
<span slot="prefix">%fa:lock%</span>
</ui-input>
<ui-input v-if="user && user.twoFactorEnabled" v-model="token" type="number" placeholder="トークン" required/>
<ui-button type="submit" :disabled="signing">{{ signing ? 'ログインしています' : 'ログイン' }}</ui-button>
</form>
2018-02-22 05:05:19 +09:00
<div>
2018-06-14 07:22:50 +09:00
<a :href="`${apiUrl}/signin/twitter`">Twitterでログイン</a>
2018-02-22 05:05:19 +09:00
</div>
</div>
2018-04-27 19:12:15 +09:00
<div class="tl">
<p>%fa:comments R% タイムラインを見てみる</p>
<mk-welcome-timeline/>
</div>
<div class="users">
2018-04-29 17:54:50 +09:00
<mk-avatar class="avatar" v-for="user in users" :key="user.id" :user="user"/>
2018-04-27 19:12:15 +09:00
</div>
<footer>
<small>{{ copyright }}</small>
</footer>
2018-02-22 05:05:19 +09:00
</div>
2018-02-22 03:11:24 +09:00
</div>
</template>
2018-02-22 05:05:19 +09:00
<script lang="ts">
import Vue from 'vue';
2018-06-14 06:29:01 +09:00
import { apiUrl, copyright, host } from '../../../config';
2018-02-22 05:05:19 +09:00
export default Vue.extend({
data() {
return {
signing: false,
user: null,
username: '',
password: '',
token: '',
2018-03-17 03:33:36 +09:00
apiUrl,
2018-03-17 23:01:17 +09:00
copyright,
2018-06-14 06:29:01 +09:00
users: [],
host
2018-02-22 05:05:19 +09:00
};
},
mounted() {
2018-03-17 23:01:17 +09:00
(this as any).api('users', {
sort: '+follower',
limit: 20
}).then(users => {
this.users = users;
});
2018-02-22 05:05:19 +09:00
},
methods: {
onUsernameChange() {
(this as any).api('users/show', {
username: this.username
}).then(user => {
this.user = user;
});
},
onSubmit() {
this.signing = true;
(this as any).api('signin', {
username: this.username,
password: this.password,
2018-04-08 03:58:11 +09:00
token: this.user && this.user.twoFactorEnabled ? this.token : undefined
2018-02-22 05:05:19 +09:00
}).then(() => {
location.reload();
}).catch(() => {
alert('something happened');
this.signing = false;
});
}
}
});
</script>
<style lang="stylus" scoped>
.welcome
2018-06-14 07:22:50 +09:00
background #fff
2018-02-22 05:05:19 +09:00
2018-04-27 19:12:15 +09:00
> div
padding 16px
margin 0 auto
max-width 500px
2018-02-22 05:05:19 +09:00
2018-06-14 07:22:50 +09:00
> img
display block
max-width 200px
margin 0 auto
2018-04-27 19:12:15 +09:00
.form
margin-bottom 16px
2018-06-14 07:22:50 +09:00
> form
padding 16px
2018-02-22 05:05:19 +09:00
2018-06-14 07:22:50 +09:00
button
display block
width 100%
padding 10px
margin 0
color #333
font-size 1em
2018-04-27 19:12:15 +09:00
text-align center
2018-06-14 07:22:50 +09:00
text-decoration none
text-shadow 0 1px 0 rgba(255, 255, 255, 0.9)
background-image linear-gradient(#fafafa, #eaeaea)
border 1px solid #ddd
border-bottom-color #cecece
border-radius 4px
&:active
background-color #767676
background-image none
border-color #444
box-shadow 0 1px 3px rgba(#000, 0.075), inset 0 0 5px rgba(#000, 0.2)
2018-03-17 03:33:36 +09:00
2018-04-27 19:12:15 +09:00
> .tl
background #fff
2018-04-29 08:51:17 +09:00
border solid 1px rgba(#000, 0.2)
2018-04-27 19:12:15 +09:00
border-radius 8px
overflow hidden
> p
margin 0
padding 12px 20px
color #555
background #f5f5f5
border-bottom solid 1px #ddd
2018-03-17 03:33:36 +09:00
2018-04-27 19:12:15 +09:00
> .mk-welcome-timeline
max-height 300px
overflow auto
2018-03-17 23:01:17 +09:00
2018-04-27 19:12:15 +09:00
> .users
margin 12px 0 0 0
2018-03-17 23:01:17 +09:00
> *
display inline-block
2018-04-27 19:12:15 +09:00
margin 4px
2018-04-29 17:54:50 +09:00
width 38px
height 38px
border-radius 6px
2018-03-17 03:33:36 +09:00
2018-04-27 19:12:15 +09:00
> footer
text-align center
color #fff
2018-03-17 23:01:17 +09:00
2018-04-27 19:12:15 +09:00
> small
display block
margin 16px 0 0 0
opacity 0.7
2018-03-17 03:33:36 +09:00
2018-02-22 05:05:19 +09:00
</style>