2020-10-17 20:12:00 +09:00
|
|
|
<template>
|
|
|
|
<XModalWindow ref="dialog"
|
|
|
|
:width="370"
|
|
|
|
:with-ok-button="true"
|
|
|
|
@close="$refs.dialog.close()"
|
|
|
|
@closed="$emit('closed')"
|
|
|
|
@ok="ok()"
|
|
|
|
>
|
|
|
|
<template #header>:{{ emoji.name }}:</template>
|
|
|
|
|
2021-04-21 12:06:02 +09:00
|
|
|
<div class="_monolithic_">
|
|
|
|
<div class="yigymqpb _section">
|
|
|
|
<img :src="emoji.url" class="img"/>
|
2021-10-09 14:43:40 +09:00
|
|
|
<MkInput class="_formBlock" v-model="name">
|
2021-08-06 22:29:19 +09:00
|
|
|
<template #label>{{ $ts.name }}</template>
|
|
|
|
</MkInput>
|
2021-10-09 14:43:40 +09:00
|
|
|
<MkInput class="_formBlock" v-model="category" :datalist="categories">
|
2021-08-06 22:29:19 +09:00
|
|
|
<template #label>{{ $ts.category }}</template>
|
|
|
|
</MkInput>
|
2021-10-09 14:43:40 +09:00
|
|
|
<MkInput class="_formBlock" v-model="aliases">
|
2021-08-06 22:29:19 +09:00
|
|
|
<template #label>{{ $ts.tags }}</template>
|
|
|
|
<template #caption>{{ $ts.setMultipleBySeparatingWithSpace }}</template>
|
2021-04-21 12:06:02 +09:00
|
|
|
</MkInput>
|
|
|
|
<MkButton danger @click="del()"><i class="fas fa-trash-alt"></i> {{ $ts.delete }}</MkButton>
|
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</div>
|
|
|
|
</XModalWindow>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import XModalWindow from '@/components/ui/modal-window.vue';
|
|
|
|
import MkButton from '@/components/ui/button.vue';
|
|
|
|
import MkInput from '@/components/form/input.vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import { unique } from '@/scripts/array';
|
2020-10-17 20:12:00 +09:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
XModalWindow,
|
|
|
|
MkButton,
|
|
|
|
MkInput,
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
emoji: {
|
|
|
|
required: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['done', 'closed'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
name: this.emoji.name,
|
|
|
|
category: this.emoji.category,
|
|
|
|
aliases: this.emoji.aliases?.join(' '),
|
|
|
|
categories: [],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
os.api('meta', { detail: false }).then(({ emojis }) => {
|
|
|
|
this.categories = unique(emojis.map((x: any) => x.category || '').filter((x: string) => x !== ''));
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
ok() {
|
|
|
|
this.update();
|
|
|
|
},
|
|
|
|
|
|
|
|
async update() {
|
|
|
|
await os.apiWithDialog('admin/emoji/update', {
|
|
|
|
id: this.emoji.id,
|
|
|
|
name: this.name,
|
|
|
|
category: this.category,
|
|
|
|
aliases: this.aliases.split(' '),
|
|
|
|
});
|
|
|
|
|
|
|
|
this.$emit('done', {
|
|
|
|
updated: {
|
|
|
|
name: this.name,
|
|
|
|
category: this.category,
|
|
|
|
aliases: this.aliases.split(' '),
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.$refs.dialog.close();
|
|
|
|
},
|
|
|
|
|
|
|
|
async del() {
|
2021-11-18 18:45:58 +09:00
|
|
|
const { canceled } = await os.confirm({
|
2020-10-17 20:12:00 +09:00
|
|
|
type: 'warning',
|
|
|
|
text: this.$t('removeAreYouSure', { x: this.emoji.name }),
|
|
|
|
});
|
|
|
|
if (canceled) return;
|
|
|
|
|
|
|
|
os.api('admin/emoji/remove', {
|
|
|
|
id: this.emoji.id
|
|
|
|
}).then(() => {
|
|
|
|
this.$emit('done', {
|
|
|
|
deleted: true
|
|
|
|
});
|
|
|
|
this.$refs.dialog.close();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.yigymqpb {
|
|
|
|
> .img {
|
|
|
|
display: block;
|
|
|
|
height: 64px;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|