Commit e1567184 by haojie

动作提交去掉文件后缀

parent b6739667
......@@ -13,7 +13,7 @@ export default defineComponent({
default: 0,
},
},
emits: ['update:modelValue'],
emits: ['update:modelValue', 'change'],
setup(props, context) {
const { slots, emit } = context;
const use_slots = useSlots();
......@@ -92,11 +92,13 @@ export default defineComponent({
watch(
() => props.modelValue,
(v) => {
// 找到对应的下标
let index = titles.value.findIndex((item: any) => item.name == v);
if (index !== -1) {
// 更新tab_bar的位置
onChange(titles.value[index].name, titles.value[index].index);
if (currentTab.value != v) {
// 找到对应的下标
let index = titles.value.findIndex((item: any) => item.name == v);
if (index !== -1) {
// 更新tab_bar的位置
onChange(titles.value[index].name, titles.value[index].index);
}
}
},
);
......@@ -105,6 +107,7 @@ export default defineComponent({
const onChange = (name: string, index: number) => {
currentTab.value = name;
emit('update:modelValue', name);
emit('change', name);
navIndex.value = index;
// 重新计算tab的宽度
getTabBarWidth();
......
......@@ -104,8 +104,8 @@
font-size: @size-14;
font-weight: 700;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
// overflow: hidden;
// text-overflow: ellipsis;
.dja();
}
& > * {
......
......@@ -110,6 +110,7 @@ watch(
}
}
.chose-person-dialog-body {
overflow: hidden;
.header {
text-align: center;
color: #fff;
......@@ -122,11 +123,11 @@ watch(
font-size: @size-13;
}
.btn-active {
border: 1px solid #04ae8a;
background: #04ae8a;
border: 1px solid #04ae8a !important;
background: #04ae8a !important;
&:hover {
border: 1px solid #04ae8a;
background: #04ae8a;
border: 1px solid #04ae8a !important;
background: #04ae8a !important;
}
}
}
......
......@@ -21,6 +21,7 @@
border-radius: 8px;
width: 200px;
height: 100%;
object-fit: contain;
}
}
.center {
......
......@@ -15,7 +15,7 @@ export default defineComponent({
{props.list.map((item: any) => (
<div class="record-items" key={item.id}>
<div class="left">
<img src={item.cover_url} alt="" />
<img src={item.cover} alt="" />
</div>
<div class="center">
<div class="name">
......
......@@ -8,7 +8,7 @@ import { useStore } from 'vuex';
import routerConfig from '@/router/tool';
import ChoseDigitalPeople from './components/choseDigitalPeople';
import Loading from '@/components/loading.vue';
import { alyOssUpload, show_message } from '@/utils/tool';
import { alyOssUpload, removeFileSuffix, show_message } from '@/utils/tool';
import { createLiveMovement, updateLiveMovement } from '@/utils/api/userApi';
import ConfirmDialog from '@/components/ConfirmDialog.vue';
import CustomTabs from '@/components/CustomTabs';
......@@ -73,12 +73,13 @@ export default defineComponent({
// 弹窗确认
const onConfirm = async () => {
try {
globalLoading.value = true;
// 成功回调
// 先把所有的封面上传到阿里云
let list = await Promise.all(
files.value.map(async (item: any) => {
let params: any = {
name: item.file.name,
name: removeFileSuffix(item.file.name),
url: item.url,
digital_man_id: currentCard.value,
};
......@@ -98,7 +99,6 @@ export default defineComponent({
}),
);
// 上传
globalLoading.value = true;
if (route.query.type == 'edit') {
// 更新
let res: any = await updateLiveMovement(route.query.id, list[0]);
......@@ -170,6 +170,11 @@ export default defineComponent({
];
};
const tabsChange = () => {
// 刷新列表
getMovement();
};
onMounted(async () => {
// 是否限制
if (route.query.type == 'edit') {
......@@ -232,7 +237,7 @@ export default defineComponent({
</div>
</div>
<div class="izable-page-tabs">
<CustomTabs v-model={currentTab.value} theme="dark2">
<CustomTabs v-model={currentTab.value} theme="dark2" onChange={tabsChange}>
<CustomTabPanel
name="1"
label="已创建"
......
......@@ -97,6 +97,14 @@ const confirm = () => {
show_message('音频至少上传一个');
return;
}
if (currentSelect.value && !currentRadio.value) {
show_message('您已选择动作,插入类型必填');
return;
}
if (!currentSelect.value && currentRadio.value) {
show_message('您已选择插入类型,动作必选');
return;
}
let movement_name = '';
let movement_url = '';
if (currentSelect.value) {
......
......@@ -656,6 +656,9 @@ const audioSplitV2 = async (type: string) => {
}
if (audioSplitTaskTotal.value === 0) {
console.log('没有要切割的,直接提交');
callPyjsInWindow('deleteTemporaryAudio', {
id: route.query.id,
});
// 没有要切割的,直接提交
if (type == 'create') {
// 创建
......
......@@ -477,7 +477,7 @@ export const mergedArray = (arr: any[], key: string = 'uuid', first: string = 'i
// 获取视频第一帧
export const getFirstFrameOfVideo = (url: string) => {
return new Promise<Blob>((resolve, reject) => {
let imgbase64 = null;
// let imgbase64 = null;
let video = document.createElement('video');
video.setAttribute('crossOrigin', 'Anonymous');
video.setAttribute('src', url);
......@@ -489,21 +489,9 @@ export const getFirstFrameOfVideo = (url: string) => {
let canvas = document.createElement('canvas');
let vWidth = video.videoWidth;
let vHeight = video.videoHeight;
let widthBg = 512;
let heightBg;
let splitHeight = 0;
if (vWidth < vHeight) {
heightBg = 300;
// heightBg = vHeight * 512 / vWidth;
splitHeight = vHeight / 2 - 150;
} else {
heightBg = vHeight;
}
//设置倍数是rate,倍数越大画图的图片越大,加载速度越慢
let rate = 1;
canvas.width = widthBg * rate;
canvas.height = 300;
canvas.getContext('2d').drawImage(video, 0, splitHeight, vWidth, heightBg, 0, 0, canvas.width, canvas.height);
canvas.width = vWidth;
canvas.height = vHeight;
canvas.getContext('2d').drawImage(video, 0, 0, vWidth, vHeight, 0, 0, canvas.width, canvas.height);
// imgbase64 = canvas.toDataURL('image/png');
// 转blob
canvas.toBlob(function (blob) {
......@@ -512,3 +500,12 @@ export const getFirstFrameOfVideo = (url: string) => {
});
});
};
// 去除文件后缀
export const removeFileSuffix = (name: string) => {
let index = name.lastIndexOf('.');
if (index !== -1) {
return name.slice(0, index);
}
return name;
};
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