Compare commits
20 Commits
15b9f38810
...
a421ca94bc
Author | SHA1 | Date |
---|---|---|
yangws | a421ca94bc | |
小杨 | 6eda37c8c9 | |
lyc | 2a11173874 | |
lyc | 88869e9a8a | |
lyc | 08db70a3f2 | |
yangws | f9efb76282 | |
小杨 | ec3d728896 | |
yangws | cb0ab7f2e9 | |
小杨 | 43e9c9f44e | |
yangws | 809c639ce9 | |
小杨 | 243561dfd8 | |
zhengdegang | e5bc693f66 | |
zdg | 29888b0674 | |
zdg | 645f9ab120 | |
朱浩 | 74767b44df | |
朱浩 | ef4ec36bbe | |
zdg | c4a15e9c53 | |
lyc | a3079a87d0 | |
zdg | 6a9392d498 | |
zdg | e8ecc27441 |
|
@ -7,11 +7,14 @@ 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() // 幻灯片-状态管理
|
||||
const screenStore = useStore.useScreenStore() // 全屏-状态管理
|
||||
const classcourseStore = useStore.useClasscourseStore() // 课堂信息-状态管理
|
||||
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
|
||||
const execPlay = useExecPlay() // 播放控制
|
||||
|
||||
export class Classcourse {
|
||||
msgObj:ElMessageBox = null // 提示消息对象
|
||||
|
@ -27,7 +30,9 @@ export class Classcourse {
|
|||
load() {
|
||||
console.log('classcourse-load', classcourse)
|
||||
// 打开全屏
|
||||
screenStore.setScreening(!!classcourse)
|
||||
const isCourse = !!classcourse
|
||||
if (isCourse) Fullscreen.enterFullscreen()
|
||||
screenStore.setScreening(isCourse)
|
||||
// 如果课堂信息有值,则连接socket
|
||||
if (!!classcourse) {
|
||||
// 连接socket
|
||||
|
@ -36,8 +41,15 @@ export class Classcourse {
|
|||
this.classcourse = classcourse // 课堂信息
|
||||
this.id = classcourse.id // 课堂id
|
||||
// 如果课堂信息有paging,则更新当前页码
|
||||
const isPaging = !!classcourse.paging||classcourse.paging==0
|
||||
const isPaging = !!classcourse.paging
|
||||
if (isPaging) slidesStore.updateSlideIndex(classcourse.paging)
|
||||
// 如果课堂信息有paging,则更新动画播放状态
|
||||
const isAnim = !!classcourse.cartoonTimes
|
||||
if (isAnim) { // 动画播放
|
||||
for (let i = 0; i <= classcourse.cartoonTimes; i++) {
|
||||
execPlay.runAnimation(true) // 异步执行动画
|
||||
}
|
||||
}
|
||||
// 课堂信息-状态管理
|
||||
classcourseStore.setClasscourse(classcourse)
|
||||
// 待上课提示
|
||||
|
|
|
@ -12,6 +12,7 @@ import Classcourse from './classcourse' // 课程相关
|
|||
import msgUtils from '@/plugins/modal' // 消息工具
|
||||
import { Homework } from './index' // api-作业相关
|
||||
import emitter from '@/utils/mitt' //mitt 事件总线
|
||||
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
|
||||
|
||||
/**
|
||||
* @description 监听器
|
||||
|
@ -21,6 +22,7 @@ export default () => {
|
|||
const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理
|
||||
const resource = sessionStore.get('curr.resource') // apt 资源
|
||||
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
|
||||
const execPlay = useExecPlay() // 播放控制
|
||||
|
||||
// 监听幻灯片内容变化
|
||||
watch(() => slidesStore.slides, (newVal, oldVal) => {
|
||||
|
@ -82,8 +84,11 @@ export default () => {
|
|||
}
|
||||
break
|
||||
case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页
|
||||
const slideIndex = content.current
|
||||
slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
|
||||
const slideIndex = content?.current || 0
|
||||
const type = content?.animation
|
||||
if (type === 'Nextsteps') execPlay.execNext() // 下一步
|
||||
else if (type === 'Previoustep') execPlay.execPrev() // 上一步
|
||||
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
|
||||
break
|
||||
case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置
|
||||
if (!content.classWorkId) return
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
@ -168,6 +168,10 @@ const type = ref<WorkType[]>([
|
|||
label: '常规作业',
|
||||
value: 'primary'
|
||||
},
|
||||
{
|
||||
label: '框架梳理',
|
||||
value: 'primary'
|
||||
}
|
||||
])
|
||||
|
||||
const objItem = ref<any>({})
|
||||
|
@ -331,9 +335,10 @@ 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))
|
||||
getCurrentPPtData()
|
||||
if(workItem.value[slideIndex.value])
|
||||
getCurrentPPtData()
|
||||
})
|
||||
// watch(() => workItem.value.length, () => {
|
||||
// getCurrentPPtData()
|
||||
|
|
|
@ -19,10 +19,10 @@ export default () => {
|
|||
// 最小已播放页面索引
|
||||
const playedSlidesMinIndex = ref(slideIndex.value)
|
||||
|
||||
// 执行元素动画
|
||||
const runAnimation = () => {
|
||||
// 执行元素动画 isAsync 为 true 时,异步执行,否则同步执行
|
||||
const runAnimation = (isAsync: boolean) => {
|
||||
// 正在执行动画时,禁止其他新的动画开始
|
||||
if (inAnimation.value) return
|
||||
if (inAnimation.value && !isAsync) return
|
||||
|
||||
const { animations, autoNext } = formatedAnimations.value[animationIndex.value]
|
||||
animationIndex.value += 1
|
||||
|
@ -69,7 +69,7 @@ export default () => {
|
|||
elRef.addEventListener('animationend', handleAnimationEnd, { once: true })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
const firstAnimations = formatedAnimations.value[0]
|
||||
if (firstAnimations && firstAnimations.animations.length) {
|
||||
|
@ -174,6 +174,7 @@ export default () => {
|
|||
|
||||
// 鼠标滚动翻页
|
||||
const mousewheelListener = throttle(function(e: WheelEvent) {
|
||||
e.preventDefault() // 阻止默认事件
|
||||
if (e.deltaY < 0) execPrev()
|
||||
else if (e.deltaY > 0) execNext()
|
||||
}, 500, { leading: true, trailing: false })
|
||||
|
@ -182,20 +183,20 @@ export default () => {
|
|||
const touchInfo = ref<{ x: number; y: number; } | null>(null)
|
||||
|
||||
const touchStartListener = (e: TouchEvent) => {
|
||||
e.preventDefault() // 阻止默认事件
|
||||
touchInfo.value = {
|
||||
x: e.changedTouches[0].pageX,
|
||||
y: e.changedTouches[0].pageY,
|
||||
// x: e.changedTouches[0].pageX,
|
||||
// y: e.changedTouches[0].pageY,
|
||||
x: e.changedTouches[0].clientX,
|
||||
y: e.changedTouches[0].clientY,
|
||||
}
|
||||
}
|
||||
const touchEndListener = (e: TouchEvent) => {
|
||||
if (!touchInfo.value) return
|
||||
|
||||
const offsetX = Math.abs(touchInfo.value.x - e.changedTouches[0].pageX)
|
||||
const offsetY = e.changedTouches[0].pageY - touchInfo.value.y
|
||||
|
||||
const offsetX = Math.abs(touchInfo.value.x - e.changedTouches[0].clientX)
|
||||
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()
|
||||
}
|
||||
|
@ -203,6 +204,7 @@ export default () => {
|
|||
|
||||
// 快捷键翻页
|
||||
const keydownListener = (e: KeyboardEvent) => {
|
||||
e.preventDefault() // 阻止默认事件
|
||||
const key = e.key.toUpperCase()
|
||||
|
||||
if (key === KEYS.UP || key === KEYS.LEFT || key === KEYS.PAGEUP) execPrev()
|
||||
|
|
|
@ -71,3 +71,11 @@ export const addFileToKj = (id) => {
|
|||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export const getModelInfo = (params) => {
|
||||
return request({
|
||||
url: '/education/llmModel/getModelInfo',
|
||||
method: 'post',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
try {
|
||||
// 系统预设模板 copy一份
|
||||
const { msg } = await addKeyWords({ name: form.name, id: props.item.id })
|
||||
emitter.emit('onGetMain')
|
||||
ElMessage.success(msg)
|
||||
mode.value = false
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
id = props.item.id
|
||||
}
|
||||
else{
|
||||
onAddChildTemp(props.item.parentId)
|
||||
// 编辑状态下 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)
|
||||
}
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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]
|
||||
})
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<el-icon class="item-icon"><Flag /></el-icon>
|
||||
<div class="content-header-title">{{item.name}}</div>
|
||||
<div class="content-header-body">
|
||||
<div class="content-header-num">6</div>
|
||||
<div class="content-header-num">{{item.num}}</div>
|
||||
<div class="content-header-text">分析结果</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -83,7 +83,7 @@ import useUserStore from '@/store/modules/user' // 用户信息
|
|||
import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
||||
import KjListItem from '@/views/prepare/container/kj-list-item.vue'
|
||||
import FileImage from '@/components/file-image/index.vue'
|
||||
import {creatAPT, getSmarttalkPage} from '@/api/file'
|
||||
import {creatAPT, getSmarttalkPage, getModelInfo} from '@/api/file'
|
||||
import {ArrowDown, Flag, Position} from '@element-plus/icons-vue'
|
||||
import {asyncLocalFile, parseCataByNode} from "@/utils/talkFile";
|
||||
import { dataSetJson } from '@/utils/comm' // 数据集id文生图
|
||||
|
@ -165,9 +165,6 @@ const uploadData = ref({
|
|||
fileRoot: '备课'
|
||||
})
|
||||
const currentFileList = ref([])
|
||||
// 页面加载
|
||||
onMounted(() => {
|
||||
})
|
||||
|
||||
const gotoRoute = (item) => {
|
||||
if (item.path) {
|
||||
|
@ -392,6 +389,35 @@ const changeBook = async(data) => {
|
|||
uploadData.value.levelSecondId = cata[1]
|
||||
uploadData.value.levelThirdId = cata[2]
|
||||
uploadData.value.textbookId = data.textBook.curBookId
|
||||
getModelInfo({cataid: currentNode.value.id}).then(res=>{
|
||||
console.log(res)
|
||||
if (res&&res.data) {
|
||||
tags.filter(item=>{
|
||||
switch (item.name) {
|
||||
case '课标分析':
|
||||
item.num = res.data.kbs
|
||||
break;
|
||||
case '教材分析':
|
||||
item.num = res.data.jcs
|
||||
break;
|
||||
case '考试分析':
|
||||
item.num = res.data.kss
|
||||
break;
|
||||
case '素材设计':
|
||||
item.num = res.data.scs
|
||||
break;
|
||||
case '作业设计':
|
||||
item.num = res.data.zys
|
||||
break;
|
||||
case '框架设计':
|
||||
item.num = res.data.kjs
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
getSmarttalkPage({
|
||||
...uploadData.value,
|
||||
orderByColumn: 'createTime',
|
||||
|
@ -469,6 +495,11 @@ const changeClass = async (type, row, other) => {
|
|||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 页面加载
|
||||
onMounted(() => {
|
||||
})
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.model-wrap{
|
||||
|
|
|
@ -419,7 +419,7 @@ export default {
|
|||
} else { // 列表-下课
|
||||
other.loading.value = false
|
||||
row.status = isApt ? head : '已结束'
|
||||
}
|
||||
}
|
||||
ElMessage({ type: 'success', message: `下课成功!` })
|
||||
}, 1000)
|
||||
break
|
||||
|
@ -1131,6 +1131,7 @@ export default {
|
|||
position: absolute;
|
||||
right: 10px;
|
||||
top: 4px;
|
||||
z-index: 10;
|
||||
}
|
||||
.prepare-center-jxkj{
|
||||
height: 100%;
|
||||
|
|
|
@ -33,7 +33,7 @@ const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
|||
|
||||
//图片裁剪数据
|
||||
const options = reactive({
|
||||
img: userStore.user.avatar ==='/img/avatar-default.jpg' ? defaultUserImg : dev_api + userStore.user.avatar, // 裁剪图片的地址
|
||||
img: userStore.user.avatar ==='/img/avatar-default.jpg' ? defaultUserImg : dev_api.value + userStore.user.avatar, // 裁剪图片的地址
|
||||
autoCrop: true, // 是否默认生成截图框
|
||||
autoCropWidth: 400, // 默认生成截图框宽度
|
||||
autoCropHeight: 400, // 默认生成截图框高度
|
||||
|
@ -41,7 +41,6 @@ const options = reactive({
|
|||
outputType: 'png', // 默认生成截图为PNG格式
|
||||
previews: {} //预览数据
|
||||
})
|
||||
|
||||
const cropper = ref(null)
|
||||
|
||||
/** 编辑头像 */
|
||||
|
@ -70,7 +69,7 @@ function uploadImg(data) {
|
|||
|
||||
/** 关闭窗口 */
|
||||
function closeDialog() {
|
||||
options.img = userStore.user.avatar
|
||||
options.img = userStore.user.avatar ==='/img/avatar-default.jpg' ? defaultUserImg : dev_api.value + userStore.user.avatar
|
||||
options.visible = false
|
||||
}
|
||||
const cancle = () => {
|
||||
|
|
|
@ -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>
|
|
@ -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,20 +64,52 @@ const getChildTemp = async () => {
|
|||
})
|
||||
} finally {
|
||||
loading.value = false
|
||||
emitter.emit('changeMode', tempList.value[0])
|
||||
}
|
||||
}
|
||||
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([''])
|
||||
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;
|
||||
|
|
|
@ -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' // ppt转json
|
||||
|
@ -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)
|
||||
// 当前操作的索引
|
||||
|
@ -346,8 +432,8 @@ const toRousrceUrl = async(o) => {
|
|||
if (o?.background?.image) await toRousrceUrl(o.background.image)
|
||||
if(o?.elements){
|
||||
for (let element of o.elements) {
|
||||
await this.toRousrceUrl(element);
|
||||
}
|
||||
await toRousrceUrl(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
// ======== zdg end ============
|
||||
|
@ -368,8 +454,10 @@ onUnmounted(() => {
|
|||
emitter.off('changeMode')
|
||||
emitter.off('changeResult')
|
||||
emitter.off('changeAdjust')
|
||||
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -402,6 +490,9 @@ onUnmounted(() => {
|
|||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
.icon-shenglvehao{
|
||||
font-weight: bold
|
||||
}
|
||||
}
|
||||
|
||||
.item-bom {
|
||||
|
@ -446,3 +537,9 @@ onUnmounted(() => {
|
|||
}
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.template-custom-popover {
|
||||
width: 110px !important;
|
||||
min-width: 110px !important;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue