Commit 942c15df by haojie

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

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