Commit 9be8cbdd by haojie

缓存动态删除和添加

parent c7731fcb
...@@ -52,9 +52,11 @@ const props = withDefaults( ...@@ -52,9 +52,11 @@ const props = withDefaults(
mainIndex?: number | null; mainIndex?: number | null;
totalTime: number; totalTime: number;
liveDetail: any; liveDetail: any;
eplay?: number;
}>(), }>(),
{ {
mainIndex: null, mainIndex: null,
eplay: 0,
}, },
); );
...@@ -86,7 +88,14 @@ const videoFirstPlay = ref(true); ...@@ -86,7 +88,14 @@ const videoFirstPlay = ref(true);
// 第二个视频是否首次播放 // 第二个视频是否首次播放
const videoSecondFirstPlay = ref(true); const videoSecondFirstPlay = ref(true);
/**
* element
*/
// 主视频
const videoFirst = ref<HTMLVideoElement>(); const videoFirst = ref<HTMLVideoElement>();
// 下一个主视频,加载完成才显示--两个主视频标签相互替换
const videoFirstAckup = ref<HTMLVideoElement>();
// 互动视频
const videoSecond = ref<HTMLVideoElement>(); const videoSecond = ref<HTMLVideoElement>();
// 初始音量 // 初始音量
...@@ -130,6 +139,7 @@ const confirm = () => { ...@@ -130,6 +139,7 @@ const confirm = () => {
const canplay = () => { const canplay = () => {
// 获取视频总时长 // 获取视频总时长
total.value = videoFirst.value.duration; total.value = videoFirst.value.duration;
console.log('本次主视频总时长', total.value);
emit('update:totalTime', total.value); emit('update:totalTime', total.value);
if (!videoFirstPlay.value) { if (!videoFirstPlay.value) {
// //
...@@ -193,13 +203,26 @@ watch( ...@@ -193,13 +203,26 @@ watch(
}, },
); );
// 主视频重新播放
watch(
() => props.eplay,
(v) => {
videoFirst.value.currentTime = 0;
// 播放video
videoFirst.value.play();
},
);
// 判断是否洗稿 // 判断是否洗稿
watch( watch(
() => props.liveDetail, () => props.liveDetail,
(v) => { (v) => {
if (v && v.is_disorganize === 0) { if (v && v.is_disorganize === 0) {
// 不洗稿,开启循环播放 // 不洗稿,开启循环播放
console.log('不洗稿,开启循环播放');
loop.value = true; loop.value = true;
} else {
console.log('需要洗稿,loop设置false');
} }
}, },
); );
......
...@@ -2,7 +2,7 @@ import { computed, onBeforeUnmount, ref, watch } from 'vue'; ...@@ -2,7 +2,7 @@ import { computed, onBeforeUnmount, ref, watch } from 'vue';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import { createLiveKeys, scriptTypeText } from '@/service/CreateLive'; import { createLiveKeys, scriptTypeText } from '@/service/CreateLive';
import { getLiveTtsCallback, createLiveTask, liveTts, liveTaskRegenerate } from '@/utils/api/userApi'; import { getLiveTtsCallback, createLiveTask, liveTts, liveTaskRegenerate } from '@/utils/api/userApi';
import { alyOssUpload, dimensionalConvert, isDev, show_message } from '@/utils/tool'; import { DataType, alyOssUpload, dimensionalConvert, isDev, show_message } from '@/utils/tool';
import { audioMerge, splitAudio } from '@/utils/audio'; import { audioMerge, splitAudio } from '@/utils/audio';
import { useLiveInfoSubmit } from '@/hooks/useStoreCommit'; import { useLiveInfoSubmit } from '@/hooks/useStoreCommit';
import { getUploadConfig, onUpdateLiveTask } from '@/service/Common'; import { getUploadConfig, onUpdateLiveTask } from '@/service/Common';
...@@ -21,6 +21,9 @@ export const processTextCallback = () => { ...@@ -21,6 +21,9 @@ export const processTextCallback = () => {
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
// 提交后的直播id
const live_task_id = ref(0);
// //
const loading = ref(false); const loading = ref(false);
...@@ -147,6 +150,7 @@ export const processTextCallback = () => { ...@@ -147,6 +150,7 @@ export const processTextCallback = () => {
try { try {
let res: any = await createLiveTask(filterFiled()); let res: any = await createLiveTask(filterFiled());
if (res.code == 0) { if (res.code == 0) {
live_task_id.value = res.data.id;
return true; return true;
} }
return false; return false;
...@@ -290,7 +294,7 @@ export const processTextCallback = () => { ...@@ -290,7 +294,7 @@ export const processTextCallback = () => {
try { try {
let params = filterFiled(); let params = filterFiled();
params.type_content = list; params.type_content = list;
let res: any = await liveTaskRegenerate(route.query.id, params); let res: any = await liveTaskRegenerate(live_task_id.value, params);
if (res.code == 0) { if (res.code == 0) {
if (successCallback) { if (successCallback) {
submitSuccessed(); submitSuccessed();
...@@ -338,9 +342,13 @@ export const processTextCallback = () => { ...@@ -338,9 +342,13 @@ export const processTextCallback = () => {
res.data.push(params); res.data.push(params);
} }
} }
if (res.data.length >= createLiveInfo.value[createLiveKeys.textScriptList].length) { if (res.data.length) {
console.log('音频任务回调成功');
console.log(res.data);
// 关闭定时器 // 关闭定时器
closeInterval(); closeInterval();
if (!isConfuse) {
if (res.data.length >= createLiveInfo.value[createLiveKeys.textScriptList].length) {
let list = JSON.parse(JSON.stringify(createLiveInfo.value[createLiveKeys.textScriptList])); let list = JSON.parse(JSON.stringify(createLiveInfo.value[createLiveKeys.textScriptList]));
let audio_list = []; let audio_list = [];
// 本次任务不是洗稿任务才修改store // 本次任务不是洗稿任务才修改store
...@@ -384,7 +392,10 @@ export const processTextCallback = () => { ...@@ -384,7 +392,10 @@ export const processTextCallback = () => {
loading.value = false; loading.value = false;
submitSuccessed(); submitSuccessed();
} }
}
}
} else { } else {
let audio_list = [];
// 洗稿任务 // 洗稿任务
res.data.forEach((item: any) => { res.data.forEach((item: any) => {
let data = item.data; let data = item.data;
......
...@@ -7,22 +7,64 @@ ...@@ -7,22 +7,64 @@
</keep-alive> </keep-alive>
</router-view> --> </router-view> -->
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<keep-alive> <!-- <component :is="Component" :key="getKey()" v-if="route.meta.keepAlive && routeCache()" /> -->
<component :is="Component" :key="getKey()" v-if="route.meta.keepAlive" /> <keep-alive :include="currentCacheList">
<component :is="Component" />
</keep-alive> </keep-alive>
<component :is="Component" v-if="!route.meta.keepAlive" /> <!-- <component :is="Component" v-if="!routeCache()" /> -->
</router-view> </router-view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import allRouter from '@/router'; import { computed, ref, watch } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useStore } from 'vuex';
const store = useStore();
// keep-alive路由
const keepAliveList = computed(() => store.getters['navbar/getCacheList']);
const route = useRoute(); const route = useRoute();
// 获取缓存的路由
const getCacheList = () => {
let list = [];
keepAliveList.value.forEach((item: any) => {
if (item.cache) {
list.push(item.name);
}
});
return list;
};
const currentCacheList = ref(getCacheList());
watch(
() => keepAliveList.value,
(v) => {
console.log('监听改变了');
currentCacheList.value = getCacheList();
console.log(currentCacheList.value);
},
{
deep: true,
immediate: true,
},
);
const getKey = () => { const getKey = () => {
return route.name; return route.name;
}; };
// 当前路由是否缓存
const routeCache = () => {
let path = route.path;
let index = keepAliveList.value.findIndex((item: any) => item.path == path);
if (index !== -1 && keepAliveList.value[index].cache) {
return true;
}
return false;
};
</script> </script>
<style lang="less"> <style lang="less">
......
...@@ -8,21 +8,22 @@ ...@@ -8,21 +8,22 @@
<span class="label"> <span class="label">
{{ item.label }} {{ item.label }}
</span> </span>
<!-- <div class="close-icon"> <div class="close-icon" @click="clearNavbar(item)">
<img :src="imgs.close" alt="" /> <img :src="imgs.close" alt="" />
</div> --> </div>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import routerConfig from '@/router/tool'; import routerConfig from '@/router/tool';
import { useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { createLiveRouteKey } from '@/constants/token'; import { createLiveRouteKey } from '@/constants/token';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import { computed } from 'vue'; import { computed } from 'vue';
const store = useStore(); const store = useStore();
const route = useRoute();
const router = useRouter(); const router = useRouter();
const navbarList = computed(() => store.getters['navbar/getNavbar']); const navbarList = computed(() => store.getters['navbar/getNavbar']);
...@@ -79,6 +80,14 @@ const jump = (item: any) => { ...@@ -79,6 +80,14 @@ const jump = (item: any) => {
query: params, query: params,
}); });
}; };
// 删除当前导航
const clearNavbar = (item: any) => {
store.commit('navbar/deleteNavbar', {
path: item.path,
currentPath: route.path,
});
};
</script> </script>
<style lang="less"> <style lang="less">
......
...@@ -20,6 +20,12 @@ ...@@ -20,6 +20,12 @@
</div> </div>
</template> </template>
<script lang="tsx">
export default {
name: routerConfig.ImageCustomization.name,
};
</script>
<script lang="tsx" setup> <script lang="tsx" setup>
import Record from './components/Record.vue'; import Record from './components/Record.vue';
import MyDigitalPerson from './components/MyDigitalPerson.vue'; import MyDigitalPerson from './components/MyDigitalPerson.vue';
...@@ -27,7 +33,7 @@ import CustomTabs from '@/components/CustomTabs'; ...@@ -27,7 +33,7 @@ import CustomTabs from '@/components/CustomTabs';
import CustomTabPanel from '@/components/CustomTabPanel'; import CustomTabPanel from '@/components/CustomTabPanel';
import Customizable from '@/components/Customizable'; import Customizable from '@/components/Customizable';
import PersonSvg from '@/assets/svg/custom/person.svg'; import PersonSvg from '@/assets/svg/custom/person.svg';
import { onMounted, ref } from 'vue'; import { onActivated, onMounted, ref } from 'vue';
import { customizedImageSubmission } from '@/utils/api/userApi'; import { customizedImageSubmission } from '@/utils/api/userApi';
import { show_message } from '@/utils/tool'; import { show_message } from '@/utils/tool';
import routerConfig from '@/router/tool'; import routerConfig from '@/router/tool';
...@@ -73,6 +79,14 @@ const submit = async (params: any) => { ...@@ -73,6 +79,14 @@ const submit = async (params: any) => {
}; };
onMounted(() => { onMounted(() => {
// 添加导航
store.commit('navbar/setNavbar', {
path: routerConfig.ImageCustomization.path,
});
});
onActivated(() => {
// 添加导航
store.commit('navbar/setNavbar', { store.commit('navbar/setNavbar', {
path: routerConfig.ImageCustomization.path, path: routerConfig.ImageCustomization.path,
}); });
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
:video1="getCurrentMainVideo" :video1="getCurrentMainVideo"
:liveDetail="liveDetail" :liveDetail="liveDetail"
:video2="addVideo" :video2="addVideo"
:eplay="eplay"
@playEnd="playEnd" @playEnd="playEnd"
@mainVideoPlayEnd="mainVideoPlayEnd" @mainVideoPlayEnd="mainVideoPlayEnd"
@mainVideoStartPlay="mainVideoStartPlay" @mainVideoStartPlay="mainVideoStartPlay"
...@@ -23,7 +24,7 @@ import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue' ...@@ -23,7 +24,7 @@ import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
import AddVideoPlay from '@/components/AddVideoPlay.vue'; import AddVideoPlay from '@/components/AddVideoPlay.vue';
import { getLiveDetail } from '@/utils/api/userApi'; import { getLiveDetail } from '@/utils/api/userApi';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { show_message, isDev } from '@/utils/tool'; import { show_message, isDev, DataType } from '@/utils/tool';
import { callPyjsInWindow, injectWindow } from '@/utils/pyqt'; import { callPyjsInWindow, injectWindow } from '@/utils/pyqt';
import { getliveTaskReply, getUserCookie, liveTts, getLiveTaskInfo, liveTaskRegenerate } from '@/utils/api/userApi'; import { getliveTaskReply, getUserCookie, liveTts, getLiveTaskInfo, liveTaskRegenerate } from '@/utils/api/userApi';
import routerConfig from '@/router/tool'; import routerConfig from '@/router/tool';
...@@ -41,6 +42,7 @@ const router = useRouter(); ...@@ -41,6 +42,7 @@ const router = useRouter();
const routeQuery = route.query; const routeQuery = route.query;
const progress = ref(0); const progress = ref(0);
const eplay = ref(0);
// 剩余多少时长时开始洗稿并获取下一个视频 // 剩余多少时长时开始洗稿并获取下一个视频
const esidueTime = 60 * 10; const esidueTime = 60 * 10;
...@@ -79,11 +81,6 @@ const addVideoList = ref([]); ...@@ -79,11 +81,6 @@ const addVideoList = ref([]);
// 互动视频当前播放id // 互动视频当前播放id
const addVideoId = ref(''); const addVideoId = ref('');
// 音调id
const phoneticTimbresId = ref();
// 音色id
const toneId = ref();
// 直播详情 // 直播详情
const liveDetail = ref({}); const liveDetail = ref({});
...@@ -91,9 +88,9 @@ const submitAudioTask = async (list: any[]) => { ...@@ -91,9 +88,9 @@ const submitAudioTask = async (list: any[]) => {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
let params = { let params = {
// 音色 // 音色
phonetic_timbres_id: phoneticTimbresId.value, phonetic_timbres_id: liveDetail.value.phonetic_timbres_id,
// 音调 // 音调
tone_id: toneId.value, tone_id: liveDetail.value.tone_id,
content: list[i].content, content: list[i].content,
uuid: currentConfuseId.value, uuid: currentConfuseId.value,
}; };
...@@ -132,13 +129,14 @@ const submitConfuse = async () => { ...@@ -132,13 +129,14 @@ const submitConfuse = async () => {
try { try {
currentConfuseId.value = v4(); currentConfuseId.value = v4();
let content = ''; let content = '';
let contentList = realVideoList.value[mainVideoIndex.value].type_content; let contentList = liveDetail.value.type_content;
// 记录本次洗稿id // 记录本次洗稿id
confuseIndex.value = mainVideoIndex.value; confuseIndex.value = mainVideoIndex.value;
if (contentList.length) { if (contentList.length) {
contentList.forEach((item: any) => { contentList.forEach((item: any) => {
content += item.content; content += item.content;
}); });
console.log('提交洗稿任务');
// 提交洗稿任务 // 提交洗稿任务
currentStartConfuse({ currentStartConfuse({
content: content, content: content,
...@@ -161,13 +159,13 @@ const currentTimeChange = (value: number) => { ...@@ -161,13 +159,13 @@ const currentTimeChange = (value: number) => {
if ( if (
currentEsidueTime < esidueTime && currentEsidueTime < esidueTime &&
currentVideoRow.confuse === CONFUSE_STATUS.CONFUSE_STATUS_WAIT && currentVideoRow.confuse === CONFUSE_STATUS.CONFUSE_STATUS_WAIT &&
realVideoList.value[mainVideoIndex.value].type_content.length && liveDetail.value.type_content.length &&
typeof phoneticTimbresId.value === 'number' && typeof liveDetail.value.phonetic_timbres_id === 'number' &&
typeof toneId.value === 'number' && typeof liveDetail.value.tone_id === 'number' &&
liveDetail.value.is_disorganize liveDetail.value.is_disorganize
) { ) {
currentVideoRow.confuse = CONFUSE_STATUS.CONFUSE_STATUS_PROGRESS; currentVideoRow.confuse = CONFUSE_STATUS.CONFUSE_STATUS_PROGRESS;
console.log('开始洗稿'); console.log('直播开始洗稿');
// 开始洗稿 // 开始洗稿
submitConfuse(); submitConfuse();
} }
...@@ -180,6 +178,7 @@ const mainVideoStartPlay = (index: number) => { ...@@ -180,6 +178,7 @@ const mainVideoStartPlay = (index: number) => {
// 主视频播放完毕 // 主视频播放完毕
const mainVideoPlayEnd = (index: number) => { const mainVideoPlayEnd = (index: number) => {
console.log('主视频播放完毕');
realVideoList.value[index].status = true; realVideoList.value[index].status = true;
// 找下一个 // 找下一个
takeMainVideo(); takeMainVideo();
...@@ -269,14 +268,15 @@ const regenerate = async (list: any[]) => { ...@@ -269,14 +268,15 @@ const regenerate = async (list: any[]) => {
let params = { let params = {
digital_man_id: liveDetail.value.digital_man_id, digital_man_id: liveDetail.value.digital_man_id,
name: liveDetail.value.name, name: liveDetail.value.name,
phonetic_timbres_id: phoneticTimbresId.value, phonetic_timbres_id: liveDetail.value.phonetic_timbres_id,
tone_id: toneId.value, tone_id: liveDetail.value.tone_id,
type: liveDetail.value.type, type: liveDetail.value.type,
}; };
params.type_content = list; params.type_content = list;
let res: any = await liveTaskRegenerate(route.query.id, params); let res: any = await liveTaskRegenerate(liveDetail.value.id, params);
if (res.code == 0) { if (res.code == 0) {
// //
console.log('重新生成直播,已提交');
} }
} catch (e) { } catch (e) {
console.log(e); console.log(e);
...@@ -320,7 +320,7 @@ const getDetail = async (type: string = '') => { ...@@ -320,7 +320,7 @@ const getDetail = async (type: string = '') => {
}, },
]; ];
} }
if (res.data.url.length) { if (DataType(res.data, 'object') && res.data.url && res.data.url.length) {
if (typeof confuseIndex.value === 'number') { if (typeof confuseIndex.value === 'number') {
// 本次是洗稿回调 // 本次是洗稿回调
} }
...@@ -341,7 +341,6 @@ const getDetail = async (type: string = '') => { ...@@ -341,7 +341,6 @@ const getDetail = async (type: string = '') => {
confuse: CONFUSE_STATUS.CONFUSE_STATUS_WAIT, confuse: CONFUSE_STATUS.CONFUSE_STATUS_WAIT,
// 洗稿任务的uuid // 洗稿任务的uuid
uuid: v4(), uuid: v4(),
type_content: res.data.type_content ? res.data.type_content : [],
}); });
if (isDev()) { if (isDev()) {
...@@ -368,6 +367,8 @@ const getDetail = async (type: string = '') => { ...@@ -368,6 +367,8 @@ const getDetail = async (type: string = '') => {
}, },
}); });
} }
} else {
console.log('直播没有返回值');
} }
} }
} catch (e) { } catch (e) {
...@@ -379,15 +380,17 @@ const getDetail = async (type: string = '') => { ...@@ -379,15 +380,17 @@ const getDetail = async (type: string = '') => {
const submitVideo = () => { const submitVideo = () => {
try { try {
if (window.pyjs) { if (window.pyjs) {
console.log(route.query.window_index, '窗口下标');
if (window.pyjs.run) { if (window.pyjs.run) {
// 未取走且未提交过的视频 // 未取走且未提交过的视频
let index = realVideoList.value.findIndex((item: any) => !item.remove && !item.submit); let index = realVideoList.value.findIndex((item: any) => !item.remove && !item.submit);
if (index !== -1) { if (index !== -1) {
realVideoList.value[index].submit = true; realVideoList.value[index].submit = true;
window.pyjs.run(realVideoList.value[index].url, routeQuery.id, route.query.window_index, index); window.pyjs.run(realVideoList.value[index].url, routeQuery.id, route.query.window_index, index);
console.log(`本次提交-${index}`);
console.log(realVideoList.value);
} else {
console.log('没有要提交的任务');
} }
console.log('执行了run方法');
} else { } else {
console.log('没有run方法'); console.log('没有run方法');
} }
...@@ -404,22 +407,37 @@ const takeMainVideo = () => { ...@@ -404,22 +407,37 @@ const takeMainVideo = () => {
let index = realVideoList.value.findIndex((item: any) => !item.remove && item.result && !item.status); let index = realVideoList.value.findIndex((item: any) => !item.remove && item.result && !item.status);
if (index !== -1) { if (index !== -1) {
realVideoList.value[index].remove = true; realVideoList.value[index].remove = true;
if (
typeof mainVideoIndex.value === 'number' &&
realVideoList.value[index].result == realVideoList.value[mainVideoIndex.value].result
) {
console.log('本次获取到的视频与上次一致,重新播放');
eplay.value += 1;
}
mainVideoIndex.value = index; mainVideoIndex.value = index;
} else { } else {
console.log('没有要播放的视频'); console.log('重新播放当前视频');
// 手动重新开始播放 // 手动重新开始播放
eplay.value += 1;
} }
}; };
// python 回调 // python 回调
const mergeCallback = (params: any) => { const mergeCallback = (params: any) => {
try { try {
if (typeof params.index === 'number' && params.video) { console.log('python回调');
console.log(params);
let index = params.index;
if (index) {
index = parseInt(index + '');
}
if (typeof index === 'number' && params.video) {
// 当前视频的返回结果 // 当前视频的返回结果
realVideoList.value[params.index].result = params.video; realVideoList.value[index].result = params.video;
// 首次播放 // 首次播放
let list = realVideoList.value.filter((item: any) => item.remove === true); let list = realVideoList.value.filter((item: any) => item.remove === true);
if (!list.length) { if (!list.length) {
console.log('首次播放');
takeMainVideo(); takeMainVideo();
} }
} else { } else {
...@@ -435,8 +453,6 @@ const getTone = async () => { ...@@ -435,8 +453,6 @@ const getTone = async () => {
try { try {
let res = await getLiveTaskInfo(route.query.id); let res = await getLiveTaskInfo(route.query.id);
if (res.code == 0) { if (res.code == 0) {
phoneticTimbresId.value = res.data.phonetic_timbres_id;
toneId.value = res.data.tone_id;
liveDetail.value = res.data; liveDetail.value = res.data;
} }
} catch (e) { } catch (e) {
......
...@@ -21,13 +21,19 @@ ...@@ -21,13 +21,19 @@
</div> </div>
</template> </template>
<script lang="tsx">
export default {
name: routerConfig.VocalCustomization.name,
};
</script>
<script lang="tsx" setup> <script lang="tsx" setup>
import Record from './components/Record.vue'; import Record from './components/Record.vue';
import MyDigitalPerson from './components/MyDigitalPerson.vue'; import MyDigitalPerson from './components/MyDigitalPerson.vue';
import CustomTabs from '@/components/CustomTabs'; import CustomTabs from '@/components/CustomTabs';
import CustomTabPanel from '@/components/CustomTabPanel'; import CustomTabPanel from '@/components/CustomTabPanel';
import Customizable from '@/components/Customizable'; import Customizable from '@/components/Customizable';
import { ref, onMounted } from 'vue'; import { ref, onMounted, onActivated } from 'vue';
import { customizedPhoneticSubmission } from '@/utils/api/userApi'; import { customizedPhoneticSubmission } from '@/utils/api/userApi';
import { show_message } from '@/utils/tool'; import { show_message } from '@/utils/tool';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
...@@ -77,6 +83,12 @@ onMounted(() => { ...@@ -77,6 +83,12 @@ onMounted(() => {
path: routerConfig.VocalCustomization.path, path: routerConfig.VocalCustomization.path,
}); });
}); });
onActivated(() => {
store.commit('navbar/setNavbar', {
path: routerConfig.VocalCustomization.path,
});
});
</script> </script>
<style lang="less"></style> <style lang="less"></style>
...@@ -84,6 +84,12 @@ ...@@ -84,6 +84,12 @@
</div> </div>
</template> </template>
<script lang="ts">
export default {
name: routerConfig.createInteract.name,
};
</script>
<script lang="ts" setup> <script lang="ts" setup>
import Loading from '@/components/loading.vue'; import Loading from '@/components/loading.vue';
import ConfirmDialog from '@/components/ConfirmDialog.vue'; import ConfirmDialog from '@/components/ConfirmDialog.vue';
...@@ -93,7 +99,7 @@ import Popup from '@/components/Popup.vue'; ...@@ -93,7 +99,7 @@ import Popup from '@/components/Popup.vue';
import MessageSvg from '@/assets/svg/interact/message.svg'; import MessageSvg from '@/assets/svg/interact/message.svg';
import Button from '@/components/Button.vue'; import Button from '@/components/Button.vue';
import { getElBounding, getWindowClient, show_message } from '@/utils/tool'; import { getElBounding, getWindowClient, show_message } from '@/utils/tool';
import { onMounted, reactive, ref } from 'vue'; import { onActivated, onMounted, reactive, ref } from 'vue';
import InteractTable from './components/InteractTable.vue'; import InteractTable from './components/InteractTable.vue';
import Input from '@/components/input/index.vue'; import Input from '@/components/input/index.vue';
import YesSvg from '@/assets/svg/home/yes.svg'; import YesSvg from '@/assets/svg/home/yes.svg';
...@@ -268,6 +274,12 @@ onMounted(() => { ...@@ -268,6 +274,12 @@ onMounted(() => {
path: routerConfig.createInteract.path, path: routerConfig.createInteract.path,
}); });
}); });
onActivated(() => {
store.commit('navbar/setNavbar', {
path: routerConfig.createInteract.path,
});
});
</script> </script>
<style lang="less"> <style lang="less">
......
...@@ -229,6 +229,10 @@ const getList = async () => { ...@@ -229,6 +229,10 @@ const getList = async () => {
} }
}; };
onMounted(() => {
getList();
});
onActivated(() => { onActivated(() => {
// 获取数字人列表 // 获取数字人列表
getList(); getList();
......
...@@ -117,7 +117,6 @@ ...@@ -117,7 +117,6 @@
ref="scriptSettingText" ref="scriptSettingText"
v-show="currentOption === scriptTypeText" v-show="currentOption === scriptTypeText"
> >
<template v-if="isDev()">
<template v-for="(item, index) in textScriptList" :key="index"> <template v-for="(item, index) in textScriptList" :key="index">
<ScriptTemplate @edit="editTextScript(item, index)" @delete="deleteTextScript(index)"> <ScriptTemplate @edit="editTextScript(item, index)" @delete="deleteTextScript(index)">
<div class="script-template-body__text"> <div class="script-template-body__text">
...@@ -140,10 +139,6 @@ ...@@ -140,10 +139,6 @@
<div class="label">添加脚本</div> <div class="label">添加脚本</div>
</div> </div>
</ScriptTemplate> </ScriptTemplate>
</template>
<template v-else>
<Textarea v-model="textareaValue" @change="textareaChange"></Textarea>
</template>
</div> </div>
<div class="script-setting-upload flex1 narrow-scrollbar" v-show="currentOption === scriptTypePhonetics"> <div class="script-setting-upload flex1 narrow-scrollbar" v-show="currentOption === scriptTypePhonetics">
<!-- edit --> <!-- edit -->
...@@ -194,7 +189,7 @@ ...@@ -194,7 +189,7 @@
</template> </template>
<script lang="tsx" setup> <script lang="tsx" setup>
import { computed, onActivated, onMounted, reactive, ref, watch } from 'vue'; import { computed, onActivated, onBeforeMount, onMounted, reactive, ref, watch } from 'vue';
import Button from '@/components/Button.vue'; import Button from '@/components/Button.vue';
import MultipleUpload from '@/components/MultipleUpload'; import MultipleUpload from '@/components/MultipleUpload';
import CheckBox from '@/components/CheckBox.vue'; import CheckBox from '@/components/CheckBox.vue';
...@@ -618,6 +613,10 @@ onMounted(async () => { ...@@ -618,6 +613,10 @@ onMounted(async () => {
// 获取音色音调列表 // 获取音色音调列表
getList(); getList();
commitInfo({
// 文本脚本的uuid
[createLiveKeys.scriptUuid]: getUuid(),
});
}); });
onActivated(() => { onActivated(() => {
......
...@@ -54,6 +54,12 @@ ...@@ -54,6 +54,12 @@
</div> </div>
</template> </template>
<script lang="tsx">
export default {
name: routerConfig.createLive.name,
};
</script>
<script lang="tsx" setup> <script lang="tsx" setup>
import Drag2 from '@/components/Drag2.vue'; import Drag2 from '@/components/Drag2.vue';
import Loading from '@/components/loading.vue'; import Loading from '@/components/loading.vue';
...@@ -450,6 +456,11 @@ const initPage = () => { ...@@ -450,6 +456,11 @@ const initPage = () => {
onBeforeMount(() => { onBeforeMount(() => {
initPage(); initPage();
let newQuery = JSON.parse(JSON.stringify(route.query));
store.commit('navbar/setNavbar', {
path: routerConfig.createLive.path,
query: newQuery,
});
}); });
const enterPageEvent = () => { const enterPageEvent = () => {
......
import routerConfig from '@/router/tool'; import routerConfig from '@/router/tool';
import { createLiveRouteKey } from '@/constants/token'; import { createLiveRouteKey } from '@/constants/token';
import { getSiteRouter } from '@/config/site';
import router from '@/router';
const imgs = { const imgs = {
home: new URL('../../assets/svg/home/home.svg', import.meta.url).href, home: new URL('../../assets/svg/home/home.svg', import.meta.url).href,
...@@ -9,9 +11,29 @@ const imgs = { ...@@ -9,9 +11,29 @@ const imgs = {
interaction: new URL('../../assets/svg/home/interaction.svg', import.meta.url).href, interaction: new URL('../../assets/svg/home/interaction.svg', import.meta.url).href,
}; };
const filterKeepAlive = () => {
let list = [];
const routes = getSiteRouter();
for (let i = 0; i < routes.length; i++) {
let items = routes[i].children;
for (let j = 0; j < items.length; j++) {
let child = items[j];
if (child.meta && child.meta.keepAlive) {
list.push({
name: child.name,
path: child.path,
cache: true,
});
}
}
}
return list;
};
const state = { const state = {
version: 'v1', version: 'v1',
navbarList: [], navbarList: [],
keepAliveList: filterKeepAlive(),
}; };
type StateType = typeof state; type StateType = typeof state;
...@@ -48,6 +70,36 @@ const mutations = { ...@@ -48,6 +70,36 @@ const mutations = {
// 记录创建直播的参数 // 记录创建直播的参数
window.localStorage.setItem(createLiveRouteKey, JSON.stringify(info.query)); window.localStorage.setItem(createLiveRouteKey, JSON.stringify(info.query));
} }
// 添加缓存
let cacheIndex = state.keepAliveList.findIndex((item: any) => item.path == info.path);
if (cacheIndex !== -1) {
state.keepAliveList[cacheIndex].cache = true;
}
console.log(state.navbarList);
},
deleteNavbar(state: StateType, info: any) {
if (info.path) {
let index = state.navbarList.findIndex((item: any) => item.path == info.path);
if (index !== -1) {
// 删除导航
state.navbarList.splice(index, 1);
// 清除当前页缓存
let cacheIndex = state.keepAliveList.findIndex((item: any) => item.path == info.path);
if (cacheIndex !== -1) {
state.keepAliveList[cacheIndex].cache = false;
}
if (info.currentPath == info.path) {
// 返回首页
setTimeout(() => {
router.replace({
path: routerConfig.home.path,
name: routerConfig.home.name,
});
}, 0);
}
}
}
}, },
}; };
...@@ -55,6 +107,9 @@ const getters = { ...@@ -55,6 +107,9 @@ const getters = {
getNavbar: (state: StateType) => { getNavbar: (state: StateType) => {
return state.navbarList; return state.navbarList;
}, },
getCacheList: (state: StateType) => {
return state.keepAliveList;
},
}; };
const actions = {}; const actions = {};
......
...@@ -24,6 +24,8 @@ export async function decodeAudio(blob: Blob) { ...@@ -24,6 +24,8 @@ export async function decodeAudio(blob: Blob) {
} }
// 合并音频文件 // 合并音频文件
export async function audioMerge(filePaths) { export async function audioMerge(filePaths) {
console.log('要合并的文件');
console.log(filePaths);
try { try {
// 创建一个新的音频上下文 // 创建一个新的音频上下文
const audioContext = createAudioContext(); const audioContext = createAudioContext();
......
...@@ -11,8 +11,8 @@ const getBaseUrl = () => { ...@@ -11,8 +11,8 @@ const getBaseUrl = () => {
// return 'http://156.247.11.21:92/'; // return 'http://156.247.11.21:92/';
return ''; return '';
} }
// return 'http://video-assistant.test'; return 'http://video-assistant.test';
return 'http://156.247.11.21:92/'; // return 'http://156.247.11.21:92/';
}; };
const instance = axios.create({ const instance = axios.create({
......
...@@ -77,7 +77,7 @@ export default defineConfig(({ command, mode }) => { ...@@ -77,7 +77,7 @@ export default defineConfig(({ command, mode }) => {
terserOptions: { terserOptions: {
compress: { compress: {
//生产环境时移除console //生产环境时移除console
drop_console: true, // drop_console: true,
// drop_debugger: true, // drop_debugger: true,
}, },
output: { output: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment