misskey-awawa/src/web/app/desktop/views/components/settings.profile.vue

88 lines
2.2 KiB
Vue
Raw Normal View History

2018-02-12 14:17:08 +00:00
<template>
2018-02-20 14:22:19 +00:00
<div class="profile">
2018-02-12 14:17:08 +00:00
<label class="avatar ui from group">
2018-02-19 07:58:37 +00:00
<p>%i18n:desktop.tags.mk-profile-setting.avatar%</p>
<img class="avatar" :src="`${os.i.avatar_url}?thumbnail&size=64`" alt="avatar"/>
2018-02-12 14:17:08 +00:00
<button class="ui" @click="updateAvatar">%i18n:desktop.tags.mk-profile-setting.choice-avatar%</button>
</label>
<label class="ui from group">
<p>%i18n:desktop.tags.mk-profile-setting.name%</p>
<input v-model="name" type="text" class="ui"/>
</label>
<label class="ui from group">
<p>%i18n:desktop.tags.mk-profile-setting.location%</p>
<input v-model="location" type="text" class="ui"/>
</label>
<label class="ui from group">
<p>%i18n:desktop.tags.mk-profile-setting.description%</p>
<textarea v-model="description" class="ui"></textarea>
</label>
<label class="ui from group">
<p>%i18n:desktop.tags.mk-profile-setting.birthday%</p>
<input v-model="birthday" type="date" class="ui"/>
</label>
<button class="ui primary" @click="save">%i18n:desktop.tags.mk-profile-setting.save%</button>
2018-03-01 21:26:31 +00:00
<section>
<h2>その他</h2>
2018-03-02 09:46:08 +00:00
<mk-switch v-model="os.i.is_bot" @change="onChangeIsBot" text="このアカウントはbotです"/>
2018-03-01 21:26:31 +00:00
</section>
2018-02-12 14:17:08 +00:00
</div>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
data() {
return {
2018-02-20 14:22:19 +00:00
name: null,
location: null,
description: null,
birthday: null,
2018-02-12 14:17:08 +00:00
};
},
2018-02-20 14:22:19 +00:00
created() {
this.name = (this as any).os.i.name;
this.location = (this as any).os.i.profile.location;
this.description = (this as any).os.i.description;
this.birthday = (this as any).os.i.profile.birthday;
},
2018-02-12 14:17:08 +00:00
methods: {
updateAvatar() {
2018-02-20 20:55:19 +00:00
(this as any).apis.updateAvatar();
2018-02-12 14:17:08 +00:00
},
save() {
2018-02-18 03:35:18 +00:00
(this as any).api('i/update', {
2018-02-12 14:17:08 +00:00
name: this.name,
location: this.location || null,
description: this.description || null,
birthday: this.birthday || null
}).then(() => {
2018-02-20 17:53:34 +00:00
(this as any).apis.notify('プロフィールを更新しました');
2018-02-12 14:17:08 +00:00
});
2018-03-01 21:26:31 +00:00
},
onChangeIsBot() {
(this as any).api('i/update', {
is_bot: (this as any).os.i.is_bot
});
2018-02-12 14:17:08 +00:00
}
}
});
</script>
<style lang="stylus" scoped>
2018-02-20 14:22:19 +00:00
.profile
2018-02-12 14:17:08 +00:00
> .avatar
> img
display inline-block
vertical-align top
width 64px
height 64px
border-radius 4px
> button
margin-left 8px
</style>