Compare commits
No commits in common. "64272467a21b91767edbf039160b25c72ff72cde" and "2d0be935bf771457b57d9610a428c9fe68b742c9" have entirely different histories.
64272467a2
...
2d0be935bf
|
@ -1,24 +0,0 @@
|
||||||
/**
|
|
||||||
* 统一处理消息 发送 避免找不到
|
|
||||||
*/
|
|
||||||
|
|
||||||
import ChatWs from '@/plugins/socket' // 聊天socket
|
|
||||||
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
|
||||||
import * as API_classcourse from '@/api/teaching/classcourse' // 后端api
|
|
||||||
|
|
||||||
export default () => {
|
|
||||||
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
|
|
||||||
const timgroupid = classcourse?.timgroupid // 群组id
|
|
||||||
if (!ChatWs.ws) ChatWs.init()
|
|
||||||
// 下课消息
|
|
||||||
const exitCourse = async() => {
|
|
||||||
if(!timgroupid) throw new Error('未获取到群组ID')
|
|
||||||
await API_classcourse.updateClasscourse({ id: classcourse.id, status: 'closed' })
|
|
||||||
return ChatWs.closedCourse(timgroupid)
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
exitCourse,
|
|
||||||
classcourse,
|
|
||||||
groupid: timgroupid,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,13 +7,13 @@ import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||||
import * as useStore from '../store' // pptist-状态管理
|
import * as useStore from '../store' // pptist-状态管理
|
||||||
import ChatWs from '@/plugins/socket' // 聊天socket
|
import ChatWs from '@/plugins/socket' // 聊天socket
|
||||||
import msgUtils from '@/plugins/modal' // 消息工具
|
import msgUtils from '@/plugins/modal' // 消息工具
|
||||||
import emitter from '@/utils/mitt' //mitt 事件总线
|
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
|
||||||
import { nextTick } from 'vue'
|
|
||||||
|
|
||||||
const slidesStore = useStore.useSlidesStore() // 幻灯片-状态管理
|
const slidesStore = useStore.useSlidesStore() // 幻灯片-状态管理
|
||||||
const screenStore = useStore.useScreenStore() // 全屏-状态管理
|
const screenStore = useStore.useScreenStore() // 全屏-状态管理
|
||||||
const classcourseStore = useStore.useClasscourseStore() // 课堂信息-状态管理
|
const classcourseStore = useStore.useClasscourseStore() // 课堂信息-状态管理
|
||||||
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
|
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
|
||||||
|
const execPlay = useExecPlay() // 播放控制
|
||||||
|
|
||||||
export class Classcourse {
|
export class Classcourse {
|
||||||
msgObj:ElMessageBox = null // 提示消息对象
|
msgObj:ElMessageBox = null // 提示消息对象
|
||||||
|
@ -23,12 +23,10 @@ export class Classcourse {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.load()
|
this.load()
|
||||||
}
|
}
|
||||||
// 延时
|
|
||||||
sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
|
||||||
/**
|
/**
|
||||||
* @description 加载
|
* @description 加载
|
||||||
*/
|
*/
|
||||||
async load() {
|
load() {
|
||||||
console.log('classcourse-load', classcourse)
|
console.log('classcourse-load', classcourse)
|
||||||
// 打开全屏
|
// 打开全屏
|
||||||
const isCourse = !!classcourse
|
const isCourse = !!classcourse
|
||||||
|
@ -41,12 +39,15 @@ export class Classcourse {
|
||||||
this.classcourse = classcourse // 课堂信息
|
this.classcourse = classcourse // 课堂信息
|
||||||
this.id = classcourse.id // 课堂id
|
this.id = classcourse.id // 课堂id
|
||||||
// 如果课堂信息有paging,则更新当前页码
|
// 如果课堂信息有paging,则更新当前页码
|
||||||
const { paging, cartoonTimes } = classcourse
|
const isPaging = !!classcourse.paging
|
||||||
const isPaging = !!paging || paging === 0
|
if (isPaging) slidesStore.updateSlideIndex(classcourse.paging)
|
||||||
// 如果课堂信息有paging,则更新动画播放状态
|
// 如果课堂信息有paging,则更新动画播放状态
|
||||||
const isAnim = !!cartoonTimes || cartoonTimes === 0
|
const isAnim = !!classcourse.cartoonTimes
|
||||||
if (isPaging) slidesStore.updateSlideIndex(paging)
|
if (isAnim) { // 动画播放
|
||||||
if (isAnim) slidesStore.updateAnimationIndex(cartoonTimes+1)
|
for (let i = 0; i <= classcourse.cartoonTimes; i++) {
|
||||||
|
execPlay.runAnimation(true) // 异步执行动画
|
||||||
|
}
|
||||||
|
}
|
||||||
// 课堂信息-状态管理
|
// 课堂信息-状态管理
|
||||||
classcourseStore.setClasscourse(classcourse)
|
classcourseStore.setClasscourse(classcourse)
|
||||||
// 待上课提示
|
// 待上课提示
|
||||||
|
|
|
@ -258,7 +258,6 @@ export class PPTApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Homework{
|
export class Homework{
|
||||||
static win: null // 作业弹窗
|
|
||||||
// 作业弹窗
|
// 作业弹窗
|
||||||
static async showHomework(id: any) {
|
static async showHomework(id: any) {
|
||||||
let result = await getClassWorkList(id)
|
let result = await getClassWorkList(id)
|
||||||
|
@ -266,14 +265,7 @@ export class Homework{
|
||||||
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
||||||
toolStore.isTaskWin=true; // 设置打开批改窗口
|
toolStore.isTaskWin=true; // 设置打开批改窗口
|
||||||
// emit('closeActive')
|
// emit('closeActive')
|
||||||
// 重复打开,先关闭弹窗
|
createWindow('open-taskwin',{url:'/teachClassTask'});
|
||||||
// if (this.win) this.win?.close?.()
|
|
||||||
this.win = await createWindow('open-taskwin',{url:'/teachClassTask'})
|
|
||||||
return this.win;
|
|
||||||
}
|
|
||||||
static closeHomework() {
|
|
||||||
if (this.win) this.win?.close?.()
|
|
||||||
this.win = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default PPTApi
|
export default PPTApi
|
|
@ -1,33 +0,0 @@
|
||||||
/**
|
|
||||||
* 点赞组件-相关
|
|
||||||
*/
|
|
||||||
export default class Upvote {
|
|
||||||
instance: any = null // 自身实例
|
|
||||||
upvoteRef: any = null // 点赞组件
|
|
||||||
constructor(elRef?: any) {
|
|
||||||
if(!!elRef) this.upvoteRef = elRef // 点赞组件
|
|
||||||
if (!Upvote.Instance) {
|
|
||||||
Upvote.Instance = this
|
|
||||||
}
|
|
||||||
return Upvote.Instance
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
init(elRef) {
|
|
||||||
if(!!elRef) this.upvoteRef = elRef // 点赞组件
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
// 打开点赞或者疑问 1点赞 2疑问
|
|
||||||
trigger(type) {
|
|
||||||
this.upvoteRef?.value?.trigger?.(type)
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
// 静态方法-初始化
|
|
||||||
static init(elRef) {
|
|
||||||
return new Upvote(elRef)
|
|
||||||
}
|
|
||||||
// 静态方法-打开点赞或者疑问 1点赞 2疑问
|
|
||||||
static trigger(type) {
|
|
||||||
return new Upvote().trigger(type)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,9 +11,8 @@ import ChatWs from '@/plugins/socket' // 聊天socket
|
||||||
import Classcourse from './classcourse' // 课程相关
|
import Classcourse from './classcourse' // 课程相关
|
||||||
import msgUtils from '@/plugins/modal' // 消息工具
|
import msgUtils from '@/plugins/modal' // 消息工具
|
||||||
import { Homework } from './index' // api-作业相关
|
import { Homework } from './index' // api-作业相关
|
||||||
// import emitter from '@/utils/mitt' //mitt 事件总线
|
import emitter from '@/utils/mitt' //mitt 事件总线
|
||||||
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
|
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
|
||||||
import hooksUpvote from './upvote' // 点赞-工具
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 监听器
|
* @description 监听器
|
||||||
|
@ -23,7 +22,7 @@ export default () => {
|
||||||
const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理
|
const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理
|
||||||
const resource = sessionStore.get('curr.resource') // apt 资源
|
const resource = sessionStore.get('curr.resource') // apt 资源
|
||||||
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
|
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
|
||||||
const { execNext, turnPrevSlide } = useExecPlay()
|
const execPlay = useExecPlay() // 播放控制
|
||||||
// 监听幻灯片内容变化
|
// 监听幻灯片内容变化
|
||||||
watch(() => slidesStore.slides, (newVal, oldVal) => {
|
watch(() => slidesStore.slides, (newVal, oldVal) => {
|
||||||
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
|
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
|
||||||
|
@ -37,8 +36,7 @@ export default () => {
|
||||||
|
|
||||||
// 监听幻灯片下标变化
|
// 监听幻灯片下标变化
|
||||||
watch(() => slidesStore.slideIndex, (newVal, oldVal) => {
|
watch(() => slidesStore.slideIndex, (newVal, oldVal) => {
|
||||||
if (!!Classcourse.id) return // 上课状态,不更新右侧作业列表
|
PPTApi.updateWorkList()
|
||||||
PPTApi.updateWorkList() // 更新作业列表
|
|
||||||
})
|
})
|
||||||
// 监听幻灯片下画布尺寸比例变化
|
// 监听幻灯片下画布尺寸比例变化
|
||||||
watch(() => slidesStore.viewportRatio, (newVal, oldVal) => {
|
watch(() => slidesStore.viewportRatio, (newVal, oldVal) => {
|
||||||
|
@ -99,8 +97,8 @@ export default () => {
|
||||||
case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页
|
case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页
|
||||||
const slideIndex = content?.current || 0
|
const slideIndex = content?.current || 0
|
||||||
const type = content?.animation
|
const type = content?.animation
|
||||||
if (type === 'Nextsteps') execNext(true) // 下一步-异步动画
|
if (type === 'Nextsteps') emitter.emit('useExecPlay', 'execNext') // 下一步
|
||||||
else if (type === 'Previoustep') turnPrevSlide() // 上一步清空-动画
|
else if (type === 'Previoustep') emitter.emit('useExecPlay', 'turnPrevSlide') // 上一步清空-动画
|
||||||
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
|
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置
|
case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置
|
||||||
|
@ -111,10 +109,10 @@ export default () => {
|
||||||
close()
|
close()
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_dz: // 点赞
|
case MsgEnum.HEADS.MSG_dz: // 点赞
|
||||||
hooksUpvote.trigger(1)
|
emitter.emit('upvoteTrigger', 1)
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_yh: // 疑惑
|
case MsgEnum.HEADS.MSG_yh: // 疑惑
|
||||||
hooksUpvote.trigger(2)
|
emitter.emit('upvoteTrigger', 2)
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_0010: // 备用
|
case MsgEnum.HEADS.MSG_0010: // 备用
|
||||||
break
|
break
|
||||||
|
|
|
@ -3,21 +3,16 @@ import type { Classcourse } from '../api/types'
|
||||||
|
|
||||||
export interface ClasscourseState {
|
export interface ClasscourseState {
|
||||||
classcourse: Classcourse | any, // 课堂信息
|
classcourse: Classcourse | any, // 课堂信息
|
||||||
isEmit: boolean, // 是否加载监听事件(动画播放)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useClasscourseStore = defineStore('classcourse', {
|
export const useClasscourseStore = defineStore('classcourse', {
|
||||||
state: (): ClasscourseState => ({
|
state: (): ClasscourseState => ({
|
||||||
classcourse: null, // 课堂信息
|
classcourse: null, // 课堂信息
|
||||||
isEmit: false, // 是否加载监听事件(动画播放)
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
setClasscourse(classcourse: Classcourse) {
|
setClasscourse(classcourse: Classcourse) {
|
||||||
this.classcourse = classcourse
|
this.classcourse = classcourse
|
||||||
},
|
},
|
||||||
setIsEmit(isEmit: boolean) {
|
|
||||||
this.isEmit = isEmit
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
|
@ -33,8 +33,7 @@ export interface SlidesState {
|
||||||
slides: Slide[]
|
slides: Slide[]
|
||||||
slideIndex: number
|
slideIndex: number
|
||||||
viewportSize: number
|
viewportSize: number
|
||||||
viewportRatio: number,
|
viewportRatio: number
|
||||||
animationIndex: number, // 不是从0开始
|
|
||||||
workList:Object[],
|
workList:Object[],
|
||||||
workItem:Object[],
|
workItem:Object[],
|
||||||
}
|
}
|
||||||
|
@ -47,7 +46,6 @@ export const useSlidesStore = defineStore('slides', {
|
||||||
slideIndex: 0, // 当前页面索引
|
slideIndex: 0, // 当前页面索引
|
||||||
viewportSize: 1000, // 可视区域宽度基数
|
viewportSize: 1000, // 可视区域宽度基数
|
||||||
viewportRatio: 0.5625, // 可视区域比例,默认16:9
|
viewportRatio: 0.5625, // 可视区域比例,默认16:9
|
||||||
animationIndex: 0, // 不是从0开始
|
|
||||||
workList:[],// 活动的列表
|
workList:[],// 活动的列表
|
||||||
workItem:[],// 获取到的所有pptlist
|
workItem:[],// 获取到的所有pptlist
|
||||||
}),
|
}),
|
||||||
|
@ -208,9 +206,6 @@ export const useSlidesStore = defineStore('slides', {
|
||||||
updateSlideIndex(index: number) {
|
updateSlideIndex(index: number) {
|
||||||
this.slideIndex = index
|
this.slideIndex = index
|
||||||
},
|
},
|
||||||
updateAnimationIndex(index: number) {
|
|
||||||
this.animationIndex = index
|
|
||||||
},
|
|
||||||
|
|
||||||
addElement(element: PPTElement | PPTElement[]) {
|
addElement(element: PPTElement | PPTElement[]) {
|
||||||
const elements = Array.isArray(element) ? element : [element]
|
const elements = Array.isArray(element) ? element : [element]
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<Popover trigger="click" placement="bottom-start" v-model:value="mainMenuVisible">
|
<Popover trigger="click" placement="bottom-start" v-model:value="mainMenuVisible">
|
||||||
<template #content>
|
<template #content>
|
||||||
<!-- <FileInput accept=".pptist" @change="files => {
|
<FileInput accept=".pptist" @change="files => {
|
||||||
importSpecificFile(files)
|
importSpecificFile(files)
|
||||||
mainMenuVisible = false
|
mainMenuVisible = false
|
||||||
}">
|
}">
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
mainMenuVisible = false
|
mainMenuVisible = false
|
||||||
}">
|
}">
|
||||||
<PopoverMenuItem>导入 pptx 文件</PopoverMenuItem>
|
<PopoverMenuItem>导入 pptx 文件</PopoverMenuItem>
|
||||||
</FileInput> -->
|
</FileInput>
|
||||||
<PopoverMenuItem @click="setDialogForExport('pptx')">导出文件</PopoverMenuItem>
|
<PopoverMenuItem @click="setDialogForExport('pptx')">导出文件</PopoverMenuItem>
|
||||||
<PopoverMenuItem @click="resetSlides(); mainMenuVisible = false">重置幻灯片</PopoverMenuItem>
|
<PopoverMenuItem @click="resetSlides(); mainMenuVisible = false">重置幻灯片</PopoverMenuItem>
|
||||||
<!-- <PopoverMenuItem @click="goLink('https://github.com/pipipi-pikachu/PPTist/issues')">意见反馈</PopoverMenuItem> -->
|
<!-- <PopoverMenuItem @click="goLink('https://github.com/pipipi-pikachu/PPTist/issues')">意见反馈</PopoverMenuItem> -->
|
||||||
|
|
|
@ -30,10 +30,14 @@
|
||||||
@close="timerlVisible = false"
|
@close="timerlVisible = false"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="tools-left" v-if="!classcourse">
|
<div class="tools-left">
|
||||||
<IconLeftTwo class="tool-btn" theme="two-tone" :fill="['#111', '#fff']" @click="execPrev()" />
|
<IconLeftTwo class="tool-btn" theme="two-tone" :fill="['#111', '#fff']" @click="execPrev()" />
|
||||||
<IconRightTwo class="tool-btn" theme="two-tone" :fill="['#111', '#fff']" @click="execNext()" />
|
<IconRightTwo class="tool-btn" theme="two-tone" :fill="['#111', '#fff']" @click="execNext()" />
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 点赞组件 -->
|
||||||
|
<div style="z-index: 999;position: absolute;top:10px">
|
||||||
|
<upvote-vue ref="upvoteRef" type="2"></upvote-vue>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="tools-right" :class="{ 'visible': rightToolsVisible }"
|
class="tools-right" :class="{ 'visible': rightToolsVisible }"
|
||||||
@mouseleave="rightToolsVisible = false"
|
@mouseleave="rightToolsVisible = false"
|
||||||
|
@ -48,16 +52,15 @@
|
||||||
<IconOffScreenOne class="tool-btn" v-tooltip="'退出全屏'" v-if="fullscreenState" @click="manualExitFullscreen()" />
|
<IconOffScreenOne class="tool-btn" v-tooltip="'退出全屏'" v-if="fullscreenState" @click="manualExitFullscreen()" />
|
||||||
<IconFullScreenOne class="tool-btn" v-tooltip="'进入全屏'" v-else @click="enterFullscreen()" />
|
<IconFullScreenOne class="tool-btn" v-tooltip="'进入全屏'" v-else @click="enterFullscreen()" />
|
||||||
<IconPower class="tool-btn" v-tooltip="'结束放映'" @click="exitScreening()" />
|
<IconPower class="tool-btn" v-tooltip="'结束放映'" @click="exitScreening()" />
|
||||||
<IconPower class="tool-btn close" v-if="chat.groupid" v-tooltip="'结束课堂'" @click="exitCourse()" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref , watchEffect, onMounted, onUnmounted} from 'vue'
|
import { ref , watchEffect} from 'vue'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { useSlidesStore ,useScreenStore, useClasscourseStore} from '../../store'
|
import { useSlidesStore ,useScreenStore} from '../../store'
|
||||||
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
||||||
import { enterFullscreen } from '../../utils/fullscreen'
|
import { enterFullscreen } from '../../utils/fullscreen'
|
||||||
import useScreening from '../../hooks/useScreening'
|
import useScreening from '../../hooks/useScreening'
|
||||||
|
@ -69,15 +72,14 @@ import ScreenSlideList from './ScreenSlideList.vue'
|
||||||
import SlideThumbnails from './SlideThumbnails.vue'
|
import SlideThumbnails from './SlideThumbnails.vue'
|
||||||
import WritingBoardTool from './WritingBoardTool.vue'
|
import WritingBoardTool from './WritingBoardTool.vue'
|
||||||
import CountdownTimer from './CountdownTimer.vue'
|
import CountdownTimer from './CountdownTimer.vue'
|
||||||
|
import upvoteVue from '@/views/tool/components/upvote.vue' // 点赞-子组件
|
||||||
import emitter from '@/utils/mitt';
|
import emitter from '@/utils/mitt';
|
||||||
import Chat from '../../api/chat' // 聊天
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { slides, slideIndex } = storeToRefs(useSlidesStore())
|
const { slides, slideIndex } = storeToRefs(useSlidesStore())
|
||||||
const { classcourse, isEmit } = storeToRefs(useClasscourseStore()) // 课堂信息
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
autoPlayTimer,
|
autoPlayTimer,
|
||||||
|
@ -101,13 +103,13 @@ const {
|
||||||
const { slideWidth, slideHeight } = useSlideSize()
|
const { slideWidth, slideHeight } = useSlideSize()
|
||||||
const { exitScreening } = useScreening()
|
const { exitScreening } = useScreening()
|
||||||
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
||||||
const chat:any = Chat() // 聊天室
|
|
||||||
|
|
||||||
const rightToolsVisible = ref(false)
|
const rightToolsVisible = ref(false)
|
||||||
const writingBoardToolVisible = ref(false)
|
const writingBoardToolVisible = ref(false)
|
||||||
const timerlVisible = ref(false)
|
const timerlVisible = ref(false)
|
||||||
const slideThumbnailModelVisible = ref(false)
|
const slideThumbnailModelVisible = ref(false)
|
||||||
const laserPen = ref(false)
|
const laserPen = ref(false)
|
||||||
|
const upvoteRef = ref(null)
|
||||||
const screenStore =useScreenStore()
|
const screenStore =useScreenStore()
|
||||||
const contextmenus = (): ContextmenuItem[] => {
|
const contextmenus = (): ContextmenuItem[] => {
|
||||||
return [
|
return [
|
||||||
|
@ -190,13 +192,42 @@ const contextmenus = (): ContextmenuItem[] => {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
// 打开点赞或者疑问 1点赞 2疑问
|
||||||
// 下课
|
emitter.on('upvoteTrigger', (type) => {
|
||||||
const exitCourse = async () => {
|
upvoteRef.value?.trigger(type)
|
||||||
// console.log('下课', chat)
|
});
|
||||||
await chat.exitCourse() // 下课消息
|
// zdg: 使用方法才生效
|
||||||
exitScreening() // 结束放映
|
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>
|
</script>
|
||||||
|
|
||||||
|
@ -278,9 +309,6 @@ const exitCourse = async () => {
|
||||||
& + .tool-btn {
|
& + .tool-btn {
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
}
|
}
|
||||||
&.close{
|
|
||||||
color: #d14424;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.page-number {
|
.page-number {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
</div>
|
</div>
|
||||||
<Divider class="divider" />
|
<Divider class="divider" />
|
||||||
<div class="tool-btn" @click="exitScreening()"><IconPower class="tool-icon" /><span>结束放映</span></div>
|
<div class="tool-btn" @click="exitScreening()"><IconPower class="tool-icon" /><span>结束放映</span></div>
|
||||||
<div class="tool-btn close" @click="exitCourse()" v-if="chat.groupid"><IconPower class="tool-icon" /><span>结束课堂</span></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -56,7 +55,7 @@
|
||||||
:class="{ 'active': index === slideIndex }"
|
:class="{ 'active': index === slideIndex }"
|
||||||
v-for="(slide, index) in slides"
|
v-for="(slide, index) in slides"
|
||||||
:key="slide.id"
|
:key="slide.id"
|
||||||
@click="turnSlideTo(index, $event)"
|
@click="turnSlideToIndex(index)"
|
||||||
>
|
>
|
||||||
<ThumbnailSlide :slide="slide" :size="120 / viewportRatio" :visible="index < slidesLoadLimit" />
|
<ThumbnailSlide :slide="slide" :size="120 / viewportRatio" :visible="index < slidesLoadLimit" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -78,9 +77,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
import { computed, nextTick, ref, watch } from 'vue'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { useSlidesStore, useClasscourseStore } from '../../store'
|
import { useSlidesStore } from '../../store'
|
||||||
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
||||||
import { enterFullscreen } from '../../utils/fullscreen'
|
import { enterFullscreen } from '../../utils/fullscreen'
|
||||||
import { parseText2Paragraphs } from '../../utils/textParser'
|
import { parseText2Paragraphs } from '../../utils/textParser'
|
||||||
|
@ -95,15 +94,12 @@ import ScreenSlideList from './ScreenSlideList.vue'
|
||||||
import WritingBoardTool from './WritingBoardTool.vue'
|
import WritingBoardTool from './WritingBoardTool.vue'
|
||||||
import CountdownTimer from './CountdownTimer.vue'
|
import CountdownTimer from './CountdownTimer.vue'
|
||||||
import Divider from '../../components/Divider.vue'
|
import Divider from '../../components/Divider.vue'
|
||||||
import emitter from '@/utils/mitt';
|
|
||||||
import Chat from '../../api/chat' // 聊天
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { slides, slideIndex, viewportRatio, currentSlide } = storeToRefs(useSlidesStore())
|
const { slides, slideIndex, viewportRatio, currentSlide } = storeToRefs(useSlidesStore())
|
||||||
const { classcourse, isEmit } = storeToRefs(useClasscourseStore()) // 课堂信息
|
|
||||||
|
|
||||||
const slideListWrapRef = ref<HTMLElement>()
|
const slideListWrapRef = ref<HTMLElement>()
|
||||||
const thumbnailsRef = ref<HTMLElement>()
|
const thumbnailsRef = ref<HTMLElement>()
|
||||||
|
@ -121,31 +117,17 @@ const {
|
||||||
turnSlideToId,
|
turnSlideToId,
|
||||||
animationIndex,
|
animationIndex,
|
||||||
} = useExecPlay()
|
} = useExecPlay()
|
||||||
|
|
||||||
const { slideWidth, slideHeight } = useSlideSize(slideListWrapRef)
|
const { slideWidth, slideHeight } = useSlideSize(slideListWrapRef)
|
||||||
const { exitScreening } = useScreening()
|
const { exitScreening } = useScreening()
|
||||||
const { slidesLoadLimit } = useLoadSlides()
|
const { slidesLoadLimit } = useLoadSlides()
|
||||||
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
||||||
const chat:any = Chat() // 聊天室
|
|
||||||
|
|
||||||
const remarkFontSize = ref(16)
|
const remarkFontSize = ref(16)
|
||||||
const currentSlideRemark = computed(() => {
|
const currentSlideRemark = computed(() => {
|
||||||
return parseText2Paragraphs(currentSlide.value.remark || '无备注')
|
return parseText2Paragraphs(currentSlide.value.remark || '无备注')
|
||||||
})
|
})
|
||||||
|
|
||||||
// 切换到指定的幻灯片
|
|
||||||
const turnSlideTo = (index: number, e: PointerEvent) => {
|
|
||||||
// 课堂信息存在时,不允许翻页
|
|
||||||
console.log('课堂信息', classcourse, index)
|
|
||||||
if (!!classcourse.value) return
|
|
||||||
turnSlideToIndex(index)
|
|
||||||
}
|
|
||||||
// 下课
|
|
||||||
const exitCourse = async () => {
|
|
||||||
// console.log('下课', chat)
|
|
||||||
await chat.exitCourse() // 下课消息
|
|
||||||
exitScreening() // 结束放映
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleMousewheelThumbnails = (e: WheelEvent) => {
|
const handleMousewheelThumbnails = (e: WheelEvent) => {
|
||||||
if (!thumbnailsRef.value) return
|
if (!thumbnailsRef.value) return
|
||||||
thumbnailsRef.value.scrollBy(e.deltaY, 0)
|
thumbnailsRef.value.scrollBy(e.deltaY, 0)
|
||||||
|
@ -210,7 +192,6 @@ const contextmenus = (): ContextmenuItem[] => {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -227,7 +208,7 @@ const contextmenus = (): ContextmenuItem[] => {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-right: solid 1px #eee;
|
border-right: solid 1px #eee;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
padding: 20px 0;
|
margin: 20px 0;
|
||||||
|
|
||||||
.tool-btn {
|
.tool-btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -243,9 +224,6 @@ const contextmenus = (): ContextmenuItem[] => {
|
||||||
&:hover, &.active {
|
&:hover, &.active {
|
||||||
color: $themeColor;
|
color: $themeColor;
|
||||||
}
|
}
|
||||||
&.close{
|
|
||||||
color: #d14424;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider {
|
.divider {
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
import { onMounted, onUnmounted, ref } from 'vue'
|
import { onMounted, onUnmounted, ref } from 'vue'
|
||||||
import { throttle } from 'lodash'
|
import { throttle } from 'lodash'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { useSlidesStore, useClasscourseStore } from '../../../store'
|
import { useSlidesStore } from '../../../store'
|
||||||
import { KEYS } from '../../../configs/hotkey'
|
import { KEYS } from '../../../configs/hotkey'
|
||||||
import { ANIMATION_CLASS_PREFIX } from '../../../configs/animation'
|
import { ANIMATION_CLASS_PREFIX } from '../../../configs/animation'
|
||||||
import message from '../../../utils/message'
|
import message from '../../../utils/message'
|
||||||
import emitter from '@/utils/mitt';
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const slidesStore = useSlidesStore()
|
const slidesStore = useSlidesStore()
|
||||||
const classcourseStore = useClasscourseStore() // 课堂信息-状态管理
|
const { slides, slideIndex, formatedAnimations } = storeToRefs(slidesStore)
|
||||||
const { slides, slideIndex, formatedAnimations, animationIndex } = storeToRefs(slidesStore)
|
|
||||||
|
|
||||||
// 当前页的元素动画执行到的位置
|
// 当前页的元素动画执行到的位置
|
||||||
// const animationIndex = ref(0)
|
const animationIndex = ref(0)
|
||||||
|
|
||||||
// 动画执行状态
|
// 动画执行状态
|
||||||
const inAnimation = ref(false)
|
const inAnimation = ref(false)
|
||||||
|
@ -123,9 +121,9 @@ export default () => {
|
||||||
// 遇到元素动画时,优先执行动画播放,无动画则执行翻页
|
// 遇到元素动画时,优先执行动画播放,无动画则执行翻页
|
||||||
// 向上播放遇到动画时,仅撤销到动画执行前的状态,不需要反向播放动画
|
// 向上播放遇到动画时,仅撤销到动画执行前的状态,不需要反向播放动画
|
||||||
// 撤回到上一页时,若该页从未播放过(意味着不存在动画状态),需要将动画索引置为最小值(初始状态),否则置为最大值(最终状态)
|
// 撤回到上一页时,若该页从未播放过(意味着不存在动画状态),需要将动画索引置为最小值(初始状态),否则置为最大值(最终状态)
|
||||||
const execPrev = (isAsync: boolean) => {
|
const execPrev = () => {
|
||||||
if (formatedAnimations.value.length && animationIndex.value > 0) {
|
if (formatedAnimations.value.length && animationIndex.value > 0) {
|
||||||
revokeAnimation(isAsync)
|
revokeAnimation()
|
||||||
}
|
}
|
||||||
else if (slideIndex.value > 0) {
|
else if (slideIndex.value > 0) {
|
||||||
slidesStore.updateSlideIndex(slideIndex.value - 1)
|
slidesStore.updateSlideIndex(slideIndex.value - 1)
|
||||||
|
@ -141,10 +139,9 @@ export default () => {
|
||||||
}
|
}
|
||||||
inAnimation.value = false
|
inAnimation.value = false
|
||||||
}
|
}
|
||||||
const execNext = (isAsync: boolean) => {
|
const execNext = () => {
|
||||||
console.log('execNext', isAsync)
|
|
||||||
if (formatedAnimations.value.length && animationIndex.value < formatedAnimations.value.length) {
|
if (formatedAnimations.value.length && animationIndex.value < formatedAnimations.value.length) {
|
||||||
runAnimation(isAsync)
|
runAnimation()
|
||||||
}
|
}
|
||||||
else if (slideIndex.value < slides.value.length - 1) {
|
else if (slideIndex.value < slides.value.length - 1) {
|
||||||
slidesStore.updateSlideIndex(slideIndex.value + 1)
|
slidesStore.updateSlideIndex(slideIndex.value + 1)
|
||||||
|
@ -176,13 +173,7 @@ export default () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 鼠标滚动翻页
|
// 鼠标滚动翻页
|
||||||
const mousewheelListener = (e: WheelEvent) => {
|
const mousewheelListener = throttle(function(e: WheelEvent) {
|
||||||
// console.log('mousewheel', e)
|
|
||||||
// 课堂信息存在时,不允许翻页
|
|
||||||
if (!!classcourseStore.classcourse) e.preventDefault()
|
|
||||||
mousewheelListenerThrottle(e)
|
|
||||||
}
|
|
||||||
const mousewheelListenerThrottle = throttle(function(e: WheelEvent) {
|
|
||||||
if (e.deltaY < 0) turning(e, 'prev')
|
if (e.deltaY < 0) turning(e, 'prev')
|
||||||
else if (e.deltaY > 0) turning(e, 'next')
|
else if (e.deltaY > 0) turning(e, 'next')
|
||||||
}, 500, { leading: true, trailing: false })
|
}, 500, { leading: true, trailing: false })
|
||||||
|
@ -212,8 +203,6 @@ export default () => {
|
||||||
// 向上翻页/向下翻页
|
// 向上翻页/向下翻页
|
||||||
const turning = (e, type) => {
|
const turning = (e, type) => {
|
||||||
e.preventDefault() // 阻止默认事件
|
e.preventDefault() // 阻止默认事件
|
||||||
// 课堂信息存在时,不允许翻页
|
|
||||||
if (!!classcourseStore.classcourse) return
|
|
||||||
if (type === 'prev') execPrev()
|
if (type === 'prev') execPrev()
|
||||||
else if (type === 'next') execNext()
|
else if (type === 'next') execNext()
|
||||||
}
|
}
|
||||||
|
@ -231,8 +220,8 @@ export default () => {
|
||||||
) turning(e, 'next')
|
) turning(e, 'next')
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {document.addEventListener('keydown', keydownListener)})
|
onMounted(() => document.addEventListener('keydown', keydownListener))
|
||||||
onUnmounted(() => {document.removeEventListener('keydown', keydownListener)})
|
onUnmounted(() => document.removeEventListener('keydown', keydownListener))
|
||||||
|
|
||||||
// 切换到上一张/上一张幻灯片(无视元素的入场动画)
|
// 切换到上一张/上一张幻灯片(无视元素的入场动画)
|
||||||
const turnPrevSlide = () => {
|
const turnPrevSlide = () => {
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
<div class="pptist-screen">
|
<div class="pptist-screen">
|
||||||
<BaseView :changeViewMode="changeViewMode" v-if="viewMode === 'base'" />
|
<BaseView :changeViewMode="changeViewMode" v-if="viewMode === 'base'" />
|
||||||
<PresenterView :changeViewMode="changeViewMode" v-else-if="viewMode === 'presenter'" />
|
<PresenterView :changeViewMode="changeViewMode" v-else-if="viewMode === 'presenter'" />
|
||||||
<!-- 点赞组件 -->
|
|
||||||
<upvote-vue ref="upvoteRef" type="2"></upvote-vue>
|
|
||||||
<!-- <div style="z-index: 999;position: absolute;top:10px">
|
|
||||||
</div> -->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -13,11 +9,9 @@
|
||||||
import { onMounted, onUnmounted, ref } from 'vue'
|
import { onMounted, onUnmounted, ref } from 'vue'
|
||||||
import { KEYS } from '../../configs/hotkey'
|
import { KEYS } from '../../configs/hotkey'
|
||||||
import useScreening from '../../hooks/useScreening'
|
import useScreening from '../../hooks/useScreening'
|
||||||
import hooksUpvote from '../../api/upvote' // 点赞-工具
|
|
||||||
|
|
||||||
import BaseView from './BaseView.vue'
|
import BaseView from './BaseView.vue'
|
||||||
import PresenterView from './PresenterView.vue'
|
import PresenterView from './PresenterView.vue'
|
||||||
import upvoteVue from '@/views/tool/components/upvote.vue' // 点赞-子组件
|
|
||||||
|
|
||||||
const viewMode = ref<'base' | 'presenter'>('base')
|
const viewMode = ref<'base' | 'presenter'>('base')
|
||||||
|
|
||||||
|
@ -26,8 +20,6 @@ const changeViewMode = (mode: 'base' | 'presenter') => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { exitScreening } = useScreening()
|
const { exitScreening } = useScreening()
|
||||||
const upvoteRef = ref(null)
|
|
||||||
hooksUpvote.init(upvoteRef) // 初始化点赞
|
|
||||||
|
|
||||||
// 快捷键退出放映
|
// 快捷键退出放映
|
||||||
const keydownListener = (e: KeyboardEvent) => {
|
const keydownListener = (e: KeyboardEvent) => {
|
||||||
|
|
|
@ -10,10 +10,11 @@ export const createChart = ({ headers, data }) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 大模型对话
|
// 大模型对话
|
||||||
export const sendChart = (data) => {
|
export const sendChart = ({ headers, data }) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/qf/sendTalk',
|
url: '/qf/sendTalk',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
headers,
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
|
@ -30,7 +30,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<div class="file-list">
|
<div class="file-list">
|
||||||
<el-dropdown @command="changeFile" v-if="type == 3">
|
<el-dropdown @command="changeFile">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
{{ curFile.fileName }}
|
{{ curFile.fileName }}
|
||||||
<i class="iconfont icon-xiangxia"></i>
|
<i class="iconfont icon-xiangxia"></i>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted, onUnmounted } from 'vue'
|
import { ref, reactive, onMounted, onUnmounted, watch } from 'vue'
|
||||||
import { completion, docList } from '@/api/mode/index'
|
import { completion, docList } from '@/api/mode/index'
|
||||||
import { sessionStore } from '@/utils/store'
|
import { sessionStore } from '@/utils/store'
|
||||||
import { dataSetJson } from '@/utils/comm.js'
|
import { dataSetJson } from '@/utils/comm.js'
|
||||||
|
@ -71,7 +71,7 @@ const props = defineProps({
|
||||||
item: {
|
item: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return { name: '' }
|
return { name: '11' }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
|
@ -125,6 +125,19 @@ const saveAdjust = (item) =>{
|
||||||
emitter.emit('onSaveAdjust', item.msg)
|
emitter.emit('onSaveAdjust', item.msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const modeType = ref('课标')
|
||||||
|
watch(() => props.type, (newVal) => {
|
||||||
|
if (newVal == 1){
|
||||||
|
modeType.value = '课标'
|
||||||
|
}
|
||||||
|
if (newVal == 2){
|
||||||
|
modeType.value = '教材'
|
||||||
|
}
|
||||||
|
if (newVal == 2){
|
||||||
|
modeType.value = '考试'
|
||||||
|
}
|
||||||
|
|
||||||
|
}, { immediate: false })
|
||||||
|
|
||||||
const curFile = reactive({})
|
const curFile = reactive({})
|
||||||
const dataset_id = ref('')
|
const dataset_id = ref('')
|
||||||
|
@ -147,12 +160,11 @@ const changeFile = (val) =>{
|
||||||
params.document_ids = val.docId
|
params.document_ids = val.docId
|
||||||
}
|
}
|
||||||
|
|
||||||
const modeType = ref('')
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
let data = sessionStore.get('subject.curNode')
|
let data = sessionStore.get('subject.curNode')
|
||||||
Object.assign(curNode, data);
|
|
||||||
|
|
||||||
modeType.value = props.type == 1 ? '课标' : props.type == 2 ? '教材' : '考试'
|
Object.assign(curNode, data);
|
||||||
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
||||||
params.dataset_id = dataSetJson[jsonKey]
|
params.dataset_id = dataSetJson[jsonKey]
|
||||||
if(props.type == 3){
|
if(props.type == 3){
|
||||||
|
|
|
@ -14,10 +14,7 @@
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<div class="flex">
|
<div>
|
||||||
<el-select v-model="curMode" placeholder="Select" class="mr-4 w-30">
|
|
||||||
<el-option v-for="item in modeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
<el-button type="danger" link :disabled="!(templateList.length)" @click="removeItem(curTemplate, false)">
|
<el-button type="danger" link :disabled="!(templateList.length)" @click="removeItem(curTemplate, false)">
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -55,8 +52,7 @@
|
||||||
<i class="iconfont icon-ai"></i>
|
<i class="iconfont icon-ai"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-answer">
|
<div class="item-answer">
|
||||||
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow"
|
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow" @complete="handleCompleteText($event,index)" @updateScroll="scrollToBottom($event,index)" />
|
||||||
@complete="handleCompleteText($event, index)" @updateScroll="scrollToBottom($event, index)" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ai-btn" v-if="item.answer">
|
<div class="ai-btn" v-if="item.answer">
|
||||||
|
@ -90,7 +86,6 @@
|
||||||
import { ref, reactive, onMounted, onUnmounted, nextTick } from 'vue'
|
import { ref, reactive, onMounted, onUnmounted, nextTick } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { tempSave, completion, modelList, removeChildTemp, tempResult, editTempResult } from '@/api/mode/index'
|
import { tempSave, completion, modelList, removeChildTemp, tempResult, editTempResult } from '@/api/mode/index'
|
||||||
import { createChart, sendChart } from '@/api/ai/index'
|
|
||||||
import { sessionStore } from '@/utils/store'
|
import { sessionStore } from '@/utils/store'
|
||||||
import keywordDialog from './keyword-dialog.vue';
|
import keywordDialog from './keyword-dialog.vue';
|
||||||
import AdjustDialog from './adjust-dialog.vue'
|
import AdjustDialog from './adjust-dialog.vue'
|
||||||
|
@ -99,23 +94,10 @@ import TypingEffect from '@/components/typing-effect/index.vue'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import emitter from '@/utils/mitt';
|
import emitter from '@/utils/mitt';
|
||||||
import { dataSetJson } from '@/utils/comm.js'
|
import { dataSetJson } from '@/utils/comm.js'
|
||||||
import { cloneDeep } from 'lodash'
|
|
||||||
|
|
||||||
const props = defineProps(['type'])
|
const props = defineProps(['type'])
|
||||||
const { user } = useUserStore()
|
const { user } = useUserStore()
|
||||||
|
|
||||||
const curMode = ref(1)
|
|
||||||
const modeOptions = ref([
|
|
||||||
{
|
|
||||||
label: '教学大模型',
|
|
||||||
value: 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '知识库模型',
|
|
||||||
value: 2
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
/*****************提示词相关****************/
|
/*****************提示词相关****************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,7 +141,7 @@ const childTempList = ref([])
|
||||||
const getTemplateList = () => {
|
const getTemplateList = () => {
|
||||||
modelList({ createUser: user.userId, model: props.type, type: 1, pageNum: 1, pageSize: 10000, ex1: curNode.edustage, ex2: curNode.edusubject }).then(res => {
|
modelList({ createUser: user.userId, model: props.type, type: 1, pageNum: 1, pageSize: 10000, ex1: curNode.edustage, ex2: curNode.edusubject }).then(res => {
|
||||||
templateList.value = res.rows
|
templateList.value = res.rows
|
||||||
if (res.rows.length > 0) {
|
if(res.rows.length > 0){
|
||||||
Object.assign(curTemplate, res.rows[0]);
|
Object.assign(curTemplate, res.rows[0]);
|
||||||
getChildTemplate()
|
getChildTemplate()
|
||||||
}
|
}
|
||||||
|
@ -169,7 +151,7 @@ const getChildTemplate = () => {
|
||||||
tempLoading.value = true
|
tempLoading.value = true
|
||||||
modelList({ model: props.type, type: 2, parentId: curTemplate.id, ex1: curNode.edustage, ex2: curNode.edusubject }).then(res => {
|
modelList({ model: props.type, type: 2, parentId: curTemplate.id, ex1: curNode.edustage, ex2: curNode.edusubject }).then(res => {
|
||||||
childTempList.value = res.rows
|
childTempList.value = res.rows
|
||||||
if (childTempList.value.length) {
|
if(childTempList.value.length){
|
||||||
childTempList.value.forEach(item => item.answer = '')
|
childTempList.value.forEach(item => item.answer = '')
|
||||||
}
|
}
|
||||||
getTempResult()
|
getTempResult()
|
||||||
|
@ -191,28 +173,28 @@ const getTempResult = () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
if (rows.length > 0) {
|
if(rows.length > 0){
|
||||||
isStarted.value = new Array(rows.length).fill(true)
|
isStarted.value = new Array(rows.length).fill(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollToBottom = (height, index) => {
|
const scrollToBottom = (height,index) =>{
|
||||||
|
|
||||||
if (listRef.value) {
|
if (listRef.value) {
|
||||||
let sum = 0
|
let sum = 0
|
||||||
let listDom = listRef.value.children
|
let listDom = listRef.value.children
|
||||||
|
|
||||||
if (index == 0) {
|
if(index == 0){
|
||||||
// 220 去掉头部
|
// 220 去掉头部
|
||||||
let screenHeight = window.innerHeight - 220
|
let screenHeight = window.innerHeight - 220
|
||||||
if (height > screenHeight) {
|
if(height > screenHeight){
|
||||||
listRef.value.scrollTop = (height - screenHeight + 50)
|
listRef.value.scrollTop = (height - screenHeight + 50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else{
|
||||||
for (let i = 0; i < index; i++) {
|
for(let i = 0; i < index; i++){
|
||||||
sum += listDom[i].clientHeight
|
sum += listDom[i].clientHeight
|
||||||
}
|
}
|
||||||
listRef.value.scrollTop = sum + height
|
listRef.value.scrollTop = sum + height
|
||||||
|
@ -270,6 +252,7 @@ const removeItem = async (item, isChild) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Ai对话调整
|
// Ai对话调整
|
||||||
const curIndex = ref(-1)
|
const curIndex = ref(-1)
|
||||||
const isAdjust = ref(false)
|
const isAdjust = ref(false)
|
||||||
|
@ -294,7 +277,6 @@ const params = reactive(
|
||||||
dataset_id: ''
|
dataset_id: ''
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
const prompt = ref('')
|
|
||||||
|
|
||||||
// 重新研读
|
// 重新研读
|
||||||
const isAgain = ref(false)
|
const isAgain = ref(false)
|
||||||
|
@ -303,10 +285,10 @@ const againResult = async (index, item) => {
|
||||||
isStarted.value[index] = false
|
isStarted.value[index] = false
|
||||||
childTempList.value[index].answer = ''
|
childTempList.value[index].answer = ''
|
||||||
|
|
||||||
if (index == 0) {
|
if(index == 0){
|
||||||
listRef.value.scrollTop = 0
|
listRef.value.scrollTop = 0
|
||||||
|
|
||||||
} else {
|
}else{
|
||||||
scrollToBottom(50, index)
|
scrollToBottom(50, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,28 +296,8 @@ const againResult = async (index, item) => {
|
||||||
await nextTick()
|
await nextTick()
|
||||||
childTempList.value[index].loading = true
|
childTempList.value[index].loading = true
|
||||||
item.aiShow = true
|
item.aiShow = true
|
||||||
|
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
||||||
let str = cloneDeep(prompt.value)
|
const { data } = await completion(params)
|
||||||
str = str.replace('{模板标题}',item.name)
|
|
||||||
str = str.replace('{模板内容}',item.prompt)
|
|
||||||
params.prompt = str
|
|
||||||
params.template = item.prompt
|
|
||||||
|
|
||||||
let data = null;
|
|
||||||
// 教学大模型
|
|
||||||
if (mode.value == 1) {
|
|
||||||
const res = await sendChart({
|
|
||||||
content: params.prompt,
|
|
||||||
conversationId: conversation_id.value,
|
|
||||||
stream: false
|
|
||||||
})
|
|
||||||
data = res.data
|
|
||||||
} else {
|
|
||||||
// 知识库模型
|
|
||||||
const res = await completion(params)
|
|
||||||
data = res.data
|
|
||||||
}
|
|
||||||
|
|
||||||
childTempList.value[index].answer = getResult(data.answer);
|
childTempList.value[index].answer = getResult(data.answer);
|
||||||
isStarted.value[index] = true
|
isStarted.value[index] = true
|
||||||
|
|
||||||
|
@ -343,14 +305,13 @@ const againResult = async (index, item) => {
|
||||||
childTempList.value[index].loading = false
|
childTempList.value[index].loading = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 一键研读
|
// 一键研读
|
||||||
const getCompletion = async () => {
|
const getCompletion = async () => {
|
||||||
isStarted.value = new Array(childTempList.length).fill(false)
|
isStarted.value = new Array(childTempList.length).fill(false)
|
||||||
isStarted.value[0] = true
|
isStarted.value[0] = true
|
||||||
|
|
||||||
childTempList.value.forEach(item => {
|
childTempList.value.forEach(item =>{
|
||||||
if (item.answer) {
|
if(item.answer){
|
||||||
item.answer = ''
|
item.answer = ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -359,27 +320,8 @@ const getCompletion = async () => {
|
||||||
try {
|
try {
|
||||||
item.loading = true
|
item.loading = true
|
||||||
item.aiShow = true
|
item.aiShow = true
|
||||||
let str = cloneDeep(prompt.value)
|
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
||||||
str = str.replace('{模板标题}',item.name)
|
const { data } = await completion(params)
|
||||||
str = str.replace('{模板内容}',item.prompt)
|
|
||||||
params.prompt = str
|
|
||||||
params.template = item.prompt
|
|
||||||
// 教学大模型
|
|
||||||
let data = null
|
|
||||||
if (curMode.value == 1) {
|
|
||||||
const res = await sendChart({
|
|
||||||
content: params.prompt,
|
|
||||||
conversationId: conversation_id.value,
|
|
||||||
stream: false
|
|
||||||
})
|
|
||||||
data = res.data
|
|
||||||
}
|
|
||||||
// 知识库模型
|
|
||||||
else {
|
|
||||||
const res = await completion(params)
|
|
||||||
data = res.data
|
|
||||||
}
|
|
||||||
|
|
||||||
item.answer = getResult(data.answer)
|
item.answer = getResult(data.answer)
|
||||||
onSaveTemp(item)
|
onSaveTemp(item)
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -388,14 +330,14 @@ const getCompletion = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCompleteText = async (answer, index) => {
|
const handleCompleteText = async (answer, index) =>{
|
||||||
if (index < childTempList.value.length - 1) {
|
if (index < childTempList.value.length - 1) {
|
||||||
isStarted.value[index + 1] = true; // 开始显示下一个文本
|
isStarted.value[index + 1] = true; // 开始显示下一个文本
|
||||||
}
|
}
|
||||||
if (isAgain.value) {
|
if(isAgain.value){
|
||||||
try {
|
try{
|
||||||
await editTempResult({ id: childTempList.value[index].resultId, content: answer })
|
await editTempResult({ id: childTempList.value[index].resultId, content: answer })
|
||||||
} finally {
|
}finally{
|
||||||
isAgain.value = false
|
isAgain.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -444,30 +386,6 @@ emitter.on('onGetMain', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 创建对话
|
|
||||||
const conversation_id = ref('')
|
|
||||||
const getChartId = () => {
|
|
||||||
createChart({ app_id: '712ff0df-ed6b-470f-bf87-8cfbaf757be5' }).then(res => {
|
|
||||||
localStorage.setItem("conversation_id", res.data.conversation_id);
|
|
||||||
conversation_id.value = res.data.conversation_id;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询prompt 替换
|
|
||||||
const getPrompt = async () => {
|
|
||||||
const { rows } = await modelList({ model: 5 })
|
|
||||||
let str = rows.find(item => item.name.indexOf(modeType.value) != -1).prompt
|
|
||||||
str = str.replace('{学段}', curNode.edustage)
|
|
||||||
str = str.replace('{学科}', curNode.edusubject)
|
|
||||||
let bookV = curNode.roottitle.split('-')[1] + '版本'
|
|
||||||
str = str.replace('{教材版本}', bookV)
|
|
||||||
str = str.replace('{课程名称}', `《${curNode.itemtitle}》`)
|
|
||||||
if(modeType.value == '课标'){
|
|
||||||
str = str.replace('{课标名称}', `${curNode.edustage}${curNode.edusubject}课标`)
|
|
||||||
}
|
|
||||||
prompt.value = str
|
|
||||||
}
|
|
||||||
|
|
||||||
const curNode = reactive({})
|
const curNode = reactive({})
|
||||||
const modeType = ref('')
|
const modeType = ref('')
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -478,15 +396,6 @@ onMounted(() => {
|
||||||
getTemplateList()
|
getTemplateList()
|
||||||
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
||||||
params.dataset_id = dataSetJson[jsonKey]
|
params.dataset_id = dataSetJson[jsonKey]
|
||||||
// 获取百度千帆会话ID
|
|
||||||
conversation_id.value = localStorage.getItem('conversation_id')
|
|
||||||
if (!conversation_id.value) {
|
|
||||||
getChartId();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取prompt
|
|
||||||
getPrompt()
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 解绑
|
// 解绑
|
||||||
|
|
|
@ -167,6 +167,9 @@ export class ChatWs {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.sendMsg('closed', '下课', null, 'group', id)
|
this.sendMsg('closed', '下课', null, 'group', id)
|
||||||
resolve()
|
resolve()
|
||||||
|
// setTimeout(() => {
|
||||||
|
// this.close() // 关闭链接
|
||||||
|
// }, 1000);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 延时 ms 毫秒
|
// 延时 ms 毫秒
|
||||||
|
|
|
@ -83,7 +83,7 @@ export const constantRoutes = [
|
||||||
path: 'questionUpload',
|
path: 'questionUpload',
|
||||||
component: () => import('@/views/classTask/newClassTaskAssign/questionUpload/index.vue'),
|
component: () => import('@/views/classTask/newClassTaskAssign/questionUpload/index.vue'),
|
||||||
name: 'questionUpload',
|
name: 'questionUpload',
|
||||||
meta: { title: '习题上传', showBread: true }
|
meta: { title: '习题上传' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'aiKolors',
|
path: 'aiKolors',
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { JYApiListCT, JYApiListOriginYear, JYApiListSO} from "@/utils/examQuesti
|
||||||
|
|
||||||
const useClassTaskStore = defineStore('classTask',{
|
const useClassTaskStore = defineStore('classTask',{
|
||||||
state: () => ({
|
state: () => ({
|
||||||
isOpenQuestUploadView: false, // 是否打开习题上传的页面
|
|
||||||
classListIds: [],
|
classListIds: [],
|
||||||
entpCourseWorkTypeList: [
|
entpCourseWorkTypeList: [
|
||||||
{value: 0, label: "不限"},
|
{value: 0, label: "不限"},
|
||||||
|
|
|
@ -225,7 +225,7 @@ export const createWindow = async (type, data) => {
|
||||||
.filter(k => typeof data[k] === 'function')
|
.filter(k => typeof data[k] === 'function')
|
||||||
.forEach(k => events[k] = data[k])
|
.forEach(k => events[k] = data[k])
|
||||||
eventHandles(type, win, events) // 事件监听处理
|
eventHandles(type, win, events) // 事件监听处理
|
||||||
return win
|
break
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="class-reserv-item-tool" style="width: 50px;">
|
<div class="class-reserv-item-tool" style="width: 50px;">
|
||||||
<!-- <el-button v-if="item.status!='open'" size="small" type="danger" @click="deleteReserv">删除</el-button>-->
|
<!-- <el-button v-if="item.status!='open'" size="small" type="danger" @click="deleteReserv">删除</el-button>-->
|
||||||
<!-- <el-tag>APT</el-tag> -->
|
<el-tag>APT</el-tag>
|
||||||
<el-tag>AIPPT</el-tag>
|
|
||||||
</div>
|
</div>
|
||||||
<div style="min-width: 150px;"><span> 浏览:25955 点赞:26605</span></div>
|
<div style="min-width: 150px;"><span> 浏览:25955 点赞:26605</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -86,7 +85,6 @@ const chatSend = () => {
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.class-reserv-item {
|
.class-reserv-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
background-color: white;
|
background-color: white;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
@ -112,7 +110,7 @@ const chatSend = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.class-reserv-item-tool {
|
.class-reserv-item-tool {
|
||||||
margin: 0 7px;
|
margin-left: 15px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,14 +149,10 @@ import { useGetHomework } from '@/hooks/useGetHomework'
|
||||||
import { sessionStore } from '@/utils/store'
|
import { sessionStore } from '@/utils/store'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import useClassTaskStore from '@/store/modules/classTask'
|
|
||||||
|
|
||||||
const userStore = useUserStore().user
|
const userStore = useUserStore().user
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
const useClassTaskStores = useClassTaskStore();
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
currentCourse: Object,
|
currentCourse: Object,
|
||||||
})
|
})
|
||||||
|
@ -193,7 +189,6 @@ const boardLoading = ref(false);
|
||||||
const fileLoading = ref(false); // 常规作业loading
|
const fileLoading = ref(false); // 常规作业loading
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log("----onMounted-------")
|
|
||||||
currentRow.value = {id:0};
|
currentRow.value = {id:0};
|
||||||
if(propsQueryCourseObj){
|
if(propsQueryCourseObj){
|
||||||
if(JSON.parse(propsQueryCourseObj)){
|
if(JSON.parse(propsQueryCourseObj)){
|
||||||
|
@ -221,28 +216,7 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initHomeWork();
|
initHomeWork();
|
||||||
isInToMyQuestion(); // 如果是上传习题后返回的,跳转到个人题库
|
|
||||||
})
|
})
|
||||||
// 是否进入个人题库
|
|
||||||
const isInToMyQuestion = () => {
|
|
||||||
console.log('isOpenQuestUploadView',useClassTaskStores.isOpenQuestUploadView);
|
|
||||||
if(useClassTaskStores.isOpenQuestUploadView){
|
|
||||||
useClassTaskStores.isOpenQuestUploadView = false;
|
|
||||||
|
|
||||||
currentRow.value = {id:1}; // 作业设计
|
|
||||||
activeAptTab.value = "个人题库";
|
|
||||||
//提交内容清空 重置
|
|
||||||
classWorkForm.id = 0;
|
|
||||||
classWorkForm.uniquekey = ""; // 作业唯一标识 作业名称
|
|
||||||
classWorkForm.worktype = "习题训练"; //作业类型
|
|
||||||
classWorkForm.title = ""; // 作业说明
|
|
||||||
classWorkForm.quizlist = []; // 作业习题列表内容
|
|
||||||
classWorkForm.chooseWorkLists = []; // 作业框架梳理list
|
|
||||||
classWorkForm.fileHomeworkList = []; // 常规作业文件列表
|
|
||||||
classWorkForm.whiteboardObj = ""; // 作业资源 - 课堂展示 白板
|
|
||||||
classWorkForm.question = ""; // 作业资源 - 课堂展示 输入的问题
|
|
||||||
}
|
|
||||||
}
|
|
||||||
watch(() => props.currentCourse, (newVal, oldVal) => {
|
watch(() => props.currentCourse, (newVal, oldVal) => {
|
||||||
if(newVal){
|
if(newVal){
|
||||||
courseObj.textbookId = newVal.textbookId // 版本
|
courseObj.textbookId = newVal.textbookId // 版本
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import "vue-cropper/dist/index.css";
|
import "vue-cropper/dist/index.css";
|
||||||
import { VueCropper } from "vue-cropper";
|
import { VueCropper } from "vue-cropper";
|
||||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick, onUnmounted } from 'vue'
|
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
|
@ -88,8 +88,6 @@ import { useRouter, useRoute } from 'vue-router'
|
||||||
|
|
||||||
import { ocrImg2ExamByManualUpl, ocrImg2ItemByManualUpl } from "@/views/classTask/newClassTaskAssign/questionUpload/ocrImg2ExamQues";
|
import { ocrImg2ExamByManualUpl, ocrImg2ItemByManualUpl } from "@/views/classTask/newClassTaskAssign/questionUpload/ocrImg2ExamQues";
|
||||||
import QuesItem from "@/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue";
|
import QuesItem from "@/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue";
|
||||||
import useClassTaskStore from '@/store/modules/classTask'
|
|
||||||
|
|
||||||
|
|
||||||
// const Remote = require('@electron/remote')
|
// const Remote = require('@electron/remote')
|
||||||
// const fs = require('fs');
|
// const fs = require('fs');
|
||||||
|
@ -98,9 +96,7 @@ import useUserStore from '@/store/modules/user'
|
||||||
const userStore = useUserStore().user
|
const userStore = useUserStore().user
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance()
|
||||||
const useClassTaskStores = useClassTaskStore();
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -155,7 +151,6 @@ const cropOption = reactive({
|
||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
useClassTaskStores.isOpenQuestUploadView = true; // 打开过习题上传界面
|
|
||||||
console.log('propsQueryCourseObj', JSON.parse(propsQueryCourseObj));
|
console.log('propsQueryCourseObj', JSON.parse(propsQueryCourseObj));
|
||||||
if(propsQueryCourseObj&&JSON.parse(propsQueryCourseObj)){
|
if(propsQueryCourseObj&&JSON.parse(propsQueryCourseObj)){
|
||||||
courseObj.textbookId = JSON.parse(propsQueryCourseObj).bookObj // 版本
|
courseObj.textbookId = JSON.parse(propsQueryCourseObj).bookObj // 版本
|
||||||
|
@ -166,13 +161,7 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
initHomeWork();
|
initHomeWork();
|
||||||
})
|
})
|
||||||
onUnmounted(()=>{
|
|
||||||
// 延迟1s 关闭习题上传界面,作业管理界面需要根据 isOpenQuestUploadView 来进行判断
|
|
||||||
setTimeout(()=>{
|
|
||||||
useClassTaskStores.isOpenQuestUploadView = false; // 关闭习题上传界面
|
|
||||||
console.log('onUnmounted 习题上传');
|
|
||||||
}, 1000)
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取 entpcourseid 获取作业列表
|
* 获取 entpcourseid 获取作业列表
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { ElMessageBox, ElMessage } from "element-plus";
|
import { ElMessageBox, ElMessage } from "element-plus";
|
||||||
import qs from "qs";
|
import qs from "qs";
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import request from '@/utils/request'
|
|
||||||
import { pyOCRAPI } from "@/api/education/entpcoursework";
|
import { pyOCRAPI } from "@/api/education/entpcoursework";
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,20 +9,13 @@ const baidubceConfig = {
|
||||||
// Header
|
// Header
|
||||||
'Content-Type': "application/x-www-form-urlencoded",
|
'Content-Type': "application/x-www-form-urlencoded",
|
||||||
// 格式
|
// 格式
|
||||||
'Accept': 'application/json',
|
'Accept' : 'application/json',
|
||||||
// id(临时测试)
|
// id(临时测试)
|
||||||
'client_id': "U0DrGBE6X92IXgV6cJMNON8F",
|
'client_id': "U0DrGBE6X92IXgV6cJMNON8F",
|
||||||
// 密钥(临时测试)
|
// 密钥(临时测试)
|
||||||
'client_secret': 'oWb0M0YWMmZPMQIhIUkJX99ddr7h61qf',
|
'client_secret': 'oWb0M0YWMmZPMQIhIUkJX99ddr7h61qf',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getOcrContent(data) {
|
|
||||||
return request({
|
|
||||||
url: '/ocr/exam',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +35,7 @@ export const ocrImg2ItemByManualUpl = async (isLocalTest = false, imgBase64 = ''
|
||||||
// 识别内容拼接
|
// 识别内容拼接
|
||||||
let ocrTxt = ''
|
let ocrTxt = ''
|
||||||
|
|
||||||
if (isLocalTest) {
|
if(isLocalTest) {
|
||||||
// 临时本地测试(json格式跟百度ocr一致)
|
// 临时本地测试(json格式跟百度ocr一致)
|
||||||
const response = await fetch('/cropImgTest/single.json');
|
const response = await fetch('/cropImgTest/single.json');
|
||||||
const resOcr = await response.json();
|
const resOcr = await response.json();
|
||||||
|
@ -67,7 +59,7 @@ export const ocrImg2ItemByManualUpl = async (isLocalTest = false, imgBase64 = ''
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const tmp = await ocrImg2Json(imgBase64);
|
const tmp = await ocrImg2Json(imgBase64);
|
||||||
if (!tmp?.data) {
|
if(!tmp?.data) {
|
||||||
return examItem;
|
return examItem;
|
||||||
}
|
}
|
||||||
ocrJson = tmp.data.results;
|
ocrJson = tmp.data.results;
|
||||||
|
@ -77,12 +69,12 @@ export const ocrImg2ItemByManualUpl = async (isLocalTest = false, imgBase64 = ''
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ocrJson == '') {
|
if(ocrJson == '') {
|
||||||
ElMessage.error('[人工录入-单项]识别的图片为空, 识别失败, 请检查重试!');
|
ElMessage.error('[人工录入-单项]识别的图片为空, 识别失败, 请检查重试!');
|
||||||
return examItem;
|
return examItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ocrTxt == '') {
|
if(ocrTxt == '') {
|
||||||
ElMessage.error('[人工录入-单项]识别内容拼接失败, 请检查重试!');
|
ElMessage.error('[人工录入-单项]识别内容拼接失败, 请检查重试!');
|
||||||
return examItem;
|
return examItem;
|
||||||
}
|
}
|
||||||
|
@ -104,13 +96,13 @@ export const ocrImg2ItemByManualUpl = async (isLocalTest = false, imgBase64 = ''
|
||||||
worktype: '单选题',
|
worktype: '单选题',
|
||||||
params: [],
|
params: [],
|
||||||
}
|
}
|
||||||
mutiParams.arrWorkDesc.forEach(item => {
|
mutiParams.arrWorkDesc.forEach( item => {
|
||||||
const obj = {
|
const obj = {
|
||||||
title: item.title,
|
title: item.title,
|
||||||
workanswer: '',
|
workanswer: '',
|
||||||
checkAnswer: [],
|
checkAnswer: [],
|
||||||
type: item.type,
|
type: item.type,
|
||||||
options: item.options.map(element => { return { text: element.replace(/<br \/>/g, '') } }),
|
options: item.options.map(element => {return {text: element.replace(/<br \/>/g, '')}}),
|
||||||
}
|
}
|
||||||
examItem.params.push(obj);
|
examItem.params.push(obj);
|
||||||
});
|
});
|
||||||
|
@ -122,7 +114,7 @@ export const ocrImg2ItemByManualUpl = async (isLocalTest = false, imgBase64 = ''
|
||||||
// 先判断是否存在选项标识, 且存在2个及以上(A.---1.---(1)---(1))
|
// 先判断是否存在选项标识, 且存在2个及以上(A.---1.---(1)---(1))
|
||||||
regex = /\s*[A-H][..。]/g;
|
regex = /\s*[A-H][..。]/g;
|
||||||
const matches = ocrTxt.match(regex);
|
const matches = ocrTxt.match(regex);
|
||||||
if (matches == null || matches.length < 2) {
|
if (matches==null || matches.length < 2){
|
||||||
ElMessage.error('[人工录入-单项]识别[选项]失败, 请检查重试!');
|
ElMessage.error('[人工录入-单项]识别[选项]失败, 请检查重试!');
|
||||||
return examItem;
|
return examItem;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +164,7 @@ export const ocrImg2ExamByManualUpl = async (isLocalTest = false, imgBase64 = ''
|
||||||
// 识别内容拼接
|
// 识别内容拼接
|
||||||
let ocrTxt = '';
|
let ocrTxt = '';
|
||||||
|
|
||||||
if (isLocalTest) {
|
if(isLocalTest) {
|
||||||
// 临时本地测试(json格式跟百度ocr一致)
|
// 临时本地测试(json格式跟百度ocr一致)
|
||||||
const response = await fetch('/cropImgTest/single.json');
|
const response = await fetch('/cropImgTest/single.json');
|
||||||
const resOcr = await response.json();
|
const resOcr = await response.json();
|
||||||
|
@ -194,7 +186,7 @@ export const ocrImg2ExamByManualUpl = async (isLocalTest = false, imgBase64 = ''
|
||||||
// });
|
// });
|
||||||
} else {
|
} else {
|
||||||
const tmp = await ocrImg2Json(imgBase64);
|
const tmp = await ocrImg2Json(imgBase64);
|
||||||
if (!tmp?.data) {
|
if(!tmp?.data) {
|
||||||
return examQues;
|
return examQues;
|
||||||
}
|
}
|
||||||
ocrJson = tmp.data.results;
|
ocrJson = tmp.data.results;
|
||||||
|
@ -203,20 +195,20 @@ export const ocrImg2ExamByManualUpl = async (isLocalTest = false, imgBase64 = ''
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ocrJson == '') {
|
if(ocrJson == '') {
|
||||||
ElMessage.error('[人工录入-整题]图片识别内容为空, 识别失败, 请重试!');
|
ElMessage.error('[人工录入-整题]图片识别内容为空, 识别失败, 请重试!');
|
||||||
return examQues;
|
return examQues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ocrTxt == '') {
|
if(ocrTxt == '') {
|
||||||
ElMessage.error('[人工录入-整题]识别内容拼接失败, 请重试!');
|
ElMessage.error('[人工录入-整题]识别内容拼接失败, 请重试!');
|
||||||
return examQues;
|
return examQues;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 识别内容转为试题结构
|
// 识别内容转为试题结构
|
||||||
examQues = assembleExam(ocrTxt);
|
examQues = assembleExam(ocrTxt);
|
||||||
if (examQues.err != '') {
|
if(examQues.err != '') {
|
||||||
ElMessage.error(`[人工录入-整题]${examQues.err}, 请重试!`);
|
ElMessage.error(`[人工录入-整题]${examQues.err}, 请重试!`);
|
||||||
examQues = {};
|
examQues = {};
|
||||||
}
|
}
|
||||||
|
@ -234,36 +226,30 @@ const ocrImg2Json = async (urlBase64) => {
|
||||||
ElMessage.error("未检测到截图图片, 请截取图片后再识别");
|
ElMessage.error("未检测到截图图片, 请截取图片后再识别");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
let base64Code = urlBase64.split(",")[1];
|
const resToken = await bdyAPI_getToken();
|
||||||
const resOcr = await getOcrContent({ base64Code: base64Code });
|
if (resToken.status !== 200) {
|
||||||
if (resOcr.code !== 200) {
|
ElMessage.error("百度智能云用户标识有误");
|
||||||
ElMessage.error("图片识别错误");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// const resToken = await bdyAPI_getToken();
|
|
||||||
// if (resToken.status !== 200) {
|
|
||||||
// ElMessage.error("百度智能云用户标识有误");
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const token = resToken.data?.access_token;
|
const token = resToken.data?.access_token;
|
||||||
// let base64Code = urlBase64.split(",")[1];
|
let base64Code = urlBase64.split(",")[1];
|
||||||
// const query = {
|
const query = {
|
||||||
// image: base64Code, //图片地址(base64)
|
image: base64Code, //图片地址(base64)
|
||||||
// line_probability: false, //是否返回每行识别结果的置信度。默认为false
|
line_probability: false, //是否返回每行识别结果的置信度。默认为false
|
||||||
// disp_line_poly: false, //是否返回每行的四角点坐标。默认为false
|
disp_line_poly: false, //是否返回每行的四角点坐标。默认为false
|
||||||
// words_type: 'handprint_mix', //文字类型。 默认:印刷文字识别 = handwring_only:手写文字识别 = handprint_mix: 手写印刷混排识别
|
words_type: 'handprint_mix', //文字类型。 默认:印刷文字识别 = handwring_only:手写文字识别 = handprint_mix: 手写印刷混排识别
|
||||||
// layout_analysis: false, //是否分析文档版面:包括layout(图、表、标题、段落、目录);attribute(栏、页眉、页脚、页码、脚注)的分析输出
|
layout_analysis: false, //是否分析文档版面:包括layout(图、表、标题、段落、目录);attribute(栏、页眉、页脚、页码、脚注)的分析输出
|
||||||
// recg_long_division: false, //是否检测并识别手写竖式
|
recg_long_division: false, //是否检测并识别手写竖式
|
||||||
// recg_formula: true, //控制是否检测并识别公式,默认为false
|
recg_formula: true, //控制是否检测并识别公式,默认为false
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
// const resOcr = await bdyAPI_getOcrContent(token, base64Code, query);
|
const resOcr = await bdyAPI_getOcrContent(token, base64Code, query);
|
||||||
// if (resOcr.status !== 200) {
|
if (resOcr.status !== 200) {
|
||||||
// ElMessage.error("百度智能云图片识别错误");
|
ElMessage.error("百度智能云图片识别错误");
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
|
|
||||||
return resOcr;
|
return resOcr;
|
||||||
}
|
}
|
||||||
|
@ -384,7 +370,7 @@ const assembleExam = (eachSub) => {
|
||||||
if (!hasAnswer) {
|
if (!hasAnswer) {
|
||||||
// 不存在答案, 仅处理[题干+选项]
|
// 不存在答案, 仅处理[题干+选项]
|
||||||
titleAndWorkDesc = eachSub;
|
titleAndWorkDesc = eachSub;
|
||||||
} else {
|
}else {
|
||||||
// 存在答案, 需处理[题干+选项]和[答案+解析]
|
// 存在答案, 需处理[题干+选项]和[答案+解析]
|
||||||
regex = /(<br \/>?\s*[【\[].*?[】\]])/g;
|
regex = /(<br \/>?\s*[【\[].*?[】\]])/g;
|
||||||
let tmpList = eachSub.split(regex);
|
let tmpList = eachSub.split(regex);
|
||||||
|
@ -400,10 +386,10 @@ const assembleExam = (eachSub) => {
|
||||||
// 第二部分[分析-答案] 处理
|
// 第二部分[分析-答案] 处理
|
||||||
let answerAndAnswer = {};
|
let answerAndAnswer = {};
|
||||||
// 将第二部分的内容做key-value绑定 - 键为【分析】、【讨论】、【方法】等. 值为随之分隔的内容
|
// 将第二部分的内容做key-value绑定 - 键为【分析】、【讨论】、【方法】等. 值为随之分隔的内容
|
||||||
for (let i = 1; i < tmpList.length - 1; i = i + 2) {
|
for (let i=1; i<tmpList.length-1; i=i+2){
|
||||||
let key = tmpList[i];
|
let key = tmpList[i];
|
||||||
key = key.replace(/<br \/>|【|】|\[|\]/g, '');
|
key = key.replace(/<br \/>|【|】|\[|\]/g, '');
|
||||||
let value = tmpList[i + 1];
|
let value = tmpList[i+1];
|
||||||
value = value.replace(/^<br \/>+|<br \/>+$/g, '');
|
value = value.replace(/^<br \/>+|<br \/>+$/g, '');
|
||||||
answerAndAnswer[key] = value;
|
answerAndAnswer[key] = value;
|
||||||
}
|
}
|
||||||
|
@ -444,12 +430,12 @@ const assembleExam = (eachSub) => {
|
||||||
|
|
||||||
// [答案] - 初步初始化 --- 根据答案判断试题大分类: 复合题(实际为大题) 或 其他基础题型(单选,多选,填空,判断)
|
// [答案] - 初步初始化 --- 根据答案判断试题大分类: 复合题(实际为大题) 或 其他基础题型(单选,多选,填空,判断)
|
||||||
answer = answerAndAnswer['答案'].trim();
|
answer = answerAndAnswer['答案'].trim();
|
||||||
if (!answer) {
|
if(!answer) {
|
||||||
answer = answerAndAnswer['答案及评分参考'].trim();
|
answer = answerAndAnswer['答案及评分参考'].trim();
|
||||||
answer = answer.replace(/^\d+[\u4e00-\u9fa5][..。]\s*<br \/>/, ''); // 去掉 - 有些开头会有[xx分。]
|
answer = answer.replace(/^\d+[\u4e00-\u9fa5][..。]\s*<br \/>/, ''); // 去掉 - 有些开头会有[xx分。]
|
||||||
}
|
}
|
||||||
// 将多余的空格替换为固定的4个空格
|
// 将多余的空格替换为固定的4个空格
|
||||||
answer = answer.replaceAll("\\s{3,}", " ");
|
answer = answer.replaceAll("\\s{3,}"," ");
|
||||||
if (answer == null | answer == '') {
|
if (answer == null | answer == '') {
|
||||||
subObj.err = '题目缺少[答案]';
|
subObj.err = '题目缺少[答案]';
|
||||||
return subObj;
|
return subObj;
|
||||||
|
@ -469,7 +455,7 @@ const assembleExam = (eachSub) => {
|
||||||
let answerFind = regex.test(answer);
|
let answerFind = regex.test(answer);
|
||||||
regex = /(\d+[..。]|\(\d+\)|(\d+))/;
|
regex = /(\d+[..。]|\(\d+\)|(\d+))/;
|
||||||
let titleFind = regex.test(titleAndWorkDesc);
|
let titleFind = regex.test(titleAndWorkDesc);
|
||||||
if (titleFind && answerFind) {
|
if(titleFind && answerFind){
|
||||||
/**
|
/**
|
||||||
* [复合题] - 处理逻辑
|
* [复合题] - 处理逻辑
|
||||||
*/
|
*/
|
||||||
|
@ -485,7 +471,7 @@ const assembleExam = (eachSub) => {
|
||||||
|
|
||||||
if (tmpExam) {
|
if (tmpExam) {
|
||||||
// 错误信息
|
// 错误信息
|
||||||
if (tmpExam.errMsg !== '') {
|
if(tmpExam.errMsg !== '') {
|
||||||
subObj.err = tmpExam.err;
|
subObj.err = tmpExam.err;
|
||||||
return subObj;
|
return subObj;
|
||||||
}
|
}
|
||||||
|
@ -522,7 +508,7 @@ const processExamSingle = function (titleAndWorkDesc, answer) {
|
||||||
let matcher = null;
|
let matcher = null;
|
||||||
|
|
||||||
/** [判断题]的处理逻辑, resp: -1-未找到 0-*为对应匹配的index */
|
/** [判断题]的处理逻辑, resp: -1-未找到 0-*为对应匹配的index */
|
||||||
let judgedStatus = answer !== '' ? containsExactMatch(answer) : -1;
|
let judgedStatus = answer!=='' ? containsExactMatch(answer) : -1;
|
||||||
|
|
||||||
/** 其他基础题型(单选,多选,填空,判断)的处理逻辑 */
|
/** 其他基础题型(单选,多选,填空,判断)的处理逻辑 */
|
||||||
// 先去掉开头的试题序号
|
// 先去掉开头的试题序号
|
||||||
|
@ -538,7 +524,7 @@ const processExamSingle = function (titleAndWorkDesc, answer) {
|
||||||
answer = answer.replace("<br />", "").trim();
|
answer = answer.replace("<br />", "").trim();
|
||||||
|
|
||||||
// [题型] - 格式化 - 根据答案字符个数区分[单选]或[多选]
|
// [题型] - 格式化 - 根据答案字符个数区分[单选]或[多选]
|
||||||
examSingle.workType = answer === '' ? '单选题' : answer.length == 1 ? "单选题" : "多选题";
|
examSingle.workType = answer==='' ? '单选题' : answer.length == 1 ? "单选题" : "多选题";
|
||||||
|
|
||||||
// 切分题干+选项
|
// 切分题干+选项
|
||||||
regex = /<br \/>*\s*[A-H][..。]/g;
|
regex = /<br \/>*\s*[A-H][..。]/g;
|
||||||
|
@ -584,7 +570,7 @@ const processExamSingle = function (titleAndWorkDesc, answer) {
|
||||||
examSingle.arrWorkAnswer = answer.split(" ");
|
examSingle.arrWorkAnswer = answer.split(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (judgedStatus != -1) {
|
else if( judgedStatus != -1 ) {
|
||||||
/**
|
/**
|
||||||
* 判断题
|
* 判断题
|
||||||
*/
|
*/
|
||||||
|
@ -649,12 +635,12 @@ const processExamMulti = function (titleAndWorkDesc, answer) {
|
||||||
// 先确定当前是以什么形式的小题序号来切分 --- 需要全部独立判断, 避免出现复合题中, 每小题内还包含小题的情况--- 1.回答以下问题 (1)***** (2)******
|
// 先确定当前是以什么形式的小题序号来切分 --- 需要全部独立判断, 避免出现复合题中, 每小题内还包含小题的情况--- 1.回答以下问题 (1)***** (2)******
|
||||||
let cliceSucc = false;
|
let cliceSucc = false;
|
||||||
let arrAnswer = []
|
let arrAnswer = []
|
||||||
if (!cliceSucc) {
|
if(!cliceSucc){
|
||||||
regex = /<br \/>\s*\d+[..。]\s*/;
|
regex = /<br \/>\s*\d+[..。]\s*/;
|
||||||
if (regex.test(titleAndWorkDesc)) {
|
if (regex.test(titleAndWorkDesc)) {
|
||||||
// 再次以答案中的序号同步匹配一次
|
// 再次以答案中的序号同步匹配一次
|
||||||
regex = /^\s*\d+[..。]\s*/;
|
regex = /^\s*\d+[..。]\s*/;
|
||||||
if (answer === '' || regex.test(answer)) {
|
if(answer === '' || regex.test(answer)){
|
||||||
regex = /<br \/>\s*\d+[..。]\s*/g;
|
regex = /<br \/>\s*\d+[..。]\s*/g;
|
||||||
tmpSplit = titleAndWorkDesc.split(regex);
|
tmpSplit = titleAndWorkDesc.split(regex);
|
||||||
if (answer !== '') {
|
if (answer !== '') {
|
||||||
|
@ -667,12 +653,12 @@ const processExamMulti = function (titleAndWorkDesc, answer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cliceSucc) {
|
if (!cliceSucc){
|
||||||
regex = /<br \/>\s*(\d+)\s*/;
|
regex = /<br \/>\s*(\d+)\s*/;
|
||||||
if (regex.test(titleAndWorkDesc)) {
|
if (regex.test(titleAndWorkDesc)) {
|
||||||
// 再次以答案中的序号同步匹配一次
|
// 再次以答案中的序号同步匹配一次
|
||||||
regex = /\s*(\d+)\s*/;
|
regex = /\s*(\d+)\s*/;
|
||||||
if (answer === '' || regex.test(answer)) {
|
if(answer === '' || regex.test(answer)){
|
||||||
regex = /<br \/>\s*(\d+)\s*/g;
|
regex = /<br \/>\s*(\d+)\s*/g;
|
||||||
tmpSplit = titleAndWorkDesc.split(regex);
|
tmpSplit = titleAndWorkDesc.split(regex);
|
||||||
if (answer !== '') {
|
if (answer !== '') {
|
||||||
|
@ -685,12 +671,12 @@ const processExamMulti = function (titleAndWorkDesc, answer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cliceSucc) {
|
if (!cliceSucc){
|
||||||
regex = /<br \/>\s*\(\d+\)\s*/;
|
regex = /<br \/>\s*\(\d+\)\s*/;
|
||||||
if (regex.test(titleAndWorkDesc)) {
|
if (regex.test(titleAndWorkDesc)) {
|
||||||
// 再次以答案中的序号同步匹配一次
|
// 再次以答案中的序号同步匹配一次
|
||||||
regex = /^\s*\(\d+\)\s*/;
|
regex = /^\s*\(\d+\)\s*/;
|
||||||
if (answer === '' || regex.test(answer)) {
|
if(answer === '' || regex.test(answer)){
|
||||||
regex = /<br \/>\s*\(\d+\)\s*/g;
|
regex = /<br \/>\s*\(\d+\)\s*/g;
|
||||||
tmpSplit = titleAndWorkDesc.split(regex);
|
tmpSplit = titleAndWorkDesc.split(regex);
|
||||||
if (answer !== '') {
|
if (answer !== '') {
|
||||||
|
@ -703,19 +689,19 @@ const processExamMulti = function (titleAndWorkDesc, answer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cliceSucc) {
|
if (!cliceSucc){
|
||||||
examMulti.errMsg = '[复合题]小题与答案序号[不匹配]';
|
examMulti.errMsg = '[复合题]小题与答案序号[不匹配]';
|
||||||
return examMulti;
|
return examMulti;
|
||||||
}
|
}
|
||||||
if (tmpSplit.length < 2) {
|
if (tmpSplit.length < 2){
|
||||||
examMulti.errMsg = '[复合题]题干与小题[切分失败]';
|
examMulti.errMsg = '[复合题]题干与小题[切分失败]';
|
||||||
return examMulti;
|
return examMulti;
|
||||||
}
|
}
|
||||||
if (answer !== '' && arrAnswer.length < 2) {
|
if (answer !== '' && arrAnswer.length < 2){
|
||||||
examMulti.errMsg = '[复合题]答案切分小题失败';
|
examMulti.errMsg = '[复合题]答案切分小题失败';
|
||||||
return examMulti;
|
return examMulti;
|
||||||
}
|
}
|
||||||
if (answer !== '' && tmpSplit.length != arrAnswer.length) {
|
if (answer !== '' && tmpSplit.length != arrAnswer.length){
|
||||||
examMulti.errMsg = '[复合题]小题个数与答案个数[不一致]';
|
examMulti.errMsg = '[复合题]小题个数与答案个数[不一致]';
|
||||||
return examMulti;
|
return examMulti;
|
||||||
}
|
}
|
||||||
|
@ -724,13 +710,13 @@ const processExamMulti = function (titleAndWorkDesc, answer) {
|
||||||
examMulti.title = tmpSplit[0].trim();
|
examMulti.title = tmpSplit[0].trim();
|
||||||
|
|
||||||
// [选项]+[答案] - 逻辑处理
|
// [选项]+[答案] - 逻辑处理
|
||||||
for (let i = 1; i < tmpSplit.length; i++) {
|
for (let i=1; i<tmpSplit.length; i++){
|
||||||
const tmp = tmpSplit[i].trim();
|
const tmp = tmpSplit[i].trim();
|
||||||
// 因arrAnswer[0]对应为分隔出来的首位空数组, 故这里也可直接使用i=1作为下标获取答案
|
// 因arrAnswer[0]对应为分隔出来的首位空数组, 故这里也可直接使用i=1作为下标获取答案
|
||||||
const tmpAnswer = answer === '' ? '' : arrAnswer[i].trim();
|
const tmpAnswer = answer === '' ? '' : arrAnswer[i].trim();
|
||||||
// 单题处理
|
// 单题处理
|
||||||
const tmpExam = processExamSingle(tmp, tmpAnswer);
|
const tmpExam = processExamSingle(tmp, tmpAnswer);
|
||||||
if (tmpExam.errMsg !== '') {
|
if(tmpExam.errMsg !== ''){
|
||||||
examMulti.errMsg = '[复合题]小题解析失败';
|
examMulti.errMsg = '[复合题]小题解析失败';
|
||||||
return examMulti;
|
return examMulti;
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,10 +163,8 @@ import quizStats from '@/views/classTask/container/quizStats.vue'
|
||||||
import ClassOverview from '@/views/classTask/container/classOverview.vue'
|
import ClassOverview from '@/views/classTask/container/classOverview.vue'
|
||||||
import {sessionStore} from '@/utils/store'
|
import {sessionStore} from '@/utils/store'
|
||||||
// import Chat from '@/utils/chat' // im 登录初始化
|
// import Chat from '@/utils/chat' // im 登录初始化
|
||||||
import { Homework } from '@/AixPPTist/src/api/index'
|
|
||||||
import MsgEnum from '@/plugins/imChat/msgEnum' // im 消息枚举
|
import MsgEnum from '@/plugins/imChat/msgEnum' // im 消息枚举
|
||||||
import ChatWs from '@/plugins/socket' // 聊天socket
|
import ChatWs from '@/plugins/socket' // 聊天socket
|
||||||
import { set } from 'lodash'
|
|
||||||
if (!ChatWs.ws) ChatWs.init()
|
if (!ChatWs.ws) ChatWs.init()
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
const emit = defineEmits(['cle-click'])
|
const emit = defineEmits(['cle-click'])
|
||||||
|
@ -721,17 +719,14 @@ const msgHandle = (msg) => {
|
||||||
const { head, content, ...other } = msg
|
const { head, content, ...other } = msg
|
||||||
switch(head) {
|
switch(head) {
|
||||||
case MsgEnum.HEADS.MSG_closed: // 下课:
|
case MsgEnum.HEADS.MSG_closed: // 下课:
|
||||||
Homework.win = null
|
|
||||||
window.close() // 关闭窗口
|
window.close() // 关闭窗口
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_finishHomework: // 跟新作业:
|
case MsgEnum.HEADS.MSG_finishHomework: // 跟新作业:
|
||||||
console.log('更新作业', head, content)
|
|
||||||
const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
|
const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
|
||||||
openDialog(data, false);
|
openDialog(data, false);
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_slideFlapping: // 切换页面
|
case MsgEnum.HEADS.MSG_slideFlapping: // 切换页面
|
||||||
console.log('切换页面-关闭窗口')
|
console.log('切换页面-关闭窗口')
|
||||||
Homework.win = null
|
|
||||||
window.close() // 关闭窗口
|
window.close() // 关闭窗口
|
||||||
break
|
break
|
||||||
// case 'TIMAddRecvNewMsgCallback': // 收到新消息 data=[]
|
// case 'TIMAddRecvNewMsgCallback': // 收到新消息 data=[]
|
||||||
|
@ -774,7 +769,7 @@ onMounted(() => {
|
||||||
console.log('socket监听消息')
|
console.log('socket监听消息')
|
||||||
ChatWs.watch((msg, e) => {
|
ChatWs.watch((msg, e) => {
|
||||||
try {
|
try {
|
||||||
msgHandle(JSON.parse(msg)?.msg)
|
msgHandle(JSON.parse(msg))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('socket 解析异常 ', error, e)
|
console.error('socket 解析异常 ', error, e)
|
||||||
msgHandle(msg)
|
msgHandle(msg)
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-right">
|
<div class="header-right">
|
||||||
<el-select v-model="curMode" placeholder="Select" class="mr-4 w-30">
|
|
||||||
<el-option v-for="item in modeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
<el-button type="primary" :disabled="!(resultList.length)" @click="getCompletion">一键研读</el-button>
|
<el-button type="primary" :disabled="!(resultList.length)" @click="getCompletion">一键研读</el-button>
|
||||||
<el-button type="primary">生成大纲</el-button>
|
<el-button type="primary">生成大纲</el-button>
|
||||||
<el-button type="danger" @click="pptDialog = true">生成PPT</el-button>
|
<el-button type="danger" @click="pptDialog = true">生成PPT</el-button>
|
||||||
|
@ -38,8 +35,7 @@
|
||||||
<div class="item-prompt">{{ item.prompt }}</div>
|
<div class="item-prompt">{{ item.prompt }}</div>
|
||||||
<div class="item-answer" v-if="item.answer">
|
<div class="item-answer" v-if="item.answer">
|
||||||
<div class="answer-text">
|
<div class="answer-text">
|
||||||
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow"
|
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow" @complete="handleCompleteText($event,index)" @updateScroll="scrollToBottom($event,index)" />
|
||||||
@complete="handleCompleteText($event, index)" @updateScroll="scrollToBottom($event, index)" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="item-btn flex">
|
<div class="item-btn flex">
|
||||||
<el-button type="primary" link @click="againResult(index, item)">
|
<el-button type="primary" link @click="againResult(index, item)">
|
||||||
|
@ -63,7 +59,7 @@
|
||||||
</div>
|
</div>
|
||||||
<EditDialog v-model="isEdit" :item="curItem" />
|
<EditDialog v-model="isEdit" :item="curItem" />
|
||||||
<AdjustDialog v-model="isAdjust" :item="curItem" />
|
<AdjustDialog v-model="isAdjust" :item="curItem" />
|
||||||
<PptDialog @add-success="addAiPPT" :dataList="resultList" v-model="pptDialog" />
|
<PptDialog @add-success="addAiPPT" :dataList="resultList" v-model="pptDialog"/>
|
||||||
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
|
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
|
||||||
<!--添加、编辑提示词-->
|
<!--添加、编辑提示词-->
|
||||||
<keywordDialog v-model="isWordDialog" :item="curItem" />
|
<keywordDialog v-model="isWordDialog" :item="curItem" />
|
||||||
|
@ -77,17 +73,15 @@ import emitter from '@/utils/mitt'
|
||||||
import EditDialog from './edit-dialog.vue'
|
import EditDialog from './edit-dialog.vue'
|
||||||
import AdjustDialog from './adjust-dialog.vue'
|
import AdjustDialog from './adjust-dialog.vue'
|
||||||
import progressDialog from './progress-dialog.vue'
|
import progressDialog from './progress-dialog.vue'
|
||||||
import { completion, tempResult, tempSave, removeChildTemp, editTempResult, modelList } from '@/api/mode/index.js'
|
import { completion, tempResult, tempSave, removeChildTemp, editTempResult } from '@/api/mode/index.js'
|
||||||
import { createChart, sendChart } from '@/api/ai/index'
|
|
||||||
// import { dataSetJson } from '@/utils/comm.js'
|
// import { dataSetJson } from '@/utils/comm.js'
|
||||||
import * as commUtils from '@/utils/comm.js'
|
import * as commUtils from '@/utils/comm.js'
|
||||||
import PptDialog from '@/views/prepare/container/pptist-dialog.vue'
|
import PptDialog from '@/views/prepare/container/pptist-dialog.vue'
|
||||||
import keywordDialog from './keyword-dialog.vue'
|
import keywordDialog from './keyword-dialog.vue'
|
||||||
import TypingEffect from '@/components/typing-effect/index.vue'
|
import TypingEffect from '@/components/typing-effect/index.vue'
|
||||||
import { cloneDeep } from 'lodash'
|
|
||||||
|
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import { PPTXFileToJson } from '@/AixPPTist/src/hooks/useImport' // ppt转json
|
import {PPTXFileToJson} from '@/AixPPTist/src/hooks/useImport' // ppt转json
|
||||||
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 * as Api_server from '@/api/apiService' // 相关api
|
import * as Api_server from '@/api/apiService' // 相关api
|
||||||
|
@ -106,7 +100,7 @@ const pgDialog = reactive({ // 弹窗-进度条
|
||||||
width: 300,
|
width: 300,
|
||||||
showClose: false,
|
showClose: false,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
beforeClose: done => { }, // 阻止-弹窗事件
|
beforeClose: done => {}, // 阻止-弹窗事件
|
||||||
pg: { // 进度条-参数
|
pg: { // 进度条-参数
|
||||||
percentage: 0, // 百分比
|
percentage: 0, // 百分比
|
||||||
color: [
|
color: [
|
||||||
|
@ -116,19 +110,6 @@ const pgDialog = reactive({ // 弹窗-进度条
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const curMode = ref(1)
|
|
||||||
const modeOptions = ref([
|
|
||||||
{
|
|
||||||
label: '教学大模型',
|
|
||||||
value: 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '知识库模型',
|
|
||||||
value: 2
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
emitter.on('changeMode', (item) => {
|
emitter.on('changeMode', (item) => {
|
||||||
resultList.value = item.child
|
resultList.value = item.child
|
||||||
getTempResult(item.id)
|
getTempResult(item.id)
|
||||||
|
@ -140,8 +121,8 @@ const getCompletion = async () => {
|
||||||
isStarted.value = new Array(resultList.length).fill(false)
|
isStarted.value = new Array(resultList.length).fill(false)
|
||||||
isStarted.value[0] = true
|
isStarted.value[0] = true
|
||||||
|
|
||||||
resultList.value.forEach(item => {
|
resultList.value.forEach(item =>{
|
||||||
if (item.answer) {
|
if(item.answer){
|
||||||
item.answer = ''
|
item.answer = ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -150,28 +131,8 @@ const getCompletion = async () => {
|
||||||
try {
|
try {
|
||||||
item.loading = true
|
item.loading = true
|
||||||
item.aiShow = true
|
item.aiShow = true
|
||||||
|
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject} 对${curNode.itemtitle}进行教学分析`
|
||||||
let str = cloneDeep(prompt.value)
|
const { data } = await completion(params)
|
||||||
str = str.replace(/{模板名称}/g, item.name)
|
|
||||||
params.prompt = str
|
|
||||||
params.template = item.prompt
|
|
||||||
|
|
||||||
// 教学大模型
|
|
||||||
let data = null
|
|
||||||
if (curMode.value == 1) {
|
|
||||||
const res = await sendChart({
|
|
||||||
content: params.prompt,
|
|
||||||
conversationId: conversation_id.value,
|
|
||||||
stream: false
|
|
||||||
})
|
|
||||||
data = res.data
|
|
||||||
}
|
|
||||||
// 知识库模型
|
|
||||||
else {
|
|
||||||
const res = await completion(params)
|
|
||||||
data = res.data
|
|
||||||
}
|
|
||||||
|
|
||||||
item.answer = getResult(data.answer)
|
item.answer = getResult(data.answer)
|
||||||
onSaveTemp(item)
|
onSaveTemp(item)
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -180,14 +141,14 @@ const getCompletion = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCompleteText = async (answer, index) => {
|
const handleCompleteText = async (answer, index) =>{
|
||||||
if (index < resultList.value.length - 1) {
|
if (index < resultList.value.length - 1) {
|
||||||
isStarted.value[index + 1] = true; // 开始显示下一个文本
|
isStarted.value[index + 1] = true; // 开始显示下一个文本
|
||||||
}
|
}
|
||||||
if (isAgain.value) {
|
if(isAgain.value){
|
||||||
try {
|
try{
|
||||||
await editTempResult({ id: resultList.value[index].resultId, content: answer })
|
await editTempResult({ id: resultList.value[index].resultId, content: answer })
|
||||||
} finally {
|
}finally{
|
||||||
isAgain.value = false
|
isAgain.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,26 +234,26 @@ const getTempResult = (id) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollToBottom = (height, index) => {
|
const scrollToBottom = (height,index) =>{
|
||||||
|
|
||||||
if (listRef.value) {
|
if (listRef.value) {
|
||||||
let sum = 0
|
let sum = 0
|
||||||
let listDom = listRef.value.children
|
let listDom = listRef.value.children
|
||||||
|
|
||||||
if (index == 0) {
|
if(index == 0){
|
||||||
// 220 去掉头部
|
// 220 去掉头部
|
||||||
let screenHeight = window.innerHeight - 220
|
let screenHeight = window.innerHeight - 220
|
||||||
if (height > screenHeight) {
|
if(height > screenHeight){
|
||||||
listRef.value.scrollTop = (height - screenHeight + 50)
|
listRef.value.scrollTop = (height - screenHeight + 50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else{
|
||||||
for (let i = 0; i < index; i++) {
|
for(let i = 0; i < index; i++){
|
||||||
sum += listDom[i].clientHeight
|
sum += listDom[i].clientHeight
|
||||||
}
|
}
|
||||||
listRef.value.scrollTop = sum + height
|
listRef.value.scrollTop = sum + height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 去掉字符串中的 ### **
|
// 去掉字符串中的 ### **
|
||||||
|
@ -304,14 +265,11 @@ let getResult = (str) => {
|
||||||
const params = reactive(
|
const params = reactive(
|
||||||
{
|
{
|
||||||
prompt: '',
|
prompt: '',
|
||||||
dataset_id: '',
|
dataset_id: ''
|
||||||
template: ''
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
const prompt = ref('')
|
|
||||||
|
|
||||||
|
const addAiPPT = async(res) => {
|
||||||
const addAiPPT = async (res) => {
|
|
||||||
let node = courseObj.node
|
let node = courseObj.node
|
||||||
pptDialog.value = false;
|
pptDialog.value = false;
|
||||||
if (!node) return msgUtils.msgWarning('请选择章节?')
|
if (!node) return msgUtils.msgWarning('请选择章节?')
|
||||||
|
@ -333,7 +291,7 @@ const addAiPPT = async (res) => {
|
||||||
// 转换图片|音频|视频 为线上地址
|
// 转换图片|音频|视频 为线上地址
|
||||||
let completed = 0
|
let completed = 0
|
||||||
const total = slides.length
|
const total = slides.length
|
||||||
for (let o of slides) {
|
for( let o of slides ) {
|
||||||
completed++
|
completed++
|
||||||
await toRousrceUrl(o)
|
await toRousrceUrl(o)
|
||||||
// 设置进度条
|
// 设置进度条
|
||||||
|
@ -342,14 +300,14 @@ const addAiPPT = async (res) => {
|
||||||
pgDialog.pg.percentage = 0
|
pgDialog.pg.percentage = 0
|
||||||
pgDialog.visible = false
|
pgDialog.visible = false
|
||||||
// 生成ppt课件-父级
|
// 生成ppt课件-父级
|
||||||
const p_params = { parentContent: JSON.stringify(content) }
|
const p_params = {parentContent: JSON.stringify(content)}
|
||||||
const parentid = await HTTP_SERVER_API('addEntpcoursefile', p_params)
|
const parentid = await HTTP_SERVER_API('addEntpcoursefile', p_params)
|
||||||
if (!!parentid ?? null) { // 生成内容幻灯片
|
if (!!parentid??null) { // 生成内容幻灯片
|
||||||
// 生成备课资源-Smarttalk
|
// 生成备课资源-Smarttalk
|
||||||
HTTP_SERVER_API('addSmarttalk', { fileId: parentid })
|
HTTP_SERVER_API('addSmarttalk',{fileId: parentid})
|
||||||
if (slides.length > 0) {
|
if (slides.length > 0) {
|
||||||
const resSlides = slides.map(({ id, ...slide }) => JSON.stringify(slide))
|
const resSlides = slides.map(({id, ...slide}) => JSON.stringify(slide))
|
||||||
const params = { parentid, filetype: 'slide', title: '', slides: resSlides }
|
const params = {parentid, filetype: 'slide', title: '', slides: resSlides }
|
||||||
const res_3 = await HTTP_SERVER_API('batchAddNew', params)
|
const res_3 = await HTTP_SERVER_API('batchAddNew', params)
|
||||||
if (res_3 && res_3.code == 200) {
|
if (res_3 && res_3.code == 200) {
|
||||||
msgUtils.msgSuccess('生成PPT课件成功')
|
msgUtils.msgSuccess('生成PPT课件成功')
|
||||||
|
@ -374,10 +332,10 @@ const againResult = async (index, item) => {
|
||||||
isAgain.value = true
|
isAgain.value = true
|
||||||
isStarted.value[index] = false
|
isStarted.value[index] = false
|
||||||
resultList.value[index].answer = ''
|
resultList.value[index].answer = ''
|
||||||
if (index == 0) {
|
if(index == 0){
|
||||||
listRef.value.scrollTop = 0
|
listRef.value.scrollTop = 0
|
||||||
|
|
||||||
} else {
|
}else{
|
||||||
scrollToBottom(50, index)
|
scrollToBottom(50, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,27 +343,8 @@ const againResult = async (index, item) => {
|
||||||
await nextTick()
|
await nextTick()
|
||||||
resultList.value[index].loading = true
|
resultList.value[index].loading = true
|
||||||
item.aiShow = true
|
item.aiShow = true
|
||||||
|
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}课标对${curNode.itemtitle}进行教学分析`
|
||||||
let str = cloneDeep(prompt.value)
|
const { data } = await completion(params)
|
||||||
str = str.replace(/{模板名称}/g, item.name)
|
|
||||||
params.prompt = str
|
|
||||||
params.template = item.prompt
|
|
||||||
|
|
||||||
let data = null;
|
|
||||||
// 教学大模型
|
|
||||||
if (mode.value == 1) {
|
|
||||||
const res = await sendChart({
|
|
||||||
content: params.prompt,
|
|
||||||
conversationId: conversation_id.value,
|
|
||||||
stream: false
|
|
||||||
})
|
|
||||||
data = res.data
|
|
||||||
} else {
|
|
||||||
// 知识库模型
|
|
||||||
const res = await completion(params)
|
|
||||||
data = res.data
|
|
||||||
}
|
|
||||||
|
|
||||||
resultList.value[index].answer = getResult(data.answer)
|
resultList.value[index].answer = getResult(data.answer)
|
||||||
isStarted.value[index] = true
|
isStarted.value[index] = true
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -447,12 +386,12 @@ const HTTP_SERVER_API = (type, params = {}) => {
|
||||||
fileFlag: 'aippt',
|
fileFlag: 'aippt',
|
||||||
fileShowName: node.itemtitle + '.aippt',
|
fileShowName: node.itemtitle + '.aippt',
|
||||||
textbookId: node.rootid,
|
textbookId: node.rootid,
|
||||||
levelFirstId: node.parentid || node.id,
|
levelFirstId: node.parentid||node.id,
|
||||||
levelSecondId: node.parentid && node.id,
|
levelSecondId: node.parentid && node.id,
|
||||||
fileSource: '个人',
|
fileSource: '个人',
|
||||||
fileRoot: '备课'
|
fileRoot: '备课'
|
||||||
}
|
}
|
||||||
return API_smarttalk.creatAPT({ ...def, ...params })
|
return API_smarttalk.creatAPT({...def, ...params})
|
||||||
}
|
}
|
||||||
case 'addEntpcourse': { // 添加课程
|
case 'addEntpcourse': { // 添加课程
|
||||||
const node = courseObj.node || {}
|
const node = courseObj.node || {}
|
||||||
|
@ -489,7 +428,7 @@ const HTTP_SERVER_API = (type, params = {}) => {
|
||||||
case 'getCourseList': { // 获取课程列表
|
case 'getCourseList': { // 获取课程列表
|
||||||
return API_entpcourse.listEntpcourse(params)
|
return API_entpcourse.listEntpcourse(params)
|
||||||
}
|
}
|
||||||
case 'getCourseFileList': { // 获取课程文件列表
|
case 'getCourseFileList':{ // 获取课程文件列表
|
||||||
return API_entpcoursefile.listEntpcoursefileNew(params)
|
return API_entpcoursefile.listEntpcoursefileNew(params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -516,7 +455,7 @@ const getDefParams = (params) => {
|
||||||
return Object.assign(def, params)
|
return Object.assign(def, params)
|
||||||
}
|
}
|
||||||
// 图片|音频|视频 转换为在线地址
|
// 图片|音频|视频 转换为在线地址
|
||||||
const toRousrceUrl = async (o) => {
|
const toRousrceUrl = async(o) => {
|
||||||
if (!!o.src) { // 如果有src就转换
|
if (!!o.src) { // 如果有src就转换
|
||||||
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
||||||
const isBlobUrl = /^blob:/.test(o.src)
|
const isBlobUrl = /^blob:/.test(o.src)
|
||||||
|
@ -530,28 +469,28 @@ const toRousrceUrl = async (o) => {
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append('file', file)
|
formData.append('file', file)
|
||||||
const res = await Api_server.Other.uploadFile(formData)
|
const res = await Api_server.Other.uploadFile(formData)
|
||||||
if (res && res.code == 200) {
|
if (res && res.code == 200){
|
||||||
const url = res?.url
|
const url = res?.url
|
||||||
url && (o.src = url)
|
url &&(o.src = url)
|
||||||
}
|
}
|
||||||
} else if (isBlobUrl) { // 视频和音频
|
} else if (isBlobUrl) { // 视频和音频
|
||||||
const res = await fetch(o.src)
|
const res = await fetch(o.src)
|
||||||
const blob = await res.blob()
|
const blob = await res.blob()
|
||||||
const fileName = o.type == 'video' ? Date.now() + '.mp4' : Date.now() + '.mp3'
|
const fileName = o.type=='video'? Date.now() + '.mp4':Date.now() + '.mp3'
|
||||||
const file = commUtils.blobToFile(blob, fileName)
|
const file = commUtils.blobToFile(blob, fileName)
|
||||||
// o.src = fileName
|
// o.src = fileName
|
||||||
// console.log('file', file)
|
// console.log('file', file)
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append('file', file)
|
formData.append('file', file)
|
||||||
const ress = await Api_server.Other.uploadFile(formData)
|
const ress = await Api_server.Other.uploadFile(formData)
|
||||||
if (ress && ress.code == 200) {
|
if (ress && ress.code == 200){
|
||||||
const url = ress?.url
|
const url = ress?.url
|
||||||
url && (o.src = url)
|
url &&(o.src = url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (o?.background?.image) await toRousrceUrl(o.background.image)
|
if (o?.background?.image) await toRousrceUrl(o.background.image)
|
||||||
if (o?.elements) {
|
if(o?.elements){
|
||||||
for (let element of o.elements) {
|
for (let element of o.elements) {
|
||||||
await toRousrceUrl(element);
|
await toRousrceUrl(element);
|
||||||
}
|
}
|
||||||
|
@ -559,27 +498,6 @@ const toRousrceUrl = async (o) => {
|
||||||
}
|
}
|
||||||
// ======== zdg end ============
|
// ======== zdg end ============
|
||||||
|
|
||||||
// 创建对话
|
|
||||||
const conversation_id = ref('')
|
|
||||||
const getChartId = () => {
|
|
||||||
createChart({ app_id: '712ff0df-ed6b-470f-bf87-8cfbaf757be5' }).then(res => {
|
|
||||||
localStorage.setItem("conversation_id", res.data.conversation_id);
|
|
||||||
conversation_id.value = res.data.conversation_id;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询prompt 替换
|
|
||||||
const getPrompt = async () => {
|
|
||||||
const { rows } = await modelList({ model: 5 })
|
|
||||||
let str = rows.find(item => item.name.indexOf('框架设计') != -1).prompt
|
|
||||||
str = str.replace('{学段}', curNode.edustage)
|
|
||||||
str = str.replace('{学科}', curNode.edusubject)
|
|
||||||
let bookV = curNode.roottitle.split('-')[1] + '版本'
|
|
||||||
str = str.replace('{教材版本}', bookV)
|
|
||||||
str = str.replace('{课程名称}', `《${curNode.itemtitle}》`)
|
|
||||||
prompt.value = str
|
|
||||||
}
|
|
||||||
|
|
||||||
const curNode = reactive({})
|
const curNode = reactive({})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
let data = sessionStore.get('subject.curNode')
|
let data = sessionStore.get('subject.curNode')
|
||||||
|
@ -588,15 +506,6 @@ onMounted(() => {
|
||||||
|
|
||||||
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
||||||
params.dataset_id = commUtils.dataSetJson[jsonKey]
|
params.dataset_id = commUtils.dataSetJson[jsonKey]
|
||||||
|
|
||||||
// 获取百度千帆会话ID
|
|
||||||
conversation_id.value = localStorage.getItem('conversation_id')
|
|
||||||
if (!conversation_id.value) {
|
|
||||||
getChartId();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取prompt
|
|
||||||
getPrompt()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -639,8 +548,7 @@ onUnmounted(() => {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
&::after{
|
||||||
&::after {
|
|
||||||
content: '';
|
content: '';
|
||||||
width: 15px;
|
width: 15px;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
|
@ -650,8 +558,7 @@ onUnmounted(() => {
|
||||||
left: -8px;
|
left: -8px;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
|
&::before{
|
||||||
&::before {
|
|
||||||
content: '';
|
content: '';
|
||||||
width: 2px;
|
width: 2px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -660,20 +567,17 @@ onUnmounted(() => {
|
||||||
left: -1px;
|
left: -1px;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
|
&:last-child{
|
||||||
&:last-child {
|
&::before{
|
||||||
&::before {
|
|
||||||
content: '';
|
content: '';
|
||||||
width: 0
|
width: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-top {
|
.item-top {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
|
.icon-shenglvehao{
|
||||||
.icon-shenglvehao {
|
|
||||||
font-weight: bold
|
font-weight: bold
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,8 +248,6 @@ defineExpose({ trigger })
|
||||||
position: fixed;
|
position: fixed;
|
||||||
// height: 90vh;
|
// height: 90vh;
|
||||||
// border: 1px solid;
|
// border: 1px solid;
|
||||||
z-index: 99;
|
|
||||||
pointer-events: none;
|
|
||||||
inset: auto auto 3em 1em;
|
inset: auto auto 3em 1em;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
|
Loading…
Reference in New Issue