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",
"version": "2.5.6",
"version": "2.5.5",
"description": "",
"main": "./out/main/index.js",
"author": "上海交大重庆人工智能研究院",

View File

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

View File

@ -8,7 +8,6 @@ import type { Result } from './types' // 接口类型
import msgUtils from '@/plugins/modal' // 消息工具
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关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 { sessionStore } from '@/utils/store' // electron-store 状态管理
import useUserStore from '@/store/modules/user' // 外部-用户信息
@ -77,14 +76,12 @@ export class PPTApi {
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] : []
// 写入作业列表数据
// slidesStore.setWorkList(workList)
slidesStore.setWorkList(workList)
// 获取所有的pptlist的数据
slidesStore.setWorkItem(workItem)
this.updateWorkList()
resolve(true)
} 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) => {
if (isThum) { // 更新缩略图
const thumUrl = await this.getSlideThumUrl()
data.base64Code = thumUrl // 更新缩略图
}
const thumUrl = await this.getSlideThumUrl()
data.base64Code = thumUrl // 更新缩略图
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
if (res.code === 200) {
resolve(true)
@ -207,31 +202,6 @@ export class PPTApi {
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 缩略图
static getSlideThumUrl(): Promise<Boolean> {
return nextTick().then(async() => {

View File

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

View File

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

View File

@ -32,14 +32,14 @@
<!-- 作业列表 -->
<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-title">
<el-tag :type="getTagType(item.worktype) || 'primary'">{{item.worktype}}</el-tag>
<el-tooltip :content="item.uniquekey" placement="top">
<div class="tt">{{item.uniquekey}}</div>
</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>
</template>
@ -94,6 +94,7 @@ import {useSlidesStore} from '../../../../../store'
import { updateEntpcoursefileNew } from '@/api/education/entpcoursefile'
const slidesStore = useSlidesStore()
const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore)
interface CourseNode {
rootid: number;
parentNode: { id: number };
@ -173,27 +174,63 @@ const type = ref<WorkType[]>([
}
])
const objItem = ref<any>({})
//
const workList = ref<WorkItem[]>([])
//
const selectedWorkList = ref<WorkItem[]>([])
// loading
const loadingActive = ref<boolean>(false)
//
const paramData = ref<{ id: number, activityContent: string }>({} as { id: number, activityContent: string })
const selectable = (row: WorkItem, index: number): boolean => {
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('是否确认删除?')
.then(async() => {
// workList
// slidesStore.workList.splice(index, 1)
console.log('删除作业', item)
await upDateData('del', [item.id])
ElMessage.success('删除成功')
})
.catch(() => { });
.then(() => {
workList.value = []
const arr = paramData.value.activityContent.split(',')
const filterArr = arr.filter(itemId => itemId!== item.id.toString())
paramData.value.activityContent = filterArr.join(',')
upDateData()
})
.catch(() => { });
}
// tag
@ -220,7 +257,6 @@ const showDialog = (item: string) => {
dialogVisible.value = true
}
//
const openList = () => {
activeVisible.value = true
initHomeWork()
@ -228,44 +264,65 @@ const openList = () => {
//
const savePPtData = async () => {
if (!selectedWorkList.value.length) {
ElMessage.warning('请选择活动')
return
}
const arr = selectedWorkList.value.map(item => item.id)
await upDateData('add', arr)
activeVisible.value = false
if (selectedWorkList.value.length === 0) {
ElMessage.warning('请选择活动')
return
}
workList.value = []
const arr = selectedWorkList.value.map(item => item.id)
//
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) => {
await upDateData('add', [data.id])
dialogVisible.value = false
}
// - type add/ | del/ ids id
const upDateData = (type: string, ids: number[]): Promise<any> => {
return new Promise(async (resolve, reject) => {
loadingActive.value = true
//
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]))
workList.value = []
if(paramData.value.activityContent){
const arr = paramData.value.activityContent.split(',')
arr.push(data.id.toString())
const unitArr = Array.from(new Set(arr))
paramData.value.activityContent = unitArr.join(',')
}else{
paramData.value.activityContent = data.id.toString()
}
//
const wItem:any = slidesStore.workItem.find((o:any) => o.id === id)
const workIdsStr = workIds.join(',') // id->
if (!!wItem) wItem.activityContent = workIdsStr
const data = { id, activityContent: workIdsStr }
//
await PPTApi.updateSlide(data, false)
//
await PPTApi.updateWorkList()
loadingActive.value = false
resolve(true)
})
upDateData()
dialogVisible.value = false
}
const upDateData = async () => {
loadingActive.value = true
await PPTApi.updateSlide(paramData.value)
// await updateEntpcoursefileNew(paramData.value)
const resource = sessionStore.get('curr.resource')
await PPTApi.getSlideList(resource.id)
const res = await homeworklist({ ids: paramData.value.activityContent, pageSize: 100 })
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(() => {
@ -275,8 +332,17 @@ onMounted(() => {
currentCourse.levelSecondId = curNode.id
currentCourse.coursetitle = curNode.itemtitle
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>
<style scoped lang="scss">
.buttonDiv{

View File

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