Compare commits
36 Commits
122c5341e9
...
4b393ecec9
Author | SHA1 | Date |
---|---|---|
lyc | 4b393ecec9 | |
lyc | f708e2f741 | |
lyc | 94276db542 | |
zhengdegang | 6ef5d4575e | |
zdg | dfc10aebbe | |
zdg | ff6fab0bcc | |
zdg | 45abab7a41 | |
朱浩 | 6128f267e1 | |
朱浩 | e0a406c497 | |
lyc | cebf864b82 | |
lyc | 0ed69394ef | |
lyc | 0b6039f9d8 | |
lyc | 627c70d0e1 | |
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 | |
zhangxuelin | 2d0be935bf | |
zhangxuelin | d6dfe966c0 | |
zdg | cf7f985020 | |
zdg | 5d6c946e08 | |
yangws | 55efc7f3e1 |
|
@ -92,6 +92,8 @@
|
||||||
"tinycolor2": "^1.6.0",
|
"tinycolor2": "^1.6.0",
|
||||||
"tinymce": "6.8.3",
|
"tinymce": "6.8.3",
|
||||||
"tippy.js": "^6.3.7",
|
"tippy.js": "^6.3.7",
|
||||||
|
"v-viewer": "^3.0.11",
|
||||||
|
"viewerjs": "^1.11.7",
|
||||||
"vite-plugin-electron": "^0.28.8",
|
"vite-plugin-electron": "^0.28.8",
|
||||||
"vue": "^3.4.34",
|
"vue": "^3.4.34",
|
||||||
"vue-cropper": "1.0.3",
|
"vue-cropper": "1.0.3",
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/**
|
||||||
|
* 统一处理消息 发送 避免找不到
|
||||||
|
*/
|
||||||
|
|
||||||
|
import ChatWs from '@/plugins/socket' // 聊天socket
|
||||||
|
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||||
|
import { useClasscourseStore } from '../store'
|
||||||
|
import * as API_classcourse from '@/api/teaching/classcourse' // 后端api
|
||||||
|
import { MsgEnum } from './types'
|
||||||
|
// import msgUtils from '@/plugins/modal' // 消息工具
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
|
||||||
|
const courseId = classcourse?.id // 课堂id
|
||||||
|
const timgroupid = classcourse?.timgroupid // 群组id
|
||||||
|
const classcourseStore = useClasscourseStore() // 课堂信息-状态管理
|
||||||
|
if (!ChatWs.ws) ChatWs.init()
|
||||||
|
// 开课消息
|
||||||
|
const startCourse = async() => {
|
||||||
|
// await API_classcourse.updateClasscourse({ id: classcourse.id, status: 'open' })
|
||||||
|
ChatWs.sendMsg('open', {id: courseId})
|
||||||
|
return Promise.resolve()
|
||||||
|
}
|
||||||
|
// 下课消息
|
||||||
|
const exitCourse = async() => {
|
||||||
|
if(!timgroupid) throw new Error('未获取到群组ID')
|
||||||
|
await API_classcourse.updateClasscourse({ id: courseId, status: 'closed' })
|
||||||
|
return ChatWs.closedCourse(timgroupid)
|
||||||
|
}
|
||||||
|
// 翻页消息
|
||||||
|
const slideFlapping = (msg:object) => {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
const isWs = !!ChatWs.ws && ChatWs.ws.readyState === 1 // 是否有socket连接
|
||||||
|
if(!timgroupid) return reject('未获取到群组ID')
|
||||||
|
else if(!isWs) return reject('信异常,请重试!')
|
||||||
|
const {current: paging, animation: cartoonTimes} = msg || {}
|
||||||
|
const head = MsgEnum.HEADS.MSG_slideFlapping
|
||||||
|
ChatWs.sendMsg(head, msg) // 发送消息
|
||||||
|
API_classcourse.setPaging({ id: courseId, paging, cartoonTimes})
|
||||||
|
// 更新本地缓存
|
||||||
|
sessionStore.set('curr.classcourse.paging', paging)
|
||||||
|
sessionStore.set('curr.classcourse.cartoonTimes', cartoonTimes)
|
||||||
|
classcourseStore.classcourse.paging = paging
|
||||||
|
classcourseStore.classcourse.cartoonTimes = cartoonTimes
|
||||||
|
return resolve(true)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
groupid: timgroupid,
|
||||||
|
classcourse,
|
||||||
|
exitCourse,
|
||||||
|
slideFlapping,
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,13 +7,14 @@ 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 useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
|
import emitter from '@/utils/mitt' //mitt 事件总线
|
||||||
|
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() // 播放控制
|
const isPublic = sessionStore.get('curr.isPublic') // 是否公屏开课
|
||||||
|
|
||||||
export class Classcourse {
|
export class Classcourse {
|
||||||
msgObj:ElMessageBox = null // 提示消息对象
|
msgObj:ElMessageBox = null // 提示消息对象
|
||||||
|
@ -23,10 +24,12 @@ export class Classcourse {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.load()
|
this.load()
|
||||||
}
|
}
|
||||||
|
// 延时
|
||||||
|
sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||||
/**
|
/**
|
||||||
* @description 加载
|
* @description 加载
|
||||||
*/
|
*/
|
||||||
load() {
|
async load() {
|
||||||
console.log('classcourse-load', classcourse)
|
console.log('classcourse-load', classcourse)
|
||||||
// 打开全屏
|
// 打开全屏
|
||||||
const isCourse = !!classcourse
|
const isCourse = !!classcourse
|
||||||
|
@ -34,20 +37,22 @@ export class Classcourse {
|
||||||
// 如果课堂信息有值,则连接socket
|
// 如果课堂信息有值,则连接socket
|
||||||
if (isCourse) {
|
if (isCourse) {
|
||||||
// 连接socket
|
// 连接socket
|
||||||
if (!ChatWs.ws) ChatWs.init()
|
|
||||||
ChatWs.id = classcourse.timgroupid // 群组id
|
ChatWs.id = classcourse.timgroupid // 群组id
|
||||||
|
if (!ChatWs.ws) {
|
||||||
|
ChatWs.init().then(_ => {
|
||||||
|
isPublic && ChatWs.sendMsg('open', {id: classcourse.id})
|
||||||
|
// isPublic && console.log('socket-开课消息-已发送')
|
||||||
|
})
|
||||||
|
}
|
||||||
this.classcourse = classcourse // 课堂信息
|
this.classcourse = classcourse // 课堂信息
|
||||||
this.id = classcourse.id // 课堂id
|
this.id = classcourse.id // 课堂id
|
||||||
// 如果课堂信息有paging,则更新当前页码
|
// 如果课堂信息有paging,则更新当前页码
|
||||||
const isPaging = !!classcourse.paging
|
const { paging, cartoonTimes } = classcourse
|
||||||
if (isPaging) slidesStore.updateSlideIndex(classcourse.paging)
|
const isPaging = !!paging || paging === 0
|
||||||
// 如果课堂信息有paging,则更新动画播放状态
|
// 如果课堂信息有paging,则更新动画播放状态
|
||||||
const isAnim = !!classcourse.cartoonTimes
|
const isAnim = !!cartoonTimes || cartoonTimes === 0
|
||||||
if (isAnim) { // 动画播放
|
if (isPaging) slidesStore.updateSlideIndex(paging)
|
||||||
for (let i = 0; i <= classcourse.cartoonTimes; i++) {
|
if (isAnim) slidesStore.updateAnimationIndex(cartoonTimes)
|
||||||
execPlay.runAnimation(true) // 异步执行动画
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 课堂信息-状态管理
|
// 课堂信息-状态管理
|
||||||
classcourseStore.setClasscourse(classcourse)
|
classcourseStore.setClasscourse(classcourse)
|
||||||
// 待上课提示
|
// 待上课提示
|
||||||
|
|
|
@ -258,6 +258,7 @@ 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)
|
||||||
|
@ -265,7 +266,14 @@ 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
|
|
@ -124,6 +124,8 @@ export class MsgEnum {
|
||||||
MSG_classlecturePagesrc : 'classlecturePagesrc',
|
MSG_classlecturePagesrc : 'classlecturePagesrc',
|
||||||
/** @desc: 课堂作业|活动 */
|
/** @desc: 课堂作业|活动 */
|
||||||
MSG_homework : 'HOMEWORK',
|
MSG_homework : 'HOMEWORK',
|
||||||
|
/** @desc: 公屏 - 课堂作业|活动 */
|
||||||
|
MSG_pushSreen_work : 'pushSreen-work',
|
||||||
/** @desc: 点赞 */
|
/** @desc: 点赞 */
|
||||||
MSG_dz : 'dz',
|
MSG_dz : 'dz',
|
||||||
/** @desc: 疑惑 */
|
/** @desc: 疑惑 */
|
||||||
|
|
|
@ -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 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 监听器
|
||||||
|
@ -22,8 +23,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 execPlay = useExecPlay() // 播放控制
|
const { execNext, turnPrevSlide } = useExecPlay(false) // 不加载钩子
|
||||||
|
|
||||||
// 监听幻灯片内容变化
|
// 监听幻灯片内容变化
|
||||||
watch(() => slidesStore.slides, (newVal, oldVal) => {
|
watch(() => slidesStore.slides, (newVal, oldVal) => {
|
||||||
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
|
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
|
||||||
|
@ -37,7 +37,15 @@ export default () => {
|
||||||
|
|
||||||
// 监听幻灯片下标变化
|
// 监听幻灯片下标变化
|
||||||
watch(() => slidesStore.slideIndex, (newVal, oldVal) => {
|
watch(() => slidesStore.slideIndex, (newVal, oldVal) => {
|
||||||
PPTApi.updateWorkList()
|
if (!!Classcourse.id) return // 上课状态,不更新右侧作业列表
|
||||||
|
PPTApi.updateWorkList() // 更新作业列表
|
||||||
|
})
|
||||||
|
// 监听幻灯片下画布尺寸比例变化
|
||||||
|
watch(() => slidesStore.viewportRatio, (newVal, oldVal) => {
|
||||||
|
const width = slidesStore.viewportSize
|
||||||
|
const widthandration={width, ratio:newVal}
|
||||||
|
const data = { id: resource.id, parentContent: JSON.stringify(widthandration)}
|
||||||
|
PPTApi.updateSlide(data)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 消息监听ws
|
// 消息监听ws
|
||||||
|
@ -91,22 +99,23 @@ 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') emitter.emit('useExecPlay', 'execNext') // 下一步
|
if (type === 'Nextsteps') execNext(true) // 下一步-异步动画
|
||||||
else if (type === 'Previoustep') emitter.emit('useExecPlay', 'turnPrevSlide') // 上一步清空-动画
|
else if (type === 'Previoustep') turnPrevSlide() // 上一步清空-动画
|
||||||
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
|
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置
|
// case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置 不处理
|
||||||
if (!content.classWorkId) return
|
case MsgEnum.HEADS.MSG_pushSreen_work: // 打开-作业|活动
|
||||||
Homework.showHomework(content.classWorkId)
|
if (!content.id) return
|
||||||
|
Homework.showHomework(content.id)
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_closed: // 下课:
|
case MsgEnum.HEADS.MSG_closed: // 下课:
|
||||||
close()
|
close()
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_dz: // 点赞
|
case MsgEnum.HEADS.MSG_dz: // 点赞
|
||||||
emitter.emit('upvoteTrigger', 1)
|
hooksUpvote.trigger(1)
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_yh: // 疑惑
|
case MsgEnum.HEADS.MSG_yh: // 疑惑
|
||||||
emitter.emit('upvoteTrigger', 2)
|
hooksUpvote.trigger(2)
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_0010: // 备用
|
case MsgEnum.HEADS.MSG_0010: // 备用
|
||||||
break
|
break
|
||||||
|
|
|
@ -3,16 +3,21 @@ 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,7 +33,8 @@ 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[],
|
||||||
}
|
}
|
||||||
|
@ -46,6 +47,7 @@ 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
|
||||||
}),
|
}),
|
||||||
|
@ -206,6 +208,9 @@ 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]
|
||||||
|
|
|
@ -30,14 +30,10 @@
|
||||||
@close="timerlVisible = false"
|
@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()" />
|
<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"
|
||||||
|
@ -52,15 +48,16 @@
|
||||||
<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} from 'vue'
|
import { ref , watchEffect, onMounted, onUnmounted} from 'vue'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { useSlidesStore ,useScreenStore} from '../../store'
|
import { useSlidesStore ,useScreenStore, useClasscourseStore} 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'
|
||||||
|
@ -72,14 +69,15 @@ 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,
|
||||||
|
@ -103,13 +101,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 [
|
||||||
|
@ -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>
|
</script>
|
||||||
|
|
||||||
|
@ -309,6 +278,9 @@ emitter.on('useExecPlay', (data: string|any) => {
|
||||||
& + .tool-btn {
|
& + .tool-btn {
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
}
|
}
|
||||||
|
&.close{
|
||||||
|
color: #d14424;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.page-number {
|
.page-number {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
</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">
|
||||||
|
@ -55,7 +56,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="turnSlideToIndex(index)"
|
@click="turnSlideTo(index, $event)"
|
||||||
>
|
>
|
||||||
<ThumbnailSlide :slide="slide" :size="120 / viewportRatio" :visible="index < slidesLoadLimit" />
|
<ThumbnailSlide :slide="slide" :size="120 / viewportRatio" :visible="index < slidesLoadLimit" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -77,9 +78,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<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 { storeToRefs } from 'pinia'
|
||||||
import { useSlidesStore } from '../../store'
|
import { useSlidesStore, useClasscourseStore } 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'
|
||||||
|
@ -94,12 +95,15 @@ 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>()
|
||||||
|
@ -117,17 +121,31 @@ 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)
|
||||||
|
@ -192,6 +210,7 @@ const contextmenus = (): ContextmenuItem[] => {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -208,7 +227,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;
|
||||||
margin: 20px 0;
|
padding: 20px 0;
|
||||||
|
|
||||||
.tool-btn {
|
.tool-btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -224,6 +243,9 @@ const contextmenus = (): ContextmenuItem[] => {
|
||||||
&:hover, &.active {
|
&:hover, &.active {
|
||||||
color: $themeColor;
|
color: $themeColor;
|
||||||
}
|
}
|
||||||
|
&.close{
|
||||||
|
color: #d14424;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider {
|
.divider {
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
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 } from '../../../store'
|
import { useSlidesStore, useClasscourseStore } 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';
|
||||||
|
import Chat from '../../../api/chat' // 聊天封装
|
||||||
|
// import ChatWs from '@/plugins/socket' // 聊天socket
|
||||||
|
// import { MsgEnum } from '../../../api/types' // 消息枚举
|
||||||
|
|
||||||
export default () => {
|
export default (isLoader?: boolean = true) => {
|
||||||
|
// isLoader 是否执行 onMounted, onUnmounted
|
||||||
|
const chatApi = Chat()
|
||||||
const slidesStore = useSlidesStore()
|
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)
|
const inAnimation = ref(false)
|
||||||
|
@ -69,7 +76,7 @@ export default () => {
|
||||||
elRef.addEventListener('animationend', handleAnimationEnd, { once: true })
|
elRef.addEventListener('animationend', handleAnimationEnd, { once: true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isLoader) { // 加载相关钩子
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const firstAnimations = formatedAnimations.value[0]
|
const firstAnimations = formatedAnimations.value[0]
|
||||||
if (firstAnimations && firstAnimations.animations.length) {
|
if (firstAnimations && firstAnimations.animations.length) {
|
||||||
|
@ -77,6 +84,7 @@ export default () => {
|
||||||
if (autoExecFirstAnimations) runAnimation()
|
if (autoExecFirstAnimations) runAnimation()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 撤销元素动画,除了将索引前移外,还需要清除动画状态
|
// 撤销元素动画,除了将索引前移外,还需要清除动画状态
|
||||||
const revokeAnimation = () => {
|
const revokeAnimation = () => {
|
||||||
|
@ -121,9 +129,9 @@ export default () => {
|
||||||
// 遇到元素动画时,优先执行动画播放,无动画则执行翻页
|
// 遇到元素动画时,优先执行动画播放,无动画则执行翻页
|
||||||
// 向上播放遇到动画时,仅撤销到动画执行前的状态,不需要反向播放动画
|
// 向上播放遇到动画时,仅撤销到动画执行前的状态,不需要反向播放动画
|
||||||
// 撤回到上一页时,若该页从未播放过(意味着不存在动画状态),需要将动画索引置为最小值(初始状态),否则置为最大值(最终状态)
|
// 撤回到上一页时,若该页从未播放过(意味着不存在动画状态),需要将动画索引置为最小值(初始状态),否则置为最大值(最终状态)
|
||||||
const execPrev = () => {
|
const execPrev = (isAsync: boolean) => {
|
||||||
if (formatedAnimations.value.length && animationIndex.value > 0) {
|
if (formatedAnimations.value.length && animationIndex.value > 0) {
|
||||||
revokeAnimation()
|
revokeAnimation(isAsync)
|
||||||
}
|
}
|
||||||
else if (slideIndex.value > 0) {
|
else if (slideIndex.value > 0) {
|
||||||
slidesStore.updateSlideIndex(slideIndex.value - 1)
|
slidesStore.updateSlideIndex(slideIndex.value - 1)
|
||||||
|
@ -139,9 +147,9 @@ export default () => {
|
||||||
}
|
}
|
||||||
inAnimation.value = false
|
inAnimation.value = false
|
||||||
}
|
}
|
||||||
const execNext = () => {
|
const execNext = (isAsync: boolean) => {
|
||||||
if (formatedAnimations.value.length && animationIndex.value < formatedAnimations.value.length) {
|
if (formatedAnimations.value.length && animationIndex.value < formatedAnimations.value.length) {
|
||||||
runAnimation()
|
runAnimation(isAsync)
|
||||||
}
|
}
|
||||||
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)
|
||||||
|
@ -173,7 +181,12 @@ export default () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 鼠标滚动翻页
|
// 鼠标滚动翻页
|
||||||
const mousewheelListener = throttle(function(e: WheelEvent) {
|
const mousewheelListener = (e: WheelEvent) => {
|
||||||
|
// console.log('mousewheel', e)
|
||||||
|
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 })
|
||||||
|
@ -201,10 +214,17 @@ export default () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 向上翻页/向下翻页
|
// 向上翻页/向下翻页
|
||||||
const turning = (e, type) => {
|
const turning = async (e, type) => {
|
||||||
e.preventDefault() // 阻止默认事件
|
e.preventDefault() // 阻止默认事件
|
||||||
if (type === 'prev') execPrev()
|
if (type === 'prev') execPrev()
|
||||||
else if (type === 'next') execNext()
|
else if (type === 'next') execNext()
|
||||||
|
if (classcourseStore.classcourse) { // 上课中
|
||||||
|
const current = slideIndex.value
|
||||||
|
const animation = animationIndex.value
|
||||||
|
const animationSteps = type == 'next'?'Nextsteps':'Previoustep'
|
||||||
|
const msg = { current, animation, animationSteps}
|
||||||
|
chatApi.slideFlapping(msg)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 快捷键翻页
|
// 快捷键翻页
|
||||||
const keydownListener = (e: KeyboardEvent) => {
|
const keydownListener = (e: KeyboardEvent) => {
|
||||||
|
@ -219,9 +239,10 @@ export default () => {
|
||||||
key === KEYS.PAGEDOWN
|
key === KEYS.PAGEDOWN
|
||||||
) turning(e, 'next')
|
) turning(e, 'next')
|
||||||
}
|
}
|
||||||
|
if (isLoader) { // 加载相关钩子
|
||||||
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,6 +2,10 @@
|
||||||
<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>
|
||||||
|
|
||||||
|
@ -9,9 +13,11 @@
|
||||||
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')
|
||||||
|
|
||||||
|
@ -20,6 +26,8 @@ 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,11 +10,10 @@ export const createChart = ({ headers, data }) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 大模型对话
|
// 大模型对话
|
||||||
export const sendChart = ({ headers, data }) => {
|
export const sendChart = (data) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/qf/sendTalk',
|
url: '/qf/sendTalk',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers,
|
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
|
@ -95,3 +95,11 @@ export function getCourseTeachingMsg(id) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function setPaging(data) {
|
||||||
|
return request({
|
||||||
|
url: '/education/classcourse/record/paging',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,333 @@
|
||||||
|
<template>
|
||||||
|
<div class="book-wrap">
|
||||||
|
<el-scrollbar height="100%">
|
||||||
|
<div class="book-name flex" @click="dialogVisible = true">
|
||||||
|
<span>{{ curBook.data.itemtitle }}</span>
|
||||||
|
<i class="iconfont icon-xiangyou"></i>
|
||||||
|
</div>
|
||||||
|
<div class="book-list" v-loading="treeLoading">
|
||||||
|
<el-tree :data="treeData" accordion :props="defaultProps" node-key="id"
|
||||||
|
:default-expanded-keys="defaultExpandedKeys" :current-node-key="curNode.data.id" highlight-current
|
||||||
|
@node-click="handleNodeClick">
|
||||||
|
<template #default="{ node }">
|
||||||
|
<span :title="node.label" class="tree-label">{{ node.label }}</span>
|
||||||
|
</template>
|
||||||
|
</el-tree>
|
||||||
|
</div>
|
||||||
|
</el-scrollbar>
|
||||||
|
</div>
|
||||||
|
<!--弹窗 选择教材-->
|
||||||
|
<el-dialog v-model="dialogVisible" append-to-body :show-close="false" width="550"
|
||||||
|
style="border-radius: 10px; padding: 10px 15px;">
|
||||||
|
<template #header>
|
||||||
|
<div class="choose-book-header flex">
|
||||||
|
<span>切换教材</span>
|
||||||
|
<i class="iconfont icon-guanbi" @click="dialogVisible = false"></i>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="textbook-container">
|
||||||
|
<el-scrollbar height="450px">
|
||||||
|
<div class="textbook-item flex" v-for="item in subjectList" :class="curBook.data.id == item.id ? 'active-item' : ''"
|
||||||
|
:key="item.id" @click="changeBook(item)">
|
||||||
|
<img v-if="item.avartar" :src="item.avartar.indexOf('http') === 0 ? item.avartar : BaseUrl + item.avartar" class="textbook-img" alt="">
|
||||||
|
<div v-else class="textbook-img">
|
||||||
|
<i class="iconfont icon-jiaocaixuanze" style="font-size: 40px;"></i>
|
||||||
|
</div>
|
||||||
|
<span class="book-name">{{ item.itemtitle }}</span>
|
||||||
|
</div>
|
||||||
|
</el-scrollbar>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, ref, nextTick, toRaw, reactive } from 'vue';
|
||||||
|
import { cloneDeep } from 'lodash'
|
||||||
|
import { listEvaluation } from '@/api/subject'
|
||||||
|
import { sessionStore } from '@/utils/store'
|
||||||
|
|
||||||
|
const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
||||||
|
// 定义要发送的emit事件
|
||||||
|
const emit = defineEmits(['nodeClick', 'changeBook'])
|
||||||
|
// 章节List
|
||||||
|
const unitList = ref([])
|
||||||
|
const subjectList = ref([])
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
// 当前教材下面单元内容数据
|
||||||
|
const treeData = ref([])
|
||||||
|
const defaultProps = {
|
||||||
|
children: 'children',
|
||||||
|
label: 'itemtitle',
|
||||||
|
class: 'textbook-tree'
|
||||||
|
}
|
||||||
|
//查当前学科
|
||||||
|
const subjectParams = reactive(
|
||||||
|
{
|
||||||
|
edusubject: '科学',
|
||||||
|
edustage:'小学',
|
||||||
|
itemkey: 'version',
|
||||||
|
orderby: 'orderidx asc',
|
||||||
|
pageSize: 10000
|
||||||
|
}
|
||||||
|
)
|
||||||
|
// 查所有的学科
|
||||||
|
const unitParams = reactive({
|
||||||
|
edusubject:'科学',
|
||||||
|
edustage:'小学',
|
||||||
|
itemgroup: 'textbook',
|
||||||
|
orderby: 'orderidx asc',
|
||||||
|
pageSize: 10000
|
||||||
|
})
|
||||||
|
// 当前选中的教材
|
||||||
|
const curBook = reactive({
|
||||||
|
data: {}
|
||||||
|
})
|
||||||
|
// 当前节点
|
||||||
|
const curNode = reactive({
|
||||||
|
data:{}
|
||||||
|
})
|
||||||
|
const treeLoading = ref(false)
|
||||||
|
// 默认展开的节点
|
||||||
|
const defaultExpandedKeys = ref([])
|
||||||
|
|
||||||
|
//选择教材
|
||||||
|
const changeBook = (data) => {
|
||||||
|
curBook.data = data
|
||||||
|
treeData.value = getTreeData(data.id)
|
||||||
|
//切换教材后默认展开第一个并选中
|
||||||
|
nextTick(() =>{
|
||||||
|
defaultExpandedKeys.value = [treeData.value[0].id]
|
||||||
|
curNode.data = getLastLevelData(treeData.value)[0]
|
||||||
|
handleNodeClick(curNode.data)
|
||||||
|
})
|
||||||
|
// 延迟关闭 视觉上选中
|
||||||
|
setTimeout(() => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
const getLastLevelData = (tree) => {
|
||||||
|
let lastLevelData = [];
|
||||||
|
// 递归函数遍历树形结构
|
||||||
|
function traverseTree(nodes) {
|
||||||
|
nodes.forEach((node) => {
|
||||||
|
// 如果当前节点有子节点,继续遍历
|
||||||
|
if (node.children && node.children.length > 0) {
|
||||||
|
traverseTree(node.children);
|
||||||
|
} else {
|
||||||
|
// 如果没有子节点,说明是最后一层的节点
|
||||||
|
lastLevelData.push(node);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用递归函数开始遍历
|
||||||
|
traverseTree(tree);
|
||||||
|
|
||||||
|
// 返回最后一层的数据
|
||||||
|
return lastLevelData;
|
||||||
|
}
|
||||||
|
// 根据id 拿到父节点数据
|
||||||
|
const findParentByChildId = (treeData, targetNodeId) => {
|
||||||
|
// 递归查找函数
|
||||||
|
// 遍历树中的每个节点
|
||||||
|
for (let node of treeData) {
|
||||||
|
// 检查当前节点的子节点是否包含目标子节点 ID
|
||||||
|
if (node.children && node.children.some(child => child.id === targetNodeId)) {
|
||||||
|
// 如果当前节点的某个子节点的 ID 匹配目标子节点 ID,则当前节点即为父节点
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
// 如果当前节点没有匹配的子节点,则递归检查当前节点的子节点
|
||||||
|
if (node.children) {
|
||||||
|
let parentNode = findParentByChildId(node.children, targetNodeId);
|
||||||
|
if (parentNode) {
|
||||||
|
return parentNode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果未找到匹配的父节点,则返回 null 或者适当的默认值
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleNodeClick = (data) => {
|
||||||
|
/**
|
||||||
|
* data : 当前节点数据
|
||||||
|
*/
|
||||||
|
let nodeData = cloneDeep(toRaw(data));
|
||||||
|
|
||||||
|
//增加一个label 之前取的label
|
||||||
|
nodeData.label = nodeData.itemtitle
|
||||||
|
// 父级节点 如果当前是一级节点 父级则为null
|
||||||
|
let parent = {
|
||||||
|
id: nodeData.parentid,
|
||||||
|
label: nodeData.parenttitle,
|
||||||
|
itemtitle: nodeData.parenttitle
|
||||||
|
}
|
||||||
|
const parentNode = nodeData.parentid ? parent : null
|
||||||
|
nodeData.parentNode = parentNode
|
||||||
|
let curData = {
|
||||||
|
textBook: {
|
||||||
|
curBookId: curBook.data.id,
|
||||||
|
curBookName: curBook.data.itemtitle,
|
||||||
|
curBookImg: BaseUrl + curBook.data.avartar,
|
||||||
|
curBookPath: curBook.data.fileurl
|
||||||
|
},
|
||||||
|
node: nodeData
|
||||||
|
}
|
||||||
|
// 本地存储:electron-store
|
||||||
|
emit('nodeClick', curData)
|
||||||
|
}
|
||||||
|
// 单元章节数据转为“树”结构
|
||||||
|
const getTreeData = (bookId) =>{
|
||||||
|
// 根据当前教材的id 查找出对应的章节
|
||||||
|
let data = unitList.value.filter(item => item.rootid == bookId && item.level == 1)
|
||||||
|
data.forEach( item => {
|
||||||
|
item.children = unitList.value.filter( item2 => item2.parentid == item.id && item2.level == 2)
|
||||||
|
})
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onMounted( async () => {
|
||||||
|
treeLoading.value = true
|
||||||
|
try{
|
||||||
|
//获取学科列表
|
||||||
|
const { rows } = await listEvaluation(subjectParams)
|
||||||
|
// 获取所有的教材
|
||||||
|
subjectList.value = rows
|
||||||
|
|
||||||
|
const res = await listEvaluation(unitParams)
|
||||||
|
unitList.value = [...res.rows]
|
||||||
|
// 当前教材
|
||||||
|
curBook.data = rows[0]
|
||||||
|
|
||||||
|
// 章节"树"rows
|
||||||
|
treeData.value = getTreeData(rows[0].id)
|
||||||
|
|
||||||
|
nextTick(() =>{
|
||||||
|
// 默认展开 选中
|
||||||
|
defaultExpandedKeys.value = [treeData.value[0].id]
|
||||||
|
curNode.data = getLastLevelData(treeData.value)[0]
|
||||||
|
handleNodeClick(curNode.data)
|
||||||
|
})
|
||||||
|
|
||||||
|
} finally{
|
||||||
|
treeLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.book-wrap {
|
||||||
|
width: 300px;
|
||||||
|
height: 100%;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.book-name {
|
||||||
|
background-color: #ffffff;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 45px;
|
||||||
|
padding: 0 15px;
|
||||||
|
z-index: 1;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
color: #3b3b3b;
|
||||||
|
cursor: pointer;
|
||||||
|
border-bottom: solid #f4f5f7 1px;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
border-radius: 10px 10px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book-list {
|
||||||
|
padding: 45px 10px 0 10px;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.choose-dialog) {
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.choose-book-header {
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
.icon-guanbi {
|
||||||
|
font-size: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.textbook-container {
|
||||||
|
.textbook-item {
|
||||||
|
padding: 10px 20px;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.book-name {
|
||||||
|
margin-left: 20px;
|
||||||
|
color: #3b3b3b;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f4f7f9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.active-item {
|
||||||
|
background-color: #f4f7f9;
|
||||||
|
|
||||||
|
.book-name {
|
||||||
|
color: #368fff;
|
||||||
|
font-weight: bold
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.textbook-img {
|
||||||
|
width: 55px;
|
||||||
|
height: 70px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tree-node) {
|
||||||
|
.el-tree-node__content {
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 10px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #eaf3ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-label {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content) {
|
||||||
|
background-color: #eaf3ff !important;
|
||||||
|
color: #409EFF
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -0,0 +1,172 @@
|
||||||
|
<template>
|
||||||
|
<draggable handle=".header-btn" :draggable="false" item-key="backgroundColor" v-model="gridPicList" class="grid-pic-wrap" :style="getGrid">
|
||||||
|
<template #item="{ element, index }">
|
||||||
|
<div class="grid-pic-item" :key="element.backgroundColor" :style="getWH(element,index)">
|
||||||
|
<div class="delete-btn" @click="gridPicList.splice(index,1)">X</div>
|
||||||
|
<div class="header-btn"></div>
|
||||||
|
<ViewerItem :gridPicList="gridPicList" :index="index" :images="[element.src]"></ViewerItem>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</draggable>
|
||||||
|
<el-input style="position:fixed;bottom: 20px;right: 80px;width: 1000px" v-model="inputValue" type="text" />
|
||||||
|
<el-button class="add-btn" @click="addPic">
|
||||||
|
添加
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {ref, computed} from 'vue'
|
||||||
|
import Draggable from 'vuedraggable'
|
||||||
|
import ViewerItem from "./viewer-item.vue";
|
||||||
|
|
||||||
|
const gridPicList = ref([])
|
||||||
|
const inputValue = ref('')
|
||||||
|
// 获取图片样式
|
||||||
|
const getWH = (item,index)=>{
|
||||||
|
return {
|
||||||
|
backgroundColor: item.backgroundColor,
|
||||||
|
'grid-area': 'a' + index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取grid样式
|
||||||
|
const getGrid = computed(() => {
|
||||||
|
switch (gridPicList.value.length) {
|
||||||
|
case 1:
|
||||||
|
return {
|
||||||
|
'grid-template-areas':
|
||||||
|
`"a0"`
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
return {
|
||||||
|
'grid-template-areas':
|
||||||
|
`"a0 a1"`
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
return {
|
||||||
|
'grid-template-areas':
|
||||||
|
`"a0 a1"
|
||||||
|
"a0 a2"`
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
return {
|
||||||
|
'grid-template-areas':
|
||||||
|
`"a0 a2"
|
||||||
|
"a1 a3"`
|
||||||
|
}
|
||||||
|
case 5:
|
||||||
|
return {
|
||||||
|
'grid-template-areas':
|
||||||
|
`"a0 a2 a4"
|
||||||
|
"a1 a3 a4"`
|
||||||
|
}
|
||||||
|
case 6:
|
||||||
|
return {
|
||||||
|
'grid-template-areas':
|
||||||
|
`"a0 a2 a4"
|
||||||
|
"a1 a3 a5"`
|
||||||
|
}
|
||||||
|
case 7:
|
||||||
|
return {
|
||||||
|
'grid-template-areas':
|
||||||
|
`"a0 a2 a4"
|
||||||
|
"a0 a2 a4"
|
||||||
|
"a0 a2 a5"
|
||||||
|
"a1 a3 a5"
|
||||||
|
"a1 a3 a6"
|
||||||
|
"a1 a3 a6"`
|
||||||
|
}
|
||||||
|
case 8:
|
||||||
|
return {
|
||||||
|
'grid-template-areas':
|
||||||
|
`"a0 a3 a6"
|
||||||
|
"a0 a3 a6"
|
||||||
|
"a1 a4 a6"
|
||||||
|
"a1 a4 a7"
|
||||||
|
"a2 a5 a7"
|
||||||
|
"a2 a5 a7"`
|
||||||
|
}
|
||||||
|
case 9:
|
||||||
|
return {
|
||||||
|
'grid-template-areas':
|
||||||
|
`"a0 a3 a6"
|
||||||
|
"a1 a4 a7"
|
||||||
|
"a2 a5 a8"`
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return {
|
||||||
|
width: '100%',
|
||||||
|
height: '100%'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 添加图片
|
||||||
|
const addPic = () => {
|
||||||
|
if (gridPicList.value.length >= 9) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
gridPicList.value.push({
|
||||||
|
src: inputValue.value,
|
||||||
|
backgroundColor: getRandomColor()
|
||||||
|
})
|
||||||
|
inputValue.value = ''
|
||||||
|
}
|
||||||
|
// 生成随机颜色
|
||||||
|
function getRandomColor() {
|
||||||
|
let r = Math.floor(Math.random() * 256).toString(16);
|
||||||
|
let g = Math.floor(Math.random() * 256).toString(16);
|
||||||
|
let b = Math.floor(Math.random() * 256).toString(16);
|
||||||
|
// 如果生成的十六进制数字只有一位,前面补0
|
||||||
|
r = r.length === 1? '0' + r : r;
|
||||||
|
g = g.length === 1? '0' + g : g;
|
||||||
|
b = b.length === 1? '0' + b : b;
|
||||||
|
return `#${r}${g}${b}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.grid-pic-wrap{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: grid;
|
||||||
|
overflow: hidden;
|
||||||
|
.grid-pic-item{
|
||||||
|
//animation: fadeIn 0.5s ease-in-out forwards;
|
||||||
|
background-color: #0a84ff;
|
||||||
|
position: relative;
|
||||||
|
.delete-btn{
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 10px;
|
||||||
|
z-index: 999;
|
||||||
|
&:hover{
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.header-btn{
|
||||||
|
position: absolute;
|
||||||
|
z-index: 998;
|
||||||
|
height: 30px;
|
||||||
|
width: 100%;
|
||||||
|
border-bottom: 1px dotted #ccc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.add-btn{
|
||||||
|
position: fixed;
|
||||||
|
right: 20px;
|
||||||
|
bottom: 20px;
|
||||||
|
}
|
||||||
|
@keyframes fadeIn {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(20px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,59 @@
|
||||||
|
<template>
|
||||||
|
<viewer :ref="collectRef('viewerRef'+index)" :options="optins" :images="images" class="images clearfix">
|
||||||
|
<template #default="scope">
|
||||||
|
<img v-for="src in scope.images" :key="index" :src="src" style="display: none">
|
||||||
|
</template>
|
||||||
|
</viewer>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {ref, watch, nextTick} from "vue";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
images: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
|
},
|
||||||
|
index: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
gridPicList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const refs = ref([]);
|
||||||
|
|
||||||
|
const collectRef = (key) => {
|
||||||
|
return (el) => {
|
||||||
|
refs.value[key] = el;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
//viewer配置
|
||||||
|
const optins = {
|
||||||
|
"inline": true,
|
||||||
|
"button": false,
|
||||||
|
"navbar": false,
|
||||||
|
"title": false,
|
||||||
|
"toolbar": false,
|
||||||
|
"tooltip": true,
|
||||||
|
"movable": true,
|
||||||
|
"zoomable": true,
|
||||||
|
"rotatable": true,
|
||||||
|
"scalable": true,
|
||||||
|
"transition": true,
|
||||||
|
"fullscreen": true,
|
||||||
|
"keyboard": true
|
||||||
|
}
|
||||||
|
const initViewers = () => {
|
||||||
|
refs.value['viewerRef'+props.index]?.rebuildViewer()
|
||||||
|
}
|
||||||
|
watch(props.gridPicList, (newValue, oldValue) => {
|
||||||
|
nextTick(()=>{
|
||||||
|
initViewers()
|
||||||
|
})
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
</style>
|
|
@ -30,7 +30,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
<div class="file-list">
|
<div class="file-list">
|
||||||
<el-dropdown @command="changeFile">
|
<el-dropdown @command="changeFile" v-if="type == 3">
|
||||||
<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,11 +54,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<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 { 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'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
|
import { sendChart } from '@/api/ai/index'
|
||||||
import emitter from '@/utils/mitt';
|
import emitter from '@/utils/mitt';
|
||||||
|
|
||||||
const userInfo = useUserStore().user
|
const userInfo = useUserStore().user
|
||||||
|
@ -71,12 +72,20 @@ const props = defineProps({
|
||||||
item: {
|
item: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return { name: '11' }
|
return { name: '' }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 1
|
default: 1
|
||||||
|
},
|
||||||
|
curMode:{
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
conversation_id: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -100,7 +109,8 @@ const curNode = reactive({})
|
||||||
const params = reactive(
|
const params = reactive(
|
||||||
{
|
{
|
||||||
prompt: '',
|
prompt: '',
|
||||||
dataset_id: ''
|
dataset_id: '',
|
||||||
|
template: ''
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -108,7 +118,24 @@ const params = reactive(
|
||||||
const getCompletion = async (val) => {
|
const getCompletion = async (val) => {
|
||||||
try {
|
try {
|
||||||
params.prompt = `按照${val}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
params.prompt = `按照${val}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析`
|
||||||
const { data } = await completion(params)
|
params.template = props.item.prompt
|
||||||
|
|
||||||
|
let data = null;
|
||||||
|
// 教学大模型
|
||||||
|
if(props.curMode == 1){
|
||||||
|
const res = await sendChart({
|
||||||
|
content: params.prompt,
|
||||||
|
conversationId: props.conversation_id,
|
||||||
|
stream: false
|
||||||
|
})
|
||||||
|
data = res.data
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// 知识库模型
|
||||||
|
const res = await completion(params)
|
||||||
|
data = res.data
|
||||||
|
}
|
||||||
|
|
||||||
let answer = data.answer
|
let answer = data.answer
|
||||||
msgList.value.push({
|
msgList.value.push({
|
||||||
type: 'robot',
|
type: 'robot',
|
||||||
|
@ -125,19 +152,6 @@ 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('')
|
||||||
|
@ -160,11 +174,12 @@ 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);
|
Object.assign(curNode, data);
|
||||||
|
|
||||||
|
modeType.value = props.type == 1 ? '课标' : props.type == 2 ? '教材' : '考试'
|
||||||
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,7 +14,10 @@
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</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 type="danger" link :disabled="!(templateList.length)" @click="removeItem(curTemplate, false)">
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -52,7 +55,8 @@
|
||||||
<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" @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>
|
</div>
|
||||||
<div class="ai-btn" v-if="item.answer">
|
<div class="ai-btn" v-if="item.answer">
|
||||||
|
@ -77,7 +81,7 @@
|
||||||
<!--编辑结果-->
|
<!--编辑结果-->
|
||||||
<EditDialog v-model="isEdit" :item="editItem" />
|
<EditDialog v-model="isEdit" :item="editItem" />
|
||||||
<!--AI 对话调整-->
|
<!--AI 对话调整-->
|
||||||
<AdjustDialog v-model="isAdjust" :type="type" :item="editItem" />
|
<AdjustDialog v-model="isAdjust" :type="type" :item="editItem" :curMode="curMode" :conversation_id="conversation_id"/>
|
||||||
<!--添加、编辑提示词-->
|
<!--添加、编辑提示词-->
|
||||||
<keywordDialog v-model="isWordDialog" :item="editItem" />
|
<keywordDialog v-model="isWordDialog" :item="editItem" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -86,6 +90,7 @@
|
||||||
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'
|
||||||
|
@ -94,10 +99,23 @@ 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
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
/*****************提示词相关****************/
|
/*****************提示词相关****************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -252,7 +270,6 @@ const removeItem = async (item, isChild) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Ai对话调整
|
// Ai对话调整
|
||||||
const curIndex = ref(-1)
|
const curIndex = ref(-1)
|
||||||
const isAdjust = ref(false)
|
const isAdjust = ref(false)
|
||||||
|
@ -277,6 +294,7 @@ const params = reactive(
|
||||||
dataset_id: ''
|
dataset_id: ''
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
const prompt = ref('')
|
||||||
|
|
||||||
// 重新研读
|
// 重新研读
|
||||||
const isAgain = ref(false)
|
const isAgain = ref(false)
|
||||||
|
@ -296,8 +314,28 @@ 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}进行教学分析`
|
|
||||||
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
|
||||||
|
}
|
||||||
|
|
||||||
childTempList.value[index].answer = getResult(data.answer);
|
childTempList.value[index].answer = getResult(data.answer);
|
||||||
isStarted.value[index] = true
|
isStarted.value[index] = true
|
||||||
|
|
||||||
|
@ -305,6 +343,7 @@ 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)
|
||||||
|
@ -320,8 +359,27 @@ 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}${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 (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 {
|
||||||
|
@ -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 curNode = reactive({})
|
||||||
const modeType = ref('')
|
const modeType = ref('')
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -396,6 +478,15 @@ 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()
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 解绑
|
// 解绑
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div class="blockBox">
|
<div class="blockBox">
|
||||||
<el-button @click="currentType = 'selection'"><el-image src="../../../src/assets/images/mouse-pointer.png"
|
<el-button @click="currentType = 'selection'"><el-image :src="pointerImg"
|
||||||
style="width: 14px; height: 14px; color: silver" /></el-button>
|
style="width: 14px; height: 14px; color: silver" /></el-button>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="type == 'design'">
|
<template v-if="type == 'design'">
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
<!-- 边框粗细 -->
|
<!-- 边框粗细 -->
|
||||||
<div class="blockBox">
|
<div class="blockBox">
|
||||||
<el-dropdown @command="updateStyle('lineWidth', $event)" placement="top">
|
<el-dropdown @command="updateStyle('lineWidth', $event)" placement="top">
|
||||||
<el-button><el-image src="../../../src/assets/images/borderwidth.png"
|
<el-button><el-image :src="borderImg"
|
||||||
style="width: 14px; height: 14px"></el-image></el-button>
|
style="width: 14px; height: 14px"></el-image></el-button>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
|
@ -303,6 +303,9 @@ import {
|
||||||
import Contextmenu from './components/Contextmenu.vue'
|
import Contextmenu from './components/Contextmenu.vue'
|
||||||
import { fontFamilyList, fontSizeList } from './constants'
|
import { fontFamilyList, fontSizeList } from './constants'
|
||||||
|
|
||||||
|
const borderImg = new URL('../../../src/assets/images/borderwidth.png', import.meta.url).href
|
||||||
|
const pointerImg = new URL('../../../src/assets/images/mouse-pointer.png', import.meta.url).href
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/**
|
||||||
|
* 无限滚动
|
||||||
|
*/
|
||||||
|
import { nextTick } from 'vue'
|
||||||
|
const mountedHook = async (el, binding) => {
|
||||||
|
console.log(el, binding)
|
||||||
|
const value = binding.value
|
||||||
|
if (typeof value !== 'function') return console.error('v-scroll must be a function')
|
||||||
|
await nextTick()
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
// Hooks for Vue3
|
||||||
|
mounted(el, binding) {
|
||||||
|
mountedHook(el, binding)
|
||||||
|
},
|
||||||
|
// Hooks for Vue2
|
||||||
|
inserted(el, binding) {
|
||||||
|
mountedHook(el, binding)
|
||||||
|
},
|
||||||
|
|
||||||
|
update(el, binding){
|
||||||
|
},
|
||||||
|
updated(el, binding){
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
|
@ -182,9 +182,9 @@ watch(
|
||||||
|
|
||||||
|
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
const hasClass = sessionStore.has('activeClass.id')
|
|
||||||
const hasTool = sessionStore.get('isToolWin')
|
if(!!sessionstore.get('curr.classcourse'))return ElMessage.warning('当前正在上课,请先结束上课')
|
||||||
if (hasClass || hasTool) return ElMessage.warning('当前正在上课,请先结束上课')
|
|
||||||
ElMessageBox.confirm('确认退出系统吗?', '提示', {
|
ElMessageBox.confirm('确认退出系统吗?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
|
|
|
@ -17,14 +17,14 @@ import log from 'electron-log/renderer' // 渲染进程日志-文件记录
|
||||||
import customComponent from '@/components/common' // 自定义组件
|
import customComponent from '@/components/common' // 自定义组件
|
||||||
import plugins from './plugins' // plugins插件
|
import plugins from './plugins' // plugins插件
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
|
import VueViewer from 'v-viewer'
|
||||||
|
import 'viewerjs/dist/viewer.css'
|
||||||
if(process.env.NODE_ENV != 'development') { // 非开发环境,将日志打印到日志文件
|
if(process.env.NODE_ENV != 'development') { // 非开发环境,将日志打印到日志文件
|
||||||
Object.assign(console, log.functions) // 渲染进程日志-控制台替换
|
Object.assign(console, log.functions) // 渲染进程日志-控制台替换
|
||||||
}
|
}
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
|
|
||||||
//专为菁优网配置的请求转发
|
//专为菁优网配置的请求转发
|
||||||
app.config.globalProperties.$requestGetJYW = (url,config)=>{
|
app.config.globalProperties.$requestGetJYW = (url,config)=>{
|
||||||
config.params = config.params?config.params:{}
|
config.params = config.params?config.params:{}
|
||||||
|
@ -42,6 +42,7 @@ import Directive from '@/AixPPTist/src/plugins/directive'
|
||||||
|
|
||||||
app.use(router)
|
app.use(router)
|
||||||
.use(store)
|
.use(store)
|
||||||
|
.use(VueViewer)
|
||||||
.use(ElementPlus, { locale: zhLocale })
|
.use(ElementPlus, { locale: zhLocale })
|
||||||
.use(customComponent) // 自定义组件
|
.use(customComponent) // 自定义组件
|
||||||
.use(plugins)
|
.use(plugins)
|
||||||
|
|
|
@ -98,6 +98,8 @@ export class MsgEnum {
|
||||||
MSG_classlecturePagesrc : 'classlecturePagesrc',
|
MSG_classlecturePagesrc : 'classlecturePagesrc',
|
||||||
/** @desc: 课堂作业|活动 */
|
/** @desc: 课堂作业|活动 */
|
||||||
MSG_homework : 'HOMEWORK',
|
MSG_homework : 'HOMEWORK',
|
||||||
|
/** @desc: 公屏 - 课堂作业|活动 */
|
||||||
|
MSG_pushSreen_work : 'pushSreen-work',
|
||||||
/** @desc: 点赞 */
|
/** @desc: 点赞 */
|
||||||
MSG_dz : 'dz',
|
MSG_dz : 'dz',
|
||||||
/** @desc: 疑惑 */
|
/** @desc: 疑惑 */
|
||||||
|
|
|
@ -167,9 +167,6 @@ 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 毫秒
|
||||||
|
|
|
@ -31,6 +31,11 @@ export const constantRoutes = [
|
||||||
component: () => import('@/AixPPTist/src/App.vue'),
|
component: () => import('@/AixPPTist/src/App.vue'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/gridPic',
|
||||||
|
component: () => import('@/components/grid-pic/index.vue'),
|
||||||
|
hidden: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/model',
|
path: '/model',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
|
@ -83,7 +88,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: '习题上传' }
|
meta: { title: '习题上传', showBread: true }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'aiKolors',
|
path: 'aiKolors',
|
||||||
|
|
|
@ -5,6 +5,7 @@ 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: "不限"},
|
||||||
|
|
|
@ -57,24 +57,31 @@ export const resourceFormat = [
|
||||||
// 资源类型
|
// 资源类型
|
||||||
export const resourceType = [
|
export const resourceType = [
|
||||||
{
|
{
|
||||||
|
id:1,
|
||||||
label: '课例库',
|
label: '课例库',
|
||||||
value: "'apt','课件','教案'"
|
value: "'apt','课件','教案'"
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: '作业库',
|
// label: '作业库',
|
||||||
value: '作业',
|
// value: '作业',
|
||||||
disabled: true
|
// disabled: true
|
||||||
},
|
// },
|
||||||
|
|
||||||
{
|
{
|
||||||
|
id:2,
|
||||||
label: '素材库',
|
label: '素材库',
|
||||||
value: "'素材'"
|
value: "'素材'"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '习题库',
|
id:3,
|
||||||
value: '习题',
|
label: '实验室',
|
||||||
disabled: true
|
value: "'素材'"
|
||||||
}
|
},
|
||||||
|
// {
|
||||||
|
// label: '习题库',
|
||||||
|
// value: '习题',
|
||||||
|
// disabled: true
|
||||||
|
// }
|
||||||
]
|
]
|
||||||
// 年级划分
|
// 年级划分
|
||||||
export const gradeList = [
|
export const gradeList = [
|
||||||
|
|
|
@ -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) // 事件监听处理
|
||||||
break
|
return win
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
|
|
@ -3,16 +3,16 @@
|
||||||
<!-- <div class="class-reserv-tabs">
|
<!-- <div class="class-reserv-tabs">
|
||||||
<el-segmented v-model="tabActive" block :options="tabOptions" size="large" />
|
<el-segmented v-model="tabActive" block :options="tabOptions" size="large" />
|
||||||
</div>-->
|
</div>-->
|
||||||
<div class="class-reserv-body">
|
<div class="class-reserv-body" v-infinite-scroll="load">
|
||||||
<template v-for="(item, index) in dataList" :key="index">
|
<template v-for="(item, index) in dataList" :key="index">
|
||||||
<reserv-item
|
<!-- <reserv-item
|
||||||
:style="{'background-color': index%2==0?'#f5f5f5':''}"
|
:style="{'background-color': index%2==0?'#f5f5f5':''}"
|
||||||
:item="item"
|
:item="item"
|
||||||
v-if="item.bookImg"
|
v-if="item.bookImg"
|
||||||
@open-edit="reservDialog.openDialog(item)"
|
@open-edit="reservDialog.openDialog(item)"
|
||||||
@delete-reserv="deleteReserv(item)"
|
@delete-reserv="deleteReserv(item)"
|
||||||
@change="(...o) => emit('change', ...o)"
|
@change="(...o) => emit('change', ...o)"
|
||||||
></reserv-item>
|
></reserv-item> -->
|
||||||
<reserv-item-apt
|
<reserv-item-apt
|
||||||
v-if="!item.bookImg"
|
v-if="!item.bookImg"
|
||||||
:style="{'background-color': index%2==0?'#f5f5f5':''}"
|
:style="{'background-color': index%2==0?'#f5f5f5':''}"
|
||||||
|
@ -22,13 +22,14 @@
|
||||||
@change="(...o) => emit('change', ...o)"
|
@change="(...o) => emit('change', ...o)"
|
||||||
></reserv-item-apt>
|
></reserv-item-apt>
|
||||||
</template>
|
</template>
|
||||||
|
<el-divider v-if="page.isEnd">到底了,没了</el-divider>
|
||||||
</div>
|
</div>
|
||||||
<reserv ref="reservDialog"></reserv>
|
<reserv ref="reservDialog"></reserv>
|
||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, computed, watch } from 'vue'
|
import { ref, onMounted, computed, watch, reactive } from 'vue'
|
||||||
import { getSelfReserv } from '@/api/classManage'
|
import { getSelfReserv } from '@/api/classManage'
|
||||||
import { listClasscourseNew } from '@/api/teaching/classcourse' // api接口
|
import { listClasscourseNew } from '@/api/teaching/classcourse' // api接口
|
||||||
import ReservItem from '@/views/classManage/reserv-item.vue'
|
import ReservItem from '@/views/classManage/reserv-item.vue'
|
||||||
|
@ -36,6 +37,7 @@ import Reserv from '@/views/prepare/container/reserv.vue'
|
||||||
import { useToolState } from '@/store/modules/tool'
|
import { useToolState } from '@/store/modules/tool'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import ReservItemApt from '@/views/classManage/reserv-item-apt.vue'
|
import ReservItemApt from '@/views/classManage/reserv-item-apt.vue'
|
||||||
|
import vScroll from '@/directive/scroll' // 指令--滚动
|
||||||
// import Chat from '@/utils/chat' // im 登录初始化
|
// import Chat from '@/utils/chat' // im 登录初始化
|
||||||
// if (!Chat.imChat) Chat.init()
|
// if (!Chat.imChat) Chat.init()
|
||||||
|
|
||||||
|
@ -44,6 +46,12 @@ const reservDialog = ref(null)
|
||||||
const tabOptions = ref(['进行中', '已结束'])
|
const tabOptions = ref(['进行中', '已结束'])
|
||||||
const tabActive = ref('进行中')
|
const tabActive = ref('进行中')
|
||||||
const dataList = ref([])
|
const dataList = ref([])
|
||||||
|
const page = reactive({
|
||||||
|
pageNum: 0, // 页码
|
||||||
|
pageSize: 10, // 每页条数
|
||||||
|
total: 0, // 总条数
|
||||||
|
isEnd: false // 是否加载完
|
||||||
|
})
|
||||||
|
|
||||||
const toolStore = useToolState()
|
const toolStore = useToolState()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
@ -72,21 +80,42 @@ const deleteReserv = (item) => {
|
||||||
})*/
|
})*/
|
||||||
// 获取数据
|
// 获取数据
|
||||||
const getData = () => {
|
const getData = () => {
|
||||||
Promise.all([listClasscourseNew({teacherid: userStore.id,evalid: props.curNode.id,pageSize:1000}), getSelfReserv({ex2:props.curNode.id})]).then(([res1,res2])=>{
|
const { pageNum, pageSize } = page
|
||||||
let list = res2.data || []
|
const params = {
|
||||||
let list2 = res1.rows || []
|
evalid: props.curNode.id,
|
||||||
// list.sort((a,b) => { if(a.status=='上课中') return -1; else return 0 })
|
teacherid: userStore.id,
|
||||||
list = list.concat(list2)
|
pageNum, pageSize
|
||||||
|
}
|
||||||
|
listClasscourseNew(params)
|
||||||
|
.then((res) => {
|
||||||
|
const list = res.rows || []
|
||||||
|
const total = res.total || 0
|
||||||
list.sort((a,b) => { return new Date(b.createTime) - new Date(a.createTime) })
|
list.sort((a,b) => { return new Date(b.createTime) - new Date(a.createTime) })
|
||||||
dataList.value = list
|
dataList.value.push(...list)
|
||||||
|
page.total = total // 总条数
|
||||||
|
page.isEnd = dataList.value.length == total // 是否结束
|
||||||
})
|
})
|
||||||
|
// aippt+ppt 获取数据
|
||||||
|
// Promise.all([listClasscourseNew({teacherid: userStore.id,evalid: props.curNode.id,pageSize:1000}), getSelfReserv({ex2:props.curNode.id})]).then(([res1,res2])=>{
|
||||||
|
// let list = res2.data || []
|
||||||
|
// let list2 = res1.rows || []
|
||||||
|
// // list.sort((a,b) => { if(a.status=='上课中') return -1; else return 0 })
|
||||||
|
// list = list.concat(list2)
|
||||||
|
// list.sort((a,b) => { return new Date(b.createTime) - new Date(a.createTime) })
|
||||||
|
// dataList.value = list
|
||||||
|
// })
|
||||||
/*getSelfReserv().then((res) => {
|
/*getSelfReserv().then((res) => {
|
||||||
const list = res.data || []
|
const list = res.data || []
|
||||||
list.sort((a,b) => { if(a.status=='上课中') return -1; else return 0 })
|
list.sort((a,b) => { if(a.status=='上课中') return -1; else return 0 })
|
||||||
dataList.value = list
|
dataList.value = list
|
||||||
})*/
|
})*/
|
||||||
}
|
}
|
||||||
|
// 列表加载更多
|
||||||
|
const load = () => {
|
||||||
|
if(page.isEnd) return console.log('已加载完-所有') // 结束
|
||||||
|
page.pageNum++
|
||||||
|
getData()
|
||||||
|
}
|
||||||
watch(
|
watch(
|
||||||
() => [dataList,toolStore.isToolWin,props.curNode],
|
() => [dataList,toolStore.isToolWin,props.curNode],
|
||||||
() => {
|
() => {
|
||||||
|
@ -96,13 +125,14 @@ watch(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getData() // 加载数据
|
// getData() // 加载数据
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.class-reserv-wrap {
|
.class-reserv-wrap {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
// height: 300px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
//padding: 15px 10px;
|
//padding: 15px 10px;
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
</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>
|
||||||
|
@ -85,6 +86,7 @@ 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;
|
||||||
|
@ -110,7 +112,7 @@ const chatSend = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.class-reserv-item-tool {
|
.class-reserv-item-tool {
|
||||||
margin-left: 15px;
|
margin: 0 7px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,10 +149,14 @@ 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,
|
||||||
})
|
})
|
||||||
|
@ -189,6 +193,7 @@ 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)){
|
||||||
|
@ -216,7 +221,28 @@ 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 } from 'vue'
|
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick, onUnmounted } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
|
@ -88,6 +88,8 @@ 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');
|
||||||
|
@ -96,7 +98,9 @@ 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({
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -151,6 +155,7 @@ 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 // 版本
|
||||||
|
@ -161,7 +166,13 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
initHomeWork();
|
initHomeWork();
|
||||||
})
|
})
|
||||||
|
onUnmounted(()=>{
|
||||||
|
// 延迟1s 关闭习题上传界面,作业管理界面需要根据 isOpenQuestUploadView 来进行判断
|
||||||
|
setTimeout(()=>{
|
||||||
|
useClassTaskStores.isOpenQuestUploadView = false; // 关闭习题上传界面
|
||||||
|
console.log('onUnmounted 习题上传');
|
||||||
|
}, 1000)
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取 entpcourseid 获取作业列表
|
* 获取 entpcourseid 获取作业列表
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
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";
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +17,13 @@ const baidubceConfig = {
|
||||||
'client_secret': 'oWb0M0YWMmZPMQIhIUkJX99ddr7h61qf',
|
'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("未检测到截图图片, 请截取图片后再识别");
|
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;
|
|
||||||
let base64Code = urlBase64.split(",")[1];
|
let base64Code = urlBase64.split(",")[1];
|
||||||
const query = {
|
const resOcr = await getOcrContent({ base64Code: base64Code });
|
||||||
image: base64Code, //图片地址(base64)
|
if (resOcr.code !== 200) {
|
||||||
line_probability: false, //是否返回每行识别结果的置信度。默认为false
|
ElMessage.error("图片识别错误");
|
||||||
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 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;
|
return resOcr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,8 +163,10 @@ 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'])
|
||||||
|
@ -719,14 +721,17 @@ 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=[]
|
||||||
|
@ -769,7 +774,7 @@ onMounted(() => {
|
||||||
console.log('socket监听消息')
|
console.log('socket监听消息')
|
||||||
ChatWs.watch((msg, e) => {
|
ChatWs.watch((msg, e) => {
|
||||||
try {
|
try {
|
||||||
msgHandle(JSON.parse(msg))
|
msgHandle(JSON.parse(msg)?.msg)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('socket 解析异常 ', error, e)
|
console.error('socket 解析异常 ', error, e)
|
||||||
msgHandle(msg)
|
msgHandle(msg)
|
||||||
|
|
|
@ -61,7 +61,8 @@
|
||||||
<div>
|
<div>
|
||||||
<div v-if="myClassActive.filetype=='apt'">开始新的课堂,需要点击先创建课堂,才能显示手机二维码</div>
|
<div v-if="myClassActive.filetype=='apt'">开始新的课堂,需要点击先创建课堂,才能显示手机二维码</div>
|
||||||
<div v-else>开始新的课堂,需要点击先创建课堂</div>
|
<div v-else>开始新的课堂,需要点击先创建课堂</div>
|
||||||
<el-button type="warning" :loading="dt.loading" @click="createClasscourse">创建课堂</el-button>
|
<el-button type="warning" :loading="dt.loading" @click="createClasscourse()">创建课堂</el-button>
|
||||||
|
<el-button type="success" @click="createClasscourse(true)">公屏上课</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<!-- 故障备用 -->
|
<!-- 故障备用 -->
|
||||||
|
@ -146,7 +147,7 @@ const open = async (id, classObj) => {
|
||||||
await getAptInfo(id)
|
await getAptInfo(id)
|
||||||
// 获取班级列表
|
// 获取班级列表
|
||||||
getClassList()
|
getClassList()
|
||||||
console.log('classObj', classObj)
|
// console.log('classObj', classObj)
|
||||||
// 继续上课
|
// 继续上课
|
||||||
if (!!classObj) {
|
if (!!classObj) {
|
||||||
dt.ctCourse = classObj
|
dt.ctCourse = classObj
|
||||||
|
@ -245,8 +246,8 @@ const getClasscourseList = async type => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 创建课程
|
// 创建课程 isPublic 公屏上课
|
||||||
const createClasscourse = async () => {
|
const createClasscourse = async (isPublic = false) => {
|
||||||
const { classid } = classForm.form
|
const { classid } = classForm.form
|
||||||
if (!classid) {
|
if (!classid) {
|
||||||
ElMessage.warning('请选择班级')
|
ElMessage.warning('请选择班级')
|
||||||
|
@ -255,8 +256,8 @@ const createClasscourse = async () => {
|
||||||
dt.loading = true
|
dt.loading = true
|
||||||
const { entpcourseid, evalid, id, coursetitle } = myClassActive.value // 课件对象
|
const { entpcourseid, evalid, id, coursetitle } = myClassActive.value // 课件对象
|
||||||
const curDate = commUtil.getDateNow('yyyy-MM-dd')
|
const curDate = commUtil.getDateNow('yyyy-MM-dd')
|
||||||
const params = {
|
const params = { // 公屏上课直接 status = open
|
||||||
id: 0, coursetype: '', courseverid: 0, coursedesc: '', status: '',
|
id: 0, coursetype: '', courseverid: 0, coursedesc: '', status: isPublic?'open':'',
|
||||||
teacherid: userStore.id, entpcoursefileid: id, classid,
|
teacherid: userStore.id, entpcoursefileid: id, classid,
|
||||||
entpcourseid, evalid, coursetitle,
|
entpcourseid, evalid, coursetitle,
|
||||||
plandate: curDate, opendate: curDate
|
plandate: curDate, opendate: curDate
|
||||||
|
@ -274,7 +275,7 @@ const createClasscourse = async () => {
|
||||||
setTimeout(async() => {
|
setTimeout(async() => {
|
||||||
msgEl.close()
|
msgEl.close()
|
||||||
const res = await Http_Classcourse.getClasscourse(teacherForm.form.classcourseid)
|
const res = await Http_Classcourse.getClasscourse(teacherForm.form.classcourseid)
|
||||||
openPublicScreen(res.data)
|
openPublicScreen(res.data, isPublic)
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
@ -355,7 +356,7 @@ const getQrUrl = async() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开公屏
|
// 打开公屏
|
||||||
const openPublicScreen = (classcourse) => {
|
const openPublicScreen = (classcourse, isPublic) => {
|
||||||
console.log('打开公屏', classcourse)
|
console.log('打开公屏', classcourse)
|
||||||
if (!dt.ctCourse) { // 新开课需要发送消息-继续上课不需要直接打开
|
if (!dt.ctCourse) { // 新开课需要发送消息-继续上课不需要直接打开
|
||||||
// 发送app端待开课消息
|
// 发送app端待开课消息
|
||||||
|
@ -366,11 +367,14 @@ const openPublicScreen = (classcourse) => {
|
||||||
const resource = toRaw(myClassActive.value)
|
const resource = toRaw(myClassActive.value)
|
||||||
sessionStore.set('curr.resource', resource) // 缓存当前资源信息
|
sessionStore.set('curr.resource', resource) // 缓存当前资源信息
|
||||||
sessionStore.set('curr.classcourse', classcourse) // 缓存当前当前上课
|
sessionStore.set('curr.classcourse', classcourse) // 缓存当前当前上课
|
||||||
|
// 公屏开课
|
||||||
|
sessionStore.set('curr.isPublic', isPublic) // 缓存是否公屏开课
|
||||||
createWindow('open-win', {
|
createWindow('open-win', {
|
||||||
url: '/pptist', // 窗口关闭时,清除缓存
|
url: '/pptist', // 窗口关闭时,清除缓存
|
||||||
close: () => {
|
close: () => {
|
||||||
sessionStore.set('curr.resource', null) // 清除缓存
|
sessionStore.set('curr.resource', null) // 清除缓存
|
||||||
sessionStore.set('curr.classcourse', null) // 清除缓存
|
sessionStore.set('curr.classcourse', null) // 清除缓存
|
||||||
|
sessionStore.set('curr.isPublic', null) // 清除缓存
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
visible.value = false // 关闭弹窗
|
visible.value = false // 关闭弹窗
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item @click="createAIPPT">新建文枢课件</el-dropdown-item>
|
<el-dropdown-item @click="createAIPPT">新建文枢课件</el-dropdown-item>
|
||||||
<el-dropdown-item @click="aiTOPPT">AI一键生成</el-dropdown-item>
|
<el-dropdown-item @click="aiTOPPT">AI一键生成</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click="openGridPic">打开宫格</el-dropdown-item>
|
||||||
<el-dropdown-item @click="openFilePicker">导入PPT</el-dropdown-item>
|
<el-dropdown-item @click="openFilePicker">导入PPT</el-dropdown-item>
|
||||||
<input type="file" ref="fileInput" style="display: none;" @change="handleFileChange" accept="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation">
|
<input type="file" ref="fileInput" style="display: none;" @change="handleFileChange" accept="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation">
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
|
@ -341,6 +342,14 @@ export default {
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
methods: {
|
methods: {
|
||||||
|
openGridPic() {
|
||||||
|
createWindow('open-win', {
|
||||||
|
url: '/gridPic', // 窗口关闭时,清除缓存
|
||||||
|
option: {
|
||||||
|
maximizable: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
// 延时
|
// 延时
|
||||||
sleep(ms){return new Promise(resolve => setTimeout(resolve, ms))},
|
sleep(ms){return new Promise(resolve => setTimeout(resolve, ms))},
|
||||||
addAiPPT(item) {
|
addAiPPT(item) {
|
||||||
|
@ -355,8 +364,8 @@ export default {
|
||||||
// 开始上课
|
// 开始上课
|
||||||
startClass(item, classObj) {
|
startClass(item, classObj) {
|
||||||
// 关闭状态,打开上课相关功能(已打开,忽略)
|
// 关闭状态,打开上课相关功能(已打开,忽略)
|
||||||
// const id = sessionStore.has('activeClass.id') ? sessionStore.get('activeClass.id') : null
|
const iscourse = !!sessionStore.get('curr.classcourse')
|
||||||
// if (id && id == item.id) return ElMessage.warning('当前正在上课,请勿重复操作')
|
if (iscourse) return ElMessage.warning('公屏已打开,请勿重复操作')
|
||||||
// 当前上课-store
|
// 当前上课-store
|
||||||
sessionStore.set('activeClass', item)
|
sessionStore.set('activeClass', item)
|
||||||
this.activeClass = item
|
this.activeClass = item
|
||||||
|
@ -367,7 +376,8 @@ export default {
|
||||||
this.$refs.calssRef.open(item.fileId, classObj)
|
this.$refs.calssRef.open(item.fileId, classObj)
|
||||||
}
|
}
|
||||||
if(item.fileFlag === 'aippt') {
|
if(item.fileFlag === 'aippt') {
|
||||||
this.$refs.calssRef.open(item.fileId, classObj)
|
if (!!classObj) this.changeClass('continue', classObj) // 继续上课
|
||||||
|
else this.$refs.calssRef.open(item.fileId, classObj) // 新开课
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 继续上课-apt
|
// 继续上课-apt
|
||||||
|
@ -375,7 +385,19 @@ export default {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case 'continue': { // 继续上课
|
case 'continue': { // 继续上课
|
||||||
const aptFileId = row.entpcoursefileid
|
const aptFileId = row.entpcoursefileid
|
||||||
this.$refs.calssRef.open(aptFileId, row)
|
const res = await getEntpcoursefile(aptFileId)
|
||||||
|
if (res.code == 200) {
|
||||||
|
const resource = res.data
|
||||||
|
if (resource.filetype != 'aippt') this.$refs.calssRef.open(aptFileId, row)
|
||||||
|
else {
|
||||||
|
if (!!sessionStore.get('curr.classcourse')) return ElMessage.warning('公屏已打开,请勿重复操作')
|
||||||
|
const msgEl = ElMessage.warning({message:'正在打开公屏,请稍后...',duration: 0})
|
||||||
|
setTimeout(()=>{
|
||||||
|
msgEl.close()
|
||||||
|
this.openPublicScreen('class', resource, row) // 打开公屏-窗口
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
} else ElMessage.error(res.msg||'获取课件信息失败')
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'close': { // 关闭上课
|
case 'close': { // 关闭上课
|
||||||
|
@ -428,16 +450,7 @@ export default {
|
||||||
if (row.fileFlag === 'aippt' && !!row.fileId) {
|
if (row.fileFlag === 'aippt' && !!row.fileId) {
|
||||||
const res = await getEntpcoursefile(row.fileId)
|
const res = await getEntpcoursefile(row.fileId)
|
||||||
if (res && res.code === 200) {
|
if (res && res.code === 200) {
|
||||||
sessionStore.set('curr.resource', res.data) // 缓存当前资源信息
|
this.openPublicScreen('edit', res.data, row) // 打开公屏-窗口
|
||||||
sessionStore.set('curr.smarttalk', row) // 缓存当前文件smarttalk
|
|
||||||
createWindow('open-win', {
|
|
||||||
url: '/pptist', // 窗口关闭时,清除缓存
|
|
||||||
close: () => {
|
|
||||||
sessionStore.set('curr.resource', null) // 清除缓存
|
|
||||||
sessionStore.set('curr.smarttalk', null) // 清除缓存
|
|
||||||
this.asyncAllFile() // 刷新资源列表
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
ElMessage.warning(res.msg||'文件获取异常!')
|
ElMessage.warning(res.msg||'文件获取异常!')
|
||||||
}
|
}
|
||||||
|
@ -448,6 +461,8 @@ export default {
|
||||||
}
|
}
|
||||||
case 'wsApp': { // 发送app端待开课消息
|
case 'wsApp': { // 发送app端待开课消息
|
||||||
// console.log('wsApp', row)
|
// console.log('wsApp', row)
|
||||||
|
window.test = sessionStore
|
||||||
|
if (!!sessionStore.get('curr.classcourse')) return ElMessage.warning('公屏已打开,请勿重复操作')
|
||||||
const head = MsgEnum.HEADS.MSG_0000
|
const head = MsgEnum.HEADS.MSG_0000
|
||||||
const data = { id: row.id }
|
const data = { id: row.id }
|
||||||
const type = ChatWs.TYPES.single
|
const type = ChatWs.TYPES.single
|
||||||
|
@ -462,24 +477,38 @@ export default {
|
||||||
msgEl.close() // 关闭提示
|
msgEl.close() // 关闭提示
|
||||||
const resource = res?.data||{}
|
const resource = res?.data||{}
|
||||||
const classcourse = row
|
const classcourse = row
|
||||||
sessionStore.set('curr.resource', resource) // 缓存当前资源信息
|
this.openPublicScreen('class',resource, classcourse) // 打开公屏-窗口
|
||||||
sessionStore.set('curr.classcourse', classcourse) // 缓存当前当前上课
|
|
||||||
createWindow('open-win', {
|
|
||||||
url: '/pptist', // 窗口关闭时,清除缓存
|
|
||||||
close: () => {
|
|
||||||
sessionStore.set('curr.resource', null) // 清除缓存
|
|
||||||
sessionStore.set('curr.classcourse', null) // 清除缓存
|
|
||||||
}
|
|
||||||
})
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* description 打开公屏
|
||||||
|
* @param {string} type 类型 edit 打开 class 上课
|
||||||
|
* @param {object} resource 资源信息
|
||||||
|
* @param {object} currData 当前数据 type: edit/class 备课信息 | 课堂信息
|
||||||
|
*/
|
||||||
|
openPublicScreen(type, resource, currData) {
|
||||||
|
sessionStore.set('curr.resource', resource) // 缓存当前资源信息
|
||||||
|
if (type=='edit') sessionStore.set('curr.smarttalk', currData) // 缓存当前文件smarttalk
|
||||||
|
else sessionStore.set('curr.classcourse', currData) // 缓存当前当前上课
|
||||||
|
createWindow('open-win', {
|
||||||
|
url: '/pptist', // 窗口关闭时,清除缓存
|
||||||
|
close: () => {
|
||||||
|
sessionStore.set('curr.resource', null) // 清除缓存
|
||||||
|
if (type=='edit') {
|
||||||
|
sessionStore.set('curr.smarttalk', null) // 清除缓存
|
||||||
|
this.asyncAllFile() // 刷新资源列表
|
||||||
|
} else sessionStore.set('curr.classcourse', null) // 清除缓存
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
closeChange() { // 上课弹窗被关闭-触发
|
closeChange() { // 上课弹窗被关闭-触发
|
||||||
// console.log('关闭上课弹窗')
|
// console.log('关闭上课弹窗')
|
||||||
// this.activeClass = null
|
this.activeClass = null
|
||||||
sessionStore.delete('activeClass')
|
sessionStore.delete('activeClass')
|
||||||
},
|
},
|
||||||
initReserv(id) {
|
initReserv(id) {
|
||||||
|
@ -895,6 +924,7 @@ export default {
|
||||||
return getSmarttalkPage({
|
return getSmarttalkPage({
|
||||||
...this.uploadData,
|
...this.uploadData,
|
||||||
orderByColumn: 'createTime',
|
orderByColumn: 'createTime',
|
||||||
|
fileFlag: 'aippt',
|
||||||
isAsc: 'desc',
|
isAsc: 'desc',
|
||||||
pageSize: 500
|
pageSize: 500
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog v-model="model" class="preview-drawer" :title="row.fileShowName" :modal="true" :destroy-on-close="true" :with-header="false" :append-to-body="true"
|
||||||
|
width="60%">
|
||||||
|
<video style="margin: 0 auto;" :src="row.fileFullPath" controls autoplay></video>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
const model = defineModel()
|
||||||
|
const props = defineProps({
|
||||||
|
row: {
|
||||||
|
type: Object,
|
||||||
|
default(){
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.header-close {
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,214 @@
|
||||||
|
<template>
|
||||||
|
<div class="page-resource flex">
|
||||||
|
<!-- 左侧 教材 目录 -->
|
||||||
|
<div class="page-right">
|
||||||
|
<!-- 排序 -->
|
||||||
|
<div style="margin-left: 5px;margin-top: 10px;height: 45px;">
|
||||||
|
<el-form size="large">
|
||||||
|
<el-form-item label="排序:">
|
||||||
|
<div
|
||||||
|
:class="['score-circle', { 'active': active == item.active }]"
|
||||||
|
v-for="(item,index) in screenList" :key="index" @click="chooseItem(item)">
|
||||||
|
<el-text
|
||||||
|
:style="{fontWeight:'bold', color: active == item.active ? 'rgb(57, 184, 244)':'rgb(131,131,131)' }"
|
||||||
|
size="large">{{ item.title }}</el-text>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<el-scrollbar>
|
||||||
|
<el-empty v-if="!sourceStore.result.list.length" description="暂无数据" />
|
||||||
|
<div class="list-content">
|
||||||
|
<div class="list-container" v-loading="loading">
|
||||||
|
<div v-for="(item, index) in sourceStore.result.list" :key="index" class="content">
|
||||||
|
<div class="content-list">
|
||||||
|
<!-- 封面 -->
|
||||||
|
<el-image style="width: 100%;border-radius: 8px;" :src="item.coverPic" fit="contain" @click="chooseVedio(item)"/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- 标题 -->
|
||||||
|
<div style="text-align: left;">
|
||||||
|
<el-text>{{ item.fileShowName }}</el-text>
|
||||||
|
</div>
|
||||||
|
<!-- 观看人数 -->
|
||||||
|
<!-- <div style="text-align: left;display: flex;align-items: center;">
|
||||||
|
<el-icon type="info"><View /></el-icon><el-text size="small" type="info">{{ item.nums }}</el-text>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-scrollbar>
|
||||||
|
<div class="pagination-box">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="sourceStore.query.pageNum"
|
||||||
|
v-model:page-size="sourceStore.query.pageSize"
|
||||||
|
:page-sizes="[10, 20, 30, 50]"
|
||||||
|
background
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="sourceStore.result.total"
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- 播放视频 -->
|
||||||
|
<VideoLog v-model="isShow" :row="curRow"></VideoLog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, computed } from 'vue'
|
||||||
|
import VideoLog from './components/VideoLog.vue'
|
||||||
|
import useResoureStore from '../store'
|
||||||
|
const sourceStore = useResoureStore()
|
||||||
|
// 排序列表
|
||||||
|
const screenList = ref([
|
||||||
|
{
|
||||||
|
title: '最新发布',
|
||||||
|
active: 1,
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const active = ref(1)
|
||||||
|
// 弹出视频
|
||||||
|
const isShow = ref(false)
|
||||||
|
const curRow = ref({})
|
||||||
|
// loading框
|
||||||
|
const loading = computed(() => sourceStore.loading)
|
||||||
|
const chooseItem = (item) => {
|
||||||
|
active.value = item.active
|
||||||
|
}
|
||||||
|
// 分页change
|
||||||
|
const handleSizeChange = (limit) => {
|
||||||
|
sourceStore.query.pageSize = limit
|
||||||
|
sourceStore.handleQuery()
|
||||||
|
}
|
||||||
|
const handleCurrentChange = (page) => {
|
||||||
|
sourceStore.query.pageNum = page
|
||||||
|
sourceStore.handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const chooseVedio = (item) => {
|
||||||
|
isShow.value = true
|
||||||
|
curRow.value = item
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.page-resource {
|
||||||
|
height: 100%;
|
||||||
|
padding: 10px 15px 0;
|
||||||
|
|
||||||
|
.page-right {
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.icon-jiahao {
|
||||||
|
font-size: 12px;
|
||||||
|
margin-right: 3px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.create-btn {
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 5px 13px;
|
||||||
|
}
|
||||||
|
.list-content {
|
||||||
|
border-radius: 8px;
|
||||||
|
height: 90%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.list-container {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
border-radius: 8px;
|
||||||
|
// box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
width: calc(20%);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
padding: 5px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
// justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
// box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
.content-list{
|
||||||
|
height: 150px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-content {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-icon {
|
||||||
|
font-size: 24px;
|
||||||
|
color: #409eff;
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-text {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-bottom {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 过渡动画 */
|
||||||
|
.fade-enter-active, .fade-leave-active {
|
||||||
|
transition: opacity 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fade-enter, .fade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
.score-circle {
|
||||||
|
background-color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-right: 5px;
|
||||||
|
width: auto;
|
||||||
|
text-align: center;
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.score-circle.active {
|
||||||
|
background-color: rgb(218, 236, 255);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.pagination-box {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
height: 65px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -3,11 +3,12 @@
|
||||||
<el-row justify="space-between">
|
<el-row justify="space-between">
|
||||||
<el-col :span="12" class="tab-btns flex">
|
<el-col :span="12" class="tab-btns flex">
|
||||||
<el-button text v-for="item in sourceStore.resourceTypeList" :key="item.id"
|
<el-button text v-for="item in sourceStore.resourceTypeList" :key="item.id"
|
||||||
:type="sourceStore.query.fileFlags == item.value ? 'primary' : ''"
|
:type="sourceStore.activeIndex == item.id ? 'primary' : ''"
|
||||||
@click="sourceStore.changeType(item.value)" :disabled="item.disabled">{{ item.label
|
@click="sourceStore.changeType(item)" :disabled="item.disabled">{{ item.label
|
||||||
}}</el-button>
|
}}</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
|
<template v-if="!isExper">
|
||||||
<el-col :span="12" class="search-box flex" v-if="isThird">
|
<el-col :span="12" class="search-box flex" v-if="isThird">
|
||||||
<el-input v-model="sourceStore.thirdQuery.title" @input="onchangeInput()" style="width: 240px"
|
<el-input v-model="sourceStore.thirdQuery.title" @input="onchangeInput()" style="width: 240px"
|
||||||
placeholder="请输入关键词" />
|
placeholder="请输入关键词" />
|
||||||
|
@ -16,6 +17,7 @@
|
||||||
<el-input v-model="sourceStore.query.fileName" @input="onchangeInput()" style="width: 240px"
|
<el-input v-model="sourceStore.query.fileName" @input="onchangeInput()" style="width: 240px"
|
||||||
placeholder="请输入关键词" />
|
placeholder="请输入关键词" />
|
||||||
</el-col>
|
</el-col>
|
||||||
|
</template>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<!-- 第三方资源筛选-->
|
<!-- 第三方资源筛选-->
|
||||||
|
@ -34,6 +36,7 @@
|
||||||
<el-col :span="24" class="query-row flex">
|
<el-col :span="24" class="query-row flex">
|
||||||
<div class="flex row-left">
|
<div class="flex row-left">
|
||||||
<!-- 第三方资源筛选-->
|
<!-- 第三方资源筛选-->
|
||||||
|
<template v-if="!isExper">
|
||||||
<el-select v-if="isThird" v-model="sourceStore.thirdQuery.type" @change="sourceStore.thirdChangeType"
|
<el-select v-if="isThird" v-model="sourceStore.thirdQuery.type" @change="sourceStore.thirdChangeType"
|
||||||
style="width: 110px">
|
style="width: 110px">
|
||||||
<el-option v-for="item in coursewareTypeList" :key="item.value" :label="item.label"
|
<el-option v-for="item in coursewareTypeList" :key="item.value" :label="item.label"
|
||||||
|
@ -50,6 +53,7 @@
|
||||||
:type="sourceStore.query.fileSource == item.value ? 'primary' : ''"
|
:type="sourceStore.query.fileSource == item.value ? 'primary' : ''"
|
||||||
@click="sourceStore.changeTab(item.value)">{{
|
@click="sourceStore.changeTab(item.value)">{{
|
||||||
item.label }}</el-button>
|
item.label }}</el-button>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<slot name="add" />
|
<slot name="add" />
|
||||||
|
@ -63,7 +67,10 @@
|
||||||
import {watch,ref,onMounted} from 'vue'
|
import {watch,ref,onMounted} from 'vue'
|
||||||
import useResoureStore from '../store'
|
import useResoureStore from '../store'
|
||||||
import {coursewareTypeList} from '@/utils/resourceDict'
|
import {coursewareTypeList} from '@/utils/resourceDict'
|
||||||
|
// 是否是第三方资源
|
||||||
const isThird = ref(false)
|
const isThird = ref(false)
|
||||||
|
//判断是不是进入实验室
|
||||||
|
const isExper = ref(false)
|
||||||
const sourceStore = useResoureStore()
|
const sourceStore = useResoureStore()
|
||||||
// 防抖函数
|
// 防抖函数
|
||||||
const debounce = (fn, t) => {
|
const debounce = (fn, t) => {
|
||||||
|
@ -85,6 +92,9 @@ onMounted(() => {
|
||||||
watch(() => sourceStore.query.fileSource,() => {
|
watch(() => sourceStore.query.fileSource,() => {
|
||||||
sourceStore.query.fileSource === '第三方'?isThird.value = true:isThird.value = false
|
sourceStore.query.fileSource === '第三方'?isThird.value = true:isThird.value = false
|
||||||
})
|
})
|
||||||
|
watch(() => sourceStore.query.orderByColumn,() => {
|
||||||
|
sourceStore.query.orderByColumn === 'uploadTime'?isExper.value = true:isExper.value = false
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.resoure-search {
|
.resoure-search {
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="page-resource flex">
|
<div class="page-resource flex">
|
||||||
<!--左侧 教材 目录-->
|
<!--左侧 教材 目录-->
|
||||||
<Third v-if="isThird" @node-click="getDataOther"></Third>
|
<template v-if="!isExper">
|
||||||
|
<Third v-if="isThird" @node-click="getDataOther"/>
|
||||||
<ChooseTextbook v-else @node-click="getData" />
|
<ChooseTextbook v-else @node-click="getData" />
|
||||||
|
</template>
|
||||||
|
<!-- 实验室的左侧树结构列表 -->
|
||||||
|
<template v-else>
|
||||||
|
<ExperimentBook @node-click="getExperData"/>
|
||||||
|
</template>
|
||||||
<div class="page-right">
|
<div class="page-right">
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<ResoureSearch #add>
|
<ResoureSearch #add>
|
||||||
|
@ -19,9 +24,14 @@
|
||||||
>
|
>
|
||||||
</ResoureSearch>
|
</ResoureSearch>
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
|
<template v-if="!isExper">
|
||||||
<!-- 第三方列表-->
|
<!-- 第三方列表-->
|
||||||
<ThirdList v-if="isThird" />
|
<ThirdList v-if="isThird" />
|
||||||
<ResoureList v-else />
|
<ResoureList v-else />
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<ExperList/>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 上传弹窗 -->
|
<!-- 上传弹窗 -->
|
||||||
|
@ -33,8 +43,12 @@ import { onMounted, ref, toRaw,watch } from 'vue'
|
||||||
import useResoureStore from './store'
|
import useResoureStore from './store'
|
||||||
import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
||||||
import Third from '@/components/choose-textbook/third.vue'
|
import Third from '@/components/choose-textbook/third.vue'
|
||||||
|
// 科学学科对应实验室
|
||||||
|
import ExperimentBook from '@/components/choose-textbook/experimentBook.vue'
|
||||||
import ResoureSearch from './container/resoure-search.vue'
|
import ResoureSearch from './container/resoure-search.vue'
|
||||||
import ResoureList from './container/resoure-list.vue'
|
import ResoureList from './container/resoure-list.vue'
|
||||||
|
// 实验列表
|
||||||
|
import ExperList from './container/exper-list.vue'
|
||||||
import ThirdList from './container/third-list.vue'
|
import ThirdList from './container/third-list.vue'
|
||||||
import uploadDialog from '@/components/upload-dialog/index.vue'
|
import uploadDialog from '@/components/upload-dialog/index.vue'
|
||||||
import uploaderState from '@/store/modules/uploader'
|
import uploaderState from '@/store/modules/uploader'
|
||||||
|
@ -48,6 +62,8 @@ const openDialog = () => {
|
||||||
}
|
}
|
||||||
//判断是否去查看第三方资源
|
//判断是否去查看第三方资源
|
||||||
const isThird = ref(false)
|
const isThird = ref(false)
|
||||||
|
//判断是不是进入实验室
|
||||||
|
const isExper = ref(false)
|
||||||
|
|
||||||
// 查询
|
// 查询
|
||||||
const getData = (data) => {
|
const getData = (data) => {
|
||||||
|
@ -73,6 +89,7 @@ const getData = (data) => {
|
||||||
// 头部 教材分析打开外部链接需要当前章节ID
|
// 头部 教材分析打开外部链接需要当前章节ID
|
||||||
localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId}))
|
localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId}))
|
||||||
}
|
}
|
||||||
|
// 查询第三方资源
|
||||||
const getDataOther = (data) => {
|
const getDataOther = (data) => {
|
||||||
sourceStore.thirdQuery.chapterId = data.chapterId
|
sourceStore.thirdQuery.chapterId = data.chapterId
|
||||||
sourceStore.thirdQuery.bookId = data.bookId
|
sourceStore.thirdQuery.bookId = data.bookId
|
||||||
|
@ -80,6 +97,19 @@ const getDataOther = (data) => {
|
||||||
sourceStore.thirdQuery.subjectId = data.subjectId
|
sourceStore.thirdQuery.subjectId = data.subjectId
|
||||||
sourceStore.handleQuery()
|
sourceStore.handleQuery()
|
||||||
}
|
}
|
||||||
|
// 查询科学实验室的资源
|
||||||
|
const getExperData = (data) => {
|
||||||
|
const { textBook, node } = data
|
||||||
|
if (node.parentNode) {
|
||||||
|
sourceStore.query.levelFirstId = node.parentNode.id
|
||||||
|
sourceStore.query.levelSecondId = node.id
|
||||||
|
} else {
|
||||||
|
sourceStore.query.levelFirstId = node.id
|
||||||
|
sourceStore.query.levelSecondId = ''
|
||||||
|
}
|
||||||
|
sourceStore.query.textbookId = node.rootid
|
||||||
|
sourceStore.handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
// 提交文件
|
// 提交文件
|
||||||
const submitFile = (data) => {
|
const submitFile = (data) => {
|
||||||
|
@ -108,6 +138,15 @@ onMounted(() => {
|
||||||
watch(() => sourceStore.query.fileSource,() => {
|
watch(() => sourceStore.query.fileSource,() => {
|
||||||
sourceStore.query.fileSource === '第三方'?isThird.value = true:isThird.value = false
|
sourceStore.query.fileSource === '第三方'?isThird.value = true:isThird.value = false
|
||||||
})
|
})
|
||||||
|
watch(() => sourceStore.query.orderByColumn,() => {
|
||||||
|
if(sourceStore.query.orderByColumn === 'uploadTime'){
|
||||||
|
isExper.value = true
|
||||||
|
sourceStore.getCreate()
|
||||||
|
}else{
|
||||||
|
isExper.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -77,6 +77,7 @@ export default defineStore('resource', {
|
||||||
list: [],
|
list: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
},
|
},
|
||||||
|
activeIndex:1
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
|
@ -119,7 +120,16 @@ export default defineStore('resource', {
|
||||||
this.handleQuery()
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
changeType(val) {
|
changeType(val) {
|
||||||
this.query.fileFlags = val
|
// 实验列表
|
||||||
|
if(val.label === '实验室'){
|
||||||
|
this.query.orderByColumn = 'uploadTime'
|
||||||
|
this.query.fileSuffix = 'mp4'
|
||||||
|
}else{
|
||||||
|
this.query.orderByColumn = 'createTime'
|
||||||
|
this.query.fileSuffix = ''
|
||||||
|
}
|
||||||
|
this.query.fileFlags = val.value
|
||||||
|
this.activeIndex = val.id
|
||||||
this.handleQuery()
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
thirdChangeType(val) {
|
thirdChangeType(val) {
|
||||||
|
@ -136,7 +146,11 @@ export default defineStore('resource', {
|
||||||
this.handleQuery()
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
getCreate(){
|
getCreate(){
|
||||||
if(this.query.fileSource == '平台' || this.query.fileSource == '第三方' ){
|
// 实验的时候也需要进入
|
||||||
|
if((this.query.fileSource == '平台' || this.query.fileSource == '第三方') || this.query.orderByColumn == 'uploadTime' ){
|
||||||
|
if(this.query.orderByColumn == 'uploadTime'){
|
||||||
|
this.query.fileSource = '平台'
|
||||||
|
}
|
||||||
this.isCreate = hasPermission(['platformmanager'])
|
this.isCreate = hasPermission(['platformmanager'])
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -42,9 +42,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { completion } from '@/api/mode/index'
|
import { completion } from '@/api/mode/index'
|
||||||
|
import { dataSetJson } from '@/utils/comm.js'
|
||||||
import emitter from '@/utils/mitt';
|
import emitter from '@/utils/mitt';
|
||||||
import { sessionStore } from '@/utils/store'
|
import { sessionStore } from '@/utils/store'
|
||||||
import { ElMessage } from 'element-plus'
|
import { sendChart } from '@/api/ai/index'
|
||||||
|
|
||||||
const textarea = ref('')
|
const textarea = ref('')
|
||||||
|
|
||||||
|
@ -56,6 +57,14 @@ const props = defineProps({
|
||||||
default: () => {
|
default: () => {
|
||||||
return { name: '11' }
|
return { name: '11' }
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
curMode:{
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
conversation_id: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -77,13 +86,36 @@ const send = () => {
|
||||||
}
|
}
|
||||||
const curNode = reactive({})
|
const curNode = reactive({})
|
||||||
|
|
||||||
// 获取会话ID
|
const params = reactive(
|
||||||
|
{
|
||||||
|
prompt: '',
|
||||||
|
dataset_id: '',
|
||||||
|
template: ''
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// 大模型对话
|
||||||
const getConversation = async (val) => {
|
const getConversation = async (val) => {
|
||||||
try {
|
try {
|
||||||
const { data } = await completion({
|
params.prompt = `按照${val}的要求,针对${curNode.edustage}${curNode.edusubject}课标,对${curNode.itemtitle}进行教学分析`
|
||||||
dataset_id: 'cee3062a9fcf11efa6910242ac140006',
|
params.template = props.item.prompt
|
||||||
prompt: val
|
|
||||||
|
let data = null;
|
||||||
|
// 教学大模型
|
||||||
|
if(props.curMode == 1){
|
||||||
|
const res = await sendChart({
|
||||||
|
content: params.prompt,
|
||||||
|
conversationId: props.conversation_id,
|
||||||
|
stream: false
|
||||||
})
|
})
|
||||||
|
data = res.data
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// 知识库模型
|
||||||
|
const res = await completion(params)
|
||||||
|
data = res.data
|
||||||
|
}
|
||||||
|
|
||||||
msgList.value.push({
|
msgList.value.push({
|
||||||
type: 'robot',
|
type: 'robot',
|
||||||
msg: data.answer,
|
msg: data.answer,
|
||||||
|
@ -94,15 +126,16 @@ const getConversation = async (val) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveAdjust = (item) => {
|
const saveAdjust = (item) => {
|
||||||
// emit('saveAdjust', item.msg)
|
|
||||||
emitter.emit('changeAdjust', item.msg)
|
|
||||||
isDialog.value = false
|
isDialog.value = false
|
||||||
ElMessage.success('操作成功')
|
emitter.emit('onSaveAdjust', item.msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
let data = sessionStore.get('subject.curNode')
|
let data = sessionStore.get('subject.curNode')
|
||||||
Object.assign(curNode, data);
|
Object.assign(curNode, data);
|
||||||
|
// 框架设计 用课标的dataset_id
|
||||||
|
let jsonKey = `课标-${data.edustage}-${data.edusubject}`
|
||||||
|
params.dataset_id = dataSetJson[jsonKey]
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,17 @@
|
||||||
<div class="container-right flex">
|
<div class="container-right flex">
|
||||||
<div class="right-header flex">
|
<div class="right-header flex">
|
||||||
<div class="header-left">
|
<div class="header-left">
|
||||||
<el-button type="primary" link>
|
<!-- <el-button type="primary" link>
|
||||||
<i class="iconfont icon-jiahao"></i>新活动
|
<i class="iconfont icon-jiahao"></i>新活动
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" link>
|
<el-button type="primary" link>
|
||||||
<i class="iconfont icon-baocun"></i>保存为教学模式
|
<i class="iconfont icon-baocun"></i>保存为教学模式
|
||||||
</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>
|
||||||
|
@ -35,7 +38,8 @@
|
||||||
<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" @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="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)">
|
||||||
|
@ -58,7 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
</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" :curMode="curMode" :conversation_id="conversation_id" />
|
||||||
<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" />
|
||||||
<!--添加、编辑提示词-->
|
<!--添加、编辑提示词-->
|
||||||
|
@ -73,12 +77,14 @@ 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 } 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 { 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
|
||||||
|
@ -110,6 +116,19 @@ 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)
|
||||||
|
@ -131,8 +150,28 @@ 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}进行教学分析`
|
|
||||||
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)
|
item.answer = getResult(data.answer)
|
||||||
onSaveTemp(item)
|
onSaveTemp(item)
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -265,9 +304,12 @@ 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
|
||||||
|
@ -343,8 +385,27 @@ 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}进行教学分析`
|
|
||||||
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
|
||||||
|
}
|
||||||
|
|
||||||
resultList.value[index].answer = getResult(data.answer)
|
resultList.value[index].answer = getResult(data.answer)
|
||||||
isStarted.value[index] = true
|
isStarted.value[index] = true
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -360,11 +421,21 @@ const onAdjust = (index, item) => {
|
||||||
Object.assign(curItem, item)
|
Object.assign(curItem, item)
|
||||||
isAdjust.value = true
|
isAdjust.value = true
|
||||||
}
|
}
|
||||||
emitter.on('changeAdjust', (item) => {
|
|
||||||
|
// 替换分析结果
|
||||||
|
emitter.on('onSaveAdjust', (item) => {
|
||||||
resultList.value[curIndex.value].answer = item
|
resultList.value[curIndex.value].answer = item
|
||||||
|
onEditSave(resultList.value[curIndex.value])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 保存 重新研读后的结果
|
||||||
|
const onEditSave = async (item) => {
|
||||||
|
const { msg } = await editTempResult({ id: item.resultId, content: item.answer })
|
||||||
|
ElMessage.success(msg)
|
||||||
|
getChildTemplate()
|
||||||
|
}
|
||||||
|
|
||||||
// 编辑
|
// 编辑
|
||||||
const onEdit = (index, item) => {
|
const onEdit = (index, item) => {
|
||||||
curIndex.value = index
|
curIndex.value = index
|
||||||
|
@ -498,14 +569,44 @@ 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')
|
||||||
Object.assign(curNode, data);
|
Object.assign(curNode, data);
|
||||||
courseObj.node = data
|
courseObj.node = data
|
||||||
|
// 框架设计 用课标的dataset_id
|
||||||
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()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -514,7 +615,7 @@ onUnmounted(() => {
|
||||||
emitter.off('changeMode')
|
emitter.off('changeMode')
|
||||||
emitter.off('changeResult')
|
emitter.off('changeResult')
|
||||||
emitter.off('changeAdjust')
|
emitter.off('changeAdjust')
|
||||||
|
emitter.off('onSaveAdjust');
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -539,7 +640,7 @@ onUnmounted(() => {
|
||||||
background: #F6F6F6;
|
background: #F6F6F6;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow-y: scroll;
|
overflow-y: auto;
|
||||||
|
|
||||||
.con-item {
|
.con-item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -548,6 +649,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;
|
||||||
|
@ -558,6 +660,7 @@ onUnmounted(() => {
|
||||||
left: -8px;
|
left: -8px;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: '';
|
content: '';
|
||||||
width: 2px;
|
width: 2px;
|
||||||
|
@ -567,16 +670,19 @@ 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,6 +248,8 @@ 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