This commit is contained in:
parent
9c2c31e4b7
commit
1326c5dd02
|
@ -14,7 +14,8 @@
|
||||||
"build:unpack": "npm run build && electron-builder --dir",
|
"build:unpack": "npm run build && electron-builder --dir",
|
||||||
"build:dev": "npm run build && electron-builder --win --config ./electron-builder-test.yml",
|
"build:dev": "npm run build && electron-builder --win --config ./electron-builder-test.yml",
|
||||||
"build:test": "node updatePackageJsonName.js && electron-vite build --mode test && electron-builder --win --config ./electron-builder.yml",
|
"build:test": "node updatePackageJsonName.js && electron-vite build --mode test && electron-builder --win --config ./electron-builder.yml",
|
||||||
"build:prod": "node updatePackageJsonName.js && electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml",
|
"build:prod": "node updatePackageJsonName.js && electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml --win",
|
||||||
|
"build:prod32": "node updatePackageJsonName.js && electron-vite build --mode production && electron-builder --win --config ./electron-builder-prod.yml --win --ia32",
|
||||||
"build:yc": "node updatePackageJsonName.js && electron-vite build --mode yc && electron-builder --win --config ./electron-builder-yc.yml",
|
"build:yc": "node updatePackageJsonName.js && electron-vite build --mode yc && electron-builder --win --config ./electron-builder-yc.yml",
|
||||||
"build:yc2": "node updatePackageJsonName.js && electron-vite build --mode yc2 && electron-builder --win --config ./electron-builder-yc2.yml",
|
"build:yc2": "node updatePackageJsonName.js && electron-vite build --mode yc2 && electron-builder --win --config ./electron-builder-yc2.yml",
|
||||||
"build:lt": "electron-vite build --mode lt && electron-builder --win --config ./electron-builder-lt.yml",
|
"build:lt": "electron-vite build --mode lt && electron-builder --win --config ./electron-builder-lt.yml",
|
||||||
|
@ -139,4 +140,4 @@
|
||||||
"vue-tsc": "^1.8.25",
|
"vue-tsc": "^1.8.25",
|
||||||
"windicss": "^3.5.6"
|
"windicss": "^3.5.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
http-equiv="Content-Security-Policy"
|
http-equiv="Content-Security-Policy"
|
||||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
|
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
|
||||||
/> -->
|
/> -->
|
||||||
<meta http-equiv="Content-Security-Policy" content="connect-src * blob: data:; frame-src 'self' *; default-src 'self' https://wzyzoss.eos-chongqing-3.cmecloud.cn/; script-src 'self' 'unsafe-eval' http://www.wiris.net 'unsafe-inline'; style-src 'self' 'unsafe-inline' http://www.wiris.net; media-src * blob:;img-src * 'self' data: blob:;font-src 'self' http://www.wiris.net data:;" />
|
<meta http-equiv="Content-Security-Policy" content="connect-src * blob: data:; frame-src 'self' *; default-src 'self' https://wzyzoss.eos-chongqing-3.cmecloud.cn/; script-src 'self' 'unsafe-eval' http://www.wiris.net 'unsafe-inline'; script-src-elem 'self' https://sdk.amazonaws.com; style-src 'self' 'unsafe-inline' http://www.wiris.net; media-src * blob:;img-src * 'self' data: blob:;font-src 'self' http://www.wiris.net data:;" />
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script src="./public/lib/build/aws-sdk-2.100.0.min.js"></script>
|
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.100.0.min.js"></script>
|
||||||
<script type="module" src="/src/main.js"></script>
|
<script type="module" src="/src/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -101,7 +101,7 @@ export default () => {
|
||||||
reader.readAsText(file)
|
reader.readAsText(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 导入PPTX文件
|
// 导入PPTX文件
|
||||||
const importPPTXFile = (files: FileList) => {
|
const importPPTXFile = (files: FileList) => {
|
||||||
|
@ -114,7 +114,7 @@ export default () => {
|
||||||
for (const item of SHAPE_LIST) {
|
for (const item of SHAPE_LIST) {
|
||||||
shapeList.push(...item.children)
|
shapeList.push(...item.children)
|
||||||
}
|
}
|
||||||
|
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
reader.onload = async e => {
|
reader.onload = async e => {
|
||||||
const json = await parse(e.target!.result as ArrayBuffer)
|
const json = await parse(e.target!.result as ArrayBuffer)
|
||||||
|
@ -174,7 +174,7 @@ export default () => {
|
||||||
el.height = el.height * ratio
|
el.height = el.height * ratio
|
||||||
el.left = el.left * ratio
|
el.left = el.left * ratio
|
||||||
el.top = el.top * ratio
|
el.top = el.top * ratio
|
||||||
|
|
||||||
if (el.type === 'text') {
|
if (el.type === 'text') {
|
||||||
const textEl: PPTTextElement = {
|
const textEl: PPTTextElement = {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
|
@ -263,7 +263,7 @@ export default () => {
|
||||||
'down': 'bottom',
|
'down': 'bottom',
|
||||||
'up': 'top',
|
'up': 'top',
|
||||||
}
|
}
|
||||||
|
|
||||||
const element: PPTShapeElement = {
|
const element: PPTShapeElement = {
|
||||||
type: 'shape',
|
type: 'shape',
|
||||||
id: nanoid(10),
|
id: nanoid(10),
|
||||||
|
@ -298,15 +298,15 @@ export default () => {
|
||||||
color: el.shadow.color,
|
color: el.shadow.color,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shape) {
|
if (shape) {
|
||||||
element.path = shape.path
|
element.path = shape.path
|
||||||
element.viewBox = shape.viewBox
|
element.viewBox = shape.viewBox
|
||||||
|
|
||||||
if (shape.pathFormula) {
|
if (shape.pathFormula) {
|
||||||
element.pathFormula = shape.pathFormula
|
element.pathFormula = shape.pathFormula
|
||||||
element.viewBox = [el.width, el.height]
|
element.viewBox = [el.width, el.height]
|
||||||
|
|
||||||
const pathFormula = SHAPE_PATH_FORMULAS[shape.pathFormula]
|
const pathFormula = SHAPE_PATH_FORMULAS[shape.pathFormula]
|
||||||
if ('editable' in pathFormula && pathFormula.editable) {
|
if ('editable' in pathFormula && pathFormula.editable) {
|
||||||
element.path = pathFormula.formula(el.width, el.height, pathFormula.defaultValue)
|
element.path = pathFormula.formula(el.width, el.height, pathFormula.defaultValue)
|
||||||
|
@ -320,19 +320,19 @@ export default () => {
|
||||||
else {
|
else {
|
||||||
element.special = true
|
element.special = true
|
||||||
element.path = el.path!
|
element.path = el.path!
|
||||||
|
|
||||||
const { maxX, maxY } = getSvgPathRange(element.path)
|
const { maxX, maxY } = getSvgPathRange(element.path)
|
||||||
element.viewBox = [maxX || originWidth, maxY || originHeight]
|
element.viewBox = [maxX || originWidth, maxY || originHeight]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.path) slide.elements.push(element)
|
if (element.path) slide.elements.push(element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (el.type === 'table') {
|
else if (el.type === 'table') {
|
||||||
const row = el.data.length
|
const row = el.data.length
|
||||||
const col = el.data[0].length
|
const col = el.data[0].length
|
||||||
|
|
||||||
const style: TableCellStyle = {
|
const style: TableCellStyle = {
|
||||||
fontname: theme.value.fontName,
|
fontname: theme.value.fontName,
|
||||||
color: theme.value.fontColor,
|
color: theme.value.fontColor,
|
||||||
|
@ -372,9 +372,9 @@ export default () => {
|
||||||
}
|
}
|
||||||
data.push(rowCells)
|
data.push(rowCells)
|
||||||
}
|
}
|
||||||
|
|
||||||
const colWidths: number[] = new Array(col).fill(1 / col)
|
const colWidths: number[] = new Array(col).fill(1 / col)
|
||||||
|
|
||||||
slide.elements.push({
|
slide.elements.push({
|
||||||
type: 'table',
|
type: 'table',
|
||||||
id: nanoid(10),
|
id: nanoid(10),
|
||||||
|
@ -397,7 +397,7 @@ export default () => {
|
||||||
let labels: string[]
|
let labels: string[]
|
||||||
let legends: string[]
|
let legends: string[]
|
||||||
let series: number[][]
|
let series: number[][]
|
||||||
|
|
||||||
if (el.chartType === 'scatterChart' || el.chartType === 'bubbleChart') {
|
if (el.chartType === 'scatterChart' || el.chartType === 'bubbleChart') {
|
||||||
labels = el.data[0].map((item, index) => `坐标${index + 1}`)
|
labels = el.data[0].map((item, index) => `坐标${index + 1}`)
|
||||||
legends = ['X', 'Y']
|
legends = ['X', 'Y']
|
||||||
|
@ -411,7 +411,7 @@ export default () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const options: ChartOptions = {}
|
const options: ChartOptions = {}
|
||||||
|
|
||||||
let chartType: ChartType = 'bar'
|
let chartType: ChartType = 'bar'
|
||||||
|
|
||||||
switch (el.chartType) {
|
switch (el.chartType) {
|
||||||
|
@ -447,7 +447,7 @@ export default () => {
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
slide.elements.push({
|
slide.elements.push({
|
||||||
type: 'chart',
|
type: 'chart',
|
||||||
id: nanoid(10),
|
id: nanoid(10),
|
||||||
|
@ -487,7 +487,7 @@ export default () => {
|
||||||
reader.readAsArrayBuffer(file)
|
reader.readAsArrayBuffer(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
importSpecificFile,
|
importSpecificFile,
|
||||||
|
@ -529,11 +529,13 @@ export const PPTXFileToJson = (data: File|ArrayBuffer) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 开始解析
|
// 开始解析
|
||||||
const json = await parse(fileArrayBuffer)
|
const json = await parse(fileArrayBuffer).catch((err) => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
|
|
||||||
const ratio = 96 / 72
|
const ratio = 96 / 72
|
||||||
const width = json.size.width
|
const width = json.size.width
|
||||||
|
|
||||||
resData.def = json // 保留原始数据
|
resData.def = json // 保留原始数据
|
||||||
resData.width = width * ratio
|
resData.width = width * ratio
|
||||||
resData.ratio = slidesStore.viewportRatio
|
resData.ratio = slidesStore.viewportRatio
|
||||||
|
@ -678,7 +680,7 @@ export const PPTXFileToJson = (data: File|ArrayBuffer) => {
|
||||||
'down': 'bottom',
|
'down': 'bottom',
|
||||||
'up': 'top',
|
'up': 'top',
|
||||||
}
|
}
|
||||||
|
|
||||||
const element: PPTShapeElement = {
|
const element: PPTShapeElement = {
|
||||||
type: 'shape',
|
type: 'shape',
|
||||||
id: nanoid(10),
|
id: nanoid(10),
|
||||||
|
@ -713,15 +715,15 @@ export const PPTXFileToJson = (data: File|ArrayBuffer) => {
|
||||||
color: el.shadow.color,
|
color: el.shadow.color,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shape) {
|
if (shape) {
|
||||||
element.path = shape.path
|
element.path = shape.path
|
||||||
element.viewBox = shape.viewBox
|
element.viewBox = shape.viewBox
|
||||||
|
|
||||||
if (shape.pathFormula) {
|
if (shape.pathFormula) {
|
||||||
element.pathFormula = shape.pathFormula
|
element.pathFormula = shape.pathFormula
|
||||||
element.viewBox = [el.width, el.height]
|
element.viewBox = [el.width, el.height]
|
||||||
|
|
||||||
const pathFormula = SHAPE_PATH_FORMULAS[shape.pathFormula]
|
const pathFormula = SHAPE_PATH_FORMULAS[shape.pathFormula]
|
||||||
if ('editable' in pathFormula && pathFormula.editable) {
|
if ('editable' in pathFormula && pathFormula.editable) {
|
||||||
element.path = pathFormula.formula(el.width, el.height, pathFormula.defaultValue)
|
element.path = pathFormula.formula(el.width, el.height, pathFormula.defaultValue)
|
||||||
|
@ -740,7 +742,7 @@ export const PPTXFileToJson = (data: File|ArrayBuffer) => {
|
||||||
element.viewBox = [maxX || originWidth, maxY || originHeight]
|
element.viewBox = [maxX || originWidth, maxY || originHeight]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.path) slide.elements.push(element)
|
if (element.path) slide.elements.push(element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -898,4 +900,4 @@ export const PPTXFileToJson = (data: File|ArrayBuffer) => {
|
||||||
resData.slides = slides
|
resData.slides = slides
|
||||||
resolve(resData)
|
resolve(resData)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
{{ item.fileShowName.substring(0, item.fileShowName.lastIndexOf('.')) }}
|
{{ item.fileShowName.substring(0, item.fileShowName.lastIndexOf('.')) }}
|
||||||
<el-tag type="danger" effect="dark">{{item.fileShowName.substring(item.fileShowName.lastIndexOf('.')+1)}}</el-tag>
|
<el-tag type="danger" effect="dark">{{item.fileShowName.substring(item.fileShowName.lastIndexOf('.')+1)}}</el-tag>
|
||||||
<template v-if="item.fileTag">
|
<template v-if="item.fileTag">
|
||||||
<el-tag v-for="(item1, index1) in item.fileTag.split(',')" :key="index1" type="success" effect="dark" style="margin-left: 5px">{{item1}}</el-tag>
|
<el-tag v-for="(item1, index1) in item.fileTag.split(',')"
|
||||||
|
@close="deleteTag(item, item1, index1)" closable :key="index1"
|
||||||
|
@click.stop="editTag(item, item1, index1)" type="success" effect="dark" style="margin-left: 5px">{{item1}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -282,6 +284,71 @@ export default {
|
||||||
})
|
})
|
||||||
// this.$emit('on-start-class', item)
|
// this.$emit('on-start-class', item)
|
||||||
},
|
},
|
||||||
|
editTagMsg(type, item, value, index) {
|
||||||
|
let fileTagList = []
|
||||||
|
if (!item.fileTag) {
|
||||||
|
item.fileTag="";
|
||||||
|
fileTagList = [];
|
||||||
|
}else {
|
||||||
|
fileTagList = item.fileTag.split(',');
|
||||||
|
}
|
||||||
|
let message = '';
|
||||||
|
switch (type) {
|
||||||
|
case 'add':
|
||||||
|
fileTagList.push(value);
|
||||||
|
message = '添加成功!';
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
fileTagList.splice(index, 1);
|
||||||
|
message = '删除成功!';
|
||||||
|
break;
|
||||||
|
case 'edit':
|
||||||
|
fileTagList[index] = value;
|
||||||
|
message = '修改成功!';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
item.fileTagList = fileTagList;
|
||||||
|
item.fileTag = fileTagList.join(",")
|
||||||
|
updateSmarttalk({ id: item.id, fileTag: item.fileTag, fileShowName: item.fileShowName }).then((res) => {
|
||||||
|
if (res.data === true) {
|
||||||
|
ElMessage({
|
||||||
|
type: 'success',
|
||||||
|
message: message
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
deleteTag(item, item1, index) {
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'是否确认删除这个标签?',
|
||||||
|
'提示',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
this.editTagMsg('delete', item, "", index)
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
editTag(item, item1, index) {
|
||||||
|
console.log(item, item1, index)
|
||||||
|
ElMessageBox.prompt('请输入新的标签', '修改标签', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
inputValue: item1,
|
||||||
|
inputPattern: /^[a-zA-Z0-9\u4e00-\u9fa5]{1,5}$/,
|
||||||
|
inputErrorMessage: '请输入最多五个字的标签,不能携带标点符号'
|
||||||
|
})
|
||||||
|
.then(({ value }) => {
|
||||||
|
this.editTagMsg('edit', item, value, index)
|
||||||
|
}).catch(() => {})
|
||||||
|
},
|
||||||
editTalk(item) {
|
editTalk(item) {
|
||||||
ElMessageBox.prompt('请输入新的标签', '添加标签', {
|
ElMessageBox.prompt('请输入新的标签', '添加标签', {
|
||||||
confirmButtonText: '确认',
|
confirmButtonText: '确认',
|
||||||
|
@ -291,24 +358,7 @@ export default {
|
||||||
inputErrorMessage: '请输入最多五个字的标签,不能携带标点符号'
|
inputErrorMessage: '请输入最多五个字的标签,不能携带标点符号'
|
||||||
})
|
})
|
||||||
.then(({ value }) => {
|
.then(({ value }) => {
|
||||||
let fileTagList = []
|
this.editTagMsg('add', item, value, 0)
|
||||||
if (!item.fileTag) {
|
|
||||||
item.fileTag="";
|
|
||||||
fileTagList = [];
|
|
||||||
}else {
|
|
||||||
fileTagList = item.fileTag.split(',');
|
|
||||||
}
|
|
||||||
fileTagList.push(value);
|
|
||||||
item.fileTagList = fileTagList;
|
|
||||||
item.fileTag = fileTagList.join(",")
|
|
||||||
updateSmarttalk({ id: item.id, fileTag: item.fileTag, fileShowName: item.fileShowName }).then((res) => {
|
|
||||||
if (res.data === true) {
|
|
||||||
ElMessage({
|
|
||||||
type: 'success',
|
|
||||||
message: `添加成功!`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
},
|
},
|
||||||
|
|
|
@ -561,6 +561,7 @@ export default {
|
||||||
},
|
},
|
||||||
importPPT(item) {
|
importPPT(item) {
|
||||||
let _this = this;
|
let _this = this;
|
||||||
|
// item.fileFullPath = "https://wzyzoss.eos-chongqing-3.cmecloud.cn/2025/1/14/c4d8ae796fc74417aefe017a49388962.ppt"
|
||||||
fetch(item.fileFullPath)
|
fetch(item.fileFullPath)
|
||||||
.then(res => res.arrayBuffer())
|
.then(res => res.arrayBuffer())
|
||||||
.then(buffer => {
|
.then(buffer => {
|
||||||
|
@ -636,7 +637,11 @@ export default {
|
||||||
async createAIPPTByFile(file,fileShowName) {
|
async createAIPPTByFile(file,fileShowName) {
|
||||||
this.pgDialog.visible = true
|
this.pgDialog.visible = true
|
||||||
this.pgDialog.pg.percentage = 0
|
this.pgDialog.pg.percentage = 0
|
||||||
const resPptJson = await PPTXFileToJson(file)
|
const resPptJson = await PPTXFileToJson(file).catch(() => {
|
||||||
|
ElMessageBox.alert('PPT文件转换失败!请点击素材右侧...下载文件后打开另存为PPTX文件格式再进行导入!')
|
||||||
|
this.pgDialog.visible = false
|
||||||
|
})
|
||||||
|
if (!resPptJson) return
|
||||||
const { def, slides, ...content } = resPptJson
|
const { def, slides, ...content } = resPptJson
|
||||||
// 生成缩略图
|
// 生成缩略图
|
||||||
const thumbnails = await slidesToImg(slides, content.width)
|
const thumbnails = await slidesToImg(slides, content.width)
|
||||||
|
|
Loading…
Reference in New Issue