Compare commits
6 Commits
bf4b857eb7
...
e58cb334e4
Author | SHA1 | Date |
---|---|---|
zhengdegang | e58cb334e4 | |
zdg | c298e1c0a2 | |
朱浩 | ed8051d0e0 | |
朱浩 | 628055fb58 | |
zhengdegang | 1698ce30dd | |
zdg | a973d296fe |
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "aix-win-ws",
|
||||
"version": "2.5.5",
|
||||
"version": "2.5.6",
|
||||
"description": "",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "上海交大重庆人工智能研究院",
|
||||
|
|
|
@ -74,6 +74,8 @@ const initLoad: Function = () => {
|
|||
!!(opt.ratio??null) && slidesStore.setViewportRatio(opt.ratio)// 有比例配置项
|
||||
}
|
||||
return PPTApi.getSlideList(resource.id)
|
||||
// PPTApi.updateWorkList()
|
||||
// return Promise.resolve()
|
||||
}
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ 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' // 外部-用户信息
|
||||
|
@ -76,12 +77,14 @@ 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)
|
||||
})
|
||||
|
@ -155,11 +158,13 @@ export class PPTApi {
|
|||
}
|
||||
}
|
||||
}
|
||||
// 更新幻灯片
|
||||
static updateSlide(data: object): Promise<Boolean> {
|
||||
// 更新幻灯片 isThum 是否更新缩略图
|
||||
static updateSlide(data: object, isThum = true): Promise<Boolean> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (isThum) { // 更新缩略图
|
||||
const thumUrl = await this.getSlideThumUrl()
|
||||
data.base64Code = thumUrl // 更新缩略图
|
||||
}
|
||||
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
|
||||
if (res.code === 200) {
|
||||
resolve(true)
|
||||
|
@ -202,6 +207,31 @@ 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() => {
|
||||
|
|
|
@ -35,6 +35,11 @@ export default () => {
|
|||
updatePPT({title: newVal})
|
||||
})
|
||||
|
||||
// 监听幻灯片下标变化
|
||||
watch(() => slidesStore.slideIndex, (newVal, oldVal) => {
|
||||
PPTApi.updateWorkList()
|
||||
})
|
||||
|
||||
// 消息监听ws
|
||||
// console.log('监听器已开启', ChatWs)
|
||||
if (!!ChatWs.ws) {
|
||||
|
|
|
@ -32,14 +32,14 @@
|
|||
<!-- 作业列表 -->
|
||||
<div class="c-apt-r" v-loading='loadingActive'>
|
||||
<!-- 显示-作业内容 -->
|
||||
<template v-for="(item, index) in workList" :key="index">
|
||||
<template v-for="(item, index) in slidesStore.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="handleRemoveDemoActivityClassWork(item)">删除</el-button>
|
||||
<el-button class="btn-del" type="danger" link @click="removeWork(item, index)">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -94,7 +94,6 @@ 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 };
|
||||
|
@ -174,61 +173,25 @@ 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 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) => {
|
||||
// 删除作业
|
||||
const removeWork = (item: WorkItem, index: number) => {
|
||||
ElMessageBox.confirm('是否确认删除?')
|
||||
.then(() => {
|
||||
workList.value = []
|
||||
const arr = paramData.value.activityContent.split(',')
|
||||
const filterArr = arr.filter(itemId => itemId!== item.id.toString())
|
||||
paramData.value.activityContent = filterArr.join(',')
|
||||
upDateData()
|
||||
.then(async() => {
|
||||
// 从workList中删除
|
||||
// slidesStore.workList.splice(index, 1)
|
||||
console.log('删除作业', item)
|
||||
await upDateData('del', [item.id])
|
||||
ElMessage.success('删除成功')
|
||||
})
|
||||
.catch(() => { });
|
||||
}
|
||||
|
@ -257,6 +220,7 @@ const showDialog = (item: string) => {
|
|||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
// 打开活动引用列表
|
||||
const openList = () => {
|
||||
activeVisible.value = true
|
||||
initHomeWork()
|
||||
|
@ -264,65 +228,44 @@ const openList = () => {
|
|||
|
||||
// 添加活动引用列表作业
|
||||
const savePPtData = async () => {
|
||||
if (selectedWorkList.value.length === 0) {
|
||||
if (!selectedWorkList.value.length) {
|
||||
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()
|
||||
await upDateData('add', arr)
|
||||
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) => {
|
||||
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()
|
||||
}
|
||||
upDateData()
|
||||
await upDateData('add', [data.id])
|
||||
dialogVisible.value = false
|
||||
}
|
||||
const upDateData = async () => {
|
||||
// 更新数据-活动 type add/增加 | del/删除 ids 作业id
|
||||
const upDateData = (type: string, ids: number[]): Promise<any> => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
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)
|
||||
// 更新本地数据
|
||||
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]))
|
||||
}
|
||||
// 判断是否做操作
|
||||
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;
|
||||
// 保存到本地
|
||||
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)
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
@ -332,17 +275,8 @@ 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{
|
||||
|
|
|
@ -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">分析结果</div>
|
||||
<div class="content-header-text">{{item.type}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -112,27 +112,33 @@ const collectRef = (key) => {
|
|||
const tags = reactive([{
|
||||
name: '课标分析',
|
||||
path: '/model/curriculum',
|
||||
bgcolor: 'rgb(241,65,108)'
|
||||
bgcolor: 'rgb(241,65,108)',
|
||||
type: '分析结果'
|
||||
},{
|
||||
name: '教材分析',
|
||||
path: '/model/teaching',
|
||||
bgcolor: 'rgb(114,57,234)'
|
||||
bgcolor: 'rgb(114,57,234)',
|
||||
type: '分析结果'
|
||||
},{
|
||||
name: '考试分析',
|
||||
path: '/model/examination',
|
||||
bgcolor: 'rgb(251,132,4)'
|
||||
bgcolor: 'rgb(251,132,4)',
|
||||
type: '分析结果'
|
||||
},{
|
||||
name: '素材设计',
|
||||
path: '/model/aiKolors',
|
||||
bgcolor: 'rgb(25,123,237)'
|
||||
bgcolor: 'rgb(25,123,237)',
|
||||
type: '素材'
|
||||
},{
|
||||
name: '作业设计',
|
||||
path: '/model/newClassTaskAssign',
|
||||
bgcolor: 'rgb(23,198,83)'
|
||||
bgcolor: 'rgb(23,198,83)',
|
||||
type: '作业'
|
||||
},{
|
||||
name: '框架设计',
|
||||
path: '/model/design',
|
||||
bgcolor: 'rgb(34,35,43)'
|
||||
bgcolor: 'rgb(34,35,43)',
|
||||
type: '设计框架'
|
||||
}])
|
||||
|
||||
const tools = reactive([{
|
||||
|
|
Loading…
Reference in New Issue