Commit 942c15df by haojie

不再提交洗稿任务,改为直接获取

parent 04039a86
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<meta name="keywords" content="" /> <meta name="keywords" content="" />
<meta property="og:title" content="" /> <meta property="og:title" content="" />
<script src="/qwebchannel.js"></script> <script src="/qwebchannel.js"></script>
<title>demo</title> <title>maoyan</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
......
...@@ -44,7 +44,7 @@ const onMessage = (params: string) => { ...@@ -44,7 +44,7 @@ const onMessage = (params: string) => {
onMounted(() => { onMounted(() => {
store.dispatch('setting/changeTheme', { ...config }); store.dispatch('setting/changeTheme', { ...config });
devicePixelRatio(); devicePixelRatio();
store.dispatch('user/getUserInfo');
// 全局注入showMessage提示 // 全局注入showMessage提示
injectWindow('onMessage', onMessage); injectWindow('onMessage', onMessage);
......
...@@ -3,10 +3,6 @@ import { liveContentRegenerate, liveContentRegenerateCallback } from '@/utils/ap ...@@ -3,10 +3,6 @@ import { liveContentRegenerate, liveContentRegenerateCallback } from '@/utils/ap
import { onBeforeUnmount, ref } from 'vue'; import { onBeforeUnmount, ref } from 'vue';
export default function () { export default function () {
// 洗稿次数
const confuseNum = 1;
// 当前洗稿次数
const currentConfuseNum = ref(0);
// 定时器 // 定时器
const confuseInterval = ref(null); const confuseInterval = ref(null);
// 洗稿回调列表 // 洗稿回调列表
...@@ -14,10 +10,10 @@ export default function () { ...@@ -14,10 +10,10 @@ export default function () {
// 洗稿id // 洗稿id
const currentConfuseId = ref(''); const currentConfuseId = ref('');
const openConfuseInterval = () => { const openConfuseInterval = (id: any = '') => {
console.log('开启轮询,洗稿回调'); console.log('开启轮询,洗稿回调');
confuseInterval.value = window.setInterval(() => { confuseInterval.value = window.setInterval(() => {
currentStartConfuseBack(currentConfuseId.value); currentStartConfuseBack(id ? id : currentConfuseId.value);
}, 3000); }, 3000);
}; };
...@@ -36,7 +32,7 @@ export default function () { ...@@ -36,7 +32,7 @@ export default function () {
if (res.code == 0) { if (res.code == 0) {
console.log('洗稿提交成功'); console.log('洗稿提交成功');
// 打开定时器 // 打开定时器
openConfuseInterval(); openConfuseInterval('1');
} }
} catch (e) { } catch (e) {
console.log(e); console.log(e);
...@@ -70,5 +66,6 @@ export default function () { ...@@ -70,5 +66,6 @@ export default function () {
confuseList, confuseList,
currentConfuseId, currentConfuseId,
currentStartConfuse, currentStartConfuse,
openConfuseInterval,
}; };
} }
...@@ -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 { DataType, alyOssUpload, dimensionalConvert, isDev, show_message } from '@/utils/tool'; import { 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';
...@@ -16,7 +16,7 @@ import { callPyjsInWindow } from '@/utils/pyqt'; ...@@ -16,7 +16,7 @@ import { callPyjsInWindow } from '@/utils/pyqt';
// 轮询处理文本脚本语音生成回调 // 轮询处理文本脚本语音生成回调
export const processTextCallback = () => { export const processTextCallback = () => {
const [commitInfo] = useLiveInfoSubmit(); const [commitInfo] = useLiveInfoSubmit();
const { currentConfuseId, confuseList, currentStartConfuse } = useConfuse(); const { currentConfuseId, confuseList, currentStartConfuse, openConfuseInterval } = useConfuse();
const store = useStore(); const store = useStore();
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
...@@ -35,6 +35,7 @@ export const processTextCallback = () => { ...@@ -35,6 +35,7 @@ export const processTextCallback = () => {
const interval = ref(null); const interval = ref(null);
const createLiveInfo = computed(() => store.getters['live/getLiveInfo']); const createLiveInfo = computed(() => store.getters['live/getLiveInfo']);
const liveName = computed(() => store.getters['live/getName']); const liveName = computed(() => store.getters['live/getName']);
const userInfo = computed(() => store.getters['user/userInfo']);
const alyList = ref([]); const alyList = ref([]);
const submitAudioTask = async (list: any[]) => { const submitAudioTask = async (list: any[]) => {
...@@ -218,18 +219,21 @@ export const processTextCallback = () => { ...@@ -218,18 +219,21 @@ export const processTextCallback = () => {
// 洗稿 // 洗稿
const startConfuse = async () => { const startConfuse = async () => {
currentConfuseId.value = v4(); // currentConfuseId.value = v4();
let content = ''; // let content = '';
// 获取所有文章 // // 获取所有文章
createLiveInfo.value[createLiveKeys.textScriptList].forEach((item: any) => { // createLiveInfo.value[createLiveKeys.textScriptList].forEach((item: any) => {
content += item.content; // content += item.content;
}); // });
// 提交洗稿任务 // 提交洗稿任务
currentStartConfuse({ // currentStartConfuse({
content: content, // content: content,
task_id: currentConfuseId.value, // task_id: currentConfuseId.value,
id: route.query.id, // id: route.query.id,
}); // });
currentConfuseId.value = v4();
// 轮询拉取洗稿回调
openConfuseInterval(`${userInfo.value.id}_${live_task_id.value}`);
}; };
// 阿里云上传成功回调 // 阿里云上传成功回调
......
<template> <template>
<!-- <router-view v-slot="{ Component }">
<keep-alive>
<transition name="fade" mode="out-in">
<component :is="Component" v-if="route.meta.keepAlive" />
</transition>
</keep-alive>
</router-view> -->
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<!-- <component :is="Component" :key="getKey()" v-if="route.meta.keepAlive && routeCache()" /> -->
<keep-alive :include="currentCacheList"> <keep-alive :include="currentCacheList">
<component :is="Component" /> <component :is="Component" />
</keep-alive> </keep-alive>
<!-- <component :is="Component" v-if="!routeCache()" /> -->
</router-view> </router-view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
const store = useStore(); const store = useStore();
// keep-alive路由 // keep-alive路由
const keepAliveList = computed(() => store.getters['navbar/getCacheList']); const keepAliveList = computed(() => store.getters['navbar/getCacheList']);
const route = useRoute();
// 获取缓存的路由 // 获取缓存的路由
const getCacheList = () => { const getCacheList = () => {
let list = []; let list = [];
...@@ -50,20 +38,6 @@ watch( ...@@ -50,20 +38,6 @@ watch(
immediate: true, immediate: true,
}, },
); );
// const getKey = () => {
// 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">
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'; import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import AddVideoPlay from '@/components/AddVideoPlay.vue'; import AddVideoPlay from '@/components/AddVideoPlay.vue';
import { getLiveDetail, closeLiveTask } from '@/utils/api/userApi'; import { getLiveDetail, closeLiveTask } from '@/utils/api/userApi';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
...@@ -33,7 +33,7 @@ import useConfuse from '@/hooks/useConfuse'; ...@@ -33,7 +33,7 @@ import useConfuse from '@/hooks/useConfuse';
import { CONFUSE_STATUS } from '@/service/Live'; import { CONFUSE_STATUS } from '@/service/Live';
import { processTextCallback } from '@/hooks/useScript'; import { processTextCallback } from '@/hooks/useScript';
import { scriptTypeText } from '@/service/CreateLive'; import { scriptTypeText } from '@/service/CreateLive';
const { currentConfuseId, confuseList, currentStartConfuse } = useConfuse(); const { currentConfuseId, confuseList, currentStartConfuse, openConfuseInterval } = useConfuse();
const { openInterval: confuseInterval } = processTextCallback(); const { openInterval: confuseInterval } = processTextCallback();
const store = useStore(); const store = useStore();
...@@ -41,6 +41,8 @@ const route = useRoute(); ...@@ -41,6 +41,8 @@ const route = useRoute();
const router = useRouter(); const router = useRouter();
const routeQuery = route.query; const routeQuery = route.query;
const userInfo = computed(() => store.getters['user/userInfo']);
// 视频加载loading // 视频加载loading
const loading = ref(true); const loading = ref(true);
...@@ -71,9 +73,6 @@ let intervalLocalMainVideo = null; ...@@ -71,9 +73,6 @@ let intervalLocalMainVideo = null;
// 主视频列表 // 主视频列表
const realVideoList = ref([]); const realVideoList = ref([]);
// 当前洗稿的下标(在主视频列表中的下标)
const confuseIndex = ref();
// 互动视频 // 互动视频
const addVideo = ref(imgs.mp4); const addVideo = ref(imgs.mp4);
// 互动视频列表 // 互动视频列表
...@@ -173,23 +172,24 @@ watch( ...@@ -173,23 +172,24 @@ watch(
// 提交洗稿 // 提交洗稿
const submitConfuse = async () => { const submitConfuse = async () => {
try { try {
// currentConfuseId.value = v4();
// let content = '';
// let contentList = liveDetail.value.type_content;
// if (contentList.length) {
// contentList.forEach((item: any) => {
// content += item.content;
// });
// console.log('提交洗稿任务');
// // 提交洗稿任务
// currentStartConfuse({
// content: content,
// task_id: currentConfuseId.value,
// id: route.query.id,
// });
// }
// 生成一个uid
currentConfuseId.value = v4(); currentConfuseId.value = v4();
let content = ''; openConfuseInterval(`${userInfo.value.id}_${liveDetail.value.id}`);
let contentList = liveDetail.value.type_content;
// 记录本次洗稿id
// confuseIndex.value = mainVideoIndex.value;
if (contentList.length) {
contentList.forEach((item: any) => {
content += item.content;
});
console.log('提交洗稿任务');
// 提交洗稿任务
currentStartConfuse({
content: content,
task_id: currentConfuseId.value,
id: route.query.id,
});
}
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
...@@ -439,9 +439,6 @@ const getDetail = async (type: string = '') => { ...@@ -439,9 +439,6 @@ const getDetail = async (type: string = '') => {
]; ];
} }
if (DataType(res.data, 'object') && res.data.url && res.data.url.length) { if (DataType(res.data, 'object') && res.data.url && res.data.url.length) {
if (typeof confuseIndex.value === 'number') {
// 本次是洗稿回调
}
// //
realVideoList.value.push({ realVideoList.value.push({
url: res.data.url, url: res.data.url,
......
...@@ -17,6 +17,7 @@ import { ref, watch } from 'vue'; ...@@ -17,6 +17,7 @@ import { ref, watch } from 'vue';
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
modelValue: boolean; modelValue: boolean;
editInfo: any;
}>(), }>(),
{}, {},
); );
...@@ -38,6 +39,19 @@ const confirm = () => { ...@@ -38,6 +39,19 @@ const confirm = () => {
}; };
watch( watch(
() => props.editInfo,
(v) => {
if (v) {
if (v.name) {
inputValue.value = v.name;
} else {
inputValue.value = '';
}
}
},
);
watch(
() => props.modelValue, () => props.modelValue,
(v) => { (v) => {
visible.value = v; visible.value = v;
......
...@@ -34,10 +34,8 @@ ...@@ -34,10 +34,8 @@
className="reset-edit-name-input" className="reset-edit-name-input"
align="left" align="left"
theme="opacity" theme="opacity"
v-model="item.c_name" v-model="item.name"
:id="item.id" :id="item.id"
:blurNum="item.blurNum"
@inputBlur="inputBlur"
></Input> ></Input>
</template> </template>
</div> </div>
...@@ -80,7 +78,7 @@ ...@@ -80,7 +78,7 @@
</div> </div>
</div> </div>
<ConfirmDialog v-model="confirmDialog" title="确定删除吗?" @confirm="onConfirm"></ConfirmDialog> <ConfirmDialog v-model="confirmDialog" title="确定删除吗?" @confirm="onConfirm"></ConfirmDialog>
<AddInteractLib v-model="createLibVisible" @submitTitle="submitTitle"></AddInteractLib> <AddInteractLib v-model="createLibVisible" :editInfo="editInfo" @submitTitle="submitTitle"></AddInteractLib>
</div> </div>
</template> </template>
...@@ -98,7 +96,7 @@ import DeleteSvg from '@/assets/svg/home/delete.svg'; ...@@ -98,7 +96,7 @@ import DeleteSvg from '@/assets/svg/home/delete.svg';
import Popup from '@/components/Popup.vue'; 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 { deepCopy, getElBounding, getWindowClient, show_message } from '@/utils/tool';
import { onActivated, 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';
...@@ -124,6 +122,7 @@ const currentGroup = ref(''); ...@@ -124,6 +122,7 @@ const currentGroup = ref('');
const confirmDialog = ref(false); const confirmDialog = ref(false);
// 创建互动库弹窗 // 创建互动库弹窗
const createLibVisible = ref(false); const createLibVisible = ref(false);
const editInfo = ref({});
// 本次item的参数 // 本次item的参数
const confirmParams = ref({}); const confirmParams = ref({});
...@@ -135,12 +134,6 @@ const groupChange = (item: any) => { ...@@ -135,12 +134,6 @@ const groupChange = (item: any) => {
currentGroup.value = item.id; currentGroup.value = item.id;
}; };
const resetName = (item: any) => {
// 修改当前name
item.edit = true;
item.blurNum += 1;
item.popup = false;
};
const getInteractList = async (chose: boolean = true) => { const getInteractList = async (chose: boolean = true) => {
try { try {
loading.value = true; loading.value = true;
...@@ -158,22 +151,19 @@ const getInteractList = async (chose: boolean = true) => { ...@@ -158,22 +151,19 @@ const getInteractList = async (chose: boolean = true) => {
} }
}; };
// 输入框失去焦点,更新name // 编辑互动库提交
const inputBlur = async (value: string, id: number) => { const editSubmit = async (title: string) => {
let index = interactList.list.findIndex((item: any) => item.id === id); let index = interactList.list.findIndex((item: any) => item.id == editInfo.value.id);
if (index !== -1) { if (index !== -1) {
let item = interactList.list[index]; let item = interactList.list[index];
if (!item.c_status) {
return;
}
// 提交
try { try {
// 根据edit信息找到下标
item.loading = true; item.loading = true;
let res: any = await editGroupsInteractionName(id, { let res: any = await editGroupsInteractionName(item.id, {
name: value, name: title,
}); });
if (res.code == 0) { if (res.code == 0) {
item.name = item.c_name; item.name = title;
show_message('修改成功', 'success'); show_message('修改成功', 'success');
} }
item.loading = false; item.loading = false;
...@@ -182,21 +172,32 @@ const inputBlur = async (value: string, id: number) => { ...@@ -182,21 +172,32 @@ const inputBlur = async (value: string, id: number) => {
console.log(e); console.log(e);
} }
} }
// 关闭所有输入框
interactList.list.forEach((item: any) => {
item.edit = false;
});
}; };
// 新增互动 // 新增互动
const addInteract = () => { const addInteract = () => {
// 打开弹窗 // 打开弹窗
editInfo.value = deepCopy({});
createLibVisible.value = true; createLibVisible.value = true;
}; };
// 编辑互动
const resetName = (item: any) => {
// 打开弹窗
editInfo.value = deepCopy(item);
createLibVisible.value = true;
item.popup = false;
};
// 提交创建互动库 // 提交创建互动库
const submitTitle = (title: string) => { const submitTitle = (title: string) => {
if (Object.keys(editInfo.value).length) {
// 编辑
editSubmit(title);
} else {
// 创建
confirm(title); confirm(title);
}
}; };
// 删除互动 // 删除互动
...@@ -376,10 +377,12 @@ onActivated(() => { ...@@ -376,10 +377,12 @@ onActivated(() => {
.tool { .tool {
position: absolute; position: absolute;
right: 30px; right: 30px;
top: 20px; top: 12px;
.tool-dot { .tool-dot {
display: flex; .da();
cursor: pointer; cursor: pointer;
width: 30px;
height: 20px;
& > * { & > * {
margin-left: 2px; margin-left: 2px;
width: 7px; width: 7px;
......
...@@ -67,7 +67,7 @@ import { useRouter } from 'vue-router'; ...@@ -67,7 +67,7 @@ import { useRouter } from 'vue-router';
import routerConfig from '@/router/tool'; import routerConfig from '@/router/tool';
import { onUpdateLiveTask } from '@/service/Common'; import { onUpdateLiveTask } from '@/service/Common';
import { getLiveTask, deleteLiveTask, liveVideoDownload } from '@/utils/api/userApi'; import { getLiveTask, deleteLiveTask, liveVideoDownload } from '@/utils/api/userApi';
import { downloadFiles, isDev, show_message } from '@/utils/tool'; import { isDev, show_message } from '@/utils/tool';
import { callPyjsInWindow, injectWindow } from '@/utils/pyqt'; import { callPyjsInWindow, injectWindow } from '@/utils/pyqt';
import { jumpToCreateLivePage } from '@/router/jump'; import { jumpToCreateLivePage } from '@/router/jump';
...@@ -131,7 +131,6 @@ const getVideoList = async (id: any) => { ...@@ -131,7 +131,6 @@ const getVideoList = async (id: any) => {
const downLoadVideo = async (item: any) => { const downLoadVideo = async (item: any) => {
let list = await getVideoList(item.id); let list = await getVideoList(item.id);
if (list) { if (list) {
// downloadFiles(list);
// 通知python合并视频并 // 通知python合并视频并
callPyjsInWindow('downLoadVideoToLocal', { callPyjsInWindow('downLoadVideoToLocal', {
list: list, list: list,
......
...@@ -193,24 +193,7 @@ const getList = async () => { ...@@ -193,24 +193,7 @@ const getList = async () => {
} }
}; };
const jumpLivePage = () => {
let params = window.customJumpLivePage;
if (params) {
if (typeof params === 'string') {
params = JSON.parse(params);
}
// 跳转到直播页面
router.push({
path: routerConfig.startLive.path,
name: routerConfig.startLive.name,
query: params,
});
}
};
onMounted(() => { onMounted(() => {
setTimeout(() => {
jumpLivePage();
}, 1000);
// //
getList(); getList();
}); });
......
...@@ -28,6 +28,7 @@ const state = { ...@@ -28,6 +28,7 @@ const state = {
play: true, play: true,
}, },
videoNum: 1, videoNum: 1,
// 任务列表
}; };
type StateType = typeof state; type StateType = typeof state;
......
...@@ -4,6 +4,7 @@ import Cookies from 'js-cookie'; ...@@ -4,6 +4,7 @@ import Cookies from 'js-cookie';
import router from '@/router'; import router from '@/router';
import routerConfig from '@/router/tool'; import routerConfig from '@/router/tool';
import { show_message } from '@/utils/tool'; import { show_message } from '@/utils/tool';
import { getUserInfo as getAdminUserInfo } from '@/utils/api/userApi';
interface MyState { interface MyState {
token: String | undefined | null; token: String | undefined | null;
userInfo: any; userInfo: any;
...@@ -48,11 +49,8 @@ const mutations = { ...@@ -48,11 +49,8 @@ const mutations = {
state.userInfo = {}; state.userInfo = {};
}, },
setUserInfo(state: StateType, userInfo: UserInfo) { setUserInfo(state: StateType, userInfo: UserInfo) {
if (!userInfo.avatar) {
userInfo.avatar =
'https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83eq3CbZYiataq17DyyniaKOGs2ZwQxqWDwA5mMhlqfaHBpBwvrwan9QBicSsKHcHTTyHWFU9mFiaH7bawQ/132';
}
state.userInfo = {}; state.userInfo = {};
console.log(userInfo);
Object.assign(state.userInfo, userInfo); Object.assign(state.userInfo, userInfo);
}, },
// 修改用户信息中的某一项 // 修改用户信息中的某一项
...@@ -74,12 +72,11 @@ const getters = { ...@@ -74,12 +72,11 @@ const getters = {
}; };
const actions = { const actions = {
async getUserInfo() { async getUserInfo({ commit }) {
try { try {
// const data: any = await getUserInfo(); const res: any = await getAdminUserInfo();
// commit('setUserInfo', data.data); commit('setUserInfo', res.data);
// return data; return res;
// commit('setUserInfo', data.data);
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
......
...@@ -22,6 +22,16 @@ export const UserLogin = (data: any) => { ...@@ -22,6 +22,16 @@ export const UserLogin = (data: any) => {
return request.post('/api/login', data); return request.post('/api/login', data);
}; };
// 获取用户信息
export const getUserInfo = () => {
const header = getHeader();
return request.get('/api/user', {
headers: {
...header,
},
});
};
// 阿里云oss配置 // 阿里云oss配置
export const getAlyOssConfig = () => { export const getAlyOssConfig = () => {
const header = getHeader(); const header = getHeader();
......
import axios from 'axios'; import axios from 'axios';
import { MessagePlugin } from 'tdesign-vue-next';
const instance: any = axios.create({ const instance: any = axios.create({
timeout: 60 * 60 * 1000, timeout: 60 * 60 * 1000,
......
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