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

@@ -2,12 +2,16 @@ module.exports = {
root: true, root: true,
env: { env: {
node: true, node: true,
'vite/config': true, // 添加Vite环境支持
}, },
extends: ['@vue/typescript/recommended', 'plugin:vue/vue3-essential', 'prettier', '@vue/eslint-config-typescript'], extends: [
parser: '@babel/eslint-parser', '@vue/typescript/recommended',
'plugin:vue/vue3-essential',
'prettier',
'@vue/eslint-config-typescript',
],
parserOptions: { parserOptions: {
ecmaVersion: 'latest', ecmaVersion: 'latest',
requireConfigFile: false,
}, },
rules: { rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',

45
.yarnclean Normal file
View File

@@ -0,0 +1,45 @@
# test directories
__tests__
test
tests
powered-test
# asset directories
docs
doc
website
images
assets
# examples
example
examples
# code coverage directories
coverage
.nyc_output
# build scripts
Makefile
Gulpfile.js
Gruntfile.js
# configs
appveyor.yml
circle.yml
codeship-services.yml
codeship-steps.yml
wercker.yml
.tern-project
.gitattributes
.editorconfig
.*ignore
.eslintrc
.jshintrc
.flowconfig
.documentup.json
.yarn-metadata.json
.travis.yml
# misc
*.md

View File

@@ -1,3 +0,0 @@
export const presets = [
'@vue/cli-plugin-babel/preset',
];

View File

@@ -1,3 +0,0 @@
module.exports = {
'*.{js,jsx,vue,ts,tsx}': 'vue-cli-service lint',
};

View File

@@ -10,58 +10,48 @@
}, },
"dependencies": { "dependencies": {
"@types/node": "^20.10.5", "@types/node": "^20.10.5",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@vicons/fluent": "^0.12.0", "@vicons/fluent": "^0.12.0",
"@vitejs/plugin-vue": "^4.2.3", "@vitejs/plugin-vue": "^4.2.3",
"@vueuse/core": "^10.1.2", "@vueuse/core": "^10.1.2",
"@vueuse/integrations": "^10.1.2",
"@vueuse/router": "^10.1.2", "@vueuse/router": "^10.1.2",
"core-js": "^3.8.3",
"date-fns": "^2.30.0", "date-fns": "^2.30.0",
"easy-speech": "^2.2.0", "easy-speech": "^2.2.0",
"echarts": "^5.4.3", "echarts": "^5.4.3",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.0.1",
"fast-xml-parser": "^4.3.2", "fast-xml-parser": "^4.3.2",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"grapheme-splitter": "^1.0.4", "grapheme-splitter": "^1.0.4",
"html2canvas": "^1.4.1", "html2canvas": "^1.4.1",
"linqts": "^1.15.0", "linqts": "^1.15.0",
"mitt": "^3.0.1", "mitt": "^3.0.1",
"prettier": "^3.1.1",
"qrcode.vue": "^3.4.1", "qrcode.vue": "^3.4.1",
"queue-typescript": "^1.0.1", "queue-typescript": "^1.0.1",
"universal-cookie": "^6.1.1",
"vite": "^5.0.10", "vite": "^5.0.10",
"vite-svg-loader": "^5.1.0", "vite-svg-loader": "^5.1.0",
"vue": "^3.3.12", "vue": "^3.3.12",
"vue-echarts": "^6.6.5", "vue-echarts": "^6.6.5",
"vue-meta": "^3.0.0-alpha.10",
"vue-request": "^2.0.3", "vue-request": "^2.0.3",
"vue-router": "4", "vue-router": "4",
"vue-turnstile": "^1.0.6", "vue-turnstile": "^1.0.6",
"vue3-aplayer": "^1.7.3", "vue3-aplayer": "^1.7.3",
"vue3-marquee": "^4.1.0", "vue3-marquee": "^4.1.0",
"vueuc": "^0.4.51", "vueuc": "^0.4.51",
"vuex": "^4.0.0",
"worker-timers": "^7.0.78" "worker-timers": "^7.0.78"
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "^7.21.3", "@babel/eslint-parser": "^7.21.3",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0", "@typescript-eslint/parser": "^6.14.0",
"@vicons/ionicons5": "^0.12.0", "@vicons/ionicons5": "^0.12.0",
"@vitejs/plugin-vue-jsx": "^3.1.0", "@vitejs/plugin-vue-jsx": "^3.1.0",
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/eslint-config-airbnb": "^7.0.1",
"@vue/eslint-config-typescript": "^12.0.0", "@vue/eslint-config-typescript": "^12.0.0",
"eslint": "^8.39.0", "eslint": "^8.39.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-vue": "^9.11.0", "eslint-plugin-vue": "^9.11.0",
"eslint-plugin-vuejs-accessibility": "^2.2.0",
"lint-staged": "^15.2.0",
"naive-ui": "^2.34.3", "naive-ui": "^2.34.3",
"prettier": "^3.1.1",
"stylus": "^0.62.0", "stylus": "^0.62.0",
"typescript": "~5.3.3", "typescript": "~5.3.3"
"vite-plugin-mkcert": "^1.16.0"
} }
} }

View File

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

View File

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

View File

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

2785
yarn.lock

File diff suppressed because it is too large Load Diff