|
@@ -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'){
|