生成ppt

This commit is contained in:
朱浩 2025-01-07 15:24:26 +08:00
parent 2b17cc103d
commit 1132dc2c0d
3 changed files with 26 additions and 10 deletions

View File

@ -107,12 +107,12 @@ const getBackGroundV2 = async () => {
} }
}; };
const createOutlineV2 = async (params) => { const createOutlineV2 = async (data) => {
try { try {
const response = await request({ const response = await request({
url:"/api/aipptV2/createOutlineV2", url:"/api/aipptV2/createOutlineV2",
method: "POST", method: "POST",
params data
}); });
console.log("createOutline response:", response); console.log("createOutline response:", response);
@ -133,6 +133,18 @@ const createPPTV2 = async (data) => {
throw error; throw error;
} }
}; };
const createPptByOutline = async (data) => {
try {
const response = await req("/api/aipptV2/createPptByOutline", "POST", data);
console.log("createOutline response:", response);
return response.data;
} catch (error) {
console.error("请求失败:", error);
throw error;
}
};
const getProgressV2 = async (id) => { const getProgressV2 = async (id) => {
try { try {
const response = await req(`/api/aipptV2/progressV2?sid=${id}`, "GET"); const response = await req(`/api/aipptV2/progressV2?sid=${id}`, "GET");
@ -143,4 +155,4 @@ const getProgressV2 = async (id) => {
} }
}; };
export { createOutline, getBackGround, createPPT, getProgress, getBackGroundV2, createOutlineV2, createPPTV2, getProgressV2, createByOutline }; export { createOutline, getBackGround, createPPT, getProgress, getBackGroundV2, createOutlineV2, createPPTV2, getProgressV2, createByOutline, createPptByOutline };

View File

@ -34,8 +34,10 @@
import AiPptist from './ai-pptistV2.vue'; import AiPptist from './ai-pptistV2.vue';
import {Select} from "@element-plus/icons-vue"; import {Select} from "@element-plus/icons-vue";
import {ref, defineEmits, onMounted} from "vue"; import {ref, defineEmits, onMounted} from "vue";
import {createPPTV2, getBackGroundV2, getProgressV2} from "@/utils/ppt-request"; import {createPPTV2, getBackGroundV2, getProgressV2, createPptByOutline} from "@/utils/ppt-request";
import {ElMessage} from "element-plus"; import {ElMessage} from "element-plus";
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
const model = defineModel() const model = defineModel()
const emit = defineEmits(['addSuccess', 'close-dialogs']) const emit = defineEmits(['addSuccess', 'close-dialogs'])
const backGroundList = ref([]); const backGroundList = ref([]);
@ -60,7 +62,7 @@
const outlineData = ref({ const outlineData = ref({
query: '', // 8000 query: '', // 8000
templateId: '', // ppt templateId: '', // ppt
author: 'AIX平台', author: userStore.user.nickName,
isFigure: false, // isFigure: false, //
search: true, search: true,
language: "cn" language: "cn"
@ -68,9 +70,10 @@
const percentage = ref(0); const percentage = ref(0);
const outlineCreatePPT = () => { const outlineCreatePPT = () => {
const newOutlineData = { ...outlineData.value, }; const newOutlineData = { ...outlineData.value, };
newOutlineData.query = props.dataList.outline; newOutlineData.outline = props.dataList.outline;
newOutlineData.query = "通过传入大纲帮我生成相应的PPT课件"
createPPTLoading.value = true; createPPTLoading.value = true;
createPPTV2(newOutlineData).then((res) => { createPptByOutline(newOutlineData).then((res) => {
console.log(res, "正在生成中"); console.log(res, "正在生成中");
createPPTLoading.value = false; createPPTLoading.value = false;
activeStep.value = 2 activeStep.value = 2

View File

@ -33,12 +33,11 @@ import * as API_entpcourse from "@/api/education/entpcourse";
import * as API_entpcoursefile from "@/api/education/entpcoursefile"; import * as API_entpcoursefile from "@/api/education/entpcoursefile";
import * as commUtils from '@/utils/comm.js' import * as commUtils from '@/utils/comm.js'
import * as Api_server from '@/api/apiService' // api import * as Api_server from '@/api/apiService' // api
import useUserStore from '@/store/modules/user'
import {createWindow} from "@/utils/tool"; import {createWindow} from "@/utils/tool";
import {editSyllabus} from "@/api/mode"; import {editSyllabus} from "@/api/mode";
import { getSmarttalkPage } from "@/api/file" import { getSmarttalkPage } from "@/api/file"
import useUserStore from '@/store/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
const pptDialog = ref(false) const pptDialog = ref(false)
const result = ref(null) const result = ref(null)
const courseObj = reactive({ const courseObj = reactive({
@ -70,6 +69,8 @@ emitter.on('onResult', (data)=>{
listEntpcoursefileNew({parentid: result.value.parentId}).then(res=>{ listEntpcoursefileNew({parentid: result.value.parentId}).then(res=>{
pptSlides.value = res.rows pptSlides.value = res.rows
}) })
}else {
pptSlides.value = []
} }
}) })