s生成PPT

This commit is contained in:
朱浩 2024-12-04 16:28:52 +08:00
parent 7ddf71c044
commit 7811bbfe3e
4 changed files with 21 additions and 19 deletions

View File

@ -34,7 +34,7 @@ export default defineConfig({
'/dev-api': { '/dev-api': {
target: 'http://27.128.240.72:7865', target: 'http://27.128.240.72:7865',
// target: 'http://36.134.181.164:7863', // target: 'http://36.134.181.164:7863',
// target: 'http://192.168.2.52:7863', // target: 'http://192.168.0.102:7865',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '') rewrite: (p) => p.replace(/^\/dev-api/, '')
}, },

View File

@ -52,12 +52,12 @@ import { useRouter } from 'vue-router'
import { Plus, Refresh, Upload, Files, UploadFilled } from '@element-plus/icons-vue' import { Plus, Refresh, Upload, Files, UploadFilled } from '@element-plus/icons-vue'
import useUserStore from '@/store/modules/user' // import useUserStore from '@/store/modules/user' //
import msgUtils from '@/plugins/modal' // import msgUtils from '@/plugins/modal' //
import { createWindow, sessionStore } from '@/utils/tool' // import { createWindow } from '@/utils/tool' //
import * as API_smarttalk from '@/api/file' // api import * as API_smarttalk from '@/api/file' // api
import * as API_entpcourse from '@/api/education/entpcourse' // api import * as API_entpcourse from '@/api/education/entpcourse' // api
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // api import * as API_entpcoursefile from '@/api/education/entpcoursefile' // api
import { dataSetJson } from '@/utils/comm' // id import { dataSetJson } from '@/utils/comm' // id
// import { sessionStore } from '@/utils/store' // import { sessionStore } from '@/utils/store' //
// //
import ChooseTextbook from '@/components/choose-textbook/index.vue' import ChooseTextbook from '@/components/choose-textbook/index.vue'
import { menusEvent } from '@/plugins/vue3-menus' // import { menusEvent } from '@/plugins/vue3-menus' //
@ -372,7 +372,7 @@ const getIcon = (o, type) => {
justify-content: flex-start; justify-content: flex-start;
.el-button { .el-button {
flex: 1 1 15%; flex: 1 1 15%;
max-width: 15%; max-width: 15%;
min-width: 15%; min-width: 15%;
box-sizing: border-box; box-sizing: border-box;
@ -387,4 +387,4 @@ const getIcon = (o, type) => {
} }
} }
} }
</style> </style>

View File

@ -57,11 +57,11 @@
</el-row> </el-row>
<div> <div>
<el-button style="margin-bottom: 5px;" type="primary" @click="activeStep = 0">上一步</el-button> <el-button style="margin-bottom: 5px;" type="primary" @click="activeStep = 0">上一步</el-button>
<el-button style="margin-bottom: 5px;" type="primary" @click="outlineCreatePPT()">生成PPT</el-button> <el-button style="margin-bottom: 5px;" type="primary" v-loading="createPPTLoading" @click="outlineCreatePPT()">生成PPT</el-button>
</div> </div>
</el-card> </el-card>
<el-card v-if="activeStep === 2"> <el-card v-if="activeStep === 2">
<el-progress :percentage="30" type="circle" v-if="percentage === 30"></el-progress> <el-progress :percentage="percentage" type="circle"></el-progress>
</el-card> </el-card>
</div> </div>
</div> </div>
@ -79,6 +79,7 @@ import {
import CryptoJS from "crypto-js" import CryptoJS from "crypto-js"
import { getSignature } from "@/utils/index.js"; import { getSignature } from "@/utils/index.js";
import {sessionStore} from "@/utils/store";
let appId = "01ec9aa3"; let appId = "01ec9aa3";
let secret = "M2QxMDAxMjYyYTEzODMwMGRkZTQ4NmUy"; let secret = "M2QxMDAxMjYyYTEzODMwMGRkZTQ4NmUy";
@ -98,8 +99,8 @@ let secondArray = ref([]); //大纲的文字部分
const backGroundList = ref([]); const backGroundList = ref([]);
let subjectdata = sessionStore.get('subject.curNode')
const inputTheme = ref("高中语文《沁园春雪》的授课课件"); // const inputTheme = ref(subjectdata.edustage + subjectdata.edusubject + "《" + subjectdata.itemtitle + "》的授课课件"); //
const inputRequire = ref("") // const inputRequire = ref("") //
const activeStep = ref(0); // const activeStep = ref(0); //
const combined = ref('') // ppt const combined = ref('') // ppt
@ -109,6 +110,8 @@ const status = ref("init");
const percentage = ref(0); const percentage = ref(0);
const createPPTLoading = ref(false);
const getBackgrounds = () => { const getBackgrounds = () => {
treeData.value = []; treeData.value = [];
getBackGroundV2().then((res) => { getBackGroundV2().then((res) => {
@ -126,6 +129,8 @@ const outlineData = ref({
// templateId: 'auto', // ppt // templateId: 'auto', // ppt
author: 'AIX平台', author: 'AIX平台',
isFigure: false, // isFigure: false, //
search: true,
language: "cn"
} }
) )
@ -145,20 +150,17 @@ function updateStagingData(role, newData) {
const outlineCreatePPT = () => { const outlineCreatePPT = () => {
const newOutlineData = { ...outlineData.value, }; const newOutlineData = { ...outlineData.value, };
newOutlineData.query = outputText.value; newOutlineData.query = outputText.value;
createPPTLoading.value = true;
createPPTV2(newOutlineData).then((res) => { createPPTV2(newOutlineData).then((res) => {
console.log(res, "正在生成中"); console.log(res, "正在生成中");
createPPTLoading.value = false;
activeStep.value = 2 activeStep.value = 2
const checkProgress = () => { const checkProgress = () => {
getProgressV2(res.sid).then((response) => { getProgressV2(res.sid).then(response => {
percentage.value = response.process; percentage.value = Math.round(response?.donePages/response?.totalPages)*100;
if (response && response.pptUrl && response.pptUrl.length > 4) { if (response.pptStatus === "done") {
console.log('PPT',response) emit('addSuccess',{...res,url:response.pptUrl})
// window.location.href = response.data.pptUrl;
//URLURL
// let url = "https://bjcdn.openstorage.cn/xinghuo-privatedata/%2Ftmp/apiTempFiledf28bf990a4c40ffb7477ed4b65392c27232357022409613439/%E3%80%8A%E9%9D%99%E5%A5%B3%E3%80%8B%E6%B7%B1%E5%BA%A6%E8%A7%A3%E8%AF%BB%E4%B8%8E%E7%A0%94%E7%A9%B6.pptx"
emit('addSuccess',res)
ElMessage.success("生成成功"); ElMessage.success("生成成功");
} else { } else {
const sleepTime = 2000; const sleepTime = 2000;

View File

@ -13,7 +13,7 @@
</template> </template>
<script setup> <script setup>
import AiPptist from './ai-pptist.vue'; import AiPptist from './ai-pptistV2.vue';
const model = defineModel() const model = defineModel()
const emit = defineEmits(['addSuccess']) const emit = defineEmits(['addSuccess'])
const props = defineProps({ const props = defineProps({