mirror of
				https://git.unlock-music.dev/um/web.git
				synced 2025-11-04 23:13:30 +08:00 
			
		
		
		
	增加歌曲命名格式选项
This commit is contained in:
		
							parent
							
								
									211b4e0206
								
							
						
					
					
						commit
						9c6af8ff9c
					
				
							
								
								
									
										23
									
								
								src/App.vue
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								src/App.vue
									
									
									
									
									
								
							@ -16,6 +16,13 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                <el-row id="app-control">
 | 
					                <el-row id="app-control">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    <el-row style="padding-bottom: 1em; font-size: 14px">
 | 
				
			||||||
 | 
					                        歌曲命名格式:
 | 
				
			||||||
 | 
					                        <el-radio name="format" v-model="format" label="1">歌曲名</el-radio>
 | 
				
			||||||
 | 
					                        <el-radio name="format" v-model="format" label="2">歌手-歌曲名</el-radio>
 | 
				
			||||||
 | 
					                        <el-radio name="format" v-model="format" label="3">歌曲名-歌手</el-radio>
 | 
				
			||||||
 | 
					                    </el-row>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    <el-button @click="handleDownloadAll" icon="el-icon-download" plain>下载全部</el-button>
 | 
					                    <el-button @click="handleDownloadAll" icon="el-icon-download" plain>下载全部</el-button>
 | 
				
			||||||
                    <el-button @click="handleDeleteAll" icon="el-icon-delete" plain type="danger">删除全部</el-button>
 | 
					                    <el-button @click="handleDeleteAll" icon="el-icon-delete" plain type="danger">删除全部</el-button>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -96,6 +103,7 @@
 | 
				
			|||||||
                tableData: [],
 | 
					                tableData: [],
 | 
				
			||||||
                playing_url: "",
 | 
					                playing_url: "",
 | 
				
			||||||
                playing_auto: false,
 | 
					                playing_auto: false,
 | 
				
			||||||
 | 
					                format: '2',
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        mounted() {
 | 
					        mounted() {
 | 
				
			||||||
@ -153,7 +161,20 @@
 | 
				
			|||||||
            handleDownload(row) {
 | 
					            handleDownload(row) {
 | 
				
			||||||
                let a = document.createElement('a');
 | 
					                let a = document.createElement('a');
 | 
				
			||||||
                a.href = row.file;
 | 
					                a.href = row.file;
 | 
				
			||||||
                a.download = row.filename;
 | 
					                switch(this.format) {
 | 
				
			||||||
 | 
					                    case "1":
 | 
				
			||||||
 | 
					                        a.download = row.title + "." + row.ext;
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case "2":
 | 
				
			||||||
 | 
					                        a.download = row.artist + " - " + row.title + "." + row.ext;
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case "3":
 | 
				
			||||||
 | 
					                        a.download = row.title + " - " + row.artist + "." + row.ext;
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    default:
 | 
				
			||||||
 | 
					                        a.download = row.filename;
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                document.body.append(a);
 | 
					                document.body.append(a);
 | 
				
			||||||
                a.click();
 | 
					                a.click();
 | 
				
			||||||
                a.remove();
 | 
					                a.remove();
 | 
				
			||||||
 | 
				
			|||||||
@ -36,6 +36,7 @@ async function Decrypt(file, raw_filename, raw_ext) {
 | 
				
			|||||||
        filename: info.filename,
 | 
					        filename: info.filename,
 | 
				
			||||||
        title: info.title,
 | 
					        title: info.title,
 | 
				
			||||||
        artist: info.artist,
 | 
					        artist: info.artist,
 | 
				
			||||||
 | 
					        ext: 'flac',
 | 
				
			||||||
        album: tag.common.album,
 | 
					        album: tag.common.album,
 | 
				
			||||||
        picture: picUrl,
 | 
					        picture: picUrl,
 | 
				
			||||||
        file: musicUrl,
 | 
					        file: musicUrl,
 | 
				
			||||||
 | 
				
			|||||||
@ -56,6 +56,7 @@ async function Decrypt(file) {
 | 
				
			|||||||
        filename: filename,
 | 
					        filename: filename,
 | 
				
			||||||
        title: musicMeta.musicName,
 | 
					        title: musicMeta.musicName,
 | 
				
			||||||
        artist: artists.join(" & "),
 | 
					        artist: artists.join(" & "),
 | 
				
			||||||
 | 
					        ext: musicMeta.format,
 | 
				
			||||||
        album: musicMeta.album,
 | 
					        album: musicMeta.album,
 | 
				
			||||||
        picture: musicMeta.albumPic,
 | 
					        picture: musicMeta.albumPic,
 | 
				
			||||||
        file: musicUrl,
 | 
					        file: musicUrl,
 | 
				
			||||||
 | 
				
			|||||||
@ -50,6 +50,7 @@ async function Decrypt(file, raw_filename, raw_ext) {
 | 
				
			|||||||
        filename: info.filename,
 | 
					        filename: info.filename,
 | 
				
			||||||
        title: info.title,
 | 
					        title: info.title,
 | 
				
			||||||
        artist: info.artist,
 | 
					        artist: info.artist,
 | 
				
			||||||
 | 
					        ext: new_ext,
 | 
				
			||||||
        album: tag.common.album,
 | 
					        album: tag.common.album,
 | 
				
			||||||
        picture: picUrl,
 | 
					        picture: picUrl,
 | 
				
			||||||
        file: musicUrl,
 | 
					        file: musicUrl,
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,7 @@ async function Decrypt(file, raw_filename, raw_ext) {
 | 
				
			|||||||
        filename: info.filename,
 | 
					        filename: info.filename,
 | 
				
			||||||
        title: info.title,
 | 
					        title: info.title,
 | 
				
			||||||
        artist: info.artist,
 | 
					        artist: info.artist,
 | 
				
			||||||
 | 
					        ext: raw_ext,
 | 
				
			||||||
        album: tag.common.album,
 | 
					        album: tag.common.album,
 | 
				
			||||||
        picture: picUrl,
 | 
					        picture: picUrl,
 | 
				
			||||||
        file: fileUrl,
 | 
					        file: fileUrl,
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +1,11 @@
 | 
				
			|||||||
import Vue from 'vue'
 | 
					import Vue from 'vue'
 | 
				
			||||||
 | 
					import { Radio } from 'element-ui'
 | 
				
			||||||
import App from './App.vue'
 | 
					import App from './App.vue'
 | 
				
			||||||
import './registerServiceWorker'
 | 
					import './registerServiceWorker'
 | 
				
			||||||
import './plugins/element.js'
 | 
					import './plugins/element.js'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Vue.component(Radio.name, Radio)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// only if your build system can import css, otherwise import it wherever you would import your css.
 | 
					// only if your build system can import css, otherwise import it wherever you would import your css.
 | 
				
			||||||
Vue.config.productionTip = false;
 | 
					Vue.config.productionTip = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user