Compare commits
21 Commits
2d0be935bf
...
64272467a2
Author | SHA1 | Date |
---|---|---|
zhangxuelin | 64272467a2 | |
zhengdegang | 792ab3284f | |
zdg | 38a50d18bf | |
zdg | 6fa0aa6e5f | |
zdg | b0fca4ad9b | |
lyc | 9381785991 | |
lyc | 28561b5016 | |
lyc | 2e2ebbd47f | |
baigl | 2b5b365e2f | |
白了个白 | 90ac7a49c7 | |
白了个白 | 75ddbf6f26 | |
白了个白 | de9235751f | |
zhengdegang | c33c0d923e | |
zdg | 94fa1a2457 | |
zdg | abce344d42 | |
zdg | 0d38a12094 | |
白了个白 | dfd53637be | |
白了个白 | c01a29bf3f | |
zhangxuelin | 436bdfe7c8 | |
zdg | cf7f985020 | |
zdg | 5d6c946e08 |
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* 统一处理消息 发送 避免找不到
|
||||
*/
|
||||
|
||||
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 ChatWs from '@/plugins/socket' // 聊天socket
|
||||
import msgUtils from '@/plugins/modal' // 消息工具
|
||||
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
|
||||
import emitter from '@/utils/mitt' //mitt 事件总线
|
||||
import { nextTick } from 'vue'
|
||||
|
||||
const slidesStore = useStore.useSlidesStore() // 幻灯片-状态管理
|
||||
const screenStore = useStore.useScreenStore() // 全屏-状态管理
|
||||
const classcourseStore = useStore.useClasscourseStore() // 课堂信息-状态管理
|
||||
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
|
||||
const execPlay = useExecPlay() // 播放控制
|
||||
|
||||
export class Classcourse {
|
||||
msgObj:ElMessageBox = null // 提示消息对象
|
||||
|
@ -23,10 +23,12 @@ export class Classcourse {
|
|||
constructor() {
|
||||
this.load()
|
||||
}
|
||||
// 延时
|
||||
sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||
/**
|
||||
* @description 加载
|
||||
*/
|
||||
load() {
|
||||
async load() {
|
||||
console.log('classcourse-load', classcourse)
|
||||
// 打开全屏
|
||||
const isCourse = !!classcourse
|
||||
|
@ -39,15 +41,12 @@ export class Classcourse {
|
|||
this.classcourse = classcourse // 课堂信息
|
||||
this.id = classcourse.id // 课堂id
|
||||
// 如果课堂信息有paging,则更新当前页码
|
||||
const isPaging = !!classcourse.paging
|
||||
if (isPaging) slidesStore.updateSlideIndex(classcourse.paging)
|
||||
const { paging, cartoonTimes } = classcourse
|
||||
const isPaging = !!paging || paging === 0
|
||||
// 如果课堂信息有paging,则更新动画播放状态
|
||||
const isAnim = !!classcourse.cartoonTimes
|
||||
if (isAnim) { // 动画播放
|
||||
for (let i = 0; i <= classcourse.cartoonTimes; i++) {
|
||||
execPlay.runAnimation(true) // 异步执行动画
|
||||
}
|
||||
}
|
||||
const isAnim = !!cartoonTimes || cartoonTimes === 0
|
||||
if (isPaging) slidesStore.updateSlideIndex(paging)
|
||||
if (isAnim) slidesStore.updateAnimationIndex(cartoonTimes+1)
|
||||
// 课堂信息-状态管理
|
||||
classcourseStore.setClasscourse(classcourse)
|
||||
// 待上课提示
|
||||
|
|
|
@ -258,6 +258,7 @@ export class PPTApi {
|
|||
}
|
||||
|
||||
export class Homework{
|
||||
static win: null // 作业弹窗
|
||||
// 作业弹窗
|
||||
static async showHomework(id: any) {
|
||||
let result = await getClassWorkList(id)
|
||||
|
@ -265,7 +266,14 @@ export class Homework{
|
|||
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
||||
toolStore.isTaskWin=true; // 设置打开批改窗口
|
||||
// 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
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* 点赞组件-相关
|
||||
*/
|
||||
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,8 +11,9 @@ import ChatWs from '@/plugins/socket' // 聊天socket
|
|||
import Classcourse from './classcourse' // 课程相关
|
||||
import msgUtils from '@/plugins/modal' // 消息工具
|
||||
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 hooksUpvote from './upvote' // 点赞-工具
|
||||
|
||||
/**
|
||||
* @description 监听器
|
||||
|
@ -22,7 +23,7 @@ export default () => {
|
|||
const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理
|
||||
const resource = sessionStore.get('curr.resource') // apt 资源
|
||||
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
|
||||
const execPlay = useExecPlay() // 播放控制
|
||||
const { execNext, turnPrevSlide } = useExecPlay()
|
||||
// 监听幻灯片内容变化
|
||||
watch(() => slidesStore.slides, (newVal, oldVal) => {
|
||||
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
|
||||
|
@ -36,7 +37,8 @@ export default () => {
|
|||
|
||||
// 监听幻灯片下标变化
|
||||
watch(() => slidesStore.slideIndex, (newVal, oldVal) => {
|
||||
PPTApi.updateWorkList()
|
||||
if (!!Classcourse.id) return // 上课状态,不更新右侧作业列表
|
||||
PPTApi.updateWorkList() // 更新作业列表
|
||||
})
|
||||
// 监听幻灯片下画布尺寸比例变化
|
||||
watch(() => slidesStore.viewportRatio, (newVal, oldVal) => {
|
||||
|
@ -97,8 +99,8 @@ export default () => {
|
|||
case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页
|
||||
const slideIndex = content?.current || 0
|
||||
const type = content?.animation
|
||||
if (type === 'Nextsteps') emitter.emit('useExecPlay', 'execNext') // 下一步
|
||||
else if (type === 'Previoustep') emitter.emit('useExecPlay', 'turnPrevSlide') // 上一步清空-动画
|
||||
if (type === 'Nextsteps') execNext(true) // 下一步-异步动画
|
||||
else if (type === 'Previoustep') turnPrevSlide() // 上一步清空-动画
|
||||
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
|
||||
break
|
||||
case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置
|
||||
|
@ -109,10 +111,10 @@ export default () => {
|
|||
close()
|
||||
break
|
||||
case MsgEnum.HEADS.MSG_dz: // 点赞
|
||||
emitter.emit('upvoteTrigger', 1)
|
||||
hooksUpvote.trigger(1)
|
||||
break
|
||||
case MsgEnum.HEADS.MSG_yh: // 疑惑
|
||||
emitter.emit('upvoteTrigger', 2)
|
||||
hooksUpvote.trigger(2)
|
||||
break
|
||||
case MsgEnum.HEADS.MSG_0010: // 备用
|
||||
break
|
||||
|
|
|
@ -3,16 +3,21 @@ import type { Classcourse } from '../api/types'
|
|||
|
||||
export interface ClasscourseState {
|
||||
classcourse: Classcourse | any, // 课堂信息
|
||||
isEmit: boolean, // 是否加载监听事件(动画播放)
|
||||
}
|
||||
|
||||
export const useClasscourseStore = defineStore('classcourse', {
|
||||
state: (): ClasscourseState => ({
|
||||
classcourse: null, // 课堂信息
|
||||
isEmit: false, // 是否加载监听事件(动画播放)
|
||||
}),
|
||||
|
||||
actions: {
|
||||
setClasscourse(classcourse: Classcourse) {
|
||||
this.classcourse = classcourse
|
||||
},
|
||||
setIsEmit(isEmit: boolean) {
|
||||
this.isEmit = isEmit
|
||||
},
|
||||
},
|
||||
})
|
|
@ -33,7 +33,8 @@ export interface SlidesState {
|
|||
slides: Slide[]
|
||||
slideIndex: number
|
||||
viewportSize: number
|
||||
viewportRatio: number
|
||||
viewportRatio: number,
|
||||
animationIndex: number, // 不是从0开始
|
||||
workList:Object[],
|
||||
workItem:Object[],
|
||||
}
|
||||
|
@ -46,6 +47,7 @@ export const useSlidesStore = defineStore('slides', {
|
|||
slideIndex: 0, // 当前页面索引
|
||||
viewportSize: 1000, // 可视区域宽度基数
|
||||
viewportRatio: 0.5625, // 可视区域比例,默认16:9
|
||||
animationIndex: 0, // 不是从0开始
|
||||
workList:[],// 活动的列表
|
||||
workItem:[],// 获取到的所有pptlist
|
||||
}),
|
||||
|
@ -206,6 +208,9 @@ export const useSlidesStore = defineStore('slides', {
|
|||
updateSlideIndex(index: number) {
|
||||
this.slideIndex = index
|
||||
},
|
||||
updateAnimationIndex(index: number) {
|
||||
this.animationIndex = index
|
||||
},
|
||||
|
||||
addElement(element: PPTElement | PPTElement[]) {
|
||||
const elements = Array.isArray(element) ? element : [element]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="left">
|
||||
<Popover trigger="click" placement="bottom-start" v-model:value="mainMenuVisible">
|
||||
<template #content>
|
||||
<FileInput accept=".pptist" @change="files => {
|
||||
<!-- <FileInput accept=".pptist" @change="files => {
|
||||
importSpecificFile(files)
|
||||
mainMenuVisible = false
|
||||
}">
|
||||
|
@ -14,7 +14,7 @@
|
|||
mainMenuVisible = false
|
||||
}">
|
||||
<PopoverMenuItem>导入 pptx 文件</PopoverMenuItem>
|
||||
</FileInput>
|
||||
</FileInput> -->
|
||||
<PopoverMenuItem @click="setDialogForExport('pptx')">导出文件</PopoverMenuItem>
|
||||
<PopoverMenuItem @click="resetSlides(); mainMenuVisible = false">重置幻灯片</PopoverMenuItem>
|
||||
<!-- <PopoverMenuItem @click="goLink('https://github.com/pipipi-pikachu/PPTist/issues')">意见反馈</PopoverMenuItem> -->
|
||||
|
|
|
@ -30,14 +30,10 @@
|
|||
@close="timerlVisible = false"
|
||||
/>
|
||||
|
||||
<div class="tools-left">
|
||||
<div class="tools-left" v-if="!classcourse">
|
||||
<IconLeftTwo class="tool-btn" theme="two-tone" :fill="['#111', '#fff']" @click="execPrev()" />
|
||||
<IconRightTwo class="tool-btn" theme="two-tone" :fill="['#111', '#fff']" @click="execNext()" />
|
||||
</div>
|
||||
<!-- 点赞组件 -->
|
||||
<div style="z-index: 999;position: absolute;top:10px">
|
||||
<upvote-vue ref="upvoteRef" type="2"></upvote-vue>
|
||||
</div>
|
||||
<div
|
||||
class="tools-right" :class="{ 'visible': rightToolsVisible }"
|
||||
@mouseleave="rightToolsVisible = false"
|
||||
|
@ -52,15 +48,16 @@
|
|||
<IconOffScreenOne class="tool-btn" v-tooltip="'退出全屏'" v-if="fullscreenState" @click="manualExitFullscreen()" />
|
||||
<IconFullScreenOne class="tool-btn" v-tooltip="'进入全屏'" v-else @click="enterFullscreen()" />
|
||||
<IconPower class="tool-btn" v-tooltip="'结束放映'" @click="exitScreening()" />
|
||||
<IconPower class="tool-btn close" v-if="chat.groupid" v-tooltip="'结束课堂'" @click="exitCourse()" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref , watchEffect} from 'vue'
|
||||
import { ref , watchEffect, onMounted, onUnmounted} from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSlidesStore ,useScreenStore} from '../../store'
|
||||
import { useSlidesStore ,useScreenStore, useClasscourseStore} from '../../store'
|
||||
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
||||
import { enterFullscreen } from '../../utils/fullscreen'
|
||||
import useScreening from '../../hooks/useScreening'
|
||||
|
@ -72,14 +69,15 @@ import ScreenSlideList from './ScreenSlideList.vue'
|
|||
import SlideThumbnails from './SlideThumbnails.vue'
|
||||
import WritingBoardTool from './WritingBoardTool.vue'
|
||||
import CountdownTimer from './CountdownTimer.vue'
|
||||
import upvoteVue from '@/views/tool/components/upvote.vue' // 点赞-子组件
|
||||
import emitter from '@/utils/mitt';
|
||||
import Chat from '../../api/chat' // 聊天
|
||||
|
||||
const props = defineProps<{
|
||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||
}>()
|
||||
|
||||
const { slides, slideIndex } = storeToRefs(useSlidesStore())
|
||||
const { classcourse, isEmit } = storeToRefs(useClasscourseStore()) // 课堂信息
|
||||
|
||||
const {
|
||||
autoPlayTimer,
|
||||
|
@ -103,13 +101,13 @@ const {
|
|||
const { slideWidth, slideHeight } = useSlideSize()
|
||||
const { exitScreening } = useScreening()
|
||||
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
||||
const chat:any = Chat() // 聊天室
|
||||
|
||||
const rightToolsVisible = ref(false)
|
||||
const writingBoardToolVisible = ref(false)
|
||||
const timerlVisible = ref(false)
|
||||
const slideThumbnailModelVisible = ref(false)
|
||||
const laserPen = ref(false)
|
||||
const upvoteRef = ref(null)
|
||||
const screenStore =useScreenStore()
|
||||
const contextmenus = (): ContextmenuItem[] => {
|
||||
return [
|
||||
|
@ -192,42 +190,13 @@ const contextmenus = (): ContextmenuItem[] => {
|
|||
},
|
||||
]
|
||||
}
|
||||
// 打开点赞或者疑问 1点赞 2疑问
|
||||
emitter.on('upvoteTrigger', (type) => {
|
||||
upvoteRef.value?.trigger(type)
|
||||
});
|
||||
// zdg: 使用方法才生效
|
||||
const execPlay = {
|
||||
autoPlayTimer,
|
||||
autoPlay,
|
||||
closeAutoPlay,
|
||||
autoPlayInterval,
|
||||
setAutoPlayInterval,
|
||||
loopPlay,
|
||||
setLoopPlay,
|
||||
mousewheelListener,
|
||||
touchStartListener,
|
||||
touchEndListener,
|
||||
turnPrevSlide,
|
||||
turnNextSlide,
|
||||
turnSlideToIndex,
|
||||
turnSlideToId,
|
||||
execPrev,
|
||||
execNext,
|
||||
animationIndex,
|
||||
}
|
||||
emitter.on('useExecPlay', (data: string|any) => {
|
||||
if (!data) throw new Error('参数错误')
|
||||
if (typeof data === 'string') { // 字符串
|
||||
if (execPlay[data]) execPlay[data]()
|
||||
else throw new Error('方法不存在')
|
||||
} else { // 对象
|
||||
const { method, ...params } = data || {}
|
||||
if (execPlay[method]) execPlay[method](...params)
|
||||
else throw new Error('方法不存在')
|
||||
}
|
||||
})
|
||||
|
||||
// 下课
|
||||
const exitCourse = async () => {
|
||||
// console.log('下课', chat)
|
||||
await chat.exitCourse() // 下课消息
|
||||
exitScreening() // 结束放映
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -309,6 +278,9 @@ emitter.on('useExecPlay', (data: string|any) => {
|
|||
& + .tool-btn {
|
||||
margin-left: 15px;
|
||||
}
|
||||
&.close{
|
||||
color: #d14424;
|
||||
}
|
||||
}
|
||||
.page-number {
|
||||
font-size: 13px;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
</div>
|
||||
<Divider class="divider" />
|
||||
<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 class="content">
|
||||
|
@ -55,7 +56,7 @@
|
|||
:class="{ 'active': index === slideIndex }"
|
||||
v-for="(slide, index) in slides"
|
||||
:key="slide.id"
|
||||
@click="turnSlideToIndex(index)"
|
||||
@click="turnSlideTo(index, $event)"
|
||||
>
|
||||
<ThumbnailSlide :slide="slide" :size="120 / viewportRatio" :visible="index < slidesLoadLimit" />
|
||||
</div>
|
||||
|
@ -77,9 +78,9 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, nextTick, ref, watch } from 'vue'
|
||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSlidesStore } from '../../store'
|
||||
import { useSlidesStore, useClasscourseStore } from '../../store'
|
||||
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
||||
import { enterFullscreen } from '../../utils/fullscreen'
|
||||
import { parseText2Paragraphs } from '../../utils/textParser'
|
||||
|
@ -94,12 +95,15 @@ import ScreenSlideList from './ScreenSlideList.vue'
|
|||
import WritingBoardTool from './WritingBoardTool.vue'
|
||||
import CountdownTimer from './CountdownTimer.vue'
|
||||
import Divider from '../../components/Divider.vue'
|
||||
import emitter from '@/utils/mitt';
|
||||
import Chat from '../../api/chat' // 聊天
|
||||
|
||||
const props = defineProps<{
|
||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||
}>()
|
||||
|
||||
const { slides, slideIndex, viewportRatio, currentSlide } = storeToRefs(useSlidesStore())
|
||||
const { classcourse, isEmit } = storeToRefs(useClasscourseStore()) // 课堂信息
|
||||
|
||||
const slideListWrapRef = ref<HTMLElement>()
|
||||
const thumbnailsRef = ref<HTMLElement>()
|
||||
|
@ -117,17 +121,31 @@ const {
|
|||
turnSlideToId,
|
||||
animationIndex,
|
||||
} = useExecPlay()
|
||||
|
||||
const { slideWidth, slideHeight } = useSlideSize(slideListWrapRef)
|
||||
const { exitScreening } = useScreening()
|
||||
const { slidesLoadLimit } = useLoadSlides()
|
||||
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
||||
const chat:any = Chat() // 聊天室
|
||||
|
||||
const remarkFontSize = ref(16)
|
||||
const currentSlideRemark = computed(() => {
|
||||
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) => {
|
||||
if (!thumbnailsRef.value) return
|
||||
thumbnailsRef.value.scrollBy(e.deltaY, 0)
|
||||
|
@ -192,6 +210,7 @@ const contextmenus = (): ContextmenuItem[] => {
|
|||
},
|
||||
]
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -208,7 +227,7 @@ const contextmenus = (): ContextmenuItem[] => {
|
|||
background-color: #fff;
|
||||
border-right: solid 1px #eee;
|
||||
font-size: 12px;
|
||||
margin: 20px 0;
|
||||
padding: 20px 0;
|
||||
|
||||
.tool-btn {
|
||||
display: flex;
|
||||
|
@ -224,6 +243,9 @@ const contextmenus = (): ContextmenuItem[] => {
|
|||
&:hover, &.active {
|
||||
color: $themeColor;
|
||||
}
|
||||
&.close{
|
||||
color: #d14424;
|
||||
}
|
||||
}
|
||||
|
||||
.divider {
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
import { onMounted, onUnmounted, ref } from 'vue'
|
||||
import { throttle } from 'lodash'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSlidesStore } from '../../../store'
|
||||
import { useSlidesStore, useClasscourseStore } from '../../../store'
|
||||
import { KEYS } from '../../../configs/hotkey'
|
||||
import { ANIMATION_CLASS_PREFIX } from '../../../configs/animation'
|
||||
import message from '../../../utils/message'
|
||||
import emitter from '@/utils/mitt';
|
||||
|
||||
export default () => {
|
||||
const slidesStore = useSlidesStore()
|
||||
const { slides, slideIndex, formatedAnimations } = storeToRefs(slidesStore)
|
||||
const classcourseStore = useClasscourseStore() // 课堂信息-状态管理
|
||||
const { slides, slideIndex, formatedAnimations, animationIndex } = storeToRefs(slidesStore)
|
||||
|
||||
// 当前页的元素动画执行到的位置
|
||||
const animationIndex = ref(0)
|
||||
// const animationIndex = ref(0)
|
||||
|
||||
// 动画执行状态
|
||||
const inAnimation = ref(false)
|
||||
|
@ -121,9 +123,9 @@ export default () => {
|
|||
// 遇到元素动画时,优先执行动画播放,无动画则执行翻页
|
||||
// 向上播放遇到动画时,仅撤销到动画执行前的状态,不需要反向播放动画
|
||||
// 撤回到上一页时,若该页从未播放过(意味着不存在动画状态),需要将动画索引置为最小值(初始状态),否则置为最大值(最终状态)
|
||||
const execPrev = () => {
|
||||
const execPrev = (isAsync: boolean) => {
|
||||
if (formatedAnimations.value.length && animationIndex.value > 0) {
|
||||
revokeAnimation()
|
||||
revokeAnimation(isAsync)
|
||||
}
|
||||
else if (slideIndex.value > 0) {
|
||||
slidesStore.updateSlideIndex(slideIndex.value - 1)
|
||||
|
@ -139,9 +141,10 @@ export default () => {
|
|||
}
|
||||
inAnimation.value = false
|
||||
}
|
||||
const execNext = () => {
|
||||
const execNext = (isAsync: boolean) => {
|
||||
console.log('execNext', isAsync)
|
||||
if (formatedAnimations.value.length && animationIndex.value < formatedAnimations.value.length) {
|
||||
runAnimation()
|
||||
runAnimation(isAsync)
|
||||
}
|
||||
else if (slideIndex.value < slides.value.length - 1) {
|
||||
slidesStore.updateSlideIndex(slideIndex.value + 1)
|
||||
|
@ -173,7 +176,13 @@ export default () => {
|
|||
}
|
||||
|
||||
// 鼠标滚动翻页
|
||||
const mousewheelListener = throttle(function(e: WheelEvent) {
|
||||
const mousewheelListener = (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')
|
||||
else if (e.deltaY > 0) turning(e, 'next')
|
||||
}, 500, { leading: true, trailing: false })
|
||||
|
@ -203,6 +212,8 @@ export default () => {
|
|||
// 向上翻页/向下翻页
|
||||
const turning = (e, type) => {
|
||||
e.preventDefault() // 阻止默认事件
|
||||
// 课堂信息存在时,不允许翻页
|
||||
if (!!classcourseStore.classcourse) return
|
||||
if (type === 'prev') execPrev()
|
||||
else if (type === 'next') execNext()
|
||||
}
|
||||
|
@ -220,8 +231,8 @@ export default () => {
|
|||
) turning(e, 'next')
|
||||
}
|
||||
|
||||
onMounted(() => document.addEventListener('keydown', keydownListener))
|
||||
onUnmounted(() => document.removeEventListener('keydown', keydownListener))
|
||||
onMounted(() => {document.addEventListener('keydown', keydownListener)})
|
||||
onUnmounted(() => {document.removeEventListener('keydown', keydownListener)})
|
||||
|
||||
// 切换到上一张/上一张幻灯片(无视元素的入场动画)
|
||||
const turnPrevSlide = () => {
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
<div class="pptist-screen">
|
||||
<BaseView :changeViewMode="changeViewMode" v-if="viewMode === 'base'" />
|
||||
<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>
|
||||
</template>
|
||||
|
||||
|
@ -9,9 +13,11 @@
|
|||
import { onMounted, onUnmounted, ref } from 'vue'
|
||||
import { KEYS } from '../../configs/hotkey'
|
||||
import useScreening from '../../hooks/useScreening'
|
||||
import hooksUpvote from '../../api/upvote' // 点赞-工具
|
||||
|
||||
import BaseView from './BaseView.vue'
|
||||
import PresenterView from './PresenterView.vue'
|
||||
import upvoteVue from '@/views/tool/components/upvote.vue' // 点赞-子组件
|
||||
|
||||
const viewMode = ref<'base' | 'presenter'>('base')
|
||||
|
||||
|
@ -20,6 +26,8 @@ const changeViewMode = (mode: 'base' | 'presenter') => {
|
|||
}
|
||||
|
||||
const { exitScreening } = useScreening()
|
||||
const upvoteRef = ref(null)
|
||||
hooksUpvote.init(upvoteRef) // 初始化点赞
|
||||
|
||||
// 快捷键退出放映
|
||||
const keydownListener = (e: KeyboardEvent) => {
|
||||
|
|
|
@ -10,11 +10,10 @@ export const createChart = ({ headers, data }) => {
|
|||
})
|
||||
}
|
||||
// 大模型对话
|
||||
export const sendChart = ({ headers, data }) => {
|
||||
export const sendChart = (data) => {
|
||||
return request({
|
||||
url: '/qf/sendTalk',
|
||||
method: 'post',
|
||||
headers,
|
||||
data,
|
||||
})
|
||||
}
|
|
@ -30,7 +30,7 @@
|
|||
</div>
|
||||
</el-scrollbar>
|
||||
<div class="file-list">
|
||||
<el-dropdown @command="changeFile">
|
||||
<el-dropdown @command="changeFile" v-if="type == 3">
|
||||
<span class="el-dropdown-link">
|
||||
{{ curFile.fileName }}
|
||||
<i class="iconfont icon-xiangxia"></i>
|
||||
|
@ -54,7 +54,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { ref, reactive, onMounted, onUnmounted } from 'vue'
|
||||
import { completion, docList } from '@/api/mode/index'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { dataSetJson } from '@/utils/comm.js'
|
||||
|
@ -71,7 +71,7 @@ const props = defineProps({
|
|||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return { name: '11' }
|
||||
return { name: '' }
|
||||
}
|
||||
},
|
||||
type: {
|
||||
|
@ -125,19 +125,6 @@ const saveAdjust = (item) =>{
|
|||
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 dataset_id = ref('')
|
||||
|
@ -160,11 +147,12 @@ const changeFile = (val) =>{
|
|||
params.document_ids = val.docId
|
||||
}
|
||||
|
||||
|
||||
const modeType = ref('')
|
||||
onMounted(() => {
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
|
||||
Object.assign(curNode, data);
|
||||
|
||||
modeType.value = props.type == 1 ? '课标' : props.type == 2 ? '教材' : '考试'
|
||||
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
||||
params.dataset_id = dataSetJson[jsonKey]
|
||||
if(props.type == 3){
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<div>
|
||||
<div class="flex">
|
||||
<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>
|
||||
|
@ -52,7 +55,8 @@
|
|||
<i class="iconfont icon-ai"></i>
|
||||
</div>
|
||||
<div class="item-answer">
|
||||
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow" @complete="handleCompleteText($event,index)" @updateScroll="scrollToBottom($event,index)" />
|
||||
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow"
|
||||
@complete="handleCompleteText($event, index)" @updateScroll="scrollToBottom($event, index)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="ai-btn" v-if="item.answer">
|
||||
|
@ -86,6 +90,7 @@
|
|||
import { ref, reactive, onMounted, onUnmounted, nextTick } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { tempSave, completion, modelList, removeChildTemp, tempResult, editTempResult } from '@/api/mode/index'
|
||||
import { createChart, sendChart } from '@/api/ai/index'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import keywordDialog from './keyword-dialog.vue';
|
||||
import AdjustDialog from './adjust-dialog.vue'
|
||||
|
@ -94,10 +99,23 @@ import TypingEffect from '@/components/typing-effect/index.vue'
|
|||
import useUserStore from '@/store/modules/user'
|
||||
import emitter from '@/utils/mitt';
|
||||
import { dataSetJson } from '@/utils/comm.js'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
const props = defineProps(['type'])
|
||||
const { user } = useUserStore()
|
||||
|
||||
const curMode = ref(1)
|
||||
const modeOptions = ref([
|
||||
{
|
||||
label: '教学大模型',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '知识库模型',
|
||||
value: 2
|
||||
}
|
||||
])
|
||||
|
||||
/*****************提示词相关****************/
|
||||
|
||||
/**
|
||||
|
@ -252,7 +270,6 @@ const removeItem = async (item, isChild) => {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Ai对话调整
|
||||
const curIndex = ref(-1)
|
||||
const isAdjust = ref(false)
|
||||
|
@ -277,6 +294,7 @@ const params = reactive(
|
|||
dataset_id: ''
|
||||
}
|
||||
)
|
||||
const prompt = ref('')
|
||||
|
||||
// 重新研读
|
||||
const isAgain = ref(false)
|
||||
|
@ -296,8 +314,28 @@ const againResult = async (index, item) => {
|
|||
await nextTick()
|
||||
childTempList.value[index].loading = true
|
||||
item.aiShow = true
|
||||
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
||||
const { data } = await completion(params)
|
||||
|
||||
let str = cloneDeep(prompt.value)
|
||||
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);
|
||||
isStarted.value[index] = true
|
||||
|
||||
|
@ -305,6 +343,7 @@ const againResult = async (index, item) => {
|
|||
childTempList.value[index].loading = false
|
||||
}
|
||||
}
|
||||
|
||||
// 一键研读
|
||||
const getCompletion = async () => {
|
||||
isStarted.value = new Array(childTempList.length).fill(false)
|
||||
|
@ -320,8 +359,27 @@ const getCompletion = async () => {
|
|||
try {
|
||||
item.loading = true
|
||||
item.aiShow = true
|
||||
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
||||
const { data } = await completion(params)
|
||||
let str = cloneDeep(prompt.value)
|
||||
str = str.replace('{模板标题}',item.name)
|
||||
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)
|
||||
onSaveTemp(item)
|
||||
} finally {
|
||||
|
@ -386,6 +444,30 @@ 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 modeType = ref('')
|
||||
onMounted(() => {
|
||||
|
@ -396,6 +478,15 @@ onMounted(() => {
|
|||
getTemplateList()
|
||||
let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}`
|
||||
params.dataset_id = dataSetJson[jsonKey]
|
||||
// 获取百度千帆会话ID
|
||||
conversation_id.value = localStorage.getItem('conversation_id')
|
||||
if (!conversation_id.value) {
|
||||
getChartId();
|
||||
}
|
||||
|
||||
// 获取prompt
|
||||
getPrompt()
|
||||
|
||||
})
|
||||
|
||||
// 解绑
|
||||
|
|
|
@ -167,9 +167,6 @@ export class ChatWs {
|
|||
return new Promise((resolve, reject) => {
|
||||
this.sendMsg('closed', '下课', null, 'group', id)
|
||||
resolve()
|
||||
// setTimeout(() => {
|
||||
// this.close() // 关闭链接
|
||||
// }, 1000);
|
||||
})
|
||||
}
|
||||
// 延时 ms 毫秒
|
||||
|
|
|
@ -83,7 +83,7 @@ export const constantRoutes = [
|
|||
path: 'questionUpload',
|
||||
component: () => import('@/views/classTask/newClassTaskAssign/questionUpload/index.vue'),
|
||||
name: 'questionUpload',
|
||||
meta: { title: '习题上传' }
|
||||
meta: { title: '习题上传', showBread: true }
|
||||
},
|
||||
{
|
||||
path: 'aiKolors',
|
||||
|
|
|
@ -5,6 +5,7 @@ import { JYApiListCT, JYApiListOriginYear, JYApiListSO} from "@/utils/examQuesti
|
|||
|
||||
const useClassTaskStore = defineStore('classTask',{
|
||||
state: () => ({
|
||||
isOpenQuestUploadView: false, // 是否打开习题上传的页面
|
||||
classListIds: [],
|
||||
entpCourseWorkTypeList: [
|
||||
{value: 0, label: "不限"},
|
||||
|
|
|
@ -225,7 +225,7 @@ export const createWindow = async (type, data) => {
|
|||
.filter(k => typeof data[k] === 'function')
|
||||
.forEach(k => events[k] = data[k])
|
||||
eventHandles(type, win, events) // 事件监听处理
|
||||
break
|
||||
return win
|
||||
}
|
||||
default:
|
||||
break
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
</div>
|
||||
<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-tag>APT</el-tag>
|
||||
<!-- <el-tag>APT</el-tag> -->
|
||||
<el-tag>AIPPT</el-tag>
|
||||
</div>
|
||||
<div style="min-width: 150px;"><span> 浏览:25955 点赞:26605</span></div>
|
||||
</div>
|
||||
|
@ -85,6 +86,7 @@ const chatSend = () => {
|
|||
<style scoped lang="scss">
|
||||
.class-reserv-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
padding: 5px;
|
||||
|
@ -110,7 +112,7 @@ const chatSend = () => {
|
|||
}
|
||||
}
|
||||
.class-reserv-item-tool {
|
||||
margin-left: 15px;
|
||||
margin: 0 7px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
|
|
@ -149,10 +149,14 @@ import { useGetHomework } from '@/hooks/useGetHomework'
|
|||
import { sessionStore } from '@/utils/store'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import useClassTaskStore from '@/store/modules/classTask'
|
||||
|
||||
const userStore = useUserStore().user
|
||||
const route = useRoute();
|
||||
const router = useRouter()
|
||||
const { proxy } = getCurrentInstance()
|
||||
const useClassTaskStores = useClassTaskStore();
|
||||
|
||||
const props = defineProps({
|
||||
currentCourse: Object,
|
||||
})
|
||||
|
@ -189,6 +193,7 @@ const boardLoading = ref(false);
|
|||
const fileLoading = ref(false); // 常规作业loading
|
||||
|
||||
onMounted(() => {
|
||||
console.log("----onMounted-------")
|
||||
currentRow.value = {id:0};
|
||||
if(propsQueryCourseObj){
|
||||
if(JSON.parse(propsQueryCourseObj)){
|
||||
|
@ -216,7 +221,28 @@ onMounted(() => {
|
|||
}
|
||||
}
|
||||
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) => {
|
||||
if(newVal){
|
||||
courseObj.textbookId = newVal.textbookId // 版本
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
<script setup>
|
||||
import "vue-cropper/dist/index.css";
|
||||
import { VueCropper } from "vue-cropper";
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick, onUnmounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
|
@ -88,6 +88,8 @@ import { useRouter, useRoute } from 'vue-router'
|
|||
|
||||
import { ocrImg2ExamByManualUpl, ocrImg2ItemByManualUpl } from "@/views/classTask/newClassTaskAssign/questionUpload/ocrImg2ExamQues";
|
||||
import QuesItem from "@/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue";
|
||||
import useClassTaskStore from '@/store/modules/classTask'
|
||||
|
||||
|
||||
// const Remote = require('@electron/remote')
|
||||
// const fs = require('fs');
|
||||
|
@ -96,7 +98,9 @@ import useUserStore from '@/store/modules/user'
|
|||
const userStore = useUserStore().user
|
||||
const route = useRoute();
|
||||
const router = useRouter()
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { proxy } = getCurrentInstance();
|
||||
const useClassTaskStores = useClassTaskStore();
|
||||
|
||||
const props = defineProps({
|
||||
})
|
||||
|
||||
|
@ -151,6 +155,7 @@ const cropOption = reactive({
|
|||
|
||||
|
||||
onMounted(() => {
|
||||
useClassTaskStores.isOpenQuestUploadView = true; // 打开过习题上传界面
|
||||
console.log('propsQueryCourseObj', JSON.parse(propsQueryCourseObj));
|
||||
if(propsQueryCourseObj&&JSON.parse(propsQueryCourseObj)){
|
||||
courseObj.textbookId = JSON.parse(propsQueryCourseObj).bookObj // 版本
|
||||
|
@ -161,7 +166,13 @@ onMounted(() => {
|
|||
}
|
||||
initHomeWork();
|
||||
})
|
||||
|
||||
onUnmounted(()=>{
|
||||
// 延迟1s 关闭习题上传界面,作业管理界面需要根据 isOpenQuestUploadView 来进行判断
|
||||
setTimeout(()=>{
|
||||
useClassTaskStores.isOpenQuestUploadView = false; // 关闭习题上传界面
|
||||
console.log('onUnmounted 习题上传');
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取 entpcourseid 获取作业列表
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { ElMessageBox, ElMessage } from "element-plus";
|
||||
import qs from "qs";
|
||||
import axios from 'axios'
|
||||
import request from '@/utils/request'
|
||||
import { pyOCRAPI } from "@/api/education/entpcoursework";
|
||||
|
||||
|
||||
|
@ -16,6 +17,13 @@ const baidubceConfig = {
|
|||
'client_secret': 'oWb0M0YWMmZPMQIhIUkJX99ddr7h61qf',
|
||||
};
|
||||
|
||||
export function getOcrContent(data) {
|
||||
return request({
|
||||
url: '/ocr/exam',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -226,30 +234,36 @@ const ocrImg2Json = async (urlBase64) => {
|
|||
ElMessage.error("未检测到截图图片, 请截取图片后再识别");
|
||||
return null;
|
||||
}
|
||||
const resToken = await bdyAPI_getToken();
|
||||
if (resToken.status !== 200) {
|
||||
ElMessage.error("百度智能云用户标识有误");
|
||||
return null;
|
||||
}
|
||||
|
||||
const token = resToken.data?.access_token;
|
||||
let base64Code = urlBase64.split(",")[1];
|
||||
const query = {
|
||||
image: base64Code, //图片地址(base64)
|
||||
line_probability: false, //是否返回每行识别结果的置信度。默认为false
|
||||
disp_line_poly: false, //是否返回每行的四角点坐标。默认为false
|
||||
words_type: 'handprint_mix', //文字类型。 默认:印刷文字识别 = handwring_only:手写文字识别 = handprint_mix: 手写印刷混排识别
|
||||
layout_analysis: false, //是否分析文档版面:包括layout(图、表、标题、段落、目录);attribute(栏、页眉、页脚、页码、脚注)的分析输出
|
||||
recg_long_division: false, //是否检测并识别手写竖式
|
||||
recg_formula: true, //控制是否检测并识别公式,默认为false
|
||||
}
|
||||
|
||||
|
||||
const resOcr = await bdyAPI_getOcrContent(token, base64Code, query);
|
||||
if (resOcr.status !== 200) {
|
||||
ElMessage.error("百度智能云图片识别错误");
|
||||
const resOcr = await getOcrContent({ base64Code: base64Code });
|
||||
if (resOcr.code !== 200) {
|
||||
ElMessage.error("图片识别错误");
|
||||
return null;
|
||||
}
|
||||
// const resToken = await bdyAPI_getToken();
|
||||
// if (resToken.status !== 200) {
|
||||
// ElMessage.error("百度智能云用户标识有误");
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// const token = resToken.data?.access_token;
|
||||
// let base64Code = urlBase64.split(",")[1];
|
||||
// const query = {
|
||||
// image: base64Code, //图片地址(base64)
|
||||
// line_probability: false, //是否返回每行识别结果的置信度。默认为false
|
||||
// disp_line_poly: false, //是否返回每行的四角点坐标。默认为false
|
||||
// words_type: 'handprint_mix', //文字类型。 默认:印刷文字识别 = handwring_only:手写文字识别 = handprint_mix: 手写印刷混排识别
|
||||
// layout_analysis: false, //是否分析文档版面:包括layout(图、表、标题、段落、目录);attribute(栏、页眉、页脚、页码、脚注)的分析输出
|
||||
// recg_long_division: false, //是否检测并识别手写竖式
|
||||
// recg_formula: true, //控制是否检测并识别公式,默认为false
|
||||
// }
|
||||
|
||||
|
||||
// const resOcr = await bdyAPI_getOcrContent(token, base64Code, query);
|
||||
// if (resOcr.status !== 200) {
|
||||
// ElMessage.error("百度智能云图片识别错误");
|
||||
// return null;
|
||||
// }
|
||||
|
||||
return resOcr;
|
||||
}
|
||||
|
|
|
@ -163,8 +163,10 @@ import quizStats from '@/views/classTask/container/quizStats.vue'
|
|||
import ClassOverview from '@/views/classTask/container/classOverview.vue'
|
||||
import {sessionStore} from '@/utils/store'
|
||||
// import Chat from '@/utils/chat' // im 登录初始化
|
||||
import { Homework } from '@/AixPPTist/src/api/index'
|
||||
import MsgEnum from '@/plugins/imChat/msgEnum' // im 消息枚举
|
||||
import ChatWs from '@/plugins/socket' // 聊天socket
|
||||
import { set } from 'lodash'
|
||||
if (!ChatWs.ws) ChatWs.init()
|
||||
const { proxy } = getCurrentInstance()
|
||||
const emit = defineEmits(['cle-click'])
|
||||
|
@ -719,14 +721,17 @@ const msgHandle = (msg) => {
|
|||
const { head, content, ...other } = msg
|
||||
switch(head) {
|
||||
case MsgEnum.HEADS.MSG_closed: // 下课:
|
||||
Homework.win = null
|
||||
window.close() // 关闭窗口
|
||||
break
|
||||
case MsgEnum.HEADS.MSG_finishHomework: // 跟新作业:
|
||||
console.log('更新作业', head, content)
|
||||
const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
|
||||
openDialog(data, false);
|
||||
break
|
||||
case MsgEnum.HEADS.MSG_slideFlapping: // 切换页面
|
||||
console.log('切换页面-关闭窗口')
|
||||
Homework.win = null
|
||||
window.close() // 关闭窗口
|
||||
break
|
||||
// case 'TIMAddRecvNewMsgCallback': // 收到新消息 data=[]
|
||||
|
@ -769,7 +774,7 @@ onMounted(() => {
|
|||
console.log('socket监听消息')
|
||||
ChatWs.watch((msg, e) => {
|
||||
try {
|
||||
msgHandle(JSON.parse(msg))
|
||||
msgHandle(JSON.parse(msg)?.msg)
|
||||
} catch (error) {
|
||||
console.error('socket 解析异常 ', error, e)
|
||||
msgHandle(msg)
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
</el-button>
|
||||
</div>
|
||||
<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">生成大纲</el-button>
|
||||
<el-button type="danger" @click="pptDialog = true">生成PPT</el-button>
|
||||
|
@ -35,7 +38,8 @@
|
|||
<div class="item-prompt">{{ item.prompt }}</div>
|
||||
<div class="item-answer" v-if="item.answer">
|
||||
<div class="answer-text">
|
||||
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow" @complete="handleCompleteText($event,index)" @updateScroll="scrollToBottom($event,index)" />
|
||||
<TypingEffect v-if="isStarted[index]" :text="item.answer" :delay="10" :aiShow="item.aiShow"
|
||||
@complete="handleCompleteText($event, index)" @updateScroll="scrollToBottom($event, index)" />
|
||||
</div>
|
||||
<div class="item-btn flex">
|
||||
<el-button type="primary" link @click="againResult(index, item)">
|
||||
|
@ -73,12 +77,14 @@ import emitter from '@/utils/mitt'
|
|||
import EditDialog from './edit-dialog.vue'
|
||||
import AdjustDialog from './adjust-dialog.vue'
|
||||
import progressDialog from './progress-dialog.vue'
|
||||
import { completion, tempResult, tempSave, removeChildTemp, editTempResult } from '@/api/mode/index.js'
|
||||
import { completion, tempResult, tempSave, removeChildTemp, editTempResult, modelList } from '@/api/mode/index.js'
|
||||
import { createChart, sendChart } from '@/api/ai/index'
|
||||
// import { dataSetJson } from '@/utils/comm.js'
|
||||
import * as commUtils from '@/utils/comm.js'
|
||||
import PptDialog from '@/views/prepare/container/pptist-dialog.vue'
|
||||
import keywordDialog from './keyword-dialog.vue'
|
||||
import TypingEffect from '@/components/typing-effect/index.vue'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { PPTXFileToJson } from '@/AixPPTist/src/hooks/useImport' // ppt转json
|
||||
|
@ -110,6 +116,19 @@ const pgDialog = reactive({ // 弹窗-进度条
|
|||
]
|
||||
}
|
||||
})
|
||||
|
||||
const curMode = ref(1)
|
||||
const modeOptions = ref([
|
||||
{
|
||||
label: '教学大模型',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '知识库模型',
|
||||
value: 2
|
||||
}
|
||||
])
|
||||
|
||||
emitter.on('changeMode', (item) => {
|
||||
resultList.value = item.child
|
||||
getTempResult(item.id)
|
||||
|
@ -131,8 +150,28 @@ const getCompletion = async () => {
|
|||
try {
|
||||
item.loading = true
|
||||
item.aiShow = true
|
||||
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject} 对${curNode.itemtitle}进行教学分析`
|
||||
const { data } = await completion(params)
|
||||
|
||||
let str = cloneDeep(prompt.value)
|
||||
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)
|
||||
onSaveTemp(item)
|
||||
} finally {
|
||||
|
@ -265,9 +304,12 @@ let getResult = (str) => {
|
|||
const params = reactive(
|
||||
{
|
||||
prompt: '',
|
||||
dataset_id: ''
|
||||
dataset_id: '',
|
||||
template: ''
|
||||
}
|
||||
)
|
||||
const prompt = ref('')
|
||||
|
||||
|
||||
const addAiPPT = async (res) => {
|
||||
let node = courseObj.node
|
||||
|
@ -343,8 +385,27 @@ const againResult = async (index, item) => {
|
|||
await nextTick()
|
||||
resultList.value[index].loading = true
|
||||
item.aiShow = true
|
||||
params.prompt = `按照${item.prompt}的要求,针对${curNode.edustage}${curNode.edusubject}课标对${curNode.itemtitle}进行教学分析`
|
||||
const { data } = await completion(params)
|
||||
|
||||
let str = cloneDeep(prompt.value)
|
||||
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)
|
||||
isStarted.value[index] = true
|
||||
} finally {
|
||||
|
@ -498,6 +559,27 @@ const toRousrceUrl = async(o) => {
|
|||
}
|
||||
// ======== 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({})
|
||||
onMounted(() => {
|
||||
let data = sessionStore.get('subject.curNode')
|
||||
|
@ -506,6 +588,15 @@ onMounted(() => {
|
|||
|
||||
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
||||
params.dataset_id = commUtils.dataSetJson[jsonKey]
|
||||
|
||||
// 获取百度千帆会话ID
|
||||
conversation_id.value = localStorage.getItem('conversation_id')
|
||||
if (!conversation_id.value) {
|
||||
getChartId();
|
||||
}
|
||||
|
||||
// 获取prompt
|
||||
getPrompt()
|
||||
})
|
||||
|
||||
|
||||
|
@ -548,6 +639,7 @@ onUnmounted(() => {
|
|||
position: relative;
|
||||
padding-left: 15px;
|
||||
box-sizing: border-box;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
width: 15px;
|
||||
|
@ -558,6 +650,7 @@ onUnmounted(() => {
|
|||
left: -8px;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 2px;
|
||||
|
@ -567,16 +660,19 @@ onUnmounted(() => {
|
|||
left: -1px;
|
||||
top: 5px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
&::before {
|
||||
content: '';
|
||||
width: 0
|
||||
}
|
||||
}
|
||||
|
||||
.item-top {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.icon-shenglvehao {
|
||||
font-weight: bold
|
||||
}
|
||||
|
|
|
@ -248,6 +248,8 @@ defineExpose({ trigger })
|
|||
position: fixed;
|
||||
// height: 90vh;
|
||||
// border: 1px solid;
|
||||
z-index: 99;
|
||||
pointer-events: none;
|
||||
inset: auto auto 3em 1em;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
|
|
Loading…
Reference in New Issue