This commit is contained in:
zhangxuelin 2024-12-16 10:19:14 +08:00
commit 79839458f0
17 changed files with 464 additions and 107 deletions

View File

@ -33,6 +33,7 @@ export default defineConfig({
proxy: {
'/dev-api': {
target: 'http://27.128.240.72:7865',
// target: 'https://prev.ysaix.com:7868/prod-api/',
// target: 'http://36.134.181.164:7863',
// target: 'http://192.168.0.102:7865',
changeOrigin: true,

View File

@ -28,8 +28,8 @@ import msgUtils from '@/plugins/modal' // 消息工具
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // api
import { PPTApi } from './api'
import { sessionStore } from '@/utils/store' // electron-store
// import './api/watcher' //
import watcher from './api/watcher' //
import emitter from '@/utils/mitt' //mitt 线
watcher() //
const loading = ref(true)
const _isPC = isPC()

View File

@ -7,7 +7,6 @@ import { sessionStore } from '@/utils/store' // electron-store 状态管理
import * as useStore from '../store' // pptist-状态管理
import ChatWs from '@/plugins/socket' // 聊天socket
import msgUtils from '@/plugins/modal' // 消息工具
import * as Fullscreen from '../utils/fullscreen' // 全屏
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
const slidesStore = useStore.useSlidesStore() // 幻灯片-状态管理
@ -31,10 +30,9 @@ export class Classcourse {
console.log('classcourse-load', classcourse)
// 打开全屏
const isCourse = !!classcourse
if (isCourse) Fullscreen.enterFullscreen()
screenStore.setScreening(isCourse)
// 如果课堂信息有值则连接socket
if (!!classcourse) {
if (isCourse) {
// 连接socket
if (!ChatWs.ws) ChatWs.init()
ChatWs.id = classcourse.timgroupid // 群组id

View File

@ -3,7 +3,7 @@
* @author zdg
* @date 2024-11-26
*/
import { toRaw } from 'vue'
import { toRaw, nextTick } from 'vue'
import type { Result } from './types' // 接口类型
import msgUtils from '@/plugins/modal' // 消息工具
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
@ -12,7 +12,8 @@ import * as useStore from '../store' // pptist-状态管理
import { sessionStore } from '@/utils/store' // electron-store 状态管理
import useUserStore from '@/store/modules/user' // 外部-用户信息
import * as Api_server from '@/api/apiService' // 相关api
import * as commUtils from '@/utils/comm.js'
import * as commUtils from '@/utils/comm.js' // 工具
import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库
const slidesStore = useStore.useSlidesStore()
const userStore = useUserStore()
@ -133,6 +134,9 @@ export class PPTApi {
const currentSlide = toRaw(slidesStore.currentSlide)
const isAdd = !/^\d+$/.test(currentSlide.id) // 是否新增
const currInd = toRaw(slidesStore.slideIndex) // 当前页索引-new
const oldInd = oldData.findIndex(o => o.id == currentSlide.id) // 当前页索引-old
const isBatch = oldVal && oldVal.length && currInd != oldInd // 是否批量更新-排序
if (isAdd) { // 新增的幻灯片(id 为非数字,说明是新增的幻灯片)
const bool = await this.addSlide(currentSlide)
bool && await this.batchUpdateSlides(newData, true) // 批量更新-排序
@ -140,6 +144,9 @@ export class PPTApi {
await PPTApi.getSlideList(resource.id)
} else { // 防抖-更新
if (!this.isUpdate) return this.isUpdate = true // 下次更新数据
if (isBatch) { // 批量更新-排序
this.batchUpdateSlides(newData, true)
} else { // 更新当前页幻灯片
const params = {
id: currentSlide.id,
datacontent: JSON.stringify(currentSlide),
@ -147,9 +154,12 @@ export class PPTApi {
Utils.mxThrottle(() => {this.updateSlide(params)}, 200, 2)
}
}
}
// 更新幻灯片
static updateSlide(data: object): Promise<Boolean> {
return new Promise(async (resolve, reject) => {
const thumUrl = await this.getSlideThumUrl()
data.base64Code = thumUrl // 更新缩略图
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
if (res.code === 200) {
resolve(true)
@ -192,7 +202,18 @@ export class PPTApi {
else msgUtils.msgError(res.msg || '更新失败');return false
})
}
// thumbnail-slide thumbnail 缩略图
static getSlideThumUrl(): Promise<Boolean> {
return nextTick().then(async() => {
const slideIndex = slidesStore.slideIndex
const elements = document.querySelectorAll('.thumbnail-slide')
if (elements.length && slideIndex >= 0) {
const element = elements[slideIndex]
return await toPng(element)
}
return null
})
}
// 图片|音频|视频 转换为在线地址
static toRousrceUrl =async (o:any) => {
const formData = new FormData()
@ -203,7 +224,6 @@ export class PPTApi {
url &&(o.src = url)
return url
}
}
}

View File

@ -86,8 +86,8 @@ export default () => {
case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页
const slideIndex = content?.current || 0
const type = content?.animation
if (type === 'Nextsteps') execPlay.execNext() // 下一步
else if (type === 'Previoustep') execPlay.execPrev() // 上一步
if (type === 'Nextsteps') emitter.emit('useExecPlay', 'execNext') // 下一步
else if (type === 'Previoustep') emitter.emit('useExecPlay', 'turnPrevSlide') // 上一步清空-动画
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
break
case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置

View File

@ -151,9 +151,9 @@ export const useSlidesStore = defineStore('slides', {
for (const slide of slides) {
if (slide.sectionTag) delete slide.sectionTag
}
// const addIndex = this.slideIndex + 1
this.slides.splice(this.slideIndex, 0, ...slides)
// this.slideIndex = addIndex
const addIndex = this.slideIndex + 1
this.slides.splice(addIndex, 0, ...slides)
this.slideIndex = addIndex
},
updateSlide(props: Partial<Slide>, slideId?: string) {
const slideIndex = slideId ? this.slides.findIndex(item => item.id === slideId) : this.slideIndex

View File

@ -45,9 +45,9 @@
</template>
</div>
<!-- // -->
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="90%" height="500">
<el-scrollbar height="550">
<div style="height: 550px;">
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="85%" height="500">
<el-scrollbar>
<div style="height: 75vh;">
<NewClassTsakAssign :currentCourse='currentCourse' @getData="getData" />
</div>
</el-scrollbar>
@ -335,8 +335,9 @@ onMounted(() => {
objItem.value = workItem.value[slideIndex.value]
getCurrentPPtData()
})
watch(() => [workItem.value.length,slideIndex.value], (newVal,oldVal) => {
watch(() => [workItem.value.length,workItem.value[slideIndex.value]?.id], (newVal,oldVal) => {
if(!objectsAreEqual(newVal,oldVal))
if(workItem.value[slideIndex.value])
getCurrentPPtData()
})
// watch(() => workItem.value.length, () => {

View File

@ -100,7 +100,6 @@ const {
execNext,
animationIndex,
} = useExecPlay()
const { slideWidth, slideHeight } = useSlideSize()
const { exitScreening } = useScreening()
const { fullscreenState, manualExitFullscreen } = useFullscreen()
@ -197,6 +196,37 @@ const contextmenus = (): ContextmenuItem[] => {
emitter.on('upvoteTrigger', (type) => {
upvoteRef.value?.trigger(type)
});
// zdg: 使
const execPlay = {
autoPlayTimer,
autoPlay,
closeAutoPlay,
autoPlayInterval,
setAutoPlayInterval,
loopPlay,
setLoopPlay,
mousewheelListener,
touchStartListener,
touchEndListener,
turnPrevSlide,
turnNextSlide,
turnSlideToIndex,
turnSlideToId,
execPrev,
execNext,
animationIndex,
}
emitter.on('useExecPlay', (data: string|any) => {
if (!data) throw new Error('参数错误')
if (typeof data === 'string') { //
if (execPlay[data]) execPlay[data]()
else throw new Error('方法不存在')
} else { //
const { method, ...params } = data || {}
if (execPlay[method]) execPlay[method](...params)
else throw new Error('方法不存在')
}
})
</script>

View File

@ -174,9 +174,8 @@ export default () => {
// 鼠标滚动翻页
const mousewheelListener = throttle(function(e: WheelEvent) {
e.preventDefault() // 阻止默认事件
if (e.deltaY < 0) execPrev()
else if (e.deltaY > 0) execNext()
if (e.deltaY < 0) turning(e, 'prev')
else if (e.deltaY > 0) turning(e, 'next')
}, 500, { leading: true, trailing: false })
// 触摸屏上下滑动翻页
@ -197,24 +196,28 @@ export default () => {
const offsetY = e.changedTouches[0].clientY - touchInfo.value.y
if ( Math.abs(offsetY) > offsetX && Math.abs(offsetY) > 50 ) {
touchInfo.value = null
if (offsetY > 0) execPrev()
else execNext()
if (offsetY > 0) turning(e, 'prev')
else turning(e, 'next')
}
}
// 向上翻页/向下翻页
const turning = (e, type) => {
e.preventDefault() // 阻止默认事件
if (type === 'prev') execPrev()
else if (type === 'next') execNext()
}
// 快捷键翻页
const keydownListener = (e: KeyboardEvent) => {
e.preventDefault() // 阻止默认事件
const key = e.key.toUpperCase()
if (key === KEYS.UP || key === KEYS.LEFT || key === KEYS.PAGEUP) execPrev()
if (key === KEYS.UP || key === KEYS.LEFT || key === KEYS.PAGEUP) turning(e, 'prev')
else if (
key === KEYS.DOWN ||
key === KEYS.RIGHT ||
key === KEYS.SPACE ||
key === KEYS.ENTER ||
key === KEYS.PAGEDOWN
) execNext()
) turning(e, 'next')
}
onMounted(() => document.addEventListener('keydown', keydownListener))

View File

@ -40,7 +40,7 @@ const props = defineProps({
type: Number,
default: 1
},
item: { //
item: { //
type: Object,
default: () => {
return { ex3: '' }
@ -73,23 +73,25 @@ const loading = ref(false)
const saveAdd = async () => {
loading.value = true
if (props.item.ex3 == '1') {
let id; // id id
if (props.item.isAdd) {
id = props.item.id
}
else{
// item item.parentId
id = props.item.parentId
}
try {
// copy
const { msg } = await addKeyWords({ name: form.name, id: props.item.id })
const { msg } = await addKeyWords({ name: form.name, id })
emitter.emit('onGetMain')
ElMessage.success(msg)
mode.value = false
} finally {
loading.value = false
}
}
else{
onAddChildTemp(props.item.parentId)
}
} else {
} else {
if (props.item.isAdd) {
onAddChildTemp(props.item.id)
}

View File

@ -16,12 +16,12 @@
</template>
<script setup>
import { ref, onMounted, nextTick } from 'vue'
import { ref, onMounted, nextTick, reactive } from 'vue'
import { sessionStore } from '@/utils/store'
import PDF from '@/components/PdfJs/index.vue'
import LeftDialog from './left-dialog.vue'
const props = defineProps(['curNode', 'type'])
const props = defineProps(['type'])
const showDialog = ref(false)
const onClick = () => {
@ -31,8 +31,13 @@ const onClick = () => {
// PDF
const pdfUrl = ref('')
const curNode = reactive({})
onMounted(async () => {
await nextTick()
//
let nodeData = sessionStore.get('subject.curNode')
Object.assign(curNode, nodeData);
let data = sessionStore.get('subject.curBook')
let fileurl = data.fileurl
if(props.type == 1){

View File

@ -83,7 +83,7 @@
</template>
<script setup>
import { ref, reactive, onMounted, watch, onUnmounted, nextTick } from 'vue'
import { ref, reactive, onMounted, onUnmounted, nextTick } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { tempSave, completion, modelList, removeChildTemp, tempResult, editTempResult } from '@/api/mode/index'
import { sessionStore } from '@/utils/store'
@ -95,7 +95,7 @@ import useUserStore from '@/store/modules/user'
import emitter from '@/utils/mitt';
import { dataSetJson } from '@/utils/comm.js'
const props = defineProps(['curNode', 'type'])
const props = defineProps(['type'])
const { user } = useUserStore()
/*****************提示词相关****************/
@ -270,21 +270,6 @@ const onEdit = (index, item) => {
isEdit.value = true
}
const modeType = ref('课标')
watch(() => props.type, (newVal) => {
if (newVal == 1) {
modeType.value = '课标'
}
if (newVal == 2) {
modeType.value = '教材'
}
if (newVal == 3) {
modeType.value = '考试'
}
}, { immediate: false })
//
const params = reactive(
{
@ -402,11 +387,14 @@ emitter.on('onGetMain', () => {
const curNode = reactive({})
const modeType = ref('')
onMounted(() => {
let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data);
modeType.value = props.type == 1 ? '课标' : props.type == 2 ? '教材' : '考试'
getTemplateList()
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
params.dataset_id = dataSetJson[jsonKey]
})

View File

@ -2,18 +2,16 @@
<div class="page-template flex">
<el-row>
<el-col :span="12">
<Left :curNode="curNode" :type="type" />
<Left :type="type" />
</el-col>
<el-col :span="12">
<Right :curNode="curNode" :type="type" />
<Right :type="type" />
</el-col>
</el-row>
</div>
</template>
<script setup>
import { reactive, onMounted } from 'vue'
import { sessionStore } from '@/utils/store'
import Left from './container/left.vue'
import Right from './container/right.vue'
@ -23,13 +21,6 @@ const props = defineProps({
default: 1
},
})
const curNode = reactive({})
onMounted(() =>{
let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data);
})
</script>
<style lang="scss" scoped>

View File

@ -4,7 +4,7 @@
<div style="font-size: 18px; display: flex; flex-wrap: nowrap">
<div style="flex: 1">
{{ classWorkAnalysis.title }}完成情况
<el-tag :type="classWorkAnalysis.workclass" size="large" style="height: 25px">{{
<el-tag :type="classWorkAnalysis.workclass||'info'" size="large" style="height: 25px">{{
classWorkAnalysis.worktype
}}</el-tag>
</div>
@ -726,6 +726,7 @@ const msgHandle = (msg) => {
openDialog(data, false);
break
case MsgEnum.HEADS.MSG_slideFlapping: //
console.log('切换页面-关闭窗口')
window.close() //
break
// case 'TIMAddRecvNewMsgCallback': // data=[]
@ -765,6 +766,7 @@ onMounted(() => {
// im
if (ChatWs.ws) {
console.log('socket监听消息')
ChatWs.watch((msg, e) => {
try {
msgHandle(JSON.parse(msg))

View File

@ -0,0 +1,159 @@
<template>
<el-dialog v-model="mode" :show-close="false" width="600" append-to-body destroy-on-close>
<template #header>
<div class="custom-header flex">
<span>{{ item.ex3 == '1' ? '请输入新的模板名称' : item.isAdd ? '添加提示词' : '编辑提示词' }}</span>
<i class="iconfont icon-guanbi" @click="mode = false"></i>
</div>
</template>
<div class="dialog-content" v-loading="loading">
<p class="small-tip" v-if="item && item.ex3 == '1'">*当前模板为系统预设不支持直接操作需要复制一份为自己的然后再操作</p>
<el-form :model="form" label-width="auto">
<el-form-item label="名称">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="提示词" v-if="item.ex3 == '1' ? false : true">
<el-input v-model="form.prompt" type="textarea" />
</el-form-item>
</el-form>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="mode = false">取消</el-button>
<el-button type="primary" @click="saveAdd">
确定
</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup>
import { ref, reactive, watch } from 'vue'
import { ElMessage } from 'element-plus'
import emitter from '@/utils/mitt';
import { addKeyWords, addChildTemp, editChildTemp } from '@/api/mode/index'
const mode = defineModel()
const props = defineProps({
modeType: {
type: Number,
default: 1
},
item: { //
type: Object,
default: () => {
return { ex3: '' }
}
},
})
const form = reactive({
name: '',
prompt: '',
})
watch(() => mode.value, (newVal) => {
if(newVal){
if (props.item.isAdd) {
form.name = ''
form.prompt = ''
}
else{
form.name = props.item?.name
form.prompt = props.item?.prompt
}
}
},{ deep: true})
const loading = ref(false)
const saveAdd = async () => {
loading.value = true
if (props.item.ex3 == '1') {
let id; // id id
if (props.item.isAdd) {
id = props.item.id
}
else{
// item item.parentId
id = props.item.parentId
}
try {
// copy
const { msg } = await addKeyWords({ name: form.name, id })
emitter.emit('onGetMain')
ElMessage.success(msg)
mode.value = false
} finally {
loading.value = false
}
} else {
if (props.item.isAdd) {
onAddChildTemp(props.item.id)
}
else {
try {
let data = JSON.parse(JSON.stringify(props.item))
data.name = form.name;
data.prompt = form.prompt
const { msg } = await editChildTemp(data)
emitter.emit('onGetChild', data )
ElMessage.success(msg)
mode.value = false
} finally {
loading.value = false
}
}
}
}
//
const onAddChildTemp = async (parentId) => {
//
let obj = {
name: form.name,
type: 2, // 2
sortNum: 1,
parentId,
lmType: 1,
model: props.modeType,
prompt: form.prompt,
ex1: props.item.ex1, //
ex2: props.item.ex2, //
ex3: '', //
}
try {
var { msg } = await addChildTemp(obj)
emitter.emit('onGetChild')
ElMessage.success(msg)
mode.value = false
} finally {
loading.value = false
}
}
</script>
<style lang="scss" scoped>
.custom-header {
justify-content: space-between;
align-items: center;
.icon-guanbi {
cursor: pointer;
font-weight: bold;
}
}
.small-tip {
text-align: left;
font-size: 12px;
margin-bottom: 15px;
color: #F56C6C;
}
</style>

View File

@ -2,6 +2,7 @@
<div class="container-left flex">
<div class="left-header flex">教学模式</div>
<div class="left-con" v-loading="loading">
<el-empty v-if="!(tempList.length)" description="暂无数据" />
<div class="con-item" v-for="item in tempList" :key="item.id">
<div class="item-header flex">
<span>{{ item.name }}</span>
@ -29,27 +30,33 @@
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { ref, reactive, onMounted, onUnmounted } from 'vue';
import emitter from '@/utils/mitt';
import { modelList } from '@/api/mode/index'
import useUserStore from '@/store/modules/user'
import { sessionStore } from '@/utils/store'
const { user } = useUserStore()
//
let list = []
const getTemplate = () => {
modelList({ model: 1, type: 1, ex3: 1 }).then(res => {
list = res.rows
getChildTemp()
})
let list = ref([])
const getTemplate = async (id) => {
const { rows } = await modelList({ createUser: user.userId, model: 4, type: 1, pageNum: 1, pageSize: 10000})
list.value = rows
if(list.value.length){
getChildTemp(id)
}
}
//
const loading = ref(false)
const tempList = ref([])
const getChildTemp = async () => {
const getChildTemp = async (parentId) => {
tempList.value.length = 0
loading.value = true
for (let item of list) {
for (let item of list.value) {
try {
const { rows } = await modelList({ model: 1, type: 2, parentId: item.id })
const { rows } = await modelList({ model: 4, type: 2, parentId: item.id })
tempList.value.push({
id: item.id,
name: item.name,
@ -57,10 +64,28 @@ const getChildTemp = async () => {
})
} finally {
loading.value = false
}
}
if(parentId){
const item = tempList.value.find(item => item.id == parentId)
emitter.emit('changeMode', item)
}
else{
emitter.emit('changeMode', tempList.value[0])
}
}
}
//
emitter.on('onGetChild', async (data) => {
await getTemplate(data.parentId)
})
//
emitter.on('onGetMain', (item) => {
getTemplate(item.parentId)
})
//
const emit = defineEmits([''])
@ -68,9 +93,23 @@ const onSelect = (item) =>{
emitter.emit('changeMode', item)
}
const curNode = reactive({})
onMounted(() => {
let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data);
getTemplate()
})
//
onUnmounted(() => {
emitter.off('onGetMain');
emitter.off('onGetChild');
})
</script>
<style lang="scss" scoped>
@ -96,7 +135,7 @@ onMounted(() => {
padding: 15px;
box-sizing: border-box;
font-size: 14px;
overflow: auto;
.item-header {
justify-content: space-between;
margin-bottom: 5px;

View File

@ -10,17 +10,29 @@
</el-button>
</div>
<div class="header-right">
<el-button type="primary" :disabled="!(resultList.length)" @click="getCompletion">一键研读</el-button>
<el-button type="primary">生成大纲</el-button>
<el-button type="danger" @click="pptDialog = true">生成PPT</el-button>
</div>
</div>
<div class="right-con flex">
<el-empty v-if="!(resultList.length)" description="暂无数据" />
<div class="con-item flex" v-for="(item, index) in resultList" :key="item.id" v-loading="item.loading">
<div class="item-top flex">
<span>{{ item.name }}</span>
<el-button type="info" link>
<el-popover placement="bottom-end" trigger="hover" popper-class="template-custom-popover">
<template #reference>
<el-button link type="primary">
<i class="iconfont icon-shenglvehao"></i></el-button>
</template>
<template #default>
<el-button type="primary" link @click="editKeyWord(item, false)">编辑</el-button>
<el-button type="primary" link @click="removeItem(item, true)">移除</el-button>
</template>
</el-popover>
<!-- <el-button type="info" link>
<i class="iconfont icon-xiazai9"></i>
</el-button>
</el-button> -->
</div>
<div class="item-bom">
<div class="item-prompt">{{ item.prompt }}</div>
@ -51,19 +63,23 @@
<AdjustDialog v-model="isAdjust" :item="curItem" />
<PptDialog @add-success="addAiPPT" :dataList="resultList" v-model="pptDialog"/>
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
<!--添加编辑提示词-->
<keywordDialog v-model="isWordDialog" :item="curItem" />
</template>
<script setup>
import { ref, onMounted, onUnmounted, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { sessionStore } from '@/utils/store'
import emitter from '@/utils/mitt'
import EditDialog from './edit-dialog.vue'
import AdjustDialog from './adjust-dialog.vue'
import progressDialog from './progress-dialog.vue'
import { completion, tempResult } from '@/api/mode/index.js'
import { completion, tempResult, tempSave, removeChildTemp } from '@/api/mode/index.js'
// import { dataSetJson } from '@/utils/comm.js'
import * as commUtils from '@/utils/comm.js'
import PptDialog from '@/views/prepare/container/pptist-dialog.vue'
import keywordDialog from './keyword-dialog.vue'
import useUserStore from '@/store/modules/user'
import {PPTXFileToJson} from '@/AixPPTist/src/hooks/useImport' // pptjson
@ -97,11 +113,87 @@ const pgDialog = reactive({ // 弹窗-进度条
})
emitter.on('changeMode', (item) => {
resultList.value = item.child
// conversation()
getTempResult(item.id)
})
//
const getCompletion = async () => {
for (let item of resultList.value) {
console.log(item)
try {
item.loading = true
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}${curNode.itemtitle}进行教学分析`
const { data } = await completion(params)
item.answer = getResult(data.answer)
onSaveTemp(item)
} finally {
item.loading = false
}
}
}
//
const onSaveTemp = (item) => {
if (item.answer == '') return
const data = {
mainModelId: item.parentId,
modelId: item.id,
examDocld: '',
content: item.answer,
ex1: curNode.id
}
tempSave(data).then(res => { })
}
const isWordDialog = ref(false)
const editKeyWord = (item, val) => {
/**
* isAdd: 子模板中的移除 为编辑false 头部删除 添加提示词为新增 true
*/
Object.assign(curItem, item)
curItem.isAdd = val
isWordDialog.value = true
}
//
const removeItem = async (item, isChild) => {
/**
* item: 当前操作的模板
* isChild: 子模板中的移除为 true
*/
if (item.ex3 != '1') {
ElMessageBox.confirm(
'确认是否移除?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
removeChildTemp(item.id).then(res => {
ElMessage.success('操作成功')
if (isChild) {
//
emitter.emit('onGetChild', item)
}
else {
//
// getTemplateList()
}
})
})
}
else {
// editKeyWord(item, !isChild)
}
}
//
const getTempResult = (id) => {
tempResult({ mainModelId: id }).then(res => {
@ -119,6 +211,11 @@ const getTempResult = (id) => {
})
}
// ### **
let getResult = (str) => {
let newStr = str.replace(/#+|(\*\*)/g, '');
return newStr
}
const params = reactive(
{
@ -176,18 +273,7 @@ const addAiPPT = async(res) => {
}
})
}
const conversation = async () => {
for (let item of resultList.value) {
item.loading = true
try {
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}课标对${curNode.itemtitle}进行教学分析`
const { data } = await completion(params)
item.answer = data.answer
} finally {
item.loading = false
}
}
}
const isEdit = ref(false)
//
@ -368,8 +454,10 @@ onUnmounted(() => {
emitter.off('changeMode')
emitter.off('changeResult')
emitter.off('changeAdjust')
})
</script>
<style lang="scss" scoped>
@ -396,12 +484,36 @@ onUnmounted(() => {
.con-item {
width: 100%;
flex-direction: column;
margin-bottom: 20px;
padding-bottom: 20px;
position: relative;
padding-left: 15px;
box-sizing: border-box;
&::after{
content: '';
width: 15px;
height: 15px;
border-radius: 50%;
background: #409eff;
position: absolute;
left: -8px;
top: 5px;
}
&::before{
content: '';
width: 2px;
height: 100%;
background: #409eff;
position: absolute;
left: -1px;
top: 5px;
}
.item-top {
justify-content: space-between;
align-items: center;
margin-bottom: 5px;
.icon-shenglvehao{
font-weight: bold
}
}
.item-bom {
@ -446,3 +558,9 @@ onUnmounted(() => {
}
}
</style>
<style>
.template-custom-popover {
width: 110px !important;
min-width: 110px !important;
}
</style>