emojigen wip10
This commit is contained in:
parent
8b3e7bf04c
commit
5e3554d693
@ -60,7 +60,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from 'vue';
|
import {defineComponent} from 'vue';
|
||||||
import FormSwitch from '@/components/form/switch.vue';
|
import FormSwitch from '@/components/form/switch.vue';
|
||||||
import FormInput from '@/components/form/input.vue';
|
import FormInput from '@/components/form/input.vue';
|
||||||
import FormTextarea from '@/components/form/textarea.vue';
|
import FormTextarea from '@/components/form/textarea.vue';
|
||||||
@ -69,11 +69,6 @@ import FormSection from '@/components/form/section.vue';
|
|||||||
import FormButton from '@/components/ui/button.vue';
|
import FormButton from '@/components/ui/button.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import * as symbols from '@/symbols';
|
import * as symbols from '@/symbols';
|
||||||
import { fetchInstance } from '@/instance';
|
|
||||||
import {string} from "postcss-selector-parser";
|
|
||||||
import { selectFiles } from '@/scripts/select-file';
|
|
||||||
import {i18n} from "@/i18n";
|
|
||||||
import {stream} from "@/stream";
|
|
||||||
import {defaultStore} from "@/store";
|
import {defaultStore} from "@/store";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@ -95,7 +90,7 @@ export default defineComponent({
|
|||||||
icon: 'fas fa-laugh',
|
icon: 'fas fa-laugh',
|
||||||
bg: 'var(--bg)',
|
bg: 'var(--bg)',
|
||||||
},
|
},
|
||||||
emojiName: null,
|
emojiName: '',
|
||||||
text: '',
|
text: '',
|
||||||
emojiAlign: 'center',
|
emojiAlign: 'center',
|
||||||
emojiSizeFixed: false,
|
emojiSizeFixed: false,
|
||||||
@ -123,22 +118,24 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
emojiApproval() {
|
emojiApproval() {
|
||||||
const marker = Math.random().toString();
|
const chooseFileFromPc = async () => {
|
||||||
|
|
||||||
os.api('drive/files/upload-from-url', {
|
const response = await fetch(this.emojiUrl).then(res => res.blob())
|
||||||
url: this.emojiUrl,
|
|
||||||
folderId: defaultStore.state.uploadFolder,
|
|
||||||
marker
|
|
||||||
});
|
|
||||||
|
|
||||||
os.alert({
|
const file = new File([response], `${this.emojiName}.png`);
|
||||||
title: i18n.ts.uploadFromUrlRequested,
|
return await os.upload(file, defaultStore.state.uploadFolder, undefined,);
|
||||||
text: i18n.ts.uploadFromUrlMayTakeTime
|
};
|
||||||
});
|
|
||||||
|
(async () => {
|
||||||
|
const fileId = await chooseFileFromPc().then(res => res.id);
|
||||||
|
await os.api('admin/emoji/add', {
|
||||||
|
fileId,
|
||||||
|
name: this.emojiName,
|
||||||
|
})
|
||||||
|
})();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user