Merge pull request 'lyc-dev' (#211) from lyc-dev into main
This commit is contained in:
commit
33d7c8c96c
|
@ -35,6 +35,7 @@
|
|||
"@electron/remote": "^2.1.2",
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@icon-park/vue-next": "^1.4.2",
|
||||
"@kangc/v-md-editor": "^2.3.18",
|
||||
"@tinymce/tinymce-vue": "5.1.1",
|
||||
"@vitejs/plugin-vue-jsx": "^4.0.0",
|
||||
"@vue-office/docx": "^1.6.2",
|
||||
|
|
|
@ -10,6 +10,15 @@ import './assets/iconfont/iconfont'
|
|||
import 'virtual:windi.css'
|
||||
import request from "@/utils/request";
|
||||
|
||||
//v-md-editor
|
||||
import VMdPreview from '@kangc/v-md-editor/lib/preview';
|
||||
import '@kangc/v-md-editor/lib/style/preview.css';
|
||||
// 引入你所使用的主题 此处以 github 主题为例
|
||||
import githubTheme from '@kangc/v-md-editor/lib/theme/github';
|
||||
import '@kangc/v-md-editor/lib/theme/style/github.css';
|
||||
// highlightjs
|
||||
import hljs from 'highlight.js';
|
||||
|
||||
import { store } from '@/store'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
|
@ -39,6 +48,10 @@ app.config.globalProperties.$requestGetJYW = (url,config)=>{
|
|||
import Icon from '@/AixPPTist/src/plugins/icon'
|
||||
import Directive from '@/AixPPTist/src/plugins/directive'
|
||||
|
||||
VMdPreview.use(githubTheme, {
|
||||
Hljs: hljs,
|
||||
});
|
||||
|
||||
app.use(router)
|
||||
.use(store)
|
||||
.use(ElementPlus, { locale: zhLocale })
|
||||
|
@ -46,6 +59,7 @@ app.use(router)
|
|||
.use(plugins)
|
||||
.use(Icon)
|
||||
.use(Directive)
|
||||
.use(VMdPreview)
|
||||
.mount('#app')
|
||||
|
||||
const isStadium = (user) => {
|
||||
|
|
|
@ -16,7 +16,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="center-con" v-loading="loading">
|
||||
<template v-if="answer.title">
|
||||
<!-- <v-md-editor v-if="markeDownAnswer" :model-value="markeDownAnswer" mode="preview"></v-md-editor> -->
|
||||
<v-md-preview v-if="markeDownAnswer" :text="markeDownAnswer"></v-md-preview>
|
||||
|
||||
<!-- <template v-if="answer.title">
|
||||
<div class="flex justify-between">
|
||||
<span style="font-size: 18px;color: #409eff;">封面页</span>
|
||||
<el-button type="primary" link @click="onEdit(item, -1)">编辑</el-button>
|
||||
|
@ -36,11 +39,11 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
</template> -->
|
||||
<el-empty v-else description="请选择符合您需要的教学模式,生成教学大纲" />
|
||||
</div>
|
||||
</div>
|
||||
<EditDialog v-model="isEdit" :item="editItem" :index="editIndex" />
|
||||
<!-- <EditDialog v-model="isEdit" :item="editItem" :index="editIndex" /> -->
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -60,7 +63,6 @@ const curMode = ref(2)
|
|||
const isEdit = ref(false)
|
||||
|
||||
const { user } = useUserStore()
|
||||
const aiShow = ref(false)
|
||||
|
||||
const modeOptions = ref([
|
||||
{
|
||||
|
@ -81,12 +83,11 @@ emitter.on('selected', (data) => {
|
|||
// 回显大纲
|
||||
const curItem = reactive({})
|
||||
emitter.on('onShow', (data) => {
|
||||
aiShow.value = false
|
||||
Object.assign(answer, JSON.parse(data.outline))
|
||||
|
||||
|
||||
let outline = JSON.parse(data.outline)
|
||||
markeDownAnswer.value = outline.markdown
|
||||
emitter.emit('onResult',data)
|
||||
Object.assign(curItem, data)
|
||||
curItem.outline = JSON.parse(curItem.outline)
|
||||
emitter.emit('onResult',curItem)
|
||||
})
|
||||
|
||||
|
||||
|
@ -100,7 +101,8 @@ const params = reactive(
|
|||
|
||||
// 研读
|
||||
const loading = ref(false)
|
||||
const answer = reactive({})
|
||||
// const answer = reactive({})
|
||||
const markeDownAnswer = ref('')
|
||||
|
||||
const createAi = async () => {
|
||||
if (selectedData.value.length == 0) {
|
||||
|
@ -111,10 +113,10 @@ const createAi = async () => {
|
|||
let str = selectedData.value.map( item => item.name).join('、')
|
||||
let bookV = curNode.roottitle.split('-')[1] + '版'
|
||||
loading.value = true
|
||||
aiShow.value = true
|
||||
|
||||
try {
|
||||
|
||||
params.prompt = `针对${curNode.edustage}${curNode.edusubject}${bookV}${curNode.itemtitle}这一课,根据以下教学环节:${str},进行课件教学PPT内容设计`
|
||||
params.prompt = `针对${curNode.edustage}${curNode.edusubject}${bookV}${curNode.itemtitle}这一课,根据以下教学环节:${str},进行课件教学PPT内容设计,按照幻灯片1、幻灯片2、...的格式`
|
||||
// params.template = item.prompt
|
||||
|
||||
// 教学大模型
|
||||
|
@ -133,65 +135,71 @@ const createAi = async () => {
|
|||
|
||||
data = res.data
|
||||
}
|
||||
markeDownAnswer.value = data.answer
|
||||
const res = await createOutlineV2({ query: data.answer })
|
||||
|
||||
Object.assign(answer, res.outline)
|
||||
curItem.outline = res.outline
|
||||
curItem.outline = JSON.stringify({
|
||||
json: res.outline,
|
||||
markdown: data.answer
|
||||
})
|
||||
emitter.emit('onResult', curItem)
|
||||
onSaveTemp(JSON.stringify(res.outline))
|
||||
onSaveTemp()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 编辑大纲
|
||||
const editItem = reactive({})
|
||||
const editIndex = ref(0)
|
||||
const onEdit = (item, index)=>{
|
||||
// const editItem = reactive({})
|
||||
// const editIndex = ref(0)
|
||||
// const onEdit = (item, index)=>{
|
||||
|
||||
let obj = null
|
||||
if(index == -1){
|
||||
obj = {
|
||||
title: answer.title,
|
||||
subTitle: answer.subTitle
|
||||
}
|
||||
}
|
||||
else{
|
||||
obj = cloneDeep(item)
|
||||
}
|
||||
editIndex.value = index
|
||||
isEdit.value = true
|
||||
Object.assign(editItem, obj)
|
||||
}
|
||||
// let obj = null
|
||||
// if(index == -1){
|
||||
// obj = {
|
||||
// title: answer.title,
|
||||
// subTitle: answer.subTitle
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// obj = cloneDeep(item)
|
||||
// }
|
||||
// editIndex.value = index
|
||||
// isEdit.value = true
|
||||
// Object.assign(editItem, obj)
|
||||
// }
|
||||
|
||||
emitter.on('editItem', (item) =>{
|
||||
if(editIndex.value == -1){
|
||||
answer.title = item.title
|
||||
answer.subTitle = item.subTitle
|
||||
}else{
|
||||
answer.chapters[editIndex.value] = item
|
||||
}
|
||||
let data = cloneDeep(curItem)
|
||||
// emitter.on('editItem', (item) =>{
|
||||
// if(editIndex.value == -1){
|
||||
// answer.title = item.title
|
||||
// answer.subTitle = item.subTitle
|
||||
// }else{
|
||||
// answer.chapters[editIndex.value] = item
|
||||
// }
|
||||
// let data = cloneDeep(curItem)
|
||||
|
||||
data.outline = JSON.stringify(cloneDeep(answer))
|
||||
loading.value = true
|
||||
// data.outline = JSON.stringify(cloneDeep(answer))
|
||||
// loading.value = true
|
||||
|
||||
editSyllabus(data).then( res =>{
|
||||
curItem.outline = answer
|
||||
emitter.emit('onResult', curItem)
|
||||
ElMessage.success('操作成功')
|
||||
}).finally( ()=>{
|
||||
loading.value = false
|
||||
})
|
||||
})
|
||||
// editSyllabus(data).then( res =>{
|
||||
// curItem.outline = answer
|
||||
// emitter.emit('onResult', curItem)
|
||||
// ElMessage.success('操作成功')
|
||||
// }).finally( ()=>{
|
||||
// loading.value = false
|
||||
// })
|
||||
// })
|
||||
|
||||
// 保存模板
|
||||
const onSaveTemp = async (answer) => {
|
||||
if (answer == '') return
|
||||
const onSaveTemp = async () => {
|
||||
let modelIds = selectedData.value.map(item => item.id).join(',')
|
||||
let outline = JSON.stringify({
|
||||
markdown: markeDownAnswer.value,
|
||||
json:curItem.outline
|
||||
})
|
||||
const data = {
|
||||
eduId: curNode.id,
|
||||
outline: answer,
|
||||
outline,
|
||||
outlineType: curMode.value == 1 ? 0 : 1,
|
||||
modelIds,
|
||||
sourceType: 1,
|
||||
|
@ -237,7 +245,6 @@ onUnmounted(() => {
|
|||
emitter.off('onShow')
|
||||
emitter.off('editItem')
|
||||
|
||||
|
||||
})
|
||||
|
||||
const curNode = reactive({})
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<div class="container-right flex">
|
||||
<div class="right-header flex">
|
||||
<span>课件预览</span>
|
||||
<span>预览</span>
|
||||
<div>
|
||||
<el-button :disabled="!result?.outline" type="danger" @click="onCreate">一键生成</el-button>
|
||||
<el-button :disabled="!result?.parentId" @click="openAiPPT">编辑课件</el-button>
|
||||
<el-button :disabled="!result?.parentId" @click="openAiPPT">编辑</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-con">
|
||||
|
@ -66,6 +66,7 @@ const pptSlides = ref([])
|
|||
emitter.on('onResult', (data)=>{
|
||||
console.log(data)
|
||||
result.value = data
|
||||
result.value.outline = JSON.parse(data.outline).json
|
||||
if (!!result.value.parentId) {
|
||||
listEntpcoursefileNew({parentid: result.value.parentId}).then(res=>{
|
||||
pptSlides.value = res.rows
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
<el-col :span="5">
|
||||
<Left />
|
||||
</el-col>
|
||||
<el-col :span="14">
|
||||
<el-col :span="15">
|
||||
<Center />
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-col :span="4">
|
||||
<Right />
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
Loading…
Reference in New Issue