From c70bc65f30eb85fc6bfe3e828af81f5d2adeb4b3 Mon Sep 17 00:00:00 2001 From: Megghy Date: Wed, 21 Feb 2024 22:34:49 +0800 Subject: [PATCH] fix danmakutype: enter --- src/components/DanmakuContainer.vue | 159 ++++++++++++++------ src/components/VideoCollectInfoCard.vue | 1 - src/views/manage/VideoCollectDetailView.vue | 7 +- 3 files changed, 121 insertions(+), 46 deletions(-) diff --git a/src/components/DanmakuContainer.vue b/src/components/DanmakuContainer.vue index 1b85c70..73c9f5c 100644 --- a/src/components/DanmakuContainer.vue +++ b/src/components/DanmakuContainer.vue @@ -25,7 +25,6 @@ import { NList, NListItem, NModal, - NPopover, NRadioButton, NRadioGroup, NSkeleton, @@ -34,7 +33,6 @@ import { NSwitch, NTag, NTooltip, - NVirtualList, } from 'naive-ui' import { computed, nextTick, onMounted, ref, watch } from 'vue' import LiveInfoContainer from './LiveInfoContainer.vue' @@ -57,11 +55,11 @@ const accountInfo = useAccount() const debouncedFn = useDebounceFn(() => { UpdateDanmakus() }, 750) -let isLoading = ref(false) -let showModal = ref(false) -let showExportModal = ref(false) -let userDanmakus = ref() -let hideAvatar = useLocalStorage('Setting.HideAvatar', false) +const isLoading = ref(false) +const showModal = ref(false) +const showExportModal = ref(false) +const userDanmakus = ref() +const hideAvatar = useLocalStorage('Setting.HideAvatar', false) const { width } = useWindowSize() interface Props { @@ -113,7 +111,7 @@ const emit = defineEmits<{ defineExpose({ InsertDanmakus, }) -let danmakus = ref([]) +const danmakus = ref([]) watch( () => showTools, (newV, oldV) => { @@ -128,25 +126,26 @@ watch(danmakuRef, (newValue) => { danmakus.value = GetFilteredDanmakus(newValue) }) -let keyword = ref('') -let enableRegex = ref(false) -let deselect = ref(false) -let price = ref() -let filterSelected = ref(defaultFilterSelected) -let innerShowTools = ref(showTools) -let modalShowTools = ref(false) -let orderDecreasing = ref(false) -let orderByPrice = ref(false) -let processing = ref(false) -let isRanking = ref(false) -let rankInfo = ref([]) -let currentRankInfo = ref([]) -let rankType = ref(RankType.Danmaku) -let hideEmoji = ref(false) +const keyword = ref('') +const enableRegex = ref(false) +const deselect = ref(false) +const price = ref() +const filterSelected = ref(defaultFilterSelected) +const innerShowTools = ref(showTools) +const modalShowTools = ref(false) +const orderDecreasing = ref(false) +const orderByPrice = ref(false) +const processing = ref(false) +const isRanking = ref(false) +const rankInfo = ref([]) +const currentRankInfo = ref([]) +const rankType = ref(RankType.Danmaku) +const hideEmoji = ref(false) +const existEnterMessage = ref(false) -let exportType = ref<'json' | 'xml' | 'csv'>('json') -let onlyExportFilteredDanmakus = ref(false) -let isExporting = ref(false) +const exportType = ref<'json' | 'xml' | 'csv'>('json') +const onlyExportFilteredDanmakus = ref(false) +const isExporting = ref(false) function OnNameClick(uId: number) { if (isInModal) { @@ -257,7 +256,17 @@ function GetRankIndexColor(index: number) { function Export() { isExporting.value = true saveAs( - new Blob([GetString(accountInfo.value, currentLive, onlyExportFilteredDanmakus.value ? danmakus.value : currentDanmakus, exportType.value)], { type: 'text/plain;charset=utf-8' }), + new Blob( + [ + GetString( + accountInfo.value, + currentLive, + onlyExportFilteredDanmakus.value ? danmakus.value : currentDanmakus, + exportType.value, + ), + ], + { type: 'text/plain;charset=utf-8' }, + ), `${Date.now()}_${currentLive.startAt}_${currentLive.title.replace('_', '-')}_${accountInfo.value?.name}.${exportType.value}`, ) isExporting.value = false @@ -283,7 +292,9 @@ function GetFilteredDanmakus(targetDanmakus?: DanmakuModel[]) { tempDanmakus = tempDanmakus.filter((d) => d.type != EventDataTypes.Message || !d.isEmoji) } if (orderByPrice.value) { - tempDanmakus = tempDanmakus.filter((d) => d.type != EventDataTypes.Message).sort((a, b) => (a.price ?? 0) - (b.price ?? 0)) + tempDanmakus = tempDanmakus + .filter((d) => d.type != EventDataTypes.Message) + .sort((a, b) => (a.price ?? 0) - (b.price ?? 0)) } else { tempDanmakus = tempDanmakus.sort((a, b) => a.time - b.time) } @@ -295,7 +306,11 @@ function GetFilteredDanmakus(targetDanmakus?: DanmakuModel[]) { if (d.uId.toString() == keyword.value || d.uName == keyword.value) { return true } - return enableRegex.value ? (d.msg?.match(keyword.value) ? true : false) : d.msg?.toLowerCase().includes(keyword.value.toLowerCase()) == true + return enableRegex.value + ? d.msg?.match(keyword.value) + ? true + : false + : d.msg?.toLowerCase().includes(keyword.value.toLowerCase()) == true } if (price.value && price.value > 0) { tempDanmakus = tempDanmakus.filter((d) => (d.price ?? 0) >= (price.value ?? 0)) @@ -317,14 +332,22 @@ function RoundNumber(num: number) { } onMounted(() => { - danmakus.value = currentDanmakus + danmakus.value = GetFilteredDanmakus() + existEnterMessage.value = danmakus.value.some((d) => d.type == EventDataTypes.Message) + //defaultFilterSelected.push(EventDataTypes.Enter) }) - + @@ -363,9 +394,10 @@ onMounted(() => {
- 文件名格式: {Unix}_{Unix: {{ currentLive.startAt }} }_{' _ ' 将被转义为 ' - '}_{{{ accountInfo?.name }}Unix}_{Unix: {{ currentLive.startAt }} }_{' _ ' 将被转义为 ' - '}_{{{ accountInfo?.name }}}.{{ exportType }}
弹幕Type对应: @@ -410,7 +442,9 @@ onMounted(() => { - 导出 + + 导出 + 降序 隐藏表情 @@ -419,7 +453,14 @@ onMounted(() => { 按价格排序 - + @@ -428,7 +469,15 @@ onMounted(() => { 反选 - + @@ -445,6 +494,8 @@ onMounted(() => { + + @@ -462,15 +513,39 @@ onMounted(() => {
- + -

- +

+

diff --git a/src/components/VideoCollectInfoCard.vue b/src/components/VideoCollectInfoCard.vue index 87ce292..df22656 100644 --- a/src/components/VideoCollectInfoCard.vue +++ b/src/components/VideoCollectInfoCard.vue @@ -25,7 +25,6 @@ const renderCountdown: CountdownProps['render'] = (info: { hours: number; minute } function onClick() { if (props.canClick == true) { - console.log(props.item.id) router.push({ name: 'manage-videoCollect-Detail', params: { id: props.item.id } }) } } diff --git a/src/views/manage/VideoCollectDetailView.vue b/src/views/manage/VideoCollectDetailView.vue index 1126d5d..93f8a25 100644 --- a/src/views/manage/VideoCollectDetailView.vue +++ b/src/views/manage/VideoCollectDetailView.vue @@ -101,13 +101,13 @@ const createRules: FormRules = { } const paddingVideos = computed(() => { - return videoDetail.value.videos.filter((v) => v.info.status == VideoStatus.Pending) + return videoDetail.value?.videos?.filter((v) => v.info.status == VideoStatus.Pending) ?? [] }) const rejectVideos = computed(() => { - return videoDetail.value.videos.filter((v) => v.info.status == VideoStatus.Rejected) + return videoDetail.value?.videos?.filter((v) => v.info.status == VideoStatus.Rejected) ?? [] }) const acceptVideos = computed(() => { - return videoDetail.value.videos.filter((v) => v.info.status == VideoStatus.Accepted) + return videoDetail.value?.videos?.filter((v) => v.info.status == VideoStatus.Accepted) ?? [] }) async function getData() { @@ -121,6 +121,7 @@ async function getData() { description: data.data.table.description, maxVideoCount: data.data.table.maxVideoCount, } as VideoCollectCreateModel + console.log(data.data) return data.data } } catch (err) {