Compare commits

..

No commits in common. "e58cb334e4d5d1db5e54519d9221c179535c9eb6" and "bf4b857eb775648172ec81298170a7c14162e0bb" have entirely different histories.

7 changed files with 137 additions and 114 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "aix-win-ws", "name": "aix-win-ws",
"version": "2.5.6", "version": "2.5.5",
"description": "", "description": "",
"main": "./out/main/index.js", "main": "./out/main/index.js",
"author": "上海交大重庆人工智能研究院", "author": "上海交大重庆人工智能研究院",

View File

@ -74,8 +74,6 @@ const initLoad: Function = () => {
!!(opt.ratio??null) && slidesStore.setViewportRatio(opt.ratio)// !!(opt.ratio??null) && slidesStore.setViewportRatio(opt.ratio)//
} }
return PPTApi.getSlideList(resource.id) return PPTApi.getSlideList(resource.id)
// PPTApi.updateWorkList()
// return Promise.resolve()
} }
return Promise.resolve() return Promise.resolve()
} }

View File

@ -8,7 +8,6 @@ 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_classwork from '@/api/teaching/classwork' // 相关api
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' // 外部-用户信息
@ -77,14 +76,12 @@ export class PPTApi {
slidesStore.setSlides(slides) // 写入数据 slidesStore.setSlides(slides) // 写入数据
} }
// 活动列表处理 // 活动列表处理
// const workList = (res.rows || []).map(o => o.activityContent) const workList = (res.rows || []).map(o => o.activityContent)
const workItem = res.rows ? [...res.rows] : [] const workItem = res.rows ? [...res.rows] : []
// 写入作业列表数据 // 写入作业列表数据
// slidesStore.setWorkList(workList) slidesStore.setWorkList(workList)
// 获取所有的pptlist的数据 // 获取所有的pptlist的数据
slidesStore.setWorkItem(workItem) slidesStore.setWorkItem(workItem)
this.updateWorkList()
resolve(true) resolve(true)
} else msgUtils.msgError(res.msg || '获取数据失败');resolve(false) } else msgUtils.msgError(res.msg || '获取数据失败');resolve(false)
}) })
@ -158,13 +155,11 @@ export class PPTApi {
} }
} }
} }
// 更新幻灯片 isThum 是否更新缩略图 // 更新幻灯片
static updateSlide(data: object, isThum = true): Promise<Boolean> { static updateSlide(data: object): Promise<Boolean> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
if (isThum) { // 更新缩略图 const thumUrl = await this.getSlideThumUrl()
const thumUrl = await this.getSlideThumUrl() data.base64Code = thumUrl // 更新缩略图
data.base64Code = thumUrl // 更新缩略图
}
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data) const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
if (res.code === 200) { if (res.code === 200) {
resolve(true) resolve(true)
@ -207,31 +202,6 @@ export class PPTApi {
else msgUtils.msgError(res.msg || '更新失败');return false else msgUtils.msgError(res.msg || '更新失败');return false
}) })
} }
// 更新-活动列表
static async updateWorkList(): Promise<Boolean> {
const resolveData = (resolve, data = []) => {
slidesStore.setWorkList(data)
return resolve()
}
return new Promise(async (resolve, reject) => {
const workItem = slidesStore.workItem // 所有的pptlist的数据-原始数据
const currentSlide = slidesStore.currentSlide // 当前页幻灯片
const slideId = currentSlide.id // 当前页幻灯片id
if (!slideId) return resolveData(resolve)
// slide详情获取-作业id
// const res = await API_entpcoursefile.getEntpcoursefile(slideId)
// const workIds = res?.data?.activityContent||''
// workItem-获取作业id
const workIds = workItem.find(o => o.id == slideId)?.activityContent
if (!workIds) return resolveData(resolve)
// 获取作业列表
const resW = await API_classwork.homeworklist({ ids: workIds, pageSize: 1000 })
if (resW && resW.rows) return resolveData(resolve, resW.rows)
else msgUtils.msgError(resW.msg || '更新失败');return resolveData(resolve)
})
}
// thumbnail-slide thumbnail 缩略图 // thumbnail-slide thumbnail 缩略图
static getSlideThumUrl(): Promise<Boolean> { static getSlideThumUrl(): Promise<Boolean> {
return nextTick().then(async() => { return nextTick().then(async() => {

View File

@ -7,13 +7,13 @@ import msgUtils from '@/plugins/modal' // 消息工具
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
export default class { export default class {
// 删除幻灯片 // 删除幻灯片
static delSlide(id: string): Promise<Boolean> { static delSlide(id: string): Promise<Boolean> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const res: Result = await API_entpcoursefile.delEntpcoursefile(id) const res: Result = await API_entpcoursefile.delEntpcoursefile(id)
if (res.code === 200) { if (res.code === 200) {
resolve(true) resolve(true)
} else msgUtils.msgError(res.msg || '删除失败');resolve(false) } else msgUtils.msgError(res.msg || '删除失败');resolve(false)
}) })
} }
} }

View File

@ -35,11 +35,6 @@ export default () => {
updatePPT({title: newVal}) updatePPT({title: newVal})
}) })
// 监听幻灯片下标变化
watch(() => slidesStore.slideIndex, (newVal, oldVal) => {
PPTApi.updateWorkList()
})
// 消息监听ws // 消息监听ws
// console.log('监听器已开启', ChatWs) // console.log('监听器已开启', ChatWs)
if (!!ChatWs.ws) { if (!!ChatWs.ws) {

View File

@ -32,14 +32,14 @@
<!-- 作业列表 --> <!-- 作业列表 -->
<div class="c-apt-r" v-loading='loadingActive'> <div class="c-apt-r" v-loading='loadingActive'>
<!-- 显示-作业内容 --> <!-- 显示-作业内容 -->
<template v-for="(item, index) in slidesStore.workList" :key="index"> <template v-for="(item, index) in workList" :key="index">
<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.uniquekey" placement="top">
<div class="tt">{{item.uniquekey}}</div> <div class="tt">{{item.uniquekey}}</div>
</el-tooltip> </el-tooltip>
<el-button class="btn-del" type="danger" link @click="removeWork(item, index)">删除</el-button> <el-button class="btn-del" type="danger" link @click="handleRemoveDemoActivityClassWork(item)">删除</el-button>
</div> </div>
</div> </div>
</template> </template>
@ -94,6 +94,7 @@ import {useSlidesStore} from '../../../../../store'
import { updateEntpcoursefileNew } from '@/api/education/entpcoursefile' import { updateEntpcoursefileNew } from '@/api/education/entpcoursefile'
const slidesStore = useSlidesStore() const slidesStore = useSlidesStore()
const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore) const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore)
interface CourseNode { interface CourseNode {
rootid: number; rootid: number;
parentNode: { id: number }; parentNode: { id: number };
@ -173,27 +174,63 @@ const type = ref<WorkType[]>([
} }
]) ])
const objItem = ref<any>({})
//
const workList = ref<WorkItem[]>([])
// //
const selectedWorkList = ref<WorkItem[]>([]) const selectedWorkList = ref<WorkItem[]>([])
// loading // loading
const loadingActive = ref<boolean>(false) const loadingActive = ref<boolean>(false)
//
const paramData = ref<{ id: number, activityContent: string }>({} as { id: number, activityContent: string })
const selectable = (row: WorkItem, index: number): boolean => { const selectable = (row: WorkItem, index: number): boolean => {
return row.status === '10'; return row.status === '10';
}; };
//
const removeWork = (item: WorkItem, index: number) => { const formatClassWorkFile = async (postData: WorkItem[]): Promise<void> => {
for (let i = 0; i < postData.length; i++) {
let item = postData[i];
switch (item.worktype) {
case '框架梳理': {
}
break;
case '习题训练': {
// let workIds = item.quizlist!.map(items => items.id).join(',');
// let ress = await listEntpcoursework({ ids: workIds });
// const arr = ress.rows.map((item:{id:number}) => {
// return item.id
// })
// processList(ress.rows);
}
break;
case '课堂展示': {
// item.base64 = JSON.parse(item.workcodes).base64;
}
break;
case '常规作业': {
// item.prevData = JSON.parse(item.workcodes);
}
}
workList.value.push(item)
loadingActive.value = false
}
await nextTick();
}//
const handleRemoveDemoActivityClassWork = (item: WorkItem) => {
ElMessageBox.confirm('是否确认删除?') ElMessageBox.confirm('是否确认删除?')
.then(async() => { .then(() => {
// workList workList.value = []
// slidesStore.workList.splice(index, 1) const arr = paramData.value.activityContent.split(',')
console.log('删除作业', item) const filterArr = arr.filter(itemId => itemId!== item.id.toString())
await upDateData('del', [item.id]) paramData.value.activityContent = filterArr.join(',')
ElMessage.success('删除成功') upDateData()
}) })
.catch(() => { }); .catch(() => { });
} }
// tag // tag
@ -220,7 +257,6 @@ const showDialog = (item: string) => {
dialogVisible.value = true dialogVisible.value = true
} }
//
const openList = () => { const openList = () => {
activeVisible.value = true activeVisible.value = true
initHomeWork() initHomeWork()
@ -228,44 +264,65 @@ const openList = () => {
// //
const savePPtData = async () => { const savePPtData = async () => {
if (!selectedWorkList.value.length) { if (selectedWorkList.value.length === 0) {
ElMessage.warning('请选择活动') ElMessage.warning('请选择活动')
return return
} }
const arr = selectedWorkList.value.map(item => item.id) workList.value = []
await upDateData('add', arr) const arr = selectedWorkList.value.map(item => item.id)
activeVisible.value = false //
const existingIds = paramData.value.activityContent ? paramData.value.activityContent.split(',') : []
paramData.value.activityContent = Array.from(new Set([...existingIds, ...arr])).join(',')
upDateData()
activeVisible.value = false
}
// ppt
const getCurrentPPtData = async () => {
workList.value = []
objItem.value = workItem.value[slideIndex.value]
paramData.value.id = objItem.value.id
paramData.value.activityContent = objItem.value?.activityContent
if (objItem.value?.activityContent) {
loadingActive.value = true
const res = await homeworklist({ ids: objItem.value?.activityContent, pageSize: 100 })
await formatClassWorkFile(res.rows)
}
} }
// //
const getData = async (data: WorkItem) => { const getData = async (data: WorkItem) => {
await upDateData('add', [data.id]) workList.value = []
dialogVisible.value = false if(paramData.value.activityContent){
} const arr = paramData.value.activityContent.split(',')
// - type add/ | del/ ids id arr.push(data.id.toString())
const upDateData = (type: string, ids: number[]): Promise<any> => { const unitArr = Array.from(new Set(arr))
return new Promise(async (resolve, reject) => { paramData.value.activityContent = unitArr.join(',')
loadingActive.value = true }else{
// paramData.value.activityContent = data.id.toString()
let workIds = slidesStore.workList.map((o:any) => o.id)
const id = slidesStore.currentSlide.id
if (type === 'del') { //
workIds = workIds.filter(id => !ids.includes(id))
} else { //
workIds = Array.from(new Set([...workIds, ...ids]))
} }
// upDateData()
const wItem:any = slidesStore.workItem.find((o:any) => o.id === id) dialogVisible.value = false
const workIdsStr = workIds.join(',') // id-> }
if (!!wItem) wItem.activityContent = workIdsStr const upDateData = async () => {
const data = { id, activityContent: workIdsStr } loadingActive.value = true
// await PPTApi.updateSlide(paramData.value)
await PPTApi.updateSlide(data, false) // await updateEntpcoursefileNew(paramData.value)
// const resource = sessionStore.get('curr.resource')
await PPTApi.updateWorkList() await PPTApi.getSlideList(resource.id)
loadingActive.value = false const res = await homeworklist({ ids: paramData.value.activityContent, pageSize: 100 })
resolve(true) await formatClassWorkFile(res.rows)
}) }
//
const objectsAreEqual = (obj1: Record<string, any>, obj2: Record<string, 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(() => {
@ -275,8 +332,17 @@ onMounted(() => {
currentCourse.levelSecondId = curNode.id currentCourse.levelSecondId = curNode.id
currentCourse.coursetitle = curNode.itemtitle currentCourse.coursetitle = curNode.itemtitle
currentCourse.node = curNode currentCourse.node = curNode
objItem.value = workItem.value[slideIndex.value]
getCurrentPPtData()
}) })
watch(() => [workItem.value.length,workItem.value[slideIndex.value]?.id], (newVal,oldVal) => {
if(!objectsAreEqual(newVal,oldVal))
if(workItem.value[slideIndex.value])
getCurrentPPtData()
})
// watch(() => workItem.value.length, () => {
// getCurrentPPtData()
// })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.buttonDiv{ .buttonDiv{

View File

@ -10,7 +10,7 @@
<div class="content-header-title">{{item.name}}</div> <div class="content-header-title">{{item.name}}</div>
<div class="content-header-body"> <div class="content-header-body">
<div class="content-header-num">{{item.num}}</div> <div class="content-header-num">{{item.num}}</div>
<div class="content-header-text">{{item.type}}</div> <div class="content-header-text">分析结果</div>
</div> </div>
</div> </div>
</div> </div>
@ -112,33 +112,27 @@ const collectRef = (key) => {
const tags = reactive([{ const tags = reactive([{
name: '课标分析', name: '课标分析',
path: '/model/curriculum', path: '/model/curriculum',
bgcolor: 'rgb(241,65,108)', bgcolor: 'rgb(241,65,108)'
type: '分析结果'
},{ },{
name: '教材分析', name: '教材分析',
path: '/model/teaching', path: '/model/teaching',
bgcolor: 'rgb(114,57,234)', bgcolor: 'rgb(114,57,234)'
type: '分析结果'
},{ },{
name: '考试分析', name: '考试分析',
path: '/model/examination', path: '/model/examination',
bgcolor: 'rgb(251,132,4)', bgcolor: 'rgb(251,132,4)'
type: '分析结果'
},{ },{
name: '素材设计', name: '素材设计',
path: '/model/aiKolors', path: '/model/aiKolors',
bgcolor: 'rgb(25,123,237)', bgcolor: 'rgb(25,123,237)'
type: '素材'
},{ },{
name: '作业设计', name: '作业设计',
path: '/model/newClassTaskAssign', path: '/model/newClassTaskAssign',
bgcolor: 'rgb(23,198,83)', bgcolor: 'rgb(23,198,83)'
type: '作业'
},{ },{
name: '框架设计', name: '框架设计',
path: '/model/design', path: '/model/design',
bgcolor: 'rgb(34,35,43)', bgcolor: 'rgb(34,35,43)'
type: '设计框架'
}]) }])
const tools = reactive([{ const tools = reactive([{