qiushang 1 year ago
parent
commit
f4c61f4ccd

BIN
bin/7.0.1/input.mp4


BIN
bin/7.0.1/output.mp4


+ 0 - 0
bin/7.0.1/ffmpeg.exe → bin/video/ffmpeg.exe


+ 0 - 0
bin/7.0.1/ffplay.exe → bin/video/ffplay.exe


+ 0 - 0
bin/7.0.1/ffprobe.exe → bin/video/ffprobe.exe


BIN
nsis/skin/bg1.png


BIN
nsis/skin/bg2.png


BIN
nsis/skin/bgtop.png


+ 1 - 1
nsis/skin/uninstallpage.xml

@@ -3,7 +3,7 @@
    <VerticalLayout >
     <VerticalLayout width="570" height="314" bkimage="file='uninstall_bg1.png'">
 		<Control height="40" />
-		<WebBrowser height="264" width="550"  padding="10,0,0,0" name="oneclick_browser" homepage="https://xy.xingyousoft.com/soft/XYPdf/uninstallWeb/" autonavi="true"/>
+		<WebBrowser height="264" width="550"  padding="10,0,0,0" name="oneclick_browser" homepage="https://xy.xingyousoft.com/soft/XYWatermark/uninstallWeb/" autonavi="true"/>
 	</VerticalLayout>
 	
 	<VerticalLayout bkimage="file='bgbottom.png' corner='10,0,10,10'" >

+ 8 - 8
nsis/test.nsi

@@ -1,16 +1,16 @@
 # ====================== 自定义宏 产品信息==============================
-!define PRODUCT_MID        		    "q2ab1F6Bo3w8"
+!define PRODUCT_MID        		    "zQ76Za9kY6Dq"
 !define PRODUCT_VERSION        		"2.0.0.0"
-!define PRODUCT_NAME           		"星优PDF工具箱"
-!define INSTALL_OUTPUT_NAME    		"XYPdf_XY.exe" 
-!define EXE_NAME               		"XYPdf.exe"
-!define PRODUCT_PATHNAME           	"XYPdf"     #安装卸载项用到的KEY,注册表
-!define INSTALL_APPEND_PATH         "XYPdf"     #安装路径追加的名称 
-!define APP_DOWNLOAD_URL    		"https://xy.xingyousoft.com/soft/XYPdf/lastest2.0.0.0.7z"
+!define PRODUCT_NAME           		"星优水印助手"
+!define INSTALL_OUTPUT_NAME    		"XYWatermark_XY.exe" 
+!define EXE_NAME               		"XYWatermark.exe"
+!define PRODUCT_PATHNAME           	"XYWatermark"     #安装卸载项用到的KEY,注册表
+!define INSTALL_APPEND_PATH         "XYWatermark"     #安装路径追加的名称 
+!define APP_DOWNLOAD_URL    		"https://xy.xingyousoft.com/soft/XYWatermark/lastest2.0.0.0.7z"
 !define PRODUCT_PUBLISHER      	    "苏州星优办公软件有限公司"
 !define PRODUCT_LEGAL          	    "苏州星优办公软件有限公司"
 !define STATISTICS_url              "https://www.xingyousoft.com/api/index/user_log"   # 统计网址
-!define UNINSTALL_url               "https://xy.xingyousoft.com/soft/XYPdf/uninstallWeb/?v=2.0.0.0"   # 接卸优惠网址
+!define UNINSTALL_url               "https://xy.xingyousoft.com/soft/XYWatermark/uninstallWeb/?v=2.0.0.0"   # 接卸优惠网址
 
 # ====================== 自定义宏 安装信息==============================
 !define INSTALL_7Z_NAME 	   		"app.7z"

+ 6 - 6
package.json

