2020-10-17 04:12:00 -07:00
|
|
|
<template>
|
2020-11-25 04:31:34 -08:00
|
|
|
<div>
|
2021-09-29 08:50:45 -07:00
|
|
|
<MkTab v-model="tab">
|
2020-12-25 17:47:36 -08:00
|
|
|
<option value="soft">{{ $ts._wordMute.soft }}</option>
|
|
|
|
<option value="hard">{{ $ts._wordMute.hard }}</option>
|
2020-11-25 04:31:34 -08:00
|
|
|
</MkTab>
|
|
|
|
<FormBase>
|
2021-09-29 08:50:45 -07:00
|
|
|
<div class="_debobigegoItem">
|
2020-10-17 04:12:00 -07:00
|
|
|
<div v-show="tab === 'soft'">
|
2021-04-13 09:41:49 -07:00
|
|
|
<FormInfo>{{ $ts._wordMute.softDescription }}</FormInfo>
|
2021-09-29 08:50:45 -07:00
|
|
|
<FormTextarea v-model="softMutedWords">
|
2020-12-25 17:47:36 -08:00
|
|
|
<span>{{ $ts._wordMute.muteWords }}</span>
|
|
|
|
<template #desc>{{ $ts._wordMute.muteWordsDescription }}<br>{{ $ts._wordMute.muteWordsDescription2 }}</template>
|
2020-11-25 04:31:34 -08:00
|
|
|
</FormTextarea>
|
2020-10-17 04:12:00 -07:00
|
|
|
</div>
|
|
|
|
<div v-show="tab === 'hard'">
|
2021-04-13 09:41:49 -07:00
|
|
|
<FormInfo>{{ $ts._wordMute.hardDescription }}</FormInfo>
|
2021-09-29 08:50:45 -07:00
|
|
|
<FormTextarea v-model="hardMutedWords">
|
2020-12-25 17:47:36 -08:00
|
|
|
<span>{{ $ts._wordMute.muteWords }}</span>
|
|
|
|
<template #desc>{{ $ts._wordMute.muteWordsDescription }}<br>{{ $ts._wordMute.muteWordsDescription2 }}</template>
|
2020-11-25 04:31:34 -08:00
|
|
|
</FormTextarea>
|
|
|
|
<FormKeyValueView v-if="hardWordMutedNotesCount != null">
|
2020-12-25 17:47:36 -08:00
|
|
|
<template #key>{{ $ts._wordMute.mutedNotes }}</template>
|
2020-11-25 04:31:34 -08:00
|
|
|
<template #value>{{ number(hardWordMutedNotesCount) }}</template>
|
|
|
|
</FormKeyValueView>
|
2020-10-17 04:12:00 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-11-19 02:36:12 -08:00
|
|
|
<FormButton primary inline :disabled="!changed" @click="save()"><i class="fas fa-save"></i> {{ $ts.save }}</FormButton>
|
2020-11-25 04:31:34 -08:00
|
|
|
</FormBase>
|
2020-10-17 04:12:00 -07:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
2021-11-11 09:02:25 -08:00
|
|
|
import FormTextarea from '@/components/form/textarea.vue';
|
|
|
|
import FormBase from '@/components/debobigego/base.vue';
|
|
|
|
import FormKeyValueView from '@/components/debobigego/key-value-view.vue';
|
|
|
|
import FormButton from '@/components/debobigego/button.vue';
|
|
|
|
import FormInfo from '@/components/debobigego/info.vue';
|
|
|
|
import MkTab from '@/components/tab.vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import number from '@/filters/number';
|
|
|
|
import * as symbols from '@/symbols';
|
2020-10-17 04:12:00 -07:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
2020-11-25 04:31:34 -08:00
|
|
|
FormBase,
|
|
|
|
FormButton,
|
|
|
|
FormTextarea,
|
|
|
|
FormKeyValueView,
|
2020-10-17 04:12:00 -07:00
|
|
|
MkTab,
|
2021-04-13 09:41:49 -07:00
|
|
|
FormInfo,
|
2020-10-17 04:12:00 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['info'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2021-04-09 20:54:12 -07:00
|
|
|
[symbols.PAGE_INFO]: {
|
2020-12-25 17:47:36 -08:00
|
|
|
title: this.$ts.wordMute,
|
2021-09-29 08:50:45 -07:00
|
|
|
icon: 'fas fa-comment-slash',
|
|
|
|
bg: 'var(--bg)',
|
2020-10-17 04:12:00 -07:00
|
|
|
},
|
|
|
|
tab: 'soft',
|
|
|
|
softMutedWords: '',
|
|
|
|
hardMutedWords: '',
|
|
|
|
hardWordMutedNotesCount: null,
|
|
|
|
changed: false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
softMutedWords: {
|
|
|
|
handler() {
|
|
|
|
this.changed = true;
|
|
|
|
},
|
|
|
|
deep: true
|
|
|
|
},
|
|
|
|
hardMutedWords: {
|
|
|
|
handler() {
|
|
|
|
this.changed = true;
|
|
|
|
},
|
|
|
|
deep: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
async created() {
|
2020-12-18 17:55:52 -08:00
|
|
|
this.softMutedWords = this.$store.state.mutedWords.map(x => x.join(' ')).join('\n');
|
|
|
|
this.hardMutedWords = this.$i.mutedWords.map(x => x.join(' ')).join('\n');
|
2020-10-17 04:12:00 -07:00
|
|
|
|
|
|
|
this.hardWordMutedNotesCount = (await os.api('i/get-word-muted-notes-count', {})).count;
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
2021-04-09 20:54:12 -07:00
|
|
|
this.$emit('info', this[symbols.PAGE_INFO]);
|
2020-10-17 04:12:00 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async save() {
|
2020-12-18 17:55:52 -08:00
|
|
|
this.$store.set('mutedWords', this.softMutedWords.trim().split('\n').map(x => x.trim().split(' ')));
|
2020-10-17 04:12:00 -07:00
|
|
|
await os.api('i/update', {
|
|
|
|
mutedWords: this.hardMutedWords.trim().split('\n').map(x => x.trim().split(' ')),
|
|
|
|
});
|
|
|
|
this.changed = false;
|
|
|
|
},
|
2020-11-25 04:31:34 -08:00
|
|
|
|
|
|
|
number
|
2020-10-17 04:12:00 -07:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|