Commit 0ea7f449 by haojie

部分组件修改为自定义组件,减小打包体积

parent 89216715
...@@ -49,7 +49,7 @@ import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'; ...@@ -49,7 +49,7 @@ import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import Loading from '@/components/Loading/FirstCircle.vue'; import Loading from '@/components/Loading/FirstCircle.vue';
import { onBeforeRouteLeave } from 'vue-router'; import { onBeforeRouteLeave } from 'vue-router';
import { callPyjsInWindow, injectWindow } from '@/utils/pyqt'; import { injectWindow } from '@/utils/pyqt';
import { scriptTypePhonetics } from '@/service/CreateLive'; import { scriptTypePhonetics } from '@/service/CreateLive';
const props = withDefaults( const props = withDefaults(
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { Checkbox as TCheckbox } from 'tdesign-vue-next';
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
const props = withDefaults( const props = withDefaults(
......
.le-loading {
display: flex;
align-items: center;
justify-content: center;
top: 0;
left: 0;
.le-spinner {
width: 40px;
height: 40px;
border: 4px solid #f3f3f3;
border-top: 4px solid #00cca2;
border-radius: 50%;
animation: spin 1.2s linear infinite;
}
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
import './index.less';
import { defineComponent } from 'vue';
export default defineComponent({
props: {
position: {
type: String,
default: 'absolute',
},
mask: {
type: Boolean,
default: false,
},
},
setup(props) {
return () => (
<div
class="le-loading"
style={{
position: props.position,
width: props.position == 'absolute' ? '100%' : '',
height: props.position == 'absolute' ? '100%' : '',
background: props.mask ? 'rgba(0,0,0,0.5)' : '',
}}
>
<div class="le-spinner"></div>
</div>
);
},
});
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { Progress as TProgress } from 'tdesign-vue-next'; import { Progress as TProgress } from 'tdesign-vue-next';
const props = withDefaults( withDefaults(
defineProps<{ defineProps<{
value: number; value: number;
}>(), }>(),
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
const props = withDefaults( withDefaults(
defineProps<{ defineProps<{
height?: string; height?: string;
showTool?: boolean; showTool?: boolean;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
const props = withDefaults( withDefaults(
defineProps<{ defineProps<{
position?: string; position?: string;
mask?: boolean; mask?: boolean;
......
<template>
<t-switch class="c-default-switch" v-model="checked" :size="size" :label="['开', '关']"></t-switch>
</template>
<script lang="ts" setup>
import { Switch as TSwitch } from 'tdesign-vue-next';
import { ref, watch } from 'vue';
const props = withDefaults(
defineProps<{
id?: number | string;
modelValue: boolean;
size?: string;
}>(),
{
size: 'large',
id: '',
},
);
const emit = defineEmits(['update:modelValue', 'change']);
const checked = ref(props.modelValue);
watch(
() => props.modelValue,
(v) => {
checked.value = v;
},
);
watch(
() => checked.value,
(v) => {
emit('update:modelValue', v);
emit('change', v, props.id);
},
);
</script>
<style lang="less">
.c-default-switch.t-is-checked {
background: #00cca2;
}
</style>
.le-switch {
height: 24px;
line-height: 24px;
border-radius: 12px;
min-width: 44px;
cursor: pointer;
display: inline-flex;
position: relative;
background-color: #c5c5c5;
.le-switch__content {
font-size: 9px;
color: white;
width: 100%;
padding: 0 8px 0 24px;
user-select: none;
transition: padding 0.2s;
}
.le-switch__handle {
position: absolute;
width: 20px;
height: 20px;
top: 2px;
left: 2px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s cubic-bezier(0.38, 0, 0.24, 1);
border-radius: 50%;
background-color: white;
}
}
.le-switch-checked {
background: #00cca2;
.le-switch__handle {
left: calc(100% - 22px);
}
.le-switch__content {
padding: 0 24px 0 8px;
}
}
import './index.less';
import { defineComponent, computed } from 'vue';
export default defineComponent({
props: {
modelValue: Boolean,
size: {
type: String,
defualt: '24px',
},
label: {
type: Array,
default: () => ['开', '关'],
},
// 用于循环渲染,切换之后要知道自己的下标
id: {
type: [String, Number],
defualt: '',
},
},
emits: ['update:modelValue', 'change'],
setup(props, { emit }) {
const switchValue = computed({
get() {
return props.modelValue;
},
set(value) {
emit('update:modelValue', value);
emit('change', value, props.id);
},
});
const switchChange = () => {
switchValue.value = !switchValue.value;
};
return () => (
<div
class={['le-switch', switchValue.value ? 'le-switch-checked' : '']}
onClick={switchChange}
>
<span class="le-switch__handle"></span>
<div class="le-switch__content">
{switchValue.value ? props.label[0] : props.label[1]}
</div>
</div>
);
},
});
.le-table-parent {
position: relative;
.le-table {
width: 100%;
border-spacing: 0;
thead {
tr {
th {
background-color: #1e1e1e !important;
font-size: 16px;
color: white;
font-weight: normal;
box-sizing: border-box;
padding: 8px 24px 8px 24px;
}
& > :first-child {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
& > :last-child {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
}
}
tbody {
min-height: 120px;
tr {
td {
padding: 13px 24px 11px 24px;
border-bottom: 1px solid #464646;
}
}
.le-table__empty-row {
td {
padding: 0;
.le-table__empty {
color: white;
background-color: #303030;
display: flex;
align-items: center;
justify-content: center;
min-height: 120px;
}
}
}
}
}
.le-table-loading {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
}
}
import './index.less';
import { defineComponent } from 'vue';
import Loading from '@/components/Loading';
export default defineComponent({
props: {
rowKey: {
type: String,
default: '',
},
data: {
type: Array,
default: () => [],
},
columns: {
type: Array,
default: () => [],
},
loading: {
type: Boolean,
default: false,
},
handleRowClick: {
type: [Function, Boolean],
default: false,
},
},
emits: ['update:loading'],
setup(props) {
// 行点击事件
const rowClick = (item: any) => {
const { handleRowClick } = props;
if (handleRowClick && typeof handleRowClick !== 'boolean') {
handleRowClick(item);
}
};
// 当前显示的元素
const currentShowElement = () => {
const { loading, data } = props;
if (data.length) {
return props.data.map((item: any, index: number) => (
<tr key={props.rowKey ? item[props.rowKey] : index} onClick={rowClick.bind(this, item)}>
{props.columns.map((column: any) => (
<td
class={column.className}
style={{
width: column.width ? column.width : '',
textAlign: column.align ? column.align : 'left',
}}
>
{column.cell
? column.cell({
col: column,
row: item,
})
: item[column.key]}
</td>
))}
</tr>
));
} else {
return (
<tr class="le-table__empty-row">
<td colspan={props.columns.length}>
<div class="le-table__empty">暂无数据</div>
</td>
</tr>
);
}
};
return () => (
<div class="le-table-parent">
<table class="le-table">
<thead>
<tr>
{props.columns.map((column: any) => (
<th
style={{
width: column.width ? column.width : '',
textAlign: column.align ? column.align : 'left',
}}
>
{column.title}
</th>
))}
</tr>
</thead>
<tbody>{currentShowElement()}</tbody>
</table>
<div class="le-table-loading" v-show={props.loading}>
<Loading mask={true}></Loading>
</div>
</div>
);
},
});
...@@ -29,7 +29,7 @@ const currentCacheList = ref(getCacheList()); ...@@ -29,7 +29,7 @@ const currentCacheList = ref(getCacheList());
watch( watch(
() => keepAliveList.value, () => keepAliveList.value,
(v) => { () => {
currentCacheList.value = getCacheList(); currentCacheList.value = getCacheList();
}, },
{ {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="my-person-items"> <div class="my-person-items">
<template v-for="item in personList.list" :key="item.id"> <template v-for="item in personList.list" :key="item.id">
<template v-if="item.audit_status == LIVE_AUDIT_STATUS.LIVE_AUDIT_STATUS_FINISH"> <template v-if="item.audit_status == LIVE_AUDIT_STATUS.LIVE_AUDIT_STATUS_FINISH">
<CardOne :id="item.id" :img="item.cover_url" :name="item.name" :edit="true" @nameChange="nameChange"> <CardOne :id="item.id" :img="item.cover_url" :name="item.name" :edit="true">
<template #hover> <template #hover>
<div class="my-digtal-people-hover2"> <div class="my-digtal-people-hover2">
<template v-if="true"> <template v-if="true">
...@@ -71,9 +71,6 @@ const openDialog = (item: any) => { ...@@ -71,9 +71,6 @@ const openDialog = (item: any) => {
deleteId.value = item.id; deleteId.value = item.id;
}; };
// 修改名称
const nameChange = (id: number | string, name: string) => {};
// 确认删除 // 确认删除
const confirm = () => { const confirm = () => {
// //
......
...@@ -12,7 +12,7 @@ import { onBeforeUnmount, onMounted, ref } from 'vue'; ...@@ -12,7 +12,7 @@ import { onBeforeUnmount, onMounted, ref } from 'vue';
import Human from './components/human.vue'; import Human from './components/human.vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { callPyjsInWindow, injectWindow } from '@/utils/pyqt'; import { callPyjsInWindow, injectWindow } from '@/utils/pyqt';
import { getliveTaskReply, getUserCookie } from '@/utils/api/userApi'; import { getliveTaskReply } from '@/utils/api/userApi';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import { writeLog } from '@/utils/pyqt'; import { writeLog } from '@/utils/pyqt';
......
...@@ -22,9 +22,9 @@ import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'; ...@@ -22,9 +22,9 @@ 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';
import { show_message, isDev, DataType, randomInt, randomIntFormList } from '@/utils/tool'; import { show_message, isDev, DataType, randomIntFormList } 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, liveTts, getLiveTaskInfo, liveTaskRegenerate } from '@/utils/api/userApi';
import routerConfig from '@/router/tool'; import routerConfig from '@/router/tool';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import { v4 } from 'uuid'; import { v4 } from 'uuid';
...@@ -33,7 +33,7 @@ import { CONFUSE_STATUS } from '@/service/Live'; ...@@ -33,7 +33,7 @@ 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';
import { writeLog } from '@/utils/pyqt'; import { writeLog } from '@/utils/pyqt';
const { currentConfuseId, confuseList, stopConfuse, currentStartConfuse, openConfuseInterval } = useConfuse(); const { currentConfuseId, confuseList, stopConfuse, openConfuseInterval } = useConfuse();
const { openInterval: confuseInterval } = processTextCallback(); const { openInterval: confuseInterval } = processTextCallback();
const store = useStore(); const store = useStore();
...@@ -151,7 +151,7 @@ const submitAudioTask = async (list: any[]) => { ...@@ -151,7 +151,7 @@ const submitAudioTask = async (list: any[]) => {
id: i, id: i,
}; };
// 生成音频 // 生成音频
let res: any = await liveTts(params); await liveTts(params);
} }
console.log('等待音频生成完成'); console.log('等待音频生成完成');
// 开始轮询 // 开始轮询
...@@ -214,8 +214,6 @@ const findOneVideoInit = () => { ...@@ -214,8 +214,6 @@ const findOneVideoInit = () => {
if (status) { if (status) {
// 当前显示的视频 // 当前显示的视频
let item = mainVideoList.value[currentPlayMainIndex.value]; let item = mainVideoList.value[currentPlayMainIndex.value];
// 主视频列表中的行
let videoInfo = realVideoList.value[item.videoIndex];
const changeVideo = (url: string, index: number | boolean = false) => { const changeVideo = (url: string, index: number | boolean = false) => {
hideVideo.play = false; hideVideo.play = false;
......
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
<script lang="tsx" setup> <script lang="tsx" setup>
import Loading from '@/components/loading.vue'; import Loading from '@/components/loading.vue';
import CustomSwitch from '@/components/switch.vue'; import CustomSwitch from '@/components/switch';
import Upload from '@/components/upload'; import Upload from '@/components/upload';
import CustomTabs from '@/components/CustomTabs'; import CustomTabs from '@/components/CustomTabs';
import CustomTabPanel from '@/components/CustomTabPanel'; import CustomTabPanel from '@/components/CustomTabPanel';
......
...@@ -5,17 +5,7 @@ ...@@ -5,17 +5,7 @@
<Button class="add-interact-button" @click="openDialog()">+ 新增互动内容</Button> <Button class="add-interact-button" @click="openDialog()">+ 新增互动内容</Button>
</div> </div>
<div class="interact-table"> <div class="interact-table">
<Table <Table rowkey="id" :data="tableList.list" :columns="columns" :loading="loading"></Table>
rowkey="id"
:pageNum="pageNum"
:pageSize="pageSize"
:total="total"
:list="tableList.list"
:columns="columns"
:loading="loading"
:pagination="false"
@PageNumChange="PageNumChange"
></Table>
</div> </div>
<AddInteractDialog <AddInteractDialog
v-model:visible="dialogVisible" v-model:visible="dialogVisible"
...@@ -32,8 +22,8 @@ ...@@ -32,8 +22,8 @@
<script lang="tsx" setup> <script lang="tsx" setup>
import ConfirmDialog from '@/components/ConfirmDialog.vue'; import ConfirmDialog from '@/components/ConfirmDialog.vue';
import Button from '@/components/Button.vue'; import Button from '@/components/Button.vue';
import Table from '@/components/table.vue'; import Table from '@/components/table';
import CustomSwitch from '@/components/switch.vue'; import CustomSwitch from '@/components/switch';
import { reactive, ref, watch } from 'vue'; import { reactive, ref, watch } from 'vue';
import EditSvg from '@/assets/svg/home/edit.svg'; import EditSvg from '@/assets/svg/home/edit.svg';
import DeleteSvg from '@/assets/svg/home/delete.svg'; import DeleteSvg from '@/assets/svg/home/delete.svg';
...@@ -52,9 +42,6 @@ const confirmRow = ref({}); ...@@ -52,9 +42,6 @@ const confirmRow = ref({});
const dialogType = ref('add'); const dialogType = ref('add');
const loading = ref(false); const loading = ref(false);
const pageNum = ref<number>(1);
const pageSize = ref<number>(10);
const total = ref<number>(0);
const dialogVisible = ref(false); const dialogVisible = ref(false);
const tableList = reactive({ const tableList = reactive({
...@@ -134,22 +121,19 @@ const switchChange = async (value: string | number | boolean, id: string | numbe ...@@ -134,22 +121,19 @@ const switchChange = async (value: string | number | boolean, id: string | numbe
const columns = [ const columns = [
{ {
title: '问题', title: '问题',
colKey: 'problem', key: 'problem',
width: '60%', width: '60%',
className: 'table-problem-td',
}, },
{ {
title: '状态', title: '状态',
colKey: 'c_status', key: 'c_status',
cell: (h, { col, row }) => ( cell: ({ col, row }) => <CustomSwitch v-model={row[col.key]} id={row.id} onChange={switchChange}></CustomSwitch>,
<div>
<CustomSwitch v-model={row[col.colKey]} id={row.id} onChange={switchChange}></CustomSwitch>
</div>
),
}, },
{ {
title: '操作', title: '操作',
colKey: 'get3', key: 'get3',
cell: (h, { row }) => ( cell: ({ row }) => (
<div class="edit-box"> <div class="edit-box">
<span class="edit-icon" onClick={rowChange.bind(this, row)}> <span class="edit-icon" onClick={rowChange.bind(this, row)}>
<EditSvg></EditSvg> <EditSvg></EditSvg>
...@@ -202,10 +186,6 @@ watch( ...@@ -202,10 +186,6 @@ watch(
}, },
); );
const PageNumChange = (value: number) => {
pageNum.value = value;
};
const openDialog = () => { const openDialog = () => {
dialogType.value = 'add'; dialogType.value = 'add';
dialogVisible.value = true; dialogVisible.value = true;
...@@ -238,6 +218,9 @@ const openDialog = () => { ...@@ -238,6 +218,9 @@ const openDialog = () => {
margin-left: 12px; margin-left: 12px;
} }
} }
.table-problem-td {
color: white;
}
} }
} }
</style> </style>
...@@ -216,7 +216,6 @@ import ScriptTemplate from '@/components/ScriptTemplate.vue'; ...@@ -216,7 +216,6 @@ import ScriptTemplate from '@/components/ScriptTemplate.vue';
import Select from '@/components/Select.vue'; import Select from '@/components/Select.vue';
import SelectionPopup from '@/components/SelectionPopup.vue'; import SelectionPopup from '@/components/SelectionPopup.vue';
import { show_message, isDev, ecursionDeepCopy } from '@/utils/tool'; import { show_message, isDev, ecursionDeepCopy } from '@/utils/tool';
import { audioAccept } from '@/constants/token';
import AudioScriptDialog from './audioScriptDialog.vue'; import AudioScriptDialog from './audioScriptDialog.vue';
import { import {
createLiveKeys, createLiveKeys,
...@@ -251,7 +250,6 @@ const route = useRoute(); ...@@ -251,7 +250,6 @@ const route = useRoute();
// 编辑信息 // 编辑信息
const editInfo = computed(() => store.getters['live/getEditLive']); const editInfo = computed(() => store.getters['live/getEditLive']);
const createLiveInfo = computed(() => store.getters['live/getLiveInfo']);
// 文本脚本列表 // 文本脚本列表
const textScriptList = ref([]); const textScriptList = ref([]);
...@@ -273,9 +271,6 @@ const deleteAudioIndex = ref(); ...@@ -273,9 +271,6 @@ const deleteAudioIndex = ref();
// 是否gpt洗稿 // 是否gpt洗稿
const isDisorganize = ref(false); const isDisorganize = ref(false);
// upload组件的ref
const uploadRef = ref();
const lists = reactive({ const lists = reactive({
tones: [], tones: [],
soundColor: [], soundColor: [],
...@@ -302,8 +297,6 @@ const audioScriptVisible = ref(false); ...@@ -302,8 +297,6 @@ const audioScriptVisible = ref(false);
const ossConfig = ref({}); const ossConfig = ref({});
// 上传的音频文件链接 // 上传的音频文件链接
const mp3Url = ref(''); const mp3Url = ref('');
// 多选文件列表
const mp3UrlList = ref([]);
// 音频 我的音色 // 音频 我的音色
const phoneticsVisible = ref(false); const phoneticsVisible = ref(false);
...@@ -315,11 +308,6 @@ const textareaValue = ref(''); ...@@ -315,11 +308,6 @@ const textareaValue = ref('');
const currentOption = ref(scriptTypeText); const currentOption = ref(scriptTypeText);
// 音频脚本编辑后
const uploadEdit = (list: any[], oldList: any[]) => {
uploadChange();
};
const confirmDeleteAudio = () => { const confirmDeleteAudio = () => {
audioScriptList.value.splice(deleteAudioIndex.value, 1); audioScriptList.value.splice(deleteAudioIndex.value, 1);
uploadChange(); uploadChange();
......
...@@ -102,10 +102,8 @@ import { useLiveInfoSubmit } from '@/hooks/useStoreCommit'; ...@@ -102,10 +102,8 @@ import { useLiveInfoSubmit } from '@/hooks/useStoreCommit';
import { processTextCallback } from '@/hooks/useScript'; import { processTextCallback } from '@/hooks/useScript';
import CustomException from '@/utils/error'; import CustomException from '@/utils/error';
import { v4 } from 'uuid'; import { v4 } from 'uuid';
import { splitAudio } from '@/utils/audio';
import { audioScriptVersion } from '@/service/CreateLive';
import { audioSplitDuration, getTestUuid } from '@/constants/token'; import { audioSplitDuration, getTestUuid } from '@/constants/token';
const { loading, initNum, currentSetp, live_task_id, openInterval, getCreateLiveInfo, submitSuccessed, uploadToAly } = const { loading, initNum, currentSetp, live_task_id, openInterval, getCreateLiveInfo, submitSuccessed } =
processTextCallback(); processTextCallback();
const [commitInfo] = useLiveInfoSubmit(); const [commitInfo] = useLiveInfoSubmit();
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</div> </div>
</t-form-item> </t-form-item>
<t-form-item> <t-form-item>
<t-checkbox class="remember-password-box" v-model="remember">记住密码</t-checkbox> <CheckBox class="remember-password-box" v-model="remember">记住密码</CheckBox>
</t-form-item> </t-form-item>
<t-form-item> <t-form-item>
<div class="submit-box"> <div class="submit-box">
...@@ -63,6 +63,7 @@ import { useStore } from 'vuex'; ...@@ -63,6 +63,7 @@ import { useStore } from 'vuex';
import { setRememberList, getRememberList } from '@/utils/remember'; import { setRememberList, getRememberList } from '@/utils/remember';
import { UserLogin } from '@/utils/api/userApi'; import { UserLogin } from '@/utils/api/userApi';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import CheckBox from '@/components/CheckBox.vue';
const store = useStore(); const store = useStore();
const router = useRouter(); const router = useRouter();
...@@ -110,7 +111,7 @@ const onSubmit = async ({ validateResult, firstError }: any) => { ...@@ -110,7 +111,7 @@ const onSubmit = async ({ validateResult, firstError }: any) => {
time: res.data.expires_in, time: res.data.expires_in,
}); });
// 获取用户信息 // 获取用户信息
store.dispatch('user/UserInfo'); store.dispatch('user/getUserInfo');
router.replace({ router.replace({
path: '/', path: '/',
}); });
...@@ -205,28 +206,6 @@ onMounted(() => { ...@@ -205,28 +206,6 @@ onMounted(() => {
} }
} }
} }
.remember-password-box {
.t-checkbox__input {
background: transparent;
border: 1px solid #848e9c;
border-radius: 0;
border-radius: 2px;
}
.t-checkbox__label {
color: white;
font-weight: 300;
font-size: @size-12;
}
}
.t-is-checked {
.t-checkbox__input {
background: #00f9f9;
border-color: transparent;
&::after {
border-color: black;
}
}
}
} }
} }
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import { onBeforeUnmount, ref, watch } from 'vue'; import { onBeforeUnmount, ref, watch } from 'vue';
import AddVideoPlay from '@/components/AddVideoPlay.vue'; import AddVideoPlay from '@/components/AddVideoPlay.vue';
const props = withDefaults( withDefaults(
defineProps<{ defineProps<{
video: any; video: any;
video2: any; video2: any;
......
...@@ -18,7 +18,7 @@ import { getLiveDetail } from '@/utils/api/userApi'; ...@@ -18,7 +18,7 @@ import { getLiveDetail } from '@/utils/api/userApi';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { show_message } from '@/utils/tool'; import { show_message } from '@/utils/tool';
import { callPyjsInWindow, injectWindow } from '@/utils/pyqt'; import { callPyjsInWindow, injectWindow } from '@/utils/pyqt';
import { getliveTaskReply, getLiveTask, getUserCookie } from '@/utils/api/userApi'; import { getliveTaskReply, getLiveTask } from '@/utils/api/userApi';
import routerConfig from '@/router/tool'; import routerConfig from '@/router/tool';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
......
...@@ -4,7 +4,6 @@ import { audioStart } from '@/service/Common'; ...@@ -4,7 +4,6 @@ import { audioStart } from '@/service/Common';
import store from '@/store'; import store from '@/store';
import { v4 } from 'uuid'; import { v4 } from 'uuid';
import { writeLog } from '@/utils/pyqt'; import { writeLog } from '@/utils/pyqt';
import { getDurationOfAudioFile } from '@/utils/audio';
/** /**
* 创建直播的版本 * 创建直播的版本
...@@ -60,7 +59,7 @@ export const movementTypeEnd = 2; // 结尾插入 ...@@ -60,7 +59,7 @@ export const movementTypeEnd = 2; // 结尾插入
// 合并同类项音频 // 合并同类项音频
export const mergeSameAudio = (content: any[]) => { export const mergeSameAudio = (content: any[]) => {
let list = []; let list = [];
content.forEach((item: any, index: number) => { content.forEach((item: any) => {
let title = ''; let title = '';
let url = ''; let url = '';
let movement_name = ''; let movement_name = '';
...@@ -277,7 +276,7 @@ export const filterFiled = (item: any, type: string = '') => { ...@@ -277,7 +276,7 @@ export const filterFiled = (item: any, type: string = '') => {
// 音色id // 音色id
params.phonetic_timbres_id = item[createLiveKeys.textSoundColor]; params.phonetic_timbres_id = item[createLiveKeys.textSoundColor];
params.content = newList.map((row: any, index: number) => { params.content = newList.map((row: any) => {
return { return {
title: row.title, title: row.title,
content: row.content, content: row.content,
...@@ -408,45 +407,6 @@ export const regenerate = async (list: any[], item: any, live_id: any) => { ...@@ -408,45 +407,6 @@ export const regenerate = async (list: any[], item: any, live_id: any) => {
} }
}; };
// 计算音频块列表的开始时间和结束时间
export const getAudioStartTimeAndEndTime = async (list: any[]) => {
try {
let durationList = [];
for (let i = 0; i < list.length; i++) {
let data = list[i].data;
let params: any = {
audio_url: data.audio_address,
};
// 计算音频块的起始与结束时间点
let duration = await getDurationOfAudioFile(data.audio_address);
console.log(duration);
params.duration = duration;
// 默认值
params.start = 0;
params.end = duration;
durationList.forEach((it: any) => {
// 开始时间
params.start += it.duration;
});
durationList.push(params);
if (i !== 0) {
durationList.forEach((it: any, index: number) => {
// 不包括自己
if (index !== durationList.length - 1) {
// 结束时间
durationList[i].end += it.duration;
}
});
}
}
return durationList;
} catch (e) {
console.log(e);
}
};
// 洗稿音频回调处理 // 洗稿音频回调处理
export const onAudioProcessed = async (res: any, liveInfo: any) => { export const onAudioProcessed = async (res: any, liveInfo: any) => {
let list = []; let list = [];
......
...@@ -23,7 +23,8 @@ const getters = { ...@@ -23,7 +23,8 @@ const getters = {
const actions = { const actions = {
// 洗稿 // 洗稿
async confuse({ commit }, params) { async confuse({ commit }, params) {
const { user_id, live_task_id, task_id, audio_task_id, createLiveInfo } = params; // user_id in params
const { live_task_id, task_id, audio_task_id, createLiveInfo } = params;
try { try {
// 获取洗稿回调 // 获取洗稿回调
let confuseList = await onRewriteCallback(task_id); let confuseList = await onRewriteCallback(task_id);
......
...@@ -71,7 +71,7 @@ const actions = { ...@@ -71,7 +71,7 @@ const actions = {
commit('changeChartColor', isDarkMode ? DARK_CHART_COLORS : LIGHT_CHART_COLORS); commit('changeChartColor', isDarkMode ? DARK_CHART_COLORS : LIGHT_CHART_COLORS);
}, },
changeBrandTheme(_: { state: IStateType }, payload: IStateType) { changeBrandTheme({ state: IStateType }, payload: IStateType) {
const { brandTheme } = payload; const { brandTheme } = payload;
document.documentElement.setAttribute('theme-color', brandTheme); document.documentElement.setAttribute('theme-color', brandTheme);
......
...@@ -73,9 +73,12 @@ const getters = { ...@@ -73,9 +73,12 @@ const getters = {
const actions = { const actions = {
async getUserInfo({ commit }) { async getUserInfo({ commit }) {
try { try {
if (state.token) {
const res: any = await getAdminUserInfo(); const res: any = await getAdminUserInfo();
commit('setUserInfo', res.data); commit('setUserInfo', res.data);
return res; return res;
}
return false;
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
......
...@@ -3,33 +3,14 @@ ...@@ -3,33 +3,14 @@
*/ */
import { import {
Button as TButton, Button as TButton,
Select as TSelect,
Option as TOption,
Pagination as TPagination,
Form as TForm, Form as TForm,
Input as TInput,
Switch as TSwitch,
FormItem as TFormItem, FormItem as TFormItem,
Dialog as TDialog, Dialog as TDialog,
Checkbox as TCheckbox,
Progress as TProgress, Progress as TProgress,
Upload as TUpload, Upload as TUpload,
} from 'tdesign-vue-next'; } from 'tdesign-vue-next';
const components = [ const components = [TButton, TForm, TFormItem, TDialog, TProgress, TUpload];
TButton,
TSelect,
TOption,
TPagination,
TForm,
TFormItem,
TInput,
TSwitch,
TDialog,
TCheckbox,
TProgress,
TUpload,
];
export default { export default {
install(app) { install(app) {
......
...@@ -444,7 +444,7 @@ export const mergedArray = (arr: any[], key: string = 'uuid', first: string = 'i ...@@ -444,7 +444,7 @@ export const mergedArray = (arr: any[], key: string = 'uuid', first: string = 'i
// 获取视频第一帧 // 获取视频第一帧
export const getFirstFrameOfVideo = (url: string) => { export const getFirstFrameOfVideo = (url: string) => {
return new Promise<Blob>((resolve, reject) => { return new Promise<Blob>((resolve) => {
// let imgbase64 = null; // let imgbase64 = null;
let video = document.createElement('video'); let video = document.createElement('video');
video.setAttribute('crossOrigin', 'Anonymous'); video.setAttribute('crossOrigin', 'Anonymous');
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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