Compare commits
No commits in common. "5b50404d3c638352f343a6a355e6efce1f7f6294" and "d9bdd5424faaedb5925f4fe50dd895d6035cadc2" have entirely different histories.
5b50404d3c
...
d9bdd5424f
|
@ -3,22 +3,22 @@
|
||||||
* @author zdg
|
* @author zdg
|
||||||
* @date 2024-11-26
|
* @date 2024-11-26
|
||||||
*/
|
*/
|
||||||
import { toRaw } from 'vue'
|
import { toRaw, nextTick } from 'vue'
|
||||||
import type { Result } from './types' // 接口类型
|
import type { Result } from './types' // 接口类型
|
||||||
import msgUtils from '@/plugins/modal' // 消息工具
|
import msgUtils from '@/plugins/modal' // 消息工具
|
||||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
||||||
import * as API_smarttalk from '@/api/file' // 相关api
|
import * as API_smarttalk from '@/api/file' // 相关api
|
||||||
|
import * as Api_server from '@/api/apiService' // 相关api
|
||||||
|
import * as CreateHomework from '@/views/tool/createHomework' // 统计相关
|
||||||
import * as useStore from '../store' // pptist-状态管理
|
import * as useStore from '../store' // pptist-状态管理
|
||||||
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||||
import useUserStore from '@/store/modules/user' // 外部-用户信息
|
import useUserStore from '@/store/modules/user' // 外部-用户信息
|
||||||
import * as Api_server from '@/api/apiService' // 相关api
|
import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库
|
||||||
import * as commUtils from '@/utils/comm.js'
|
// import * as commUtils from '@/utils/comm.js'
|
||||||
|
import { createWindow } from '@/utils/tool'
|
||||||
|
import { useToolState } from '@/store/modules/tool'
|
||||||
const slidesStore = useStore.useSlidesStore()
|
const slidesStore = useStore.useSlidesStore()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
import { getClassWorkList,getStudentClassWorkData } from '@/views/tool/createHomework'
|
|
||||||
import {createWindow} from '@/utils/tool'
|
|
||||||
import { useToolState } from '@/store/modules/tool'
|
|
||||||
const toolStore = useToolState()
|
const toolStore = useToolState()
|
||||||
/** 工具类 */
|
/** 工具类 */
|
||||||
export class Utils {
|
export class Utils {
|
||||||
|
@ -147,6 +147,8 @@ export class PPTApi {
|
||||||
// 更新幻灯片
|
// 更新幻灯片
|
||||||
static updateSlide(data: object): Promise<Boolean> {
|
static updateSlide(data: object): Promise<Boolean> {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
|
const thumUrl = await this.getSlideThumUrl()
|
||||||
|
data.base64Code = thumUrl // 更新缩略图
|
||||||
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
|
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
|
||||||
console.log(data,'data');
|
console.log(data,'data');
|
||||||
console.log(res,'dresata');
|
console.log(res,'dresata');
|
||||||
|
@ -191,30 +193,40 @@ export class PPTApi {
|
||||||
else msgUtils.msgError(res.msg || '更新失败');return false
|
else msgUtils.msgError(res.msg || '更新失败');return false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// thumbnail-slide thumbnail
|
||||||
|
static getSlideThumUrl(): Promise<Boolean> {
|
||||||
|
return nextTick().then(async() => {
|
||||||
|
const slideIndex = slidesStore.slideIndex
|
||||||
|
const elements = document.querySelectorAll('.thumbnail-slide')
|
||||||
|
if (elements.length && slideIndex >= 0) {
|
||||||
|
const element = elements[slideIndex]
|
||||||
|
return await toPng(element)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 图片|音频|视频 转换为在线地址
|
// 图片|音频|视频 转换为在线地址
|
||||||
static toRousrceUrl =async (o:any) => {
|
static toRousrceUrl =async (file: File|any) => {
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append('file', o)
|
formData.append('file', file)
|
||||||
const res = await Api_server.Other.uploadFile(formData)
|
const res = await Api_server.Other.uploadFile(formData)
|
||||||
if (res && res.code == 200){
|
if (res && res.code == 200){
|
||||||
const url = res?.url
|
const url = res?.url
|
||||||
url &&(o.src = url)
|
url &&(o.src = url)
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Homework{
|
export class Homework{
|
||||||
// 作业弹窗
|
// 作业弹窗
|
||||||
static async showHomework(id: any) {
|
static async showHomework(id: any) {
|
||||||
let result = await getClassWorkList(id)
|
let result = await CreateHomework.getClassWorkList(id)
|
||||||
result = await getStudentClassWorkData()
|
result = await CreateHomework.getStudentClassWorkData()
|
||||||
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
||||||
toolStore.isTaskWin=true; // 设置打开批改窗口
|
toolStore.isTaskWin=true; // 设置打开批改窗口
|
||||||
// emit('closeActive')
|
createWindow('open-taskwin',{url:'/teachClassTask'});
|
||||||
createWindow('open-taskwin',{url:'/teachClassTask'});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default PPTApi
|
export default PPTApi
|
|
@ -5,12 +5,9 @@ import type { Slide, SlideTheme, PPTElement, PPTAnimation } from '../types/slide
|
||||||
import { slides } from '../mocks/slides'
|
import { slides } from '../mocks/slides'
|
||||||
import { theme } from '../mocks/theme'
|
import { theme } from '../mocks/theme'
|
||||||
import { layouts } from '../mocks/layout'
|
import { layouts } from '../mocks/layout'
|
||||||
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
|
||||||
import useUserStore from '@/store/modules/user' // 外部-用户信息
|
|
||||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
|
||||||
|
|
||||||
import PPTApi from '../api/store'
|
import PPTApi from '../api/store'
|
||||||
const userStore = useUserStore()
|
|
||||||
interface RemovePropData {
|
interface RemovePropData {
|
||||||
id: string
|
id: string
|
||||||
propName: string | string[]
|
propName: string | string[]
|
||||||
|
@ -145,46 +142,16 @@ export const useSlidesStore = defineStore('slides', {
|
||||||
setWorkItem(list: Object[]) {
|
setWorkItem(list: Object[]) {
|
||||||
this.workItem = list
|
this.workItem = list
|
||||||
},
|
},
|
||||||
addWorkItem(data: any) {
|
|
||||||
const id = data?.parentid
|
|
||||||
if (!id) return
|
|
||||||
this.workItem.splice(this.slideIndex, 0, data)
|
|
||||||
},
|
|
||||||
|
|
||||||
addSlide(slide: Slide | Slide[]) {
|
addSlide(slide: Slide | Slide[]) {
|
||||||
const resource = sessionStore.get('curr.resource')||{}
|
|
||||||
const enpt = sessionStore.get('curr.entp')||{}
|
|
||||||
const {id, ...content} = slide
|
|
||||||
const params = {
|
|
||||||
parentid: resource.id,
|
|
||||||
activityContent:null,
|
|
||||||
entpid: userStore.user.deptId,
|
|
||||||
entpcourseid: enpt.id,
|
|
||||||
ppttype: 'file',
|
|
||||||
title: '',
|
|
||||||
fileurl: '',
|
|
||||||
filetype: 'slide',
|
|
||||||
datacontent: JSON.stringify(content),
|
|
||||||
filekey: '',
|
|
||||||
filetag: '',
|
|
||||||
fileidx: 0,
|
|
||||||
dflag: 0,
|
|
||||||
status: '',
|
|
||||||
edituserid: userStore.id,
|
|
||||||
}
|
|
||||||
const slides = Array.isArray(slide) ? slide : [slide]
|
const slides = Array.isArray(slide) ? slide : [slide]
|
||||||
for (const slide of slides) {
|
for (const slide of slides) {
|
||||||
if (slide.sectionTag) delete slide.sectionTag
|
if (slide.sectionTag) delete slide.sectionTag
|
||||||
}
|
}
|
||||||
API_entpcoursefile.addEntpcoursefileReturnId(params).then((rid:number) => {
|
|
||||||
if(!!rid){
|
|
||||||
params.id = rid
|
|
||||||
this.addWorkItem(params)
|
|
||||||
const addIndex = this.slideIndex + 1
|
const addIndex = this.slideIndex + 1
|
||||||
this.slides.splice(addIndex, 0, ...slides)
|
this.slides.splice(addIndex, 0, ...slides)
|
||||||
this.slideIndex = addIndex
|
this.slideIndex = addIndex
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
updateSlide(props: Partial<Slide>, slideId?: string) {
|
updateSlide(props: Partial<Slide>, slideId?: string) {
|
||||||
|
@ -221,7 +188,6 @@ export const useSlidesStore = defineStore('slides', {
|
||||||
const isDel = await PPTApi.delSlide(deletedId)
|
const isDel = await PPTApi.delSlide(deletedId)
|
||||||
if (isDel) {
|
if (isDel) {
|
||||||
// 后端删除成功,更新页面数据
|
// 后端删除成功,更新页面数据
|
||||||
this.workItem.splice(index, 1)
|
|
||||||
deleteSlidesIndex.push(index)
|
deleteSlidesIndex.push(index)
|
||||||
slides.splice(index, 1)
|
slides.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<div class="item-title">
|
<div class="item-title">
|
||||||
<el-tag :type="getTagType(item.worktype) || 'primary'">{{item.worktype}}</el-tag>
|
<el-tag :type="getTagType(item.worktype) || 'primary'">{{item.worktype}}</el-tag>
|
||||||
<el-tooltip :content="item.uniquekey" placement="top">
|
<el-tooltip :content="item.evaltitle" placement="top">
|
||||||
<div class="tt">{{item.uniquekey}}</div>
|
<div class="tt">{{item.evaltitle}}</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-button class="btn-del" type="danger" link @click="handleRemoveDemoActivityClassWork(item)">删除</el-button>
|
<el-button class="btn-del" type="danger" link @click="handleRemoveDemoActivityClassWork(item)">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
>
|
>
|
||||||
<el-table :data="taskList" style="width: 100%" height="500" @selection-change="handleSelectionChange">
|
<el-table :data="taskList" style="width: 100%" height="500" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" :selectable="selectable"/>
|
<el-table-column type="selection" width="55" :selectable="selectable"/>
|
||||||
<el-table-column prop="uniquekey" label="活动名称" width="150" />
|
<el-table-column prop="evaltitle" label="活动名称" width="150" />
|
||||||
<el-table-column prop="worktype" label="活动类型" width="120" sortable>
|
<el-table-column prop="worktype" label="活动类型" width="120" sortable>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag :type="getTagType(scope.row.worktype) || 'primary'">{{ scope.row.worktype }}</el-tag>
|
<el-tag :type="getTagType(scope.row.worktype) || 'primary'">{{ scope.row.worktype }}</el-tag>
|
||||||
|
@ -131,7 +131,7 @@ interface WorkItem {
|
||||||
base64?: string;
|
base64?: string;
|
||||||
prevData?: any;
|
prevData?: any;
|
||||||
id: number;
|
id: number;
|
||||||
uniquekey?: string; // 添加 evaltitle 属性
|
evaltitle?: string; // 添加 evaltitle 属性
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentCourse = reactive<CurrentCourse>({
|
const currentCourse = reactive<CurrentCourse>({
|
||||||
|
@ -277,8 +277,6 @@ const getCurrentPPtData = async () => {
|
||||||
workList.value = []
|
workList.value = []
|
||||||
objItem.value = workItem.value[slideIndex.value]
|
objItem.value = workItem.value[slideIndex.value]
|
||||||
paramData.value.id = objItem.value.id
|
paramData.value.id = objItem.value.id
|
||||||
console.log(paramData.value.id,'paramData.value.id');
|
|
||||||
|
|
||||||
paramData.value.activityContent = objItem.value?.activityContent
|
paramData.value.activityContent = objItem.value?.activityContent
|
||||||
if (objItem.value?.activityContent) {
|
if (objItem.value?.activityContent) {
|
||||||
loadingActive.value = true
|
loadingActive.value = true
|
||||||
|
@ -289,7 +287,6 @@ const getCurrentPPtData = async () => {
|
||||||
|
|
||||||
// 接收习题训练的值
|
// 接收习题训练的值
|
||||||
const getData = async (data: WorkItem) => {
|
const getData = async (data: WorkItem) => {
|
||||||
debugger
|
|
||||||
workList.value = []
|
workList.value = []
|
||||||
if(paramData.value.activityContent){
|
if(paramData.value.activityContent){
|
||||||
const arr = paramData.value.activityContent.split(',')
|
const arr = paramData.value.activityContent.split(',')
|
||||||
|
@ -310,16 +307,6 @@ const upDateData = async () => {
|
||||||
const resource = sessionStore.get('curr.resource')
|
const resource = sessionStore.get('curr.resource')
|
||||||
await PPTApi.getSlideList(resource.id)
|
await PPTApi.getSlideList(resource.id)
|
||||||
}
|
}
|
||||||
// 判断是否做操作
|
|
||||||
const objectsAreEqual = (obj1: any[], obj2: any[]) => {
|
|
||||||
const keys1 = Object.keys(obj1);
|
|
||||||
const keys2 = Object.keys(obj2);
|
|
||||||
if (keys1.length !== keys2.length) return false;
|
|
||||||
for (const key of keys1) {
|
|
||||||
if (obj1[key] !== obj2[key]) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const curNode = sessionStore.get('subject.curNode') as CourseNode
|
const curNode = sessionStore.get('subject.curNode') as CourseNode
|
||||||
|
@ -331,13 +318,9 @@ onMounted(() => {
|
||||||
objItem.value = workItem.value[slideIndex.value]
|
objItem.value = workItem.value[slideIndex.value]
|
||||||
getCurrentPPtData()
|
getCurrentPPtData()
|
||||||
})
|
})
|
||||||
watch(() => [workItem.value.length,slideIndex.value], (newVal,oldVal) => {
|
watch(() => slideIndex.value, () => {
|
||||||
if(!objectsAreEqual(newVal,oldVal))
|
|
||||||
getCurrentPPtData()
|
getCurrentPPtData()
|
||||||
})
|
})
|
||||||
// watch(() => workItem.value.length, () => {
|
|
||||||
// getCurrentPPtData()
|
|
||||||
// })
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.buttonDiv{
|
.buttonDiv{
|
||||||
|
|
Loading…
Reference in New Issue