From 837db768cd05e04ba971ea6f674c6dcb6d7768d2 Mon Sep 17 00:00:00 2001 From: congzc Date: Tue, 17 Oct 2023 18:20:17 +0800 Subject: [PATCH] 1 --- .env.development | 3 +- src/apis/createVideo.js | 13 +++++++++ src/types/auto-imports.d.ts | 4 +++ src/types/components.d.ts | 9 ++++++ src/views/createVideo/index.vue | 50 +++++++++++++++++++++++++++++++-- src/views/myCreating/index.vue | 3 +- 6 files changed, 78 insertions(+), 4 deletions(-) diff --git a/.env.development b/.env.development index a42f23a..536cb33 100644 --- a/.env.development +++ b/.env.development @@ -6,5 +6,6 @@ NODE_ENV='development' VITE_APP_TITLE = 'Metavatar-PC' VITE_APP_PORT = 3000 ## VITE_APP_BASE_API = 'https://photo.metavatar.cc/C' -VITE_APP_BASE_API = 'https://test.metavatar.cc/C' +# VITE_APP_BASE_API = 'https://test.metavatar.cc/C' +VITE_APP_BASE_API = 'https://phototest.metavatar.cc/C' diff --git a/src/apis/createVideo.js b/src/apis/createVideo.js index 229f1df..be74431 100644 --- a/src/apis/createVideo.js +++ b/src/apis/createVideo.js @@ -188,3 +188,16 @@ export function getModelDetailByIdApi(id) { method: 'get' }) } + +/** + * @description:文字判断语种 + * @param {number} id + * @return data + */ +export function getLanguageApi(data) { + return request({ + url: `/api/VoiceLanguage/getLanguage`, + method: 'POST', + data + }) +} diff --git a/src/types/auto-imports.d.ts b/src/types/auto-imports.d.ts index 6f8d200..9ea2d5d 100644 --- a/src/types/auto-imports.d.ts +++ b/src/types/auto-imports.d.ts @@ -2,6 +2,8 @@ export {} declare global { const EffectScope: typeof import('vue')['EffectScope'] + const ElMessage: typeof import('element-plus/es')['ElMessage'] + const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'] const asyncComputed: typeof import('@vueuse/core')['asyncComputed'] const autoResetRef: typeof import('@vueuse/core')['autoResetRef'] const computed: typeof import('vue')['computed'] @@ -268,6 +270,8 @@ import { UnwrapRef } from 'vue' declare module 'vue' { interface ComponentCustomProperties { readonly EffectScope: UnwrapRef + readonly ElMessage: UnwrapRef + readonly ElMessageBox: UnwrapRef readonly asyncComputed: UnwrapRef readonly autoResetRef: UnwrapRef readonly computed: UnwrapRef diff --git a/src/types/components.d.ts b/src/types/components.d.ts index 1956f7e..231836d 100644 --- a/src/types/components.d.ts +++ b/src/types/components.d.ts @@ -18,10 +18,13 @@ declare module '@vue/runtime-core' { ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] + ElForm: typeof import('element-plus/es')['ElForm'] + ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElIcon: typeof import('element-plus/es')['ElIcon'] ElInput: typeof import('element-plus/es')['ElInput'] ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] ElOption: typeof import('element-plus/es')['ElOption'] + ElPagination: typeof import('element-plus/es')['ElPagination'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] @@ -29,12 +32,18 @@ declare module '@vue/runtime-core' { GithubCorner: typeof import('./../components/GithubCorner/index.vue')['default'] Hamburger: typeof import('./../components/Hamburger/index.vue')['default'] IconSelect: typeof import('./../components/IconSelect/index.vue')['default'] + IEpCloseBold: typeof import('~icons/ep/close-bold')['default'] + IEpDelete: typeof import('~icons/ep/delete')['default'] IEpDocumentAdd: typeof import('~icons/ep/document-add')['default'] + IEpDownload: typeof import('~icons/ep/download')['default'] IEpEdit: typeof import('~icons/ep/edit')['default'] IEpGoods: typeof import('~icons/ep/goods')['default'] + IEpLoading: typeof import('~icons/ep/loading')['default'] IEpMenu: typeof import('~icons/ep/menu')['default'] IEpPhone: typeof import('~icons/ep/phone')['default'] + IEpSearch: typeof import('~icons/ep/search')['default'] IEpUser: typeof import('~icons/ep/user')['default'] + IEpVideoPlay: typeof import('~icons/ep/video-play')['default'] LangSelect: typeof import('./../components/LangSelect/index.vue')['default'] MultiUpload: typeof import('./../components/Upload/MultiUpload.vue')['default'] MyLoading: typeof import('./../components/myLoading.vue')['default'] diff --git a/src/views/createVideo/index.vue b/src/views/createVideo/index.vue index d3cadb2..29d6098 100644 --- a/src/views/createVideo/index.vue +++ b/src/views/createVideo/index.vue @@ -218,7 +218,7 @@ > < - +

{{ $t("createVideo.sex") }}

+

{{ $t("createVideo.videoRatio") }}

+ +
{ // if (newVal == 0) { // getModeList("", modelPageNum.value, modelPageSize.value); @@ -869,7 +890,7 @@ const title = const textareaContent = ref(""); function insertIcon() { const textarea = document.getElementById("textInputId"); - const icon = "🕗"; // 这里使用了一个星星作为示例图标,你可以替换为你自己的图标 + const icon = "🕗"; // 获取光标位置 const startPos = textarea.selectionStart; const endPos = textarea.selectionEnd; @@ -887,6 +908,31 @@ function insertIcon() { const language = ref(""); //选择的语言 const sound = ref(""); // 选择的声音 const soundStyle = ref(""); //选择的风格 +// 输入文字判断语种 +const getLanguageTimeOut = ref(false); //定时器 +watch( + () => textareaContent.value, + () => { + clearTimeout(getLanguageTimeOut.value); + getLanguageTimeOut.value = setTimeout(async () => { + try { + const data = { + paperwork: textareaContent.value, + }; + const res = await getLanguageApi(data); + if (res.code == 200) { + language.value = res.data.id; + } + } catch (error) {} + }, 1500); + } +); +watch( + () => language.value, + () => { + chooseType(); + } +); // 语言下拉框内容 const languageOptions = ref([]); async function voiceTotal() { diff --git a/src/views/myCreating/index.vue b/src/views/myCreating/index.vue index 469bf5c..8b8587c 100644 --- a/src/views/myCreating/index.vue +++ b/src/views/myCreating/index.vue @@ -481,6 +481,7 @@ const checkVideoStatus = async () => { // 如果列表中没有生成中的视频,不发送请求 const intervalId = setInterval(async () => { // && notGenerateList2.value.length == 0; + console.log(""); if (notGenerateList.value.length == 0) { return; } @@ -509,7 +510,7 @@ onMounted(() => { isLoading.value = true; getPhotoVideoList(pageNum.value, pageSize.value, title.value); - // checkVideoStatus(); + checkVideoStatus(); }); //#endregion ---------------------------