@@ -1,6 +1,6 @@
 {
-	"name": "XYPdf",
-	"version": "2.1.0.0",
+	"name": "XYWatermark",
+	"version": "2.0.0.0",
 	"author": "苏州星优办公软件有限公司",
 	"description": "An electron-vue project",
 	"license": "watermark",
@@ -8,11 +8,11 @@
 	"softInfo": {
 		"description": "这里是软件描述文档",
 		"downloadName": "XYWatermark",
-		"softMid": "q2ab1F6Bo3w8",
-		"softName": "星优水印处理器",
+		"softMid": "zQ76Za9kY6Dq",
+		"softName": "星优水印助手",
 		"copyright": "苏州星优办公软件有限公司",
-		"popupAdvId": "28",
-		"linkId": "28",
+		"popupAdvId": "11",
+		"linkId": "12",
 		"upgradeLog": "1、修复了部分BUG</br>",
 		"downloadPrefix": "https://xy.xingyousoft.com/soft",
 		"statisticsUrl": "https://www.xingyousoft.com/api/index/user_log"

+ 1 - 1
src/index.ejs

@@ -2,7 +2,7 @@
 <html>
   <head>
     <meta charset="utf-8">
-    <title>星优音频转换器</title>
+    <title>星优水印助手</title>
     <% if (htmlWebpackPlugin.options.nodeModules) { %>
       <!-- Add `node_modules/` to global paths so `require` works properly in development -->
       <script>

+ 62 - 42
src/renderer/components/home.vue

@@ -250,9 +250,20 @@
 									<div class="handle-item">
 										<label class="handle-label">文字字体:</label>
 										<el-select size="small" v-model="handleData.fonts" style="width:128px;" @change="handleImg">
-											<el-option v-for="(item,key) in fonts" :value="item.path" :key="key" :label="item.name"></el-option>
+											<el-option-group
+												v-for="group in fonts"
+												:key="group.label"
+												:label="group.label">
+												<el-option
+													v-for="(item,key) in group.options"
+													:key="key"
+													:label="item.name"
+													:value="item.path">
+												</el-option>
+											</el-option-group>
+											<!-- <el-option v-for="(item,key) in fonts" :value="item.path" :key="key" :label="item.name"></el-option> -->
 										</el-select>
-										<el-upload :style="{display: 'inline-block'}" action="/" :before-upload="getFontPath">
+										<el-upload :style="{display: 'inline-block'}" action="/" :before-upload="getFontPath" accept=".ttf,.ttc">
 											<vxe-button icon="vxe-icon-add" circle size="mini" title="导入自定义字体"></vxe-button>
 										</el-upload>
 										<vxe-button type="text" status="info" icon="vxe-icon-info-circle-fill" @click="$message({message:'文字为中文时,请选择中文字体!', type:'warning'})"></vxe-button>
@@ -498,28 +509,35 @@ export default {
 				speed: 2,
 			},
 			fonts:[{
-				name:'宋体',
-				path:'c:\\windows\\fonts\\simsun.ttc',
-			},
-			{
-				name:'仿宋',
-				path:'c:\\windows\\fonts\\simfang.ttf',
-			},
-			{
-				name:'新宋体',
-				path:'c:\\windows\\fonts\\simsun.ttc',
-			},
-			{
-				name:'楷体',
-				path:'c:\\windows\\fonts\\simkai.ttf',
-			},
-			{
-				name:'微软雅黑 常规',
-				path:'c:\\windows\\fonts\\msyh.ttc',
+				label: '系统默认',
+				options:[
+					{
+						name:'宋体',
+						path:'c:\\windows\\fonts\\simsun.ttc',
+					},
+					{
+						name:'仿宋',
+						path:'c:\\windows\\fonts\\simfang.ttf',
+					},
+					{
+						name:'楷体',
+						path:'c:\\windows\\fonts\\simkai.ttf',
+					},
+					{
+						name:'微软雅黑 常规',
+						path:'c:\\windows\\fonts\\msyh.ttc',
+					},
+					{
+						name:'微软雅黑 粗体',
+						path:'c:\\windows\\fonts\\msyhbd.ttc'
+					}
+				]
 			},
 			{
-				name:'微软雅黑 粗体',
-				path:'c:\\windows\\fonts\\msyhbd.ttc'
+				label: '自定义',
+				options:[
+					
+				]
 			}],
 			defaultFont: 'c:\\windows\\fonts\\simkai.ttf',
 			watermarkPosition:['NorthWest','North','NorthEast','West','Center','East','SouthWest','South','SouthEast'],
@@ -694,17 +712,23 @@ export default {
 			if(this.isChange){
 				if(e.name == '1'){
 					if(this.imgList.length > 0){
-						this.$refs.imgTable.setCurrentRow(this.imgList[0]);
+						setTimeout(() => {
+							this.$refs.imgTable.setCurrentRow(this.imgList[0]);
+						}, 300)
 						this.setDefaultImgInfo(this.imgList[0], 0);
 					}
 				}else if(e.name == '2'){
 					if(this.fileList.length > 0){
-						this.$refs.fileTable.setCurrentRow(this.fileList[0]);
+						setTimeout(() => {
+							this.$refs.fileTable.setCurrentRow(this.fileList[0]);
+						}, 300)
 						this.setDefaultImgInfo(this.fileList[0], 0);
 					}
 				}else{
 					if(this.videoList.length > 0){
-						this.$refs.videoTable.setCurrentRow(this.videoList[0]);
+						setTimeout(() => {
+							this.$refs.videoTable.setCurrentRow(this.videoList[0]);
+						}, 300)
 						this.setDefaultImgInfo(this.videoList[0], 0);
 					}
 				}
@@ -842,7 +866,7 @@ export default {
 				// 取视频的第1帧
 				await this.dealVideo(index, info, tmpVideoPreviewPath, true).then(async (re) =>{
 					await electronApi.spawnExec(['ffmpeg.exe','-i', tmpVideoPreviewPath, '-vframes', 1, '-ss', '0:0:01', '-an', '-vcodec', 'png', '-f', 'rawvideo',imgPath, '-hide_banner','-y']).then((result) => {
-						console.log(result, 'imgPathimgPath')
+						console.log(result, '取视频的第1帧')
 					})
 				}).catch(err =>{
 					this.$message({message: '预览出现错误!', type: 'warning'});
@@ -1140,11 +1164,16 @@ export default {
 		// 选择自定义字体
 		getFontPath(e){
 			if(e){
+				let suffix = e.name.substr(e.name.lastIndexOf('.')+1);
+				if(suffix.toUpperCase() != 'TTF' && suffix.toUpperCase() != 'TTC'){
+					this.$message.error({message: '请选择ttf/ttc格式字体!'});
+					return false;
+				}
 				if(/[\u4e00-\u9fa5]/.test(e.path)){
-					this.$message({message: '字体路径中不能包含中文字符!', type: 'warning'});
+					this.$message.error({message: '字体路径中不能包含中文字符!'});
 				}else{
 					this.$message({message: '自定义字体导入成功!', type: 'success'});
-					this.fonts.push({
+					this.fonts[1].options.push({
 						name: e.name,
 						path: e.path
 					});
@@ -1197,10 +1226,7 @@ export default {
 		},
 		// 图片水印参数操作
 		handleImg() {
-			if(this.menuIndex == '3'){
-				// this.imgLoading = true;
-				// this.setDefaultImgInfo(this.videoList[this.currentRowIndex],this.currentRowIndex);
-			}else{
+			if(this.menuIndex != '3'){
 				this.imgLoading = true;
 				this.dealImg();
 			}
@@ -1216,10 +1242,8 @@ export default {
 				pdfDoc.registerFontkit(fontkit)
 		
 				// 获取pdf第一页宽和高
-				pdf.width = pages[0].getWidth();
-				pdf.height = pages[0].getHeight();
-				
-				console.log(pdf.width, pdf.height);
+				pdf.width = Math.abs(pages[0].getWidth());
+				pdf.height = Math.abs(pages[0].getHeight());
 						
 				let task = '';
 				if (this.handleData.watermarkType == '1') { // 文字水印
@@ -1263,12 +1287,8 @@ export default {
 				let imgSource = "";
 		
 				if(this.handleData.watermarkType == 1){ // 文字
-					if(os.platform == 'linux'){
-						customFont = await pdfDoc.embedFont(StandardFonts.Helvetica, {subset: true});
-					}else{
-						let fontBuffer = await electronApi.fileStream(this.handleData.fonts);
-						customFont = await pdfDoc.embedFont(fontBuffer, {subset: true})
-					}
+					let fontBuffer = await electronApi.fileStream(this.handleData.fonts);
+					customFont = await pdfDoc.embedFont(fontBuffer, {subset: true})
 				}else if(this.handleData.watermarkType == 2){ // 图片
 					const buffer = await electronApi.fileStream(this.handleData.watermarkImgPath);  
 					if(this.handleData.watermarkImgType == 'jpg'){

+ 3 - 3
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 = [];
@@ -126,13 +126,13 @@ window.electron_api = {
             console.log('读取中... - ' + path);
         })
         rs.on('error', function (err) {
-            console.log(err);
+			console.log(err);
         })
 
         return new Promise((resolve, reject) => {
             rs.on('end', () => {
                 resolve(Buffer.concat(bufferArr))
-            })
+			});
         })
     },
     writeFileStream(path, data, opts = 'utf8') {