Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into zxl
This commit is contained in:
commit
d866f546bc
|
@ -97,14 +97,30 @@ export class PPTApi {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 批量插入slide
|
||||
* @param slides 批量新增的幻灯片
|
||||
* @param slideAll 所有幻灯片
|
||||
* @returns
|
||||
*/
|
||||
static async addSlideServer(slides: object[], slideAll: object[]) {
|
||||
const resource = sessionStore.get('curr.resource')||{}
|
||||
for(const slide of slides){
|
||||
slide.id = resource.id // 覆盖默认随机id
|
||||
await this.addSlide(slide)
|
||||
}
|
||||
await this.batchUpdateSlides(slideAll, true) // 批量更新-排序
|
||||
return PPTApi.getSlideList(resource.id) // 更新幻灯片列表以及活动相关
|
||||
}
|
||||
|
||||
// 新增幻灯片
|
||||
static addSlide(data: object): Promise<Boolean> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const enpt = sessionStore.get('curr.entp')||{}
|
||||
const resource = sessionStore.get('curr.resource')||{}
|
||||
// const resource = sessionStore.get('curr.resource')||{}
|
||||
const {id, ...content} = data
|
||||
const params = {
|
||||
parentid: resource.id,
|
||||
parentid: id,
|
||||
entpid: userStore.user.deptId,
|
||||
entpcourseid: enpt.id,
|
||||
ppttype: 'file',
|
||||
|
@ -126,7 +142,7 @@ export class PPTApi {
|
|||
// msgUtils.msgSuccess('新增成功')
|
||||
this.isUpdate = false // 新增后会触发监听,不再更新数据
|
||||
resolve(true)
|
||||
} else msgUtils.msgError('新增失败');resolve(false)
|
||||
} else msgUtils.msgError('新增失败');reject(false)
|
||||
})
|
||||
}
|
||||
/**
|
||||
|
@ -147,12 +163,8 @@ export class PPTApi {
|
|||
const currInd = toRaw(slidesStore.slideIndex) // 当前页索引-new
|
||||
const oldInd = oldData.findIndex(o => o.id == currentSlide.id) // 当前页索引-old
|
||||
const isBatch = oldVal && oldVal.length && currInd != oldInd // 是否批量更新-排序
|
||||
if (isAdd) { // 新增的幻灯片(id 为非数字,说明是新增的幻灯片)
|
||||
const bool = await this.addSlide(currentSlide)
|
||||
bool && await this.batchUpdateSlides(newData, true) // 批量更新-排序
|
||||
const resource = sessionStore.get('curr.resource')||{}
|
||||
await PPTApi.getSlideList(resource.id)
|
||||
} else { // 防抖-更新
|
||||
if (isAdd) return // 新增-这里不处理 状态管理-处理
|
||||
// 防抖-更新
|
||||
if (!this.isUpdate) return this.isUpdate = true // 下次更新数据
|
||||
if (isBatch) { // 批量更新-排序
|
||||
this.batchUpdateSlides(newData, true)
|
||||
|
@ -164,7 +176,6 @@ export class PPTApi {
|
|||
Utils.mxThrottle(() => {this.updateSlide(params)}, 200, 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
// 更新幻灯片 isThum 是否更新缩略图
|
||||
static updateSlide(data: object, isThum = true): Promise<Boolean> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
|
|
|
@ -148,7 +148,8 @@ export const useSlidesStore = defineStore('slides', {
|
|||
this.workItem = list
|
||||
},
|
||||
|
||||
addSlide(slide: Slide | Slide[]) {
|
||||
async addSlide(slide: Slide | Slide[]) {
|
||||
const { PPTApi } = await import('../api/index')
|
||||
const slides = Array.isArray(slide) ? slide : [slide]
|
||||
for (const slide of slides) {
|
||||
if (slide.sectionTag) delete slide.sectionTag
|
||||
|
@ -156,6 +157,8 @@ export const useSlidesStore = defineStore('slides', {
|
|||
const addIndex = this.slideIndex + 1
|
||||
this.slides.splice(addIndex, 0, ...slides)
|
||||
this.slideIndex = addIndex
|
||||
// 添加到服务器
|
||||
PPTApi.addSlideServer(slides, this.slides)
|
||||
},
|
||||
updateSlide(props: Partial<Slide>, slideId?: string) {
|
||||
const slideIndex = slideId ? this.slides.findIndex(item => item.id === slideId) : this.slideIndex
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="whiteboart-container" :style="{ height: height + 'px' }">
|
||||
<div class="canvasBox" ref="box" @mouseleave="handleMouseLeave" ></div>
|
||||
<div class="canvasBox" ref="box" @mouseenter.capture="handleMouseEnter" @mouseleave.capture="handleMouseLeave"></div>
|
||||
|
||||
<div class="footerLeft" @click.stop
|
||||
:style="type == 'design' ? ['top: 10px', 'justify-content: space-between'] : ['bottom: 10px', 'justify-content: center']">
|
||||
|
@ -278,7 +278,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref, getCurrentInstance, watch, toRaw, nextTick, computed, reactive, defineProps, defineEmits } from 'vue'
|
||||
import { onMounted, onBeforeUnmount, ref, getCurrentInstance, watch, toRaw, nextTick, computed, reactive, defineProps, defineEmits } from 'vue'
|
||||
import TinyWhiteboard from 'whiteboard_lyc'
|
||||
import ColorPicker from './components/ColorPicker.vue'
|
||||
import {
|
||||
|
@ -791,6 +791,25 @@ const init = () => {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
const isMyCanvas = ref(false); // 鼠标 是否进入画布判断
|
||||
const handleKeyDown=(event)=> {
|
||||
// console.log('键盘按键被按下:', event.key);
|
||||
// console.log(isMyCanvas.value,'??????????')
|
||||
if(isMyCanvas.value == false){
|
||||
event.stopPropagation();
|
||||
// console.log('键盘事件被捕获,已阻止冒泡:', event.key);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 鼠标进入事件
|
||||
*/
|
||||
const handleMouseEnter = () => {
|
||||
console.log('进入白板')
|
||||
isMyCanvas.value = true;
|
||||
document.addEventListener('keydown', handleKeyDown, true);
|
||||
}
|
||||
/**
|
||||
* 课堂展示-鼠标离开白板监听事件:该事件是避免,选中状态,在其他地方点击、后退、删除等事件,会删除白板内选中的元素
|
||||
*/
|
||||
|
@ -798,7 +817,10 @@ const handleMouseLeave = () => {
|
|||
console.log('离开白板')
|
||||
// 清除激活项--点击事件的激活项
|
||||
app.cancelActiveElement()
|
||||
// TODO 缺失点击拖动范围的取消激活项……
|
||||
// 阻止 点击拖动范围的取消激活项……
|
||||
isMyCanvas.value = false;
|
||||
// 确保事件处理函数在组件挂载后绑定
|
||||
document.addEventListener('keydown', handleKeyDown, true);
|
||||
};
|
||||
|
||||
// 暴露方法
|
||||
|
|
|
@ -449,6 +449,7 @@ export default {
|
|||
}
|
||||
case 'click': { // 点击-打开课件-aippt
|
||||
if (row.fileFlag === 'aippt' && !!row.fileId) {
|
||||
sessionStore.delete('curr.classcourse') // 清除上课相关信息
|
||||
const res = await getEntpcoursefile(row.fileId)
|
||||
if (res && res.code === 200) {
|
||||
this.openPublicScreen('edit', res.data, row) // 打开公屏-窗口
|
||||
|
|
Loading…
Reference in New Issue