fix songlist export

This commit is contained in:
2023-12-18 14:58:08 +08:00
parent ddc84cbbdc
commit 8894a5649e
9 changed files with 155 additions and 2782 deletions

View File

@@ -25,8 +25,6 @@ import {
NInputGroup,
NInputGroupLabel,
NInputNumber,
NList,
NListItem,
NModal,
NPopconfirm,
NSelect,
@@ -38,8 +36,7 @@ import {
NTooltip,
useMessage,
} from 'naive-ui'
import { onMounted, h, ref, watch, computed, reactive, VNodeChild } from 'vue'
import APlayer from 'vue3-aplayer'
import { onMounted, h, ref, watch, computed, VNodeChild } from 'vue'
import { NotepadEdit20Filled, Delete24Filled, Play24Filled, SquareArrowForward24Filled, Info24Filled } from '@vicons/fluent'
import NeteaseIcon from '@/svgs/netease.svg'
import FiveSingIcon from '@/svgs/fivesing.svg'

View File

@@ -187,8 +187,9 @@ async function ChangeBili() {
注册
</NText>
</NSpace>
<NDivider />
<NDivider>
<NText depth="3" style="font-size: 18px"> {{ accountInfo?.id }} </NText>
</NDivider>
<NSpace vertical>
<NCard size="small">
<NSpace :size="5">

View File

@@ -51,10 +51,10 @@ const neteaseSongListId = computed(() => {
const url = new URL(neteaseIdInput.value)
console.log(url)
if (url.host == 'music.163.com') {
let regex = /id=(\d+)/
const regex = /id=(\d+)/
// 使用exec方法在链接中查找匹配项
let match = regex.exec(neteaseIdInput.value)
const match = regex.exec(neteaseIdInput.value)
// 如果找到了匹配项那么match[1]就是分组1的值也就是id的值
if (match) {
@@ -233,7 +233,7 @@ async function addSongs(songsShoudAdd: SongsInfo[], from: SongFrom) {
Author: s.author,
Url: s.url,
Description: s.description,
}))
})),
)
}
@@ -345,6 +345,16 @@ async function getSongs() {
})
}
function exportData() {
const from = (f: SongFrom) => {
switch (f) {
case SongFrom.Custom:
return '手动添加'
case SongFrom.Netease:
return '网易云'
case SongFrom.FiveSing:
return '5sing'
}
}
const text = objectsToCSV(
songs.value.map((s) => ({
id: s.id,
@@ -358,19 +368,12 @@ function exportData() {
语言: s.language.map((l) => songSelectOption.find((o) => o.value == l)?.label).join(','),
标签: s.tags?.join(',') ?? '',
链接: s.url,
}))
})),
)
const from = (f: SongFrom) => {
switch (f) {
case SongFrom.Custom:
return '手动添加'
case SongFrom.Netease:
return '网易云'
case SongFrom.FiveSing:
return '5sing'
}
}
saveAs(new Blob([text], { type: 'text/plain;charset=utf-8' }), `歌单_${format(Date.now(), 'yyyy-MM-dd HH:mm:ss')}_${accountInfo.value?.name}_.csv`)
const BOM = new Uint8Array([0xef, 0xbb, 0xbf])
const utf8encoder = new TextEncoder()
const utf8array = utf8encoder.encode(text)
saveAs(new Blob([BOM, utf8array], { type: 'text/csv;charset=utf-8;' }), `歌单_${format(Date.now(), 'yyyy-MM-dd HH:mm:ss')}_${accountInfo.value?.name}_.csv`)
}
onMounted(async () => {
@@ -433,11 +436,17 @@ onMounted(async () => {
<NSpace vertical>
<NCheckbox
:checked="addSongModel.options != undefined"
@update:checked="(checked: boolean) => {addSongModel.options = checked ? {
needJianzhang: false,
needTidu: false,
needZongdu: false
} as SongRequestOption : undefined}"
@update:checked="
(checked: boolean) => {
addSongModel.options = checked
? ({
needJianzhang: false,
needTidu: false,
needZongdu: false,
} as SongRequestOption)
: undefined
}
"
>
是否启用
</NCheckbox>
@@ -450,7 +459,11 @@ onMounted(async () => {
<NSpace align="center">
<NCheckbox
:checked="addSongModel.options.scMinPrice != undefined"
@update:checked="(checked: boolean) => {if(addSongModel.options) addSongModel.options.scMinPrice = checked ? 30 : undefined}"
@update:checked="
(checked: boolean) => {
if (addSongModel.options) addSongModel.options.scMinPrice = checked ? 30 : undefined
}
"
>
需要SC
</NCheckbox>
@@ -462,7 +475,11 @@ onMounted(async () => {
<NSpace align="center">
<NCheckbox
:checked="addSongModel.options.fanMedalMinLevel != undefined"
@update:checked="(checked: boolean) => {if(addSongModel.options) addSongModel.options.fanMedalMinLevel = checked ? 5 : undefined}"
@update:checked="
(checked: boolean) => {
if (addSongModel.options) addSongModel.options.fanMedalMinLevel = checked ? 5 : undefined
}
"
>
需要粉丝牌
<NTooltip>