qiushang 1 tahun lalu
induk
melakukan
899e94a59c

+ 3 - 3
package.json

@@ -8,11 +8,11 @@
 	"softInfo": {
 		"description": "这里是软件描述文档",
 		"downloadName": "XYAudio",
-		"softMid": "lf3bK2ESo9QC",
+		"softMid": "W0GN9r611Z7w",
 		"softName": "音频处理器",
 		"copyright": "苏州星优办公软件有限公司",
-		"popupAdvId": "14",
-		"linkId": "8",
+		"popupAdvId": "6",
+		"linkId": "9",
 		"upgradeLog": "1、修复了部分BUG</br>",
 		"downloadPrefix": "https://xy.xingyousoft.com/soft",
 		"statisticsUrl": "https://www.xingyousoft.com/api/index/user_log"

+ 1 - 15
src/renderer/components/header.vue

@@ -77,7 +77,7 @@
 				</div>
 				<div class="font-12" style="padding: 20px; margin-bottom: 10px;">
 					<div style="text-align: center; margin-bottom: 10px;">
-						<p style="font-size: 16px;font-weight: 600;color: #f73131;">试用时限制文件大小为200KB</p>
+						<p style="font-size: 16px;font-weight: 600;color: #f73131;">试用时限制文件大小为500KB</p>
 						<p style="font-size: 14px; font-weight: 600; margin-top: 15px;">开通会员即享以下权益</p>
 					</div>
 					<el-row :gutter="20" class="micon-list">
@@ -125,8 +125,6 @@
 		<!-- 软件设置 -->
 		<el-dialog title="软件设置" :visible.sync="settingModal" width="400px">
 			<div>
-				<el-divider content-position="left">开机启动</el-divider>
-				<el-checkbox v-model="boot">开机时自动启动此软件</el-checkbox>
 				<el-divider content-position="left">退出设置</el-divider>
 				<el-radio-group v-model="closeType">
 				    <el-radio :label="1">最小化到系统托盘</el-radio>
@@ -248,18 +246,6 @@
 				ipcRenderer.send('close-loading-window', {isClose:true});
 			}, 2000);
 			
-			// 判断是否设置开机启动
-			await electronApi.call('getLoginItem').then((res)=>{
-				if(res.openAtLogin){
-					this.boot = true;
-				}else{
-					this.boot = false;
-				}
-			});
-			if(fs.existsSync(path.join(os.tmpdir() , '../../Roaming/Microsoft/Windows/Start Menu/Programs/Startup/'+pjson.softInfo.softName+'.lnk'))){
-				this.boot = true;
-			}
-			
 			// 接收系统托盘命令 - 软件设置
 			ipcRenderer.on('setting', (event, message) => {
 				this.changeMenu('setting');

+ 176 - 197
src/renderer/components/home.vue

@@ -64,8 +64,6 @@
 				</div>
 
 				<template v-else>
-					
-
 					<div class="content-top">
 						<el-button-group>
 							<el-button type="primary" size="mini" icon="el-icon-document"
@@ -96,20 +94,20 @@
 					</div>
 					
 					<div v-if="audioList.length == 0" class="upload-area">
-						<div class="file-area" @click="pickFile()" id="drag-compress">
+						<div class="file-area" @click="pickFile()" id="drag-audio" @dragover.prevent @drop="handleDrop">
 							<div class="file-area-pos">
 								<img src="../assets/image/upload.png" style="width: 220px;"/>
 								<p style="font-size: 16px;">点击添加文件或拖拽文件到此</p>
-								<p style="font-size: 12px; color: #999;margin-top:15px;">支持以下电子书格式</p>
-								<p style="font-size: 12px; color: #999;">
-									EPUB/AZW3/MOBI/FB2/PDF/LRF/RTF/TCR/TXTZ/LIT/CAJ</p>
+								<p style="font-size: 12px; color: #999;margin-top:15px;">不支持音乐平台付费格式音频,支持以下格式:</p>
+								<p style="font-size: 12px; color: #999;">mp3/wav/ogg/flac/mp2/m4a/m4r/ac3/amr/wma/aiff/</p>
+								<p style="font-size: 12px; color: #999;">aifc/caf/aac/ape/mmf/wv/au/voc/3gpp/mka/mp4</p>
 							</div>
 						</div>
 					</div>
 
 					<div class="soft-content" v-else>
 						<div class="content-left">
-							<div class="table-scroll" id="drag-compress">
+							<div class="table-scroll" @dragover.prevent @drop="handleDrop">
 								<vxe-table
 									show-overflow
 									class="img-table"
@@ -123,6 +121,13 @@
 									:scroll-y="{enabled: true}"
 									@cell-click="selectTab">
 									<vxe-column field="name" :title="'文件名称'+'(' + audioList.length + ')'"></vxe-column>
+							
+									<vxe-column field="sort" title="排序" width="140" v-if="menuIndex == '2'">
+										<template #default="{ row, rowIndex }">
+											<el-button @click="fileSort('up', rowIndex);" :disabled="rowIndex == 0 ? true : false" class="sort-btn" type="primary" icon="el-icon-upload2" size="mini" title="上移"></el-button>
+											<el-button @click="fileSort('down', rowIndex);" :disabled="rowIndex == audioList.length - 1 ? true : false" class="sort-btn" type="primary" icon="el-icon-download" size="mini" title="下移"></el-button>
+										</template>
+									</vxe-column>
 									<vxe-column field="size" title="大小" width="140">
 										<template #default="{ row }">
 											<span>{{$utils.handleSize(row.size)}}</span>
@@ -152,7 +157,7 @@
 					<div class="img-footer-area" v-if="audioList.length > 0">
 						<div class="footer-line-between">
 							<!-- 1格式转化 -->
-							<div class="handle-item" v-if="menuIndex == 1">
+							<div class="handle-item" v-if="menuIndex == '1' || menuIndex == '2'">
 								<label class="handle-label">输出转换:</label>
 								<el-select v-model="handleData.format" style="width:100px;" size="small">
 									<el-option v-for="(item, key) in outputAudio" :key="key" :value="item" :label="item"></el-option>
@@ -168,6 +173,95 @@
 									<el-option value="8k" label="8 kbps"></el-option>
 									<el-option value="16k" label="16 kbps"></el-option>
 									<el-option value="24k" label="24 kbps"></el-option>
+									<el-option value="32k" label="32 kbps"></el-option>
+									<el-option value="40k" label="40 kbps"></el-option>
+									<el-option value="48k" label="48 kbps"></el-option>
+									<el-option value="56k" label="56 kbps"></el-option>
+									<el-option value="64k" label="64 kbps"></el-option>
+									<el-option value="80k" label="80 kbps"></el-option>
+									<el-option value="96k" label="96 kbps"></el-option>
+									<el-option value="112k" label="112 kbps"></el-option>
+									<el-option value="128k" label="128 kbps"></el-option>
+									<el-option value="144k" label="144 kbps"></el-option>
+									<el-option value="160k" label="160 kbps"></el-option>
+									<el-option value="192k" label="192 kbps"></el-option>
+									<el-option value="224k" label="224 kbps"></el-option>
+									<el-option value="256k" label="256 kbps"></el-option>
+									<el-option value="320k" label="320 kbps"></el-option>
+									<el-option value="512k" label="512 kbps"></el-option>
+									<el-option value="1400k" label="1400 kbps"></el-option>
+								</el-select>
+							</div>
+							
+							<!-- 3音频压缩 -->
+							<div class="handle-item" v-if="menuIndex == '3'">
+								<label class="handle-label">压缩级别:</label>
+								<el-select v-model="handleData.compressLevel" style="width:100px;" size="small">
+									<el-option :value="1" label="1"></el-option>
+									<el-option :value="2" label="2"></el-option>
+									<el-option :value="3" label="3"></el-option>
+									<el-option :value="4" label="4"></el-option>
+									<el-option :value="5" label="5"></el-option>
+									<el-option :value="6" label="6"></el-option>
+									<el-option :value="7" label="7"></el-option>
+									<el-option :value="8" label="8"></el-option>
+									<el-option :value="9" label="9"></el-option>
+								</el-select>
+								<span style="margin-left: 10px; font-size: 12px; color: #F56C6C;">等级越高压缩效果越好</span>
+							</div>
+							
+							<!-- 音频分割 -->
+							<div class="handle-item" v-if="menuIndex == '4'">
+								<label class="handle-label">分割格式:</label>
+								<el-select v-model="handleData.format" style="width:100px;" size="small">
+									<el-option v-for="(item,key) in outputAudio" :key="key" :value="item" :label="item"></el-option>
+								</el-select>
+							
+								<label class="handle-label">分割模式:</label>
+								<el-select v-model="handleData.split_type" style="width:100px;" size="small">
+									<el-option :value="1" label="按份分割"></el-option>
+									<el-option :value="2" label="时长分割"></el-option>
+									<el-option :value="3" label="平均分割"></el-option>
+								</el-select>
+							
+								<template v-if="handleData.split_type == 1">
+									<label class="handle-label">分割分数:</label>
+									<el-select v-model="handleData.split_num" style="width:100px;" size="small">
+										<el-option :value="2" label="2"></el-option>
+										<el-option :value="3" label="3"></el-option>
+										<el-option :value="4" label="4"></el-option>
+										<el-option :value="5" label="5"></el-option>
+										<el-option :value="6" label="6"></el-option>
+										<el-option :value="7" label="7"></el-option>
+										<el-option :value="8" label="8"></el-option>
+										<el-option :value="9" label="9"></el-option>
+										<el-option :value="10" label="10"></el-option>
+									</el-select>
+								</template>
+								<template v-else>
+									<label class="handle-label">分割时间:</label>
+									<el-time-picker arrow-control @change="selectTime" v-model="split_timeStr" placeholder="选择时间" style="width:120px;" size="small"></el-time-picker>
+								</template>
+							</div>
+							
+							<!-- 音频变速 -->
+							<div class="handle-item" v-if="menuIndex == '5'">
+								<label class="handle-label">播放速度:</label>
+								<el-slider class="info-input" v-model="handleData.speed" :min="0.5" :max="2.0" :step="0.05" style="margin-right: 10px;"></el-slider> {{handleData.speed}}倍
+							</div>
+							
+							<!-- 音量调整 -->
+							<div class="handle-item" v-if="menuIndex == '6'">
+								<label class="handle-label">音量调整:</label>
+								<el-slider class="info-input" v-model="handleData.volume" :min="0.5" :max="2.0" :step="0.05" style="margin-right: 10px;"></el-slider> {{handleData.volume}}
+							</div>
+							
+							<!-- 音频反转 -->
+							<div class="handle-item" v-if="menuIndex == '7'">
+								<label class="handle-label">输出格式:</label>
+								<el-checkbox size="small"  v-model="handleData.isOriginal">同原音频</el-checkbox>
+								<el-select v-if="!handleData.isOriginal" v-model="handleData.format" style="width:100px;margin-left: 5px;" size="small">
+									<el-option v-for="(item, key) in outputAudio" :key="key" :value="item" :label="item"></el-option>
 								</el-select>
 							</div>
 							
@@ -179,7 +273,7 @@
 								<el-popover placement="bottom" popper-class="popper-open" trigger="hover" content="打开保存目录">
 									<i class="el-icon-folder-opened" slot="reference" style="padding-left: 5px; cursor: pointer; font-size: 22px; vertical-align: middle;" @click="openFolder()"></i>
 								</el-popover>
-								<el-button type="danger" style="margin: 0 20px;" @click="exportImg()" :loading="loading">开始处理</el-button>
+								<el-button type="danger" style="margin: 0 20px;" @click="exportFile()" :loading="loading">开始处理</el-button>
 							</div>
 						</div>
 					</div>
@@ -230,125 +324,6 @@ export default {
 			imgUrl: this.$api.imgUrl,
 			imgSrc: '',
 			audioList: [],
-			columns: [{
-				title: '文件名称',
-				key: 'name',
-				minWidth: 95,
-			},
-			{
-				title: '大小',
-				key: 'size',
-				width: 100,
-				render:(h,params) => {
-					return h('span',this.$utils.handleSize(params.row.size))
-				}
-			},
-			{
-				title: '时间',
-				key: 'duration',
-				width: 100,
-				render:(h,params) => {
-					return h('span',this.formatSeconds(params.row.duration))
-				}
-			},
-			{
-				title:"进度",
-				minWidth: 105,
-				maxWidth: 220,
-				slot:"progress"
-			},
-			{
-				title: '操作',
-				key: 'action',
-				width: 130,
-				render: (h, params) => {
-					let btnArr = [];
-					if(this.menuIndex == '2'){
-						let upDisabled = false;
-						let downDisabled = false;
-						if(params.index == 0){
-							upDisabled = true;
-						}
-						if(params.index == this.audioList.length - 1){
-							downDisabled = true;
-						}
-						btnArr.push([
-							h('Button', {
-								props: {
-									type: 'primary',
-									size: 'small',
-									disabled: upDisabled
-								},
-								style: {
-									padding: "0 2px",
-									marginRight: "5px"
-								},
-								on: {
-									click: (e) => {
-										e.stopPropagation();
-										this.fileSort('up', params.index);
-									}
-								}
-							}, [h('Icon', {
-									props: {
-										type: 'md-arrow-up',
-									}
-								})]
-							),
-							h('Button', {
-								props: {
-									type: 'primary',
-									size: 'small',
-									disabled: downDisabled
-								},
-								style: {
-									padding: "0 2px",
-									marginRight: "5px"
-								},
-								on: {
-									click: (e) => {
-										e.stopPropagation()
-										this.fileSort('down', params.index);
-									}
-								}
-							}, [h('Icon', {
-									props: {
-										type: 'md-arrow-down',
-									}
-								})]
-							),
-						]);
-					}
-					
-					btnArr.push([
-						h('Button', {
-							props: {
-								type: 'error',
-								size: 'small'
-							},
-							on: {
-								click: () => {
-									this.$Modal.confirm({
-										title: '提示',
-										content: '确认删除这张图片吗?',
-										onOk: () => {
-											this.audioList.splice(params.index, 1);
-											if (this.audioList.length == 0) {
-												this.clearList();
-											}
-										}
-									});
-								}
-							}
-						}, '删除')
-					]);
-					
-					return h('div', btnArr);
-					
-
-				}
-			}
-			],
 			imgInfo: '',
 			menuIndex: '', // 选中菜单
 
@@ -358,6 +333,7 @@ export default {
 			downloadDir: '', // 默认下载目录
 			handleData: {
 				pathType: 2,
+				isOriginal: true,
 				format: 'mp3',
 				newPath: os.userInfo().homedir + separator + "Downloads", // 新路径
 				type: 1, // 声道
@@ -365,10 +341,12 @@ export default {
 				compressLevel: 1,
 				split_type: 1,
 				split_num: 2,
-				split_time: '00:00:00',
+				split_time: '00:00:10',
 				speed: 1,
 				volume: 1,
 			},
+			isDrop: false,
+			split_timeStr: new Date(2024, 12, 12, 0, 0, 10),
 			dowloadModel: false,
 			finishModel: false,
 			version: '0.0.1',
@@ -400,62 +378,32 @@ export default {
                 electronApi.call('openExternal', [url]);
 			});
 		});
-		// 加载拖拽监听事件
-		this.initDrop();
 	},
 	methods: {
-		hideFormat(){
-			return null;
-		},
-		// 加载拖拽监听事件
-		initDrop(){
-			const dragWrapper = document.getElementById("drag-audio");
-			const dragWrapper2 = document.getElementById("drag-table");
-			let domArr = [dragWrapper, dragWrapper2];
-			domArr.map(item => {
-				//添加拖拽事件监听器
-				item.addEventListener("drop", (e) => {
-				    //阻止默认行为
-				    e.preventDefault();
-				    //获取文件列表
-				    let files = e.dataTransfer.files;
-					let pathArr = [];
-					for(let i = 0; i < files.length; i++){
-						pathArr.push(files[i].path);
-					}
-					this.pushFileToList(pathArr);
-				})
-				//阻止拖拽结束事件默认行为
-				item.addEventListener("dragover", (e) => {
-				    e.preventDefault();
-				})
-			})
-		},
-		//
-		changeFenbianlv(val){
-			if (val == 6) {
-				this.handleData.height = 720
-			} else if (val == 7) {
-				this.handleData.height = 960
+		selectTime(e){
+			if(e){
+				let hours = e.getHours() < 10 ? '0'+e.getHours() : e.getHours();
+				let minutes = e.getMinutes() < 10 ? '0'+e.getMinutes() : e.getHours();
+				let second = e.getSeconds() < 10 ? '0'+e.getSeconds() : e.getSeconds();
+				this.handleData.split_time = hours + ':' + minutes + ':' + second;
+			}else{
+				this.split_timeStr = new Date(2024,12,12,0,0,0);
+				this.handleData.split_time = "00:00:00";
 			}
 		},
-		changeHeight() {
-			if (this.handleData.height > 0) {
-				if (this.handleData.fenbianlv == 6) {
-					this.handleData.width = Math.round((this.handleData.height * 16) / 9)
-				} else if (this.handleData.fenbianlv == 7) {
-					this.handleData.width = Math.round((this.handleData.height * 4) / 3)
-				}
-			}
+		hideFormat(){
+			return null;
 		},
-		changeWidth() {
-			if (this.handleData.width > 0) {
-				if (this.handleData.fenbianlv == 6) {
-					this.handleData.height = Math.round((this.handleData.width * 9) / 16)
-				} else if (this.handleData.fenbianlv == 7) {
-					this.handleData.height = Math.round((this.handleData.width * 3) / 4)
-				}
+		handleDrop(e){
+			//阻止默认行为
+			e.preventDefault();
+			//获取文件列表
+			let files = e.dataTransfer.files;
+			let pathArr = [];
+			for(let i = 0; i < files.length; i++){
+				pathArr.push(files[i].path);
 			}
+			this.pushFileToList(pathArr);
 		},
 		openVip() {
 			this.$refs.headerRef.openVip();
@@ -489,6 +437,7 @@ export default {
 			this.audioList = [];
 			this.handleData = {
 				pathType: 2,
+				isOriginal: true,
 				format: 'mp3',
 				newPath: os.userInfo().homedir + separator + "Downloads", // 新路径
 				type: 2, // 
@@ -496,7 +445,7 @@ export default {
 				compressLevel: 1,
 				split_type: 1,
 				split_num: 2,
-				split_time: '00:00:00'
+				split_time: '00:00:10'
 			};
 		},
 		async pickFile(){
@@ -550,7 +499,7 @@ export default {
 				if (this.inputAudio.indexOf(suffix.toLowerCase()) == -1) {
 					this.$message({message: '不是有效的音频文件或该文件暂不支持!' + suffix , type: 'warning'});
 					continue;
-				} else {	
+				} else {
 					if(!this.$refs.headerRef.authority.isAuthority){
 						if(size > 1024*500){
 							setTimeout(() => {
@@ -715,7 +664,7 @@ export default {
 			const regexTime = /time=(.*?) bitrate/;
 			switch (this.menuIndex) {
 				case '1': // 格式转换
-				case '2':
+				case '7': // 音频倒放
 					task = new Promise((resolve,reject) =>{
 						let filePath = file.path;
 						let suffix = this.handleData.format;
@@ -724,8 +673,12 @@ export default {
 
 						if(this.menuIndex == '1'){
 							outPath = this.handleData.newPath + separator + file.name.slice(0, file.name.lastIndexOf('.')) + '.' + suffix;
-						}else{
-							outPath = os.tmpdir() + separator + file.name.slice(0, file.name.lastIndexOf('.')) + '.' + suffix;;	
+						}else {
+							let ss = suffix;
+							if(this.handleData.isOriginal){
+								ss = suffix2;
+							}
+							outPath = this.handleData.newPath + separator + file.name.slice(0, file.name.lastIndexOf('.')) + '.' + ss;
 						}
 
 						let params = [];
@@ -763,6 +716,11 @@ export default {
 
 						params.push('-b:a')
 						params.push(this.handleData.quality)
+						
+						if(this.menuIndex == '7'){
+							params.push('-af');
+							params.push('areverse');
+						}
 
 						params.push(outPath);
 						params.push('-hide_banner');
@@ -908,7 +866,7 @@ export default {
 						params.push('-y');
 
 						let arr = [];
-						if(this.handleData.split_type == 1){ // 平均
+						if(this.handleData.split_type == 1){ // 按份
 							let time = (file.duration/this.handleData.split_num);
 							let startTime = 0;
 							for(let i =0; i < this.handleData.split_num; i++){
@@ -917,20 +875,22 @@ export default {
 							}
 						}else if(this.handleData.split_type == 2){
 							let time = this.getSs(this.handleData.split_time);
-							//  //按时间平均分割
-							// let total = Number(file.duration);
-							// let length = Math.ceil(total / time);
-							// for(let i = 0; i < length; i ++){   // 
-							// 	let startT = time * i;
-							// 	let endT = time * (i + 1);
-							// 	if(i == length - 1){
-							// 		arr.push({start: startT, end: file.duration});
-							// 	}else{
-							// 		arr.push({start: startT, end: endT});
-							// 	}
-							// }
 							arr.push({start: 0, end:time});
 							arr.push({start: time+1, end:file.duration});
+						}else if(this.handleData.split_type == 3){ // 平均分割
+							let time = this.getSs(this.handleData.split_time);
+							 //按时间平均分割
+							let total = Number(file.duration);
+							let length = Math.ceil(total / time);
+							for(let i = 0; i < length; i ++){   // 
+								let startT = time * i;
+								let endT = time * (i + 1);
+								if(i == length - 1){
+									arr.push({start: startT, end: file.duration});
+								}else{
+									arr.push({start: startT, end: endT});
+								}
+							}
 						}
 
 						for(let m=0; m < arr.length; m++){
@@ -1196,6 +1156,21 @@ export default {
 				this.$message.error('操作失败,请重试!');
 			})
 		},
+		// 删除文件
+		delFile(rowIndex){
+			this.$confirm('确认删除此音频吗?', '提示', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning'
+			}).then(() => {
+				this.audioList.splice(rowIndex, 1);
+				if (this.audioList.length == 0) {
+					this.clearList();
+				}
+			}).catch(() => {
+					  
+			});
+		},
 		//文件排序
 		fileSort(type, index){
 			this.audioList.map((item, index) => {
@@ -1371,4 +1346,8 @@ export default {
 	.el-tabs__item{
 		padding: 0 13px !important;
 	}
+	
+	.sort-btn{
+		padding: 7px !important;
+	}
 </style>

+ 1 - 1
src/renderer/utils/electronApi.js

@@ -77,7 +77,7 @@ window.electron_api = {
             proc = child_process.spawn(cmd, cmds.slice(1), opts);
         }
 
-        // console.log(cmds.join(' '))
+        console.log(cmds.join(' '))
 
         return new Promise(function (resolve, reject) {
             let stdout = [];