2018-02-12 23:17:08 +09:00
|
|
|
<template>
|
2018-02-20 23:22:19 +09:00
|
|
|
<div class="profile">
|
2018-02-12 23:17:08 +09:00
|
|
|
<label class="avatar ui from group">
|
2018-04-15 01:04:40 +09:00
|
|
|
<p>%i18n:@avatar%</p>
|
2018-07-24 23:43:14 +09:00
|
|
|
<img class="avatar" :src="$store.state.i.avatarUrl" alt="avatar"/>
|
2018-04-15 01:04:40 +09:00
|
|
|
<button class="ui" @click="updateAvatar">%i18n:@choice-avatar%</button>
|
2018-02-12 23:17:08 +09:00
|
|
|
</label>
|
|
|
|
<label class="ui from group">
|
2018-04-15 01:04:40 +09:00
|
|
|
<p>%i18n:@name%</p>
|
2018-02-12 23:17:08 +09:00
|
|
|
<input v-model="name" type="text" class="ui"/>
|
|
|
|
</label>
|
|
|
|
<label class="ui from group">
|
2018-04-15 01:04:40 +09:00
|
|
|
<p>%i18n:@location%</p>
|
2018-02-12 23:17:08 +09:00
|
|
|
<input v-model="location" type="text" class="ui"/>
|
|
|
|
</label>
|
|
|
|
<label class="ui from group">
|
2018-04-15 01:04:40 +09:00
|
|
|
<p>%i18n:@description%</p>
|
2018-02-12 23:17:08 +09:00
|
|
|
<textarea v-model="description" class="ui"></textarea>
|
|
|
|
</label>
|
|
|
|
<label class="ui from group">
|
2018-04-15 01:04:40 +09:00
|
|
|
<p>%i18n:@birthday%</p>
|
2018-03-03 14:25:36 +09:00
|
|
|
<el-date-picker v-model="birthday" type="date" value-format="yyyy-MM-dd"/>
|
2018-02-12 23:17:08 +09:00
|
|
|
</label>
|
2018-04-15 01:04:40 +09:00
|
|
|
<button class="ui primary" @click="save">%i18n:@save%</button>
|
2018-03-02 06:26:31 +09:00
|
|
|
<section>
|
2018-06-02 00:51:20 +09:00
|
|
|
<h2>%i18n:@locked-account%</h2>
|
|
|
|
<mk-switch v-model="$store.state.i.isLocked" @change="onChangeIsLocked" text="%i18n:@is-locked%"/>
|
|
|
|
</section>
|
|
|
|
<section>
|
|
|
|
<h2>%i18n:@other%</h2>
|
2018-05-27 13:49:09 +09:00
|
|
|
<mk-switch v-model="$store.state.i.isBot" @change="onChangeIsBot" text="%i18n:@is-bot%"/>
|
|
|
|
<mk-switch v-model="$store.state.i.isCat" @change="onChangeIsCat" text="%i18n:@is-cat%"/>
|
2018-09-14 20:11:01 +09:00
|
|
|
<mk-switch v-model="alwaysMarkNsfw" text="%i18n:common.always-mark-nsfw%"/>
|
2018-03-02 06:26:31 +09:00
|
|
|
</section>
|
2018-02-12 23:17:08 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
data() {
|
|
|
|
return {
|
2018-02-20 23:22:19 +09:00
|
|
|
name: null,
|
|
|
|
location: null,
|
|
|
|
description: null,
|
|
|
|
birthday: null,
|
2018-02-12 23:17:08 +09:00
|
|
|
};
|
|
|
|
},
|
2018-09-14 20:11:01 +09:00
|
|
|
computed: {
|
|
|
|
alwaysMarkNsfw: {
|
|
|
|
get() { return this.$store.state.i.settings.alwaysMarkNsfw; },
|
|
|
|
set(value) { (this as any).api('i/update', { alwaysMarkNsfw: value }); }
|
|
|
|
},
|
|
|
|
},
|
2018-02-20 23:22:19 +09:00
|
|
|
created() {
|
2018-05-27 13:49:09 +09:00
|
|
|
this.name = this.$store.state.i.name || '';
|
|
|
|
this.location = this.$store.state.i.profile.location;
|
|
|
|
this.description = this.$store.state.i.description;
|
|
|
|
this.birthday = this.$store.state.i.profile.birthday;
|
2018-02-20 23:22:19 +09:00
|
|
|
},
|
2018-02-12 23:17:08 +09:00
|
|
|
methods: {
|
|
|
|
updateAvatar() {
|
2018-02-21 05:55:19 +09:00
|
|
|
(this as any).apis.updateAvatar();
|
2018-02-12 23:17:08 +09:00
|
|
|
},
|
|
|
|
save() {
|
2018-02-18 12:35:18 +09:00
|
|
|
(this as any).api('i/update', {
|
2018-04-06 01:36:34 +09:00
|
|
|
name: this.name || null,
|
2018-02-12 23:17:08 +09:00
|
|
|
location: this.location || null,
|
|
|
|
description: this.description || null,
|
|
|
|
birthday: this.birthday || null
|
|
|
|
}).then(() => {
|
2018-08-01 03:03:43 +09:00
|
|
|
(this as any).apis.notify('%i18n:@profile-updated%');
|
2018-02-12 23:17:08 +09:00
|
|
|
});
|
2018-03-02 06:26:31 +09:00
|
|
|
},
|
2018-06-02 00:51:20 +09:00
|
|
|
onChangeIsLocked() {
|
|
|
|
(this as any).api('i/update', {
|
|
|
|
isLocked: this.$store.state.i.isLocked
|
|
|
|
});
|
|
|
|
},
|
2018-03-02 06:26:31 +09:00
|
|
|
onChangeIsBot() {
|
|
|
|
(this as any).api('i/update', {
|
2018-05-27 13:49:09 +09:00
|
|
|
isBot: this.$store.state.i.isBot
|
2018-03-02 06:26:31 +09:00
|
|
|
});
|
2018-05-21 11:08:08 +09:00
|
|
|
},
|
|
|
|
onChangeIsCat() {
|
|
|
|
(this as any).api('i/update', {
|
2018-05-27 13:49:09 +09:00
|
|
|
isCat: this.$store.state.i.isCat
|
2018-05-21 11:08:08 +09:00
|
|
|
});
|
2018-02-12 23:17:08 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-02-20 23:22:19 +09:00
|
|
|
.profile
|
2018-02-12 23:17:08 +09:00
|
|
|
> .avatar
|
|
|
|
> img
|
|
|
|
display inline-block
|
|
|
|
vertical-align top
|
|
|
|
width 64px
|
|
|
|
height 64px
|
|
|
|
border-radius 4px
|
|
|
|
|
|
|
|
> button
|
|
|
|
margin-left 8px
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|