diff --git a/env.d.ts b/env.d.ts new file mode 100644 index 0000000..32b911d --- /dev/null +++ b/env.d.ts @@ -0,0 +1,5 @@ +declare module '*.vue' { + import { ComponentOptions } from 'vue' + const componentOptions: ComponentOptions + export default componentOptions +} \ No newline at end of file diff --git a/src/renderer/src/AixPPTist/src/App.vue b/src/renderer/src/AixPPTist/src/App.vue index 5214d9b..7cb504f 100644 --- a/src/renderer/src/AixPPTist/src/App.vue +++ b/src/renderer/src/AixPPTist/src/App.vue @@ -81,5 +81,8 @@ const initLoad: Function = () => { \ No newline at end of file + diff --git a/src/renderer/src/AixPPTist/src/plugins/icon.ts b/src/renderer/src/AixPPTist/src/plugins/icon.ts index da9ce97..bc6e035 100644 --- a/src/renderer/src/AixPPTist/src/plugins/icon.ts +++ b/src/renderer/src/AixPPTist/src/plugins/icon.ts @@ -125,6 +125,8 @@ import { User, Switch, More, + Material, + AddPicture } from '@icon-park/vue-next' export interface Icons { @@ -255,6 +257,8 @@ export const icons: Icons = { IconUser: User, IconSwitch: Switch, IconMore: More, + IconMaterial: Material, + IconAddPicture: AddPicture } export default { diff --git a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue new file mode 100644 index 0000000..dd648a3 --- /dev/null +++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue @@ -0,0 +1,172 @@ + + + + + \ No newline at end of file diff --git a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue index 12d9df4..6896137 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue @@ -82,6 +82,8 @@ + +
@@ -120,7 +122,18 @@ @update="data => { onhtml2canvas(data); classWorkTaskVisible = false }" /> - + + + + + + + +
@@ -147,6 +160,8 @@ import Divider from '../../../components/Divider.vue' import Popover from '../../../components/Popover.vue' import PopoverMenuItem from '../../../components/PopoverMenuItem.vue' import QuestToPPTist from '@/views/classTask/newClassTaskAssign/questToPPTist/index.vue' +import MaterialDialog from './MaterialDialog.vue' +import TextCreateImg from '@/components/ai-kolors/index.vue' const mainStore = useMainStore() const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore) @@ -198,6 +213,7 @@ const classWorkTaskVisible = ref(false) const textTypeSelectVisible = ref(false) const shapeMenuVisible = ref(false) const moreVisible = ref(false) +const materiaVisible = ref(false) // 绘制文字范围 const drawText = (vertical = false) => { @@ -244,6 +260,25 @@ const toggleSraechPanel = () => { const toggleNotesPanel = () => { mainStore.setNotesPanelState(!showNotesPanel.value) } + +// 插入素材 +interface MaterialParams { + type: string, + data: string +} +const insertMaterial = (item: MaterialParams) =>{ + const { type, data } = item + if(type == 'video'){ + createVideoElement(data) + } + else{ + createImageElement(data) + } + materiaVisible.value = false +} + +// 文生图 +const imgVisible = ref(false) \ No newline at end of file + diff --git a/src/renderer/src/utils/ruoyi.js b/src/renderer/src/utils/ruoyi.js index 8d7971e..4650536 100644 --- a/src/renderer/src/utils/ruoyi.js +++ b/src/renderer/src/utils/ruoyi.js @@ -258,16 +258,45 @@ export const getFileName = (filename) => { return filename.replace(/\.[^/.]+$/, ""); } -// 清除当前选中的教材 章节 相关信息 -export const clearBookInfo = () =>{ - //当前选中的教材 - localStorage.removeItem('curBook') - // 当前选中的节点 - localStorage.removeItem('curNode') - // 所有章节单元数据 - localStorage.removeItem('unitList') - // 所有教材数据 - localStorage.removeItem('subjectList') - // 展开的节点 - localStorage.removeItem('defaultExpandedKeys') + +/** + * 根据图片的url转换对应的base64值 + * @param { String } url 如:http://xxxx/xxx.png + * @returns base64取值 + */ +export const urlToBase64 = (url) => { + + return new Promise((resolve, reject) => { + if (!url) { + reject('请传入url内容') + } + if (/\.(png|jpe?g|gif|svg)(\?.*)?$/.test(url)) { + // 图片地址 + let image = new Image() + // 设置跨域问题 + image.setAttribute('crossOrigin', 'anonymous') + // 图片地址 + image.src = url +"?v=" + Math.random(); // 处理缓存,fix缓存bug,有缓存,浏览器会报错; + image.onload = () => { + let canvas = document.createElement('canvas') + const ctx = canvas.getContext('2d') + canvas.width = image.width + canvas.height = image.height + ctx.drawImage(image, 0, 0, image.width, image.height) + + // 获取图片后缀 + const ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase() + // 转base64 + const dataUrl = canvas.toDataURL(`image/${ext}`) + resolve(dataUrl || '') + canvas = null // 清除canvas元素 + image = null // 清除img元素 + } + } else { + // 非图片地址 + reject('非(png/jpe?g/gif/svg等)图片地址'); + } + }) + + } \ No newline at end of file diff --git a/src/renderer/src/views/model/index.vue b/src/renderer/src/views/model/index.vue index 6085346..ef727b5 100644 --- a/src/renderer/src/views/model/index.vue +++ b/src/renderer/src/views/model/index.vue @@ -10,7 +10,7 @@ 作业管理 教材研读 教学框架设计 - 打开PPTist + 考试分析 测试 文生图片 @@ -230,7 +230,7 @@ const HTTP_SERVER_API = (type, params = {}) => { ppttype: 'file', title: enpt.coursetitle, fileurl: '', - filetype: 'aptist', + filetype: 'aippt', datacontent: '', filekey: '', filetag: '', @@ -287,7 +287,7 @@ const handleAll = async(type, row) =>{ break; } case 'open': { // 打开资源-pptist - if (row.filetype != 'aptist') return msgUtils.msgWarning('暂不支持该类型文件操作!') + if (row.filetype != 'aippt') return msgUtils.msgWarning('暂不支持该类型文件操作!') sessionStore.set('curr.resource', row) // 缓存当前资源信息 createWindow('open-win', { url: '/pptist', // 窗口关闭时,清除缓存 @@ -312,7 +312,7 @@ const handleAll = async(type, row) =>{ // icons 处理 type 代表传递svg const getIcon = (o, type) => { let icon = typeof o == 'string' ? o : o?.filetype - if (['aptist'].includes(o?.filetype)) icon = 'pptx' + if (['aippt'].includes(o?.filetype)) icon = 'pptx' if (!!type) { // 其他格式icon switch(type) { case 'svg': // 返回svg格式 diff --git a/src/renderer/src/views/prepare/container/ai-pptistV2.vue b/src/renderer/src/views/prepare/container/ai-pptistV2.vue index 674c65a..f92eca6 100644 --- a/src/renderer/src/views/prepare/container/ai-pptistV2.vue +++ b/src/renderer/src/views/prepare/container/ai-pptistV2.vue @@ -158,7 +158,7 @@ const outlineCreatePPT = () => { const checkProgress = () => { getProgressV2(res.sid).then(response => { - percentage.value = Math.round(response?.donePages/response?.totalPages)*100; + percentage.value = Math.round(response?.donePages*100/response?.totalPages); if (response.pptStatus === "done") { emit('addSuccess',{...res,url:response.pptUrl}) ElMessage.success("生成成功"); @@ -267,7 +267,6 @@ function webSocketSend(ws, data) { function result1(resultData) { let jsonData = JSON.parse(resultData); - console.log(jsonData) outputText.value += jsonData.payload.choices.text[0].content; const div = document.querySelector('.paragraphs'); if (div) { diff --git a/src/renderer/src/views/prepare/container/class-start.vue b/src/renderer/src/views/prepare/container/class-start.vue index 3829064..3fa408b 100644 --- a/src/renderer/src/views/prepare/container/class-start.vue +++ b/src/renderer/src/views/prepare/container/class-start.vue @@ -262,7 +262,7 @@ const createClasscourse = async () => { // getClasscourseList('update') // 更新列表 ElMessage.success('创建课程-成功') // 新版-pptList 打开公屏 - if (myClassActive.value.filetype == 'aptist') { + if (myClassActive.value.filetype == 'aippt') { const msgEl = ElMessage.warning({message:'正在打开公屏,请稍后...',duration: 0}) setTimeout(() => { msgEl.close() diff --git a/src/renderer/src/views/prepare/container/kj-list-item.vue b/src/renderer/src/views/prepare/container/kj-list-item.vue index fc1cc6d..b874549 100644 --- a/src/renderer/src/views/prepare/container/kj-list-item.vue +++ b/src/renderer/src/views/prepare/container/kj-list-item.vue @@ -341,7 +341,7 @@ export default { cookieData: { ...configObj.data } }) return - } else if(items.fileFlag === 'aptist') { // aptist 被点击 打开PPT-List 课件 + } else if(items.fileFlag === 'aippt') { // aippt 被点击 打开PPT-List 课件 return this.$emit('change', 'click', items) } if (!items||!items.fileSuffix) return; diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue index ca44ba8..43ff14a 100644 --- a/src/renderer/src/views/prepare/index.vue +++ b/src/renderer/src/views/prepare/index.vue @@ -2,8 +2,20 @@
+ + + 新建 + + + - +
@@ -145,7 +157,7 @@