Compare commits

...

40 Commits

Author SHA1 Message Date
lyc a379176496 edti 插入素材 2024-12-13 09:47:15 +08:00
lyc eaa14b1666 Merge branch 'main' into lyc-dev 2024-12-12 17:14:55 +08:00
baigl c3b975fee9 Merge pull request 'baigl' (#126) from baigl into main
Reviewed-on: #126
2024-12-12 16:45:29 +08:00
白了个白 ea2a8ebfda Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into baigl 2024-12-12 16:44:36 +08:00
白了个白 308465adb4 ppts: 64转file 提取到utils image中 2024-12-12 16:44:03 +08:00
yangws 469116701b Merge pull request 'fix:修改pptlist活动的bug;' (#125) from yws_dev into main
Reviewed-on: #125
2024-12-12 16:39:46 +08:00
小杨 7861727e92 fix:修改pptlist活动的bug; 2024-12-12 16:39:01 +08:00
zhangxuelin c5e71e6e7b Merge pull request '修改作业弹窗' (#122) from zxl into main
Reviewed-on: #122
2024-12-12 16:38:33 +08:00
zhangxuelin c7ebc6de65 1 2024-12-12 16:37:51 +08:00
zhangxuelin b906a1e688 Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into zxl 2024-12-12 16:37:22 +08:00
baigl f75ab621d2 Merge pull request 'baigl' (#124) from baigl into main
Reviewed-on: #124
2024-12-12 16:35:47 +08:00
白了个白 a711eb2745 Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into baigl 2024-12-12 16:35:04 +08:00
白了个白 363b284b7c 1 2024-12-12 16:34:47 +08:00
baigl dc4c0fd334 Merge pull request 'baigl' (#123) from baigl into main
Reviewed-on: #123
2024-12-12 16:24:36 +08:00
白了个白 fb3ffd5dda Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into baigl 2024-12-12 16:23:51 +08:00
白了个白 5771533039 ppts: 插入试题 图片路径存储修改 2024-12-12 16:23:28 +08:00
zhangxuelin 75ea11e171 Merge branch 'main' of http://27.128.240.72:3000/zhuhao/AIx_Smarttalk_WS into zxl 2024-12-12 16:15:55 +08:00
zhangxuelin 851a39897b 修改作业弹窗 2024-12-12 16:15:16 +08:00
zhangxuelin 69bfc68b28 Merge pull request '作业弹窗' (#121) from zxl into main
Reviewed-on: #121
2024-12-12 16:12:53 +08:00
zhangxuelin 590b318757 作业弹窗 2024-12-12 16:12:32 +08:00
CYS 4421ee7fea Merge pull request '政治课标dataset_id修改' (#120) from cys_dev into main
Reviewed-on: #120
2024-12-12 16:05:55 +08:00
cys 19ef95447c 1 2024-12-12 16:04:43 +08:00
baigl 25b6da7f26 Merge pull request '教程分析:pdf页面展示修改' (#119) from baigl into main
Reviewed-on: #119
2024-12-12 15:27:00 +08:00
白了个白 892b4ee3b0 教程分析:pdf页面展示修改 2024-12-12 15:26:14 +08:00
yangws 3d8f7c2a3a Merge pull request 'fix:修改pptlist添加活动的bug;' (#118) from yws_dev into main
Reviewed-on: #118
2024-12-12 11:27:19 +08:00
小杨 78cc5edd39 fix:修改pptlist添加活动的bug; 2024-12-12 11:26:26 +08:00
朱浩 9f4e232d6f Merge remote-tracking branch 'origin/main' 2024-12-12 11:20:12 +08:00
朱浩 afc9fe89d1 解决按钮层级问题 2024-12-12 11:19:38 +08:00
朱浩 894ed269ce 解决生产无法关闭PPTIST页面问题 2024-12-12 11:17:12 +08:00
zhangxuelin 64d2dbcabb Merge pull request '点赞疑问' (#117) from zxl into main
Reviewed-on: #117
2024-12-12 10:58:09 +08:00
zhangxuelin f4cb3a8916 点赞疑问 2024-12-12 10:57:48 +08:00
yangws 69db6bd8b1 Merge pull request '清除debugger;' (#116) from yws_dev into main
Reviewed-on: #116
2024-12-12 10:53:38 +08:00
小杨 e522fc8ee5 清除debugger; 2024-12-12 10:53:15 +08:00
yangws 5b50404d3c Merge pull request 'fix:修改ppt添加活动的bug;' (#115) from yws_dev into main
Reviewed-on: #115
2024-12-12 10:52:40 +08:00
小杨 bbed835ffe fix:修改ppt添加活动的bug; 2024-12-12 10:52:10 +08:00
朱浩 9c7aeb1a27 Merge remote-tracking branch 'origin/main' 2024-12-11 17:11:22 +08:00
朱浩 a9faeea3fd Merge remote-tracking branch 'origin/main' 2024-12-11 17:03:04 +08:00
朱浩 5493de7a61 版本升级 2024-12-11 17:02:44 +08:00
朱浩 02ab1ffa8e 霞客 2024-12-11 16:42:46 +08:00
朱浩 10e76add35 霞客 2024-12-11 16:35:52 +08:00
24 changed files with 483 additions and 161 deletions

View File

@ -22,4 +22,4 @@ VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
VITE_APP_WS_URL = 'wss://file.ysaix.com:7868' VITE_APP_WS_URL = 'wss://file.ysaix.com:7868'
# 是否显示开发工具 # 是否显示开发工具
VITE_SHOW_DEV_TOOLS = 'false' VITE_SHOW_DEV_TOOLS = 'true'

View File

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

View File

@ -13097,15 +13097,15 @@ const PDFViewerApplication = {
} }
if (isValidSpreadMode(spread)) { if (isValidSpreadMode(spread)) {
//默认双页 //默认双页
// this.pdfViewer.spreadMode = spread; this.pdfViewer.spreadMode = spread;
this.pdfViewer.spreadMode = 1; // this.pdfViewer.spreadMode = 1;
} }
}; };
this.isInitialViewSet = true; this.isInitialViewSet = true;
this.pdfSidebar?.setInitialView(sidebarView); this.pdfSidebar?.setInitialView(sidebarView);
//默认双页 //默认双页
// setViewerModes(scrollMode, spreadMode); setViewerModes(scrollMode, spreadMode);
setViewerModes(scrollMode, 1); // setViewerModes(scrollMode, 1);
if (this.initialBookmark) { if (this.initialBookmark) {
setRotation(this.initialRotation); setRotation(this.initialRotation);
delete this.initialRotation; delete this.initialRotation;

View File

@ -39,8 +39,8 @@ const slidesStore = useSlidesStore()
const { databaseId } = storeToRefs(mainStore) const { databaseId } = storeToRefs(mainStore)
const { screening } = storeToRefs(useScreenStore()) const { screening } = storeToRefs(useScreenStore())
if (import.meta.env.MODE !== 'development') { if (import.meta.env.MODE === 'development') {
window.onbeforeunload = () => false // window.onbeforeunload = () => false
} }
onMounted(async () => { onMounted(async () => {

View File

@ -3,22 +3,22 @@
* @author zdg * @author zdg
* @date 2024-11-26 * @date 2024-11-26
*/ */
import { toRaw, nextTick } from 'vue' import { toRaw } 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 { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库 import * as Api_server from '@/api/apiService' // 相关api
// 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 {
@ -73,7 +73,6 @@ export class PPTApi {
// 活动列表处理 // 活动列表处理
const workList = (res.rows || []).map(o => o.activityContent) const workList = (res.rows || []).map(o => o.activityContent)
const workItem = [...res.rows] const workItem = [...res.rows]
// 加入活动后刷新ppt数据内容不跟换为第一页
// slidesStore.updateSlideIndex(0) // 下标0 为第一页 // slidesStore.updateSlideIndex(0) // 下标0 为第一页
slidesStore.setSlides(slides) // 写入数据 slidesStore.setSlides(slides) // 写入数据
// 写入作业列表数据 // 写入作业列表数据
@ -112,6 +111,7 @@ export class PPTApi {
data.id = rid data.id = rid
slidesStore.updateSlide(data) slidesStore.updateSlide(data)
// msgUtils.msgSuccess('新增成功') // msgUtils.msgSuccess('新增成功')
PPTApi.getSlideList(resource.id)
this.isUpdate = false // 新增后会触发监听,不再更新数据 this.isUpdate = false // 新增后会触发监听,不再更新数据
resolve(true) resolve(true)
} else msgUtils.msgError('新增失败');resolve(false) } else msgUtils.msgError('新增失败');resolve(false)
@ -147,11 +147,7 @@ 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(res,'dresata');
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)
@ -193,40 +189,30 @@ 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 (file: File|any) => { static toRousrceUrl =async (o:any) => {
const formData = new FormData() const formData = new FormData()
formData.append('file', file) formData.append('file', o)
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 CreateHomework.getClassWorkList(id) let result = await getClassWorkList(id)
result = await CreateHomework.getStudentClassWorkData()   result = await getStudentClassWorkData()
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));   localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
toolStore.isTaskWin=true; // 设置打开批改窗口   toolStore.isTaskWin=true; // 设置打开批改窗口
createWindow('open-taskwin',{url:'/teachClassTask'}); //   emit('closeActive')
  createWindow('open-taskwin',{url:'/teachClassTask'});
} }
} }
export default PPTApi export default PPTApi

View File

@ -5,9 +5,12 @@ 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[]
@ -142,16 +145,19 @@ export const useSlidesStore = defineStore('slides', {
setWorkItem(list: Object[]) { setWorkItem(list: Object[]) {
this.workItem = list this.workItem = list
}, },
addWorkItem(data: any) {
const id = data?.id
if (!id) return
this.workItem.splice(this.slideIndex + 1, 0, data)
this.slideIndex += 1
},
addSlide(slide: Slide | Slide[]) { addSlide(slide: Slide | Slide[]) {
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
} }
this.slides.splice(this.slideIndex, 0, ...slides)
const addIndex = this.slideIndex + 1
this.slides.splice(addIndex, 0, ...slides)
this.slideIndex = addIndex
}, },
updateSlide(props: Partial<Slide>, slideId?: string) { updateSlide(props: Partial<Slide>, slideId?: string) {
@ -188,6 +194,7 @@ 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)
} }

View File

@ -72,4 +72,55 @@ export const isSVGString = (text: string): boolean => {
export const svg2File = (svg: string): File => { export const svg2File = (svg: string): File => {
const blob = new Blob([svg], { type: 'image/svg+xml' }) const blob = new Blob([svg], { type: 'image/svg+xml' })
return new File([blob], `${Date.now()}.svg`, { type: 'image/svg+xml' }) return new File([blob], `${Date.now()}.svg`, { type: 'image/svg+xml' })
}
/**
*
* @returns
*/
export const getTime=()=>{
const now = new Date();
const year = now.getFullYear();
const month = ('0' + (now.getMonth() + 1)).slice(-2);
const day = ('0' + now.getDate()).slice(-2);
const hours = ('0' + now.getHours()).slice(-2);
const minutes = ('0' + now.getMinutes()).slice(-2);
const seconds = ('0' + now.getSeconds()).slice(-2);
return `${year}-${month}-${day}_${hours}:${minutes}:${seconds}`;
};
/**
* base64转图片File
* @param {String} base64 base64
* @param {String} fileName | myimg
* @returns File file数据类型
*/
export const base64ToFile = (base64: string, fileName = '试题图片') => {
// 将base64按照 , 进行分割 将前缀 与后续内容分隔开
let data = base64.split(','),
// 利用正则表达式 从前缀中获取图片的类型信息image/png、image/jpeg、image/webp等
type = data[0].match(/:(.*?);/)[1],
// 从图片的类型信息中 获取具体的文件格式后缀png、jpeg、webp
suffix = type.split('/')[1],
// 使用atob()对base64数据进行解码 结果是一个文件数据流 以字符串的格式输出
bstr = window.atob(data[1]),
// 获取解码结果字符串的长度
n = bstr.length,
// 根据解码结果字符串的长度创建一个等长的整形数字数组
// 但在创建时 所有元素初始值都为 0
u8arr = new Uint8Array(n)
// 将整形数组的每个元素填充为解码结果字符串对应位置字符的UTF-16 编码单元
while (n--) {
// charCodeAt():获取给定索引处字符对应的 UTF-16 代码单元
u8arr[n] = bstr.charCodeAt(n)
}
const filename = fileName+getTime()
// 利用构造函数创建File文件对象
// new File(bits, name, options)
const file = new File([u8arr], `${filename}.${suffix}`, {
type: type
})
// 返回file
return file
} }

View File

@ -19,8 +19,8 @@
import { ref, reactive, onMounted, computed } from 'vue'; import { ref, reactive, onMounted, computed } from 'vue';
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import { getSmarttalkPage } from '@/api/file' import { getSmarttalkPage } from '@/api/file'
import { getFileSuffix, urlToBase64 } from '@/utils/ruoyi.js'
import * as commUtils from '@/utils/comm.js' import * as commUtils from '@/utils/comm.js'
import { getFileSuffix } from '@/utils/ruoyi.js'
const emit = defineEmits(['insertMaterial', 'close']) const emit = defineEmits(['insertMaterial', 'close'])
@ -63,12 +63,9 @@ const fileUrl = computed(() => (item) =>{
// //
const onInsert = async (item) =>{ const onInsert = async (item) =>{
const res = await fetch(item.fileFullPath)
const bolb = commUtils.base64ToBlob(item.fileFullPath) const bolb = await res.blob()
const file = commUtils.blobToFile(bolb, item.fileShowName)
const file = commutils.blobToFile(bolb, item.fileShowName)
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){ if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
emit('insertMaterial',{ type: 'video', file }) emit('insertMaterial',{ type: 'video', file })

View File

@ -114,7 +114,7 @@
/> />
</Modal> </Modal>
<!--插入试题-->
<el-dialog v-model="classWorkTaskVisible" append-to-body :show-close="false" width="70%"> <el-dialog v-model="classWorkTaskVisible" append-to-body :show-close="false" width="70%">
<QuestToPPTist <QuestToPPTist
class="class-work-task-modal" class="class-work-task-modal"
@ -141,7 +141,7 @@
import { ref } from 'vue' import { ref } from 'vue'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { useMainStore, useSnapshotStore } from '../../../store' import { useMainStore, useSnapshotStore } from '../../../store'
import { getImageDataURL } from '../../../utils/image' import { getImageDataURL, base64ToFile } from '../../../utils/image'
import type { ShapePoolItem } from '../../../configs/shapes' import type { ShapePoolItem } from '../../../configs/shapes'
import type { LinePoolItem } from '../../../configs/lines' import type { LinePoolItem } from '../../../configs/lines'
import useScaleCanvas from '../../../hooks/useScaleCanvas' import useScaleCanvas from '../../../hooks/useScaleCanvas'
@ -210,8 +210,14 @@ const insertImageElement = (files: FileList) => {
} }
const onhtml2canvas = async (html: HTMLElement) => { const onhtml2canvas = async (html: HTMLElement) => {
const ele = await toPng(html); const base64Dta = await toPng(html);
createImageElement(ele); // base64File
const toFile = base64ToFile(base64Dta)
// 线
PPTApi.toRousrceUrl(toFile).then(data=>{
createImageElement(data)
})
// createImageElement(ele);
} }
const shapePoolVisible = ref(false) const shapePoolVisible = ref(false)
@ -286,8 +292,9 @@ const insertMaterial = (item: MaterialParams) =>{
else{ else{
createImageElement(data) createImageElement(data)
} }
materiaVisible.value = false
}) })
materiaVisible.value = false
} }
// //

View File

@ -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.evaltitle" placement="top"> <el-tooltip :content="item.uniquekey" placement="top">
<div class="tt">{{item.evaltitle}}</div> <div class="tt">{{item.uniquekey}}</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="evaltitle" label="活动名称" width="150" /> <el-table-column prop="uniquekey" 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>
@ -90,7 +90,8 @@ import { sessionStore } from '@/utils/store'
import { useGetHomework } from '@/hooks/useGetHomework' import { useGetHomework } from '@/hooks/useGetHomework'
import { PPTApi } from '../../../../../api/index' import { PPTApi } from '../../../../../api/index'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import {useSlidesStore} from '../../../../../store' import {useSlidesStore} from '../../../../../store'
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)
@ -131,7 +132,7 @@ interface WorkItem {
base64?: string; base64?: string;
prevData?: any; prevData?: any;
id: number; id: number;
evaltitle?: string; // evaltitle uniquekey?: string; // evaltitle
} }
const currentCourse = reactive<CurrentCourse>({ const currentCourse = reactive<CurrentCourse>({
@ -277,6 +278,7 @@ 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
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
@ -300,12 +302,23 @@ const getData = async (data: WorkItem) => {
dialogVisible.value = false dialogVisible.value = false
} }
const upDateData = async () => { const upDateData = async () => {
await PPTApi.updateSlide(paramData.value) // await PPTApi.updateSlide(paramData.value)
loadingActive.value = true loadingActive.value = true
const res = await homeworklist({ ids: paramData.value.activityContent, pageSize: 100 }) await updateEntpcoursefileNew(paramData.value)
await formatClassWorkFile(res.rows)
const resource = sessionStore.get('curr.resource') const resource = sessionStore.get('curr.resource')
await PPTApi.getSlideList(resource.id) 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(() => { onMounted(() => {
@ -318,9 +331,13 @@ onMounted(() => {
objItem.value = workItem.value[slideIndex.value] objItem.value = workItem.value[slideIndex.value]
getCurrentPPtData() getCurrentPPtData()
}) })
watch(() => slideIndex.value, () => { watch(() => [workItem.value.length,slideIndex.value], (newVal,oldVal) => {
getCurrentPPtData() if(!objectsAreEqual(newVal,oldVal))
getCurrentPPtData()
}) })
// watch(() => workItem.value.length, () => {
// getCurrentPPtData()
// })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.buttonDiv{ .buttonDiv{

View File

@ -36,7 +36,7 @@
</div> </div>
<!-- 点赞组件 --> <!-- 点赞组件 -->
<div style="z-index: 999;position: absolute;top:10px"> <div style="z-index: 999;position: absolute;top:10px">
<upvote-vue ref="upvoteRef" :test='true' type="2"></upvote-vue> <upvote-vue ref="upvoteRef" type="2"></upvote-vue>
</div> </div>
<div <div
class="tools-right" :class="{ 'visible': rightToolsVisible }" class="tools-right" :class="{ 'visible': rightToolsVisible }"
@ -73,6 +73,8 @@ import SlideThumbnails from './SlideThumbnails.vue'
import WritingBoardTool from './WritingBoardTool.vue' import WritingBoardTool from './WritingBoardTool.vue'
import CountdownTimer from './CountdownTimer.vue' import CountdownTimer from './CountdownTimer.vue'
import upvoteVue from '@/views/tool/components/upvote.vue' // - import upvoteVue from '@/views/tool/components/upvote.vue' // -
import emitter from '@/utils/mitt';
const props = defineProps<{ const props = defineProps<{
changeViewMode: (mode: 'base' | 'presenter') => void changeViewMode: (mode: 'base' | 'presenter') => void
}>() }>()
@ -191,13 +193,11 @@ const contextmenus = (): ContextmenuItem[] => {
}, },
] ]
} }
// 1 2
emitter.on('upvoteTrigger', (type) => {
upvoteRef.value?.trigger(type)
});
watchEffect(() => {
const likeCont = screenStore.like //
const doubtCount = screenStore.doubt //
if (likeCont > 0) upvoteRef.value?.trigger?.(1)
if (doubtCount > 0) upvoteRef.value?.trigger?.(2)
})
</script> </script>

View File

@ -482,10 +482,7 @@ export default {
// //
async saveImage(resultIndex, index, url, resultItem) { async saveImage(resultIndex, index, url, resultItem) {
if(this.hasPPt){
this.$emit('insertImg', url)
return
}
this.buttonStates[resultIndex][index].disabled = true; this.buttonStates[resultIndex][index].disabled = true;
this.buttonStates[resultIndex][index].text = "正在保存..."; this.buttonStates[resultIndex][index].text = "正在保存...";
const numberIndex = url.indexOf('filename='); const numberIndex = url.indexOf('filename=');
@ -494,6 +491,7 @@ export default {
const finalPath = path.substring(0, pngIndex + 4); const finalPath = path.substring(0, pngIndex + 4);
try { try {
const blob = await this.getImageBlob(`https://ai.ysaix.com:7853/view?filename=${finalPath}&type=temp`); const blob = await this.getImageBlob(`https://ai.ysaix.com:7853/view?filename=${finalPath}&type=temp`);
const hash = CryptoJS.MD5(blob).toString(); const hash = CryptoJS.MD5(blob).toString();
@ -502,7 +500,10 @@ export default {
let file = new File([blob], `${resultItem}.png`, { let file = new File([blob], `${resultItem}.png`, {
type: 'image/png' type: 'image/png'
}) })
if(this.hasPPt){
this.$emit('insertImg', file)
return
}
// //
formData.append('md5', hash); formData.append('md5', hash);
formData.append('file', file); formData.append('file', file);

View File

@ -1,7 +1,8 @@
<template> <template>
<div class="book-wrap"> <div class="book-wrap">
<el-scrollbar height="100%"> <el-scrollbar height="100%">
<div class="book-name flex" @click="dialogVisible = true"> <div class="book-name flex" v-if="isStadium() === true"> {{userStore.user.deptName}}</div>
<div v-else class="book-name flex" @click="dialogVisible = true">
<span>{{ curBook.data.itemtitle }}</span> <span>{{ curBook.data.itemtitle }}</span>
<i class="iconfont icon-xiangyou"></i> <i class="iconfont icon-xiangyou"></i>
</div> </div>
@ -46,8 +47,14 @@ import { onMounted, ref, nextTick, toRaw, reactive } from 'vue';
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import { useGetSubject } from '@/hooks/useGetSubject' import { useGetSubject } from '@/hooks/useGetSubject'
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
const isStadium = () => {
let roles = userStore.user.roles
return roles.some(item => item.roleKey === 'stadium')
}
// emit // emit
const emit = defineEmits(['nodeClick', 'changeBook']) const emit = defineEmits(['nodeClick', 'changeBook'])
let useSubject = null let useSubject = null
@ -139,7 +146,7 @@ const handleNodeClick = (data) => {
* data : 当前节点数据 * data : 当前节点数据
*/ */
let nodeData = cloneDeep(toRaw(data)); let nodeData = cloneDeep(toRaw(data));
//label label //label label
nodeData.label = nodeData.itemtitle nodeData.label = nodeData.itemtitle
let parentNode let parentNode
@ -181,13 +188,17 @@ onMounted( async () => {
curBook.data = sessionStore.get('subject.curBook') curBook.data = sessionStore.get('subject.curBook')
} }
else{ else{
curBook.data = subjectList.value[0] if (subjectList.value) {
curBook.data = subjectList.value[0]
}else {
curBook.data = {}
}
} }
// "" // ""
treeData.value = useSubject.getTreeData(curBook.data.id) treeData.value = useSubject.getTreeData(curBook.data.id)
sessionStore.set('subject.subjectTree',useSubject.getTreeData(curBook.data.id)) sessionStore.set('subject.subjectTree',useSubject.getTreeData(curBook.data.id))
nextTick(() =>{ nextTick(() =>{
// //
if(sessionStore.get('subject.curNode')){ if(sessionStore.get('subject.curNode')){
@ -199,7 +210,7 @@ onMounted( async () => {
} }
handleNodeClick(curNode.data) handleNodeClick(curNode.data)
}) })
} finally{ } finally{
treeLoading.value = false treeLoading.value = false
} }

View File

@ -136,7 +136,7 @@ const handleNodeClick = (data) => {
id: nodeData.parentid, id: nodeData.parentid,
label: nodeData.parenttitle, label: nodeData.parenttitle,
itemtitle: nodeData.parenttitle itemtitle: nodeData.parenttitle
} }
const parentNode = nodeData.parentid ? parent : null const parentNode = nodeData.parentid ? parent : null
nodeData.parentNode = parentNode nodeData.parentNode = parentNode
@ -204,7 +204,11 @@ onMounted(async () => {
curBook.data = sessionStore.get('subject.curBook') curBook.data = sessionStore.get('subject.curBook')
} }
else{ else{
curBook.data = subjectList.value[0] if (subjectList.value) {
curBook.data = subjectList.value[0]
}else {
curBook.data = {}
}
} }
// "" // ""
@ -220,7 +224,7 @@ onMounted(async () => {
} }
handleNodeClick(curNode.data) handleNodeClick(curNode.data)
}) })
}) })
</script> </script>

View File

@ -15,24 +15,40 @@ export const useGetSubject = async () =>{
// 单元章节树结构 // 单元章节树结构
let treeData = null let treeData = null
// 根据学科 + 学段 获取所有单元章节 // 根据学科 + 学段 获取所有单元章节
const getSubjectUnit = async () =>{ const getSubjectUnit = async () =>{
if(sessionStore.get('subject.unitList')){ if(isStadium(userStore.user)) {
unitList.value = sessionStore.get('subject.unitList') //如果是基地人员直接拿treeData
}
else{
const unitParams = { const unitParams = {
edusubject, itemgroup: '基地课程',
edustage,
itemgroup: 'textbook',
orderby: 'orderidx asc', orderby: 'orderidx asc',
entpid: userStore.user.deptId,
pageSize: 10000 pageSize: 10000
} }
const { rows } = await listEvaluation(unitParams) const { rows } = await listEvaluation(unitParams)
unitList.value = rows unitList.value = rows
sessionStore.set('subject.unitList', rows) }else{
if(sessionStore.get('subject.unitList')){
unitList.value = sessionStore.get('subject.unitList')
}
else{
const unitParams = {
edusubject,
edustage,
itemgroup: 'textbook',
orderby: 'orderidx asc',
pageSize: 10000
}
const { rows } = await listEvaluation(unitParams)
unitList.value = rows
sessionStore.set('subject.unitList', rows)
}
await getSubject()
} }
await getSubject() }
const isStadium = (user) => {
let roles = user.roles
return roles.some(item => item.roleKey === 'stadium')
} }
// 根据学科 + 学段 获取教材 // 根据学科 + 学段 获取教材
@ -42,7 +58,7 @@ export const useGetSubject = async () =>{
subjectList = sessionStore.get('subject.bookList') subjectList = sessionStore.get('subject.bookList')
} }
else{ else{
const subjectParams = { const subjectParams = {
itemkey: "version", itemkey: "version",
edusubject, edusubject,
edustage, edustage,
@ -68,11 +84,14 @@ export const useGetSubject = async () =>{
// 单元章节数据转为“树”结构 // 单元章节数据转为“树”结构
const getTreeData = (bookId) =>{ const getTreeData = (bookId) =>{
// 根据当前教材的id 查找出对应的章节 if (!bookId) {
let data = unitList.value.filter(item => item.rootid == bookId && item.level == 1) return unitList.value
}
// 根据当前教材的id 查找出对应的章节
let data = unitList.value.filter(item => item.rootid == bookId && item.level == 1)
data.forEach( item => { data.forEach( item => {
item.children = unitList.value.filter( item2 => item2.parentid == item.id && item2.level == 2) item.children = unitList.value.filter( item2 => item2.parentid == item.id && item2.level == 2)
}) })
return data return data
} }
@ -80,4 +99,4 @@ export const useGetSubject = async () =>{
return { subjectList, treeData, getTreeData } return { subjectList, treeData, getTreeData }
} }

View File

@ -11,7 +11,7 @@
</template> </template>
<div class="head-aside"> <div class="head-aside">
<ul > <ul >
<li :class="computedregistertype==1 || computedregistertype==3?'auth-li':'auth-li pointer-events'" @click="onUserTo('/schoolCertification')" > <li v-if="!isStadium" :class="computedregistertype==1 || computedregistertype==3?'auth-li':'auth-li pointer-events'" @click="onUserTo('/schoolCertification')" >
<i class="iconfont icon-renzheng-" :style="computedregistertype==4?'color:green;':''"></i> <i class="iconfont icon-renzheng-" :style="computedregistertype==4?'color:green;':''"></i>
<span class="mlr-5" v-if="computedregistertype!=4">学校认证</span> <span class="mlr-5" v-if="computedregistertype!=4">学校认证</span>
<span class="mlr-5" v-else>{{ userStore.DeptInfo.register.schoolName }}</span> <span class="mlr-5" v-else>{{ userStore.DeptInfo.register.schoolName }}</span>
@ -19,8 +19,8 @@
</li> </li>
<li v-if="computedregistertype!=4" :class="computedregistertype==1 || computedregistertype==2 ? '':'pointer-events'" @click="onUserTo('/joinSchool')">加入学校</li> <li v-if="computedregistertype!=4" :class="computedregistertype==1 || computedregistertype==2 ? '':'pointer-events'" @click="onUserTo('/joinSchool')">加入学校</li>
<li @click="onUserTo('/profile')">个人中心</li> <li @click="onUserTo('/profile')">个人中心</li>
<li @click="onUserTo('/schoolManagement')">学校管理</li> <li v-if="!isStadium" @click="onUserTo('/schoolManagement')">学校管理</li>
<li @click="onUserTo('/class')">班级中心</li> <li v-if="!isStadium" @click="onUserTo('/class')">班级中心</li>
<li @click="logout">退出登录</li> <li @click="logout">退出登录</li>
</ul> </ul>
</div> </div>
@ -53,7 +53,7 @@
</template> </template>
<script setup> <script setup>
import { ref, watch , reactive, onMounted,computed} from 'vue' import { ref, watch , reactive, onMounted, onBeforeMount, computed} from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { ElMessageBox, ElMessage } from 'element-plus' import { ElMessageBox, ElMessage } from 'element-plus'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
@ -64,6 +64,7 @@ import pkc from "../../../../../package.json"
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
const dev_api = ref(import.meta.env.VITE_APP_BASE_API) const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
const userStore = useUserStore() const userStore = useUserStore()
console.log(userStore)
const router = useRouter() const router = useRouter()
const currentRoute = ref('') const currentRoute = ref('')
const activeId = ref('/home') const activeId = ref('/home')
@ -74,7 +75,19 @@ const version = ref(pkc.version)
const popoverRef = ref('') const popoverRef = ref('')
const headerMenus = [ //
const isStadium = () => {
let user = userStore.user
let roles = user.roles
return roles.some(item => item.roleKey === 'stadium')
}
const headerMenus = isStadium() ?[{
name: '教学实践',
id: 4,
icon: 'icon-jiaoxueshijian',
path: '/prepare'
},]:[
{ {
name: '教学大模型', name: '教学大模型',
id: 1, id: 1,

View File

@ -16,6 +16,7 @@ import router from './router'
import log from 'electron-log/renderer' // 渲染进程日志-文件记录 import log from 'electron-log/renderer' // 渲染进程日志-文件记录
import customComponent from '@/components/common' // 自定义组件 import customComponent from '@/components/common' // 自定义组件
import plugins from './plugins' // plugins插件 import plugins from './plugins' // plugins插件
import useUserStore from '@/store/modules/user'
if(process.env.NODE_ENV != 'development') { // 非开发环境,将日志打印到日志文件 if(process.env.NODE_ENV != 'development') { // 非开发环境,将日志打印到日志文件
Object.assign(console, log.functions) // 渲染进程日志-控制台替换 Object.assign(console, log.functions) // 渲染进程日志-控制台替换
@ -47,3 +48,16 @@ app.use(router)
.use(Icon) .use(Icon)
.use(Directive) .use(Directive)
.mount('#app') .mount('#app')
const isStadium = (user) => {
let roles = user.roles
return roles.some(item => item.roleKey === 'stadium')
}
router.beforeEach((to, from, next) => {
if (to.path === '/model/index') {
isStadium(useUserStore().user) === true ? next('/prepare') :next()
}else {
next()
}
})

View File

@ -82,6 +82,8 @@ export class MsgEnum {
MSG_classcourseopen : 'classcourseopen', MSG_classcourseopen : 'classcourseopen',
/** @desc: 学生的测练结果反馈 */ /** @desc: 学生的测练结果反馈 */
MSG_classquizfeedback : 'classquizfeedback', MSG_classquizfeedback : 'classquizfeedback',
/** @desc: 学生提交作业 */
MSG_finishHomework : 'finishHomework',
/** @desc: 老师端:接收到学生反馈消息-课堂测练中的其他任务 */ /** @desc: 老师端:接收到学生反馈消息-课堂测练中的其他任务 */
MSG_classtaskfeedback : 'classtaskfeedback', MSG_classtaskfeedback : 'classtaskfeedback',
/** @desc: 老师端学生反馈的消息具体要看其中的feedbackkey类别较繁杂 */ /** @desc: 老师端学生反馈的消息具体要看其中的feedbackkey类别较繁杂 */

View File

@ -101,7 +101,7 @@ const dynamicRoutes = [
{ {
path: '/', path: '/',
component: Layout, component: Layout,
redirect: '/desktop', redirect: '/model/index',
meta: { title: '教学工作台' }, meta: { title: '教学工作台' },
children: [ children: [
{ {

View File

@ -395,6 +395,6 @@ export const dataSetJson = {
"课标-高中-英语": "e889fcac9fd011efb22a0242ac140006", "课标-高中-英语": "e889fcac9fd011efb22a0242ac140006",
"课标-高中-数学": "e03aa4fe9fd011ef91270242ac140006", "课标-高中-数学": "e03aa4fe9fd011ef91270242ac140006",
"课标-高中-地理": "270516829fd111efb13c0242ac140006", "课标-高中-地理": "270516829fd111efb13c0242ac140006",
"课标-高中-政治": "a7df2b01aafd11ef8bb40242ac140002", "课标-高中-政治": "a2f0b247b85d11ef84290242ac140005",
"鉴权": "ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm" "鉴权": "ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm"
} }

View File

@ -162,9 +162,10 @@ import ItemDialogScore from '@/views/classTask/container/classTask/item-dialog-s
import quizStats from '@/views/classTask/container/quizStats.vue' import quizStats from '@/views/classTask/container/quizStats.vue'
import ClassOverview from '@/views/classTask/container/classOverview.vue' import ClassOverview from '@/views/classTask/container/classOverview.vue'
import {sessionStore} from '@/utils/store' import {sessionStore} from '@/utils/store'
import Chat from '@/utils/chat' // im // import Chat from '@/utils/chat' // im
import MsgEnum from '@/plugins/imChat/msgEnum' // im
import ChatWs from '@/plugins/socket' // socket
if (!ChatWs.ws) ChatWs.init()
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const emit = defineEmits(['cle-click']) const emit = defineEmits(['cle-click'])
const props = defineProps({ const props = defineProps({
@ -713,27 +714,39 @@ const closeDialog = () => {
// im // im
const msgHandle = (msg) => { const msgHandle = (msg) => {
const { type, data } = msg if (typeof msg === 'object'){
switch(type) { const { head, content, ...other } = msg
case 'TIMAddRecvNewMsgCallback': // data=[] switch(head) {
{ case MsgEnum.HEADS.MSG_closed: // :
(data||[]).forEach(o => { window.close() //
const msgArr = o?.message_elem_array||[] break
msgArr.forEach(info => { case MsgEnum.HEADS.MSG_finishHomework: // :
const msgType = info?.elem_type // TIMElemType const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
const msgData = !!info.text_elem_content ? JSON.parse(info.text_elem_content)||'' : '' openDialog(data, false);
//
//console.log('msgData->', msgData);
if (msgData.msgKey == "finishHomework"){
//
const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
//console.log('data->', data);
openDialog(data, false);
}
})
})
}
break break
case MsgEnum.HEADS.MSG_slideFlapping: //
window.close() //
break
// case 'TIMAddRecvNewMsgCallback': // data=[]
// {
// (data||[]).forEach(o => {
// const msgArr = o?.message_elem_array||[]
// msgArr.forEach(info => {
// const msgType = info?.elem_type // TIMElemType
// const msgData = !!info.text_elem_content ? JSON.parse(info.text_elem_content)||'' : ''
// //
// //console.log('msgData->', msgData);
// if (msgData.msgKey == "finishHomework"){
// //
// const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
// //console.log('data->', data);
// openDialog(data, false);
// }
// })
// })
// }
// break
}
} }
} }
@ -750,11 +763,21 @@ onMounted(() => {
isReloadTimer(); isReloadTimer();
// im // im
if (!Chat.imChat) { if (ChatWs.ws) {
Chat.init(true, true, msgHandle); ChatWs.watch((msg, e) => {
} else { try {
Chat.listenMsg(msgHandle); msgHandle(JSON.parse(msg))
} } catch (error) {
console.error('socket 解析异常 ', error, e)
msgHandle(msg)
}
})
}
// if (!Chat.imChat) {
// Chat.init(true, true, msgHandle);
// } else {
// Chat.listenMsg(msgHandle);
// }
}) })
const isReloadTimer = () =>{ const isReloadTimer = () =>{
clearInterval(reloadTimer.value) // clearInterval(reloadTimer.value) //

View File

@ -43,7 +43,7 @@
<el-form-item label="密码" prop="password" > <el-form-item label="密码" prop="password" >
<el-input autocomplete="on" type="password" v-model="ruleForm.password" placeholder="请输入密码" /> <el-input autocomplete="on" type="password" v-model="ruleForm.password" placeholder="请输入密码" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button class="btn" type="primary" @click="RegisterForm(ruleFormRef)">立即注册</el-button> <el-button class="btn" type="primary" @click="RegisterForm(ruleFormRef)">立即注册</el-button>
</el-form-item> </el-form-item>
@ -77,8 +77,8 @@
<SelectSubject v-model="isSubject" :login-data="loginForm" /> <SelectSubject v-model="isSubject" :login-data="loginForm" />
<!--注册弹框--> <!--注册弹框-->
<Register ref="RegModel"></Register> <Register ref="RegModel"></Register>
</template> </template>
<script setup> <script setup>
import { onMounted, reactive, ref } from 'vue' import { onMounted, reactive, ref } from 'vue'
@ -118,7 +118,7 @@ const loginForm = reactive({
}) })
// //
const ruleForm = reactive({ const ruleForm = reactive({
}) })
// //
const rules = reactive({ const rules = reactive({
@ -175,7 +175,7 @@ const sendyzm=()=>{
if(ruleForm.username){ if(ruleForm.username){
const pattern = /^1[3-9]\d{9}$/; const pattern = /^1[3-9]\d{9}$/;
if( pattern.test(ruleForm.username) ){ if( pattern.test(ruleForm.username) ){
getCodeImg().then(res=>{ getCodeImg().then(res=>{
if(res.code==200){ if(res.code==200){
ruleForm.imgCode=null ruleForm.imgCode=null
@ -231,7 +231,7 @@ const submitForm = async (formEl) => {
try { try {
await userStore.login(loginForm) await userStore.login(loginForm)
await userStore.getInfo() await userStore.getInfo()
if (userStore.user.edustage || userStore.user.edusubject) { if (userStore.user.edustage || userStore.user.edusubject || isStadium(userStore.user)) {
ElMessage.success('登录成功') ElMessage.success('登录成功')
ipcRenderer && ipcRenderer.send('openMainWindow') ipcRenderer && ipcRenderer.send('openMainWindow')
} else { } else {
@ -244,6 +244,11 @@ const submitForm = async (formEl) => {
}) })
} }
const isStadium = (user) => {
let roles = user.roles
return roles.some(item => item.roleKey === 'stadium')
}
const getCookie = async () => { const getCookie = async () => {
const username = (await getCookieDetail('username'))[0] const username = (await getCookieDetail('username'))[0]
const password = (await getCookieDetail('password'))[0] const password = (await getCookieDetail('password'))[0]
@ -298,12 +303,12 @@ const RegisterForm = async (formEl) => {
} }
onMounted(() => { onMounted(() => {
localStorage.clear() localStorage.clear()
sessionStore.set('subject', { sessionStore.set('subject', {
bookList: null, bookList: null,
curBook: null, curBook: null,
curNode: null, curNode: null,
defaultExpandedKeys: [], defaultExpandedKeys: [],
subjectTree: [] subjectTree: []
}) })
getCookie() getCookie()
}) })

View File

@ -18,7 +18,20 @@
<div class="content-body-left"> <div class="content-body-left">
<div class="content-body-left-title"> <div class="content-body-left-title">
文枢课件 文枢课件
<el-button class="add-btn" size="small" type="primary" @click="createAIPPT">新建</el-button> <!-- <el-button class="add-btn" size="small" type="primary" @click="createAIPPT">新建</el-button>-->
<el-dropdown class="prepare-center-dropdown add-btn">
<el-button type="primary">
新建<el-icon class="el-icon--right"><arrow-down /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="createAIPPT">新建文枢课件</el-dropdown-item>
<el-dropdown-item @click="router.push({path: '/model/design'})">AI一键生成</el-dropdown-item>
<el-dropdown-item @click="openFilePicker">导入PPT</el-dropdown-item>
<input type="file" ref="fileInput" style="display: none;" @change="handleFileChange" accept="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation">
</el-dropdown-menu>
</template>
</el-dropdown>
</div> </div>
<div class="content-body-left-body"> <div class="content-body-left-body">
<kj-list-item <kj-list-item
@ -59,6 +72,7 @@
</div> </div>
</div> </div>
</el-row> </el-row>
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
</template> </template>
<script setup> <script setup>
@ -70,14 +84,20 @@ import ChooseTextbook from '@/components/choose-textbook/index.vue'
import KjListItem from '@/views/prepare/container/kj-list-item.vue' import KjListItem from '@/views/prepare/container/kj-list-item.vue'
import FileImage from '@/components/file-image/index.vue' import FileImage from '@/components/file-image/index.vue'
import {creatAPT, getSmarttalkPage} from '@/api/file' import {creatAPT, getSmarttalkPage} from '@/api/file'
import {Flag, Position} from '@element-plus/icons-vue' import {ArrowDown, Flag, Position} from '@element-plus/icons-vue'
import {asyncLocalFile, parseCataByNode} from "@/utils/talkFile"; import {asyncLocalFile, parseCataByNode} from "@/utils/talkFile";
import { dataSetJson } from '@/utils/comm' // id import { dataSetJson } from '@/utils/comm' // id
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import {listEntpcourse} from "@/api/teaching/classwork"; import {listEntpcourse} from "@/api/teaching/classwork";
import {addEntpcoursefileReturnId, getEntpcoursefile} from "@/api/education/entpcoursefile"; import {addEntpcoursefileReturnId, getEntpcoursefile} from "@/api/education/entpcoursefile";
import {createWindow, ipcMsgSend} from "@/utils/tool"; import {createWindow, ipcMsgSend} from "@/utils/tool";
import {ElMessage} from "element-plus"; // import {ElMessage} from "element-plus";
import {PPTXFileToJson} from "@/AixPPTist/src/hooks/useImport";
import * as API_entpcoursefile from "@/api/education/entpcoursefile";
import progressDialog from '@/views/teachingDesign/container/progress-dialog.vue'
import msgUtils from "@/plugins/modal";
import * as commUtils from "@/utils/comm";
import * as Api_server from "@/api/apiService"; //
const router = useRouter() const router = useRouter()
const userStore = useUserStore().user // const userStore = useUserStore().user //
const currentNode = ref({}) const currentNode = ref({})
@ -212,6 +232,153 @@ const createAIPPT = () => {
}) })
} }
const pgDialog = ref({ // -
visible: false,
title: 'PPT解析中...',
width: 300,
showClose: false,
draggable: true,
beforeClose: done => {}, // -
pg: { // -
percentage: 0, //
color: [
{ color: '#1989fa', percentage: 50 }, //
{ color: '#e6a23c', percentage: 80 }, //
{ color: '#5cb87a', percentage: 100 }, // 绿
]
}
})
const fileInput = ref(null)
const openFilePicker = () =>{
fileInput.value.click();
}
const handleFileChange = ()=> {
const file = event.target.files[0];
if (file) {
console.log(file);
createAIPPTByFile(file)
}
}
const createAIPPTByFile = async (file)=> {
pgDialog.value.visible = true
pgDialog.value.pg.percentage = 0
const resPptJson = await PPTXFileToJson(file)
const { def, slides, ...content } = resPptJson
// || 线
let completed = 0
const total = slides.length
for( let o of slides ) {
completed++
await toRousrceUrl(o)
//
pgDialog.value.pg.percentage = Math.floor(completed / total * 100)
}
pgDialog.value.pg.percentage = 0
pgDialog.value.visible = false
listEntpcourse({
evalid: currentNode.value.id,
edituserid: userStore.userId,
pageSize: 500
}).then((response) => {
if (response.rows.length <= 0) return
let resCourse = response.rows[0]
//
let form = {
parentid: 0,
entpid: userStore.deptId,
entpcourseid: resCourse.id,
ppttype: 'file',
title: resCourse.coursetitle,
fileurl: '',
filetype: 'aippt',
datacontent: '',
parentContent: JSON.stringify(content),
filekey: '',
filetag: '',
fileidx: 0,
dflag: 0,
status: '',
edituserid: userStore.userId
}
addEntpcoursefileReturnId(form).then((slideid) => {
creatAPT({
...uploadData.value,
fileId: slideid,
fileFlag: 'aippt',
fileShowName: currentNode.value.itemtitle + '.aippt'
}).then(async (res) => {
const resSlides = slides.map(({id, ...slide}) => JSON.stringify(slide))
let params = {
parentid: slideid,
entpid: resCourse.entpid,
entpcourseid: resCourse.id,
title: '',
filetype: 'slide',
slides: resSlides,
edituserid: userStore.userId
}
const res_3 = await API_entpcoursefile.batchAddNew(params)
if (res_3 && res_3.code == 200) {
msgUtils.msgSuccess('导入PPT课件成功')
currentFileList.value.unshift(res.resData)
await nextTick();
refs.value['kjItemRef'+res.resData.id].openFileWin(res.resData);
} else {
msgUtils.msgWarning('导入PPT课件失败')
}
})
})
})
}
const toRousrceUrl = async (o) => {
if (!!o.src) { // src
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
const isBlobUrl = /^blob:/.test(o.src)
// console.log('isBase64', o, isBase64)
if (isBase64) {
const bolb = commUtils.base64ToBlob(o.src)
const fileName = Date.now() + '.png'
const file = commUtils.blobToFile(bolb, fileName)
// o.src = fileName
// console.log('file', file)
const formData = new FormData()
formData.append('file', file)
const res = await Api_server.Other.uploadFile(formData)
if (res && res.code == 200){
const url = res?.url
url &&(o.src = url)
}
} else if (isBlobUrl) { //
const res = await fetch(o.src)
const blob = await res.blob()
const fileName = o.type=='video'? Date.now() + '.mp4':Date.now() + '.mp3'
const file = commUtils.blobToFile(blob, fileName)
// o.src = fileName
// console.log('file', file)
const formData = new FormData()
formData.append('file', file)
const ress = await Api_server.Other.uploadFile(formData)
if (ress && ress.code == 200){
const url = ress?.url
url &&(o.src = url)
}
}
}
if (o?.background?.image) await toRousrceUrl(o.background.image)
if(o?.elements){
for (let element of o.elements) {
await toRousrceUrl(element);
}
}
}
const deleteTalk = (item) => { const deleteTalk = (item) => {
let index = currentFileList.value.indexOf(item) let index = currentFileList.value.indexOf(item)
currentFileList.value.splice(index, 1) currentFileList.value.splice(index, 1)
@ -219,7 +386,6 @@ const deleteTalk = (item) => {
// //
const changeBook = async(data) => { const changeBook = async(data) => {
console.log(data)
let cata = parseCataByNode(data.node) let cata = parseCataByNode(data.node)
currentNode.value = data.node currentNode.value = data.node
uploadData.value.levelFirstId = cata[0] uploadData.value.levelFirstId = cata[0]

View File

@ -1127,7 +1127,6 @@ export default {
background-color: white; background-color: white;
position: relative; position: relative;
.prepare-center-dropdown{ .prepare-center-dropdown{
z-index: 9999;
position: absolute; position: absolute;
right: 10px; right: 10px;
top: 4px; top: 4px;