This commit is contained in:
syuilo 2019-02-25 20:08:56 +09:00
parent c0a60260c2
commit a2517d1a1d
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
3 changed files with 32 additions and 41 deletions

View file

@ -2,18 +2,23 @@
<div class="felqjxyj" :class="{ splash }"> <div class="felqjxyj" :class="{ splash }">
<div class="bg" ref="bg" @click="onBgClick"></div> <div class="bg" ref="bg" @click="onBgClick"></div>
<div class="main" ref="main"> <div class="main" ref="main">
<div class="icon" v-if="!input && !select && !user" :class="type"><fa :icon="icon"/></div> <template v-if="type == 'signin'">
<header v-if="title" v-html="title"></header> <mk-signin/>
<div class="body" v-if="text" v-html="text"></div> </template>
<ui-input v-if="input" v-model="inputValue" autofocus :type="input.type || 'text'" :placeholder="input.placeholder" @keydown="onInputKeydown"></ui-input> <template v-else>
<ui-input v-if="user" v-model="userInputValue" autofocus @keydown="onInputKeydown"><template #prefix>@</template></ui-input> <div class="icon" v-if="!input && !select && !user" :class="type"><fa :icon="icon"/></div>
<ui-select v-if="select" v-model="selectedValue"> <header v-if="title" v-html="title"></header>
<option v-for="item in select.items" :value="item.value">{{ item.text }}</option> <div class="body" v-if="text" v-html="text"></div>
</ui-select> <ui-input v-if="input" v-model="inputValue" autofocus :type="input.type || 'text'" :placeholder="input.placeholder" @keydown="onInputKeydown"></ui-input>
<ui-horizon-group no-grow class="buttons fit-bottom" v-if="!splash"> <ui-input v-if="user" v-model="userInputValue" autofocus @keydown="onInputKeydown"><template #prefix>@</template></ui-input>
<ui-button @click="ok" primary :autofocus="!input && !select && !user">OK</ui-button> <ui-select v-if="select" v-model="selectedValue">
<ui-button @click="cancel" v-if="showCancelButton || input || select || user">Cancel</ui-button> <option v-for="item in select.items" :value="item.value">{{ item.text }}</option>
</ui-horizon-group> </ui-select>
<ui-horizon-group no-grow class="buttons fit-bottom" v-if="!splash">
<ui-button @click="ok" primary :autofocus="!input && !select && !user">{{ $t('@.ok') }}</ui-button>
<ui-button @click="cancel" v-if="showCancelButton || input || select || user">{{ $t('@.cancel') }}</ui-button>
</ui-horizon-group>
</template>
</div> </div>
</div> </div>
</template> </template>
@ -23,8 +28,10 @@ import Vue from 'vue';
import anime from 'animejs'; import anime from 'animejs';
import { faTimesCircle, faQuestionCircle } from '@fortawesome/free-regular-svg-icons'; import { faTimesCircle, faQuestionCircle } from '@fortawesome/free-regular-svg-icons';
import parseAcct from "../../../../../misc/acct/parse"; import parseAcct from "../../../../../misc/acct/parse";
import i18n from '../../../i18n';
export default Vue.extend({ export default Vue.extend({
i18n: i18n(),
props: { props: {
type: { type: {
type: String, type: String,

View file

@ -1,16 +1,16 @@
<template> <template>
<form class="mk-signin" :class="{ signing }" @submit.prevent="onSubmit"> <form class="mk-signin" :class="{ signing }" @submit.prevent="onSubmit">
<div class="avatar" :style="{ backgroundImage: user ? `url('${ user.avatarUrl }')` : null }" v-show="withAvatar"></div> <div class="avatar" :style="{ backgroundImage: user ? `url('${ user.avatarUrl }')` : null }" v-show="withAvatar"></div>
<ui-input v-model="username" type="text" pattern="^[a-zA-Z0-9_]+$" spellcheck="false" autofocus required @input="onUsernameChange" styl="fill"> <ui-input v-model="username" type="text" pattern="^[a-zA-Z0-9_]+$" spellcheck="false" autofocus required @input="onUsernameChange">
<span>{{ $t('username') }}</span> <span>{{ $t('username') }}</span>
<template #prefix>@</template> <template #prefix>@</template>
<template #suffix>@{{ host }}</template> <template #suffix>@{{ host }}</template>
</ui-input> </ui-input>
<ui-input v-model="password" type="password" :with-password-toggle="true" required styl="fill"> <ui-input v-model="password" type="password" :with-password-toggle="true" required>
<span>{{ $t('password') }}</span> <span>{{ $t('password') }}</span>
<template #prefix><fa icon="lock"/></template> <template #prefix><fa icon="lock"/></template>
</ui-input> </ui-input>
<ui-input v-if="user && user.twoFactorEnabled" v-model="token" type="number" required styl="fill"> <ui-input v-if="user && user.twoFactorEnabled" v-model="token" type="number" required>
<span>{{ $t('@.2fa') }}</span> <span>{{ $t('@.2fa') }}</span>
<template #prefix><fa icon="gavel"/></template> <template #prefix><fa icon="gavel"/></template>
</ui-input> </ui-input>

View file

@ -10,8 +10,8 @@
<p v-html="description || this.$t('@.about')"></p> <p v-html="description || this.$t('@.about')"></p>
<router-link class="signup" to="/signup">{{ $t('signup') }}</router-link> <router-link class="signup" to="/signup">{{ $t('signup') }}</router-link>
</div> </div>
<div class="login"> <div class="signin">
<mk-signin :with-avatar="false"/> <a href="/signin" @click.prevent="signin()">{{ $t('signin') }}</a>
</div> </div>
<div class="tl"> <div class="tl">
<mk-welcome-timeline/> <mk-welcome-timeline/>
@ -120,6 +120,13 @@ export default Vue.extend({
const files = concat(notes.map((n: any): any[] => n.files)); const files = concat(notes.map((n: any): any[] => n.files));
this.photos = files.filter(f => image.includes(f.type)).slice(0, 6); this.photos = files.filter(f => image.includes(f.type)).slice(0, 6);
}); });
},
methods: {
signin() {
this.$root.dialog({
type: 'signin'
});
}
} }
}); });
</script> </script>
@ -185,32 +192,9 @@ export default Vue.extend({
> .signup > .signup
font-weight bold font-weight bold
> .login > .signin
margin 16px 0 margin 16px 0
> form
button
display block
width 100%
padding 10px
margin 0
color #333
font-size 1em
text-align center
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)
> .tl > .tl
margin 16px 0 margin 16px 0