Compare commits

..

No commits in common. "89cba04b8cd63e5a81f0b9f7ee73b4e4222127c2" and "ff0dd3600cf665ff4e8c372af55804dd38d0a6ce" have entirely different histories.

16 changed files with 104 additions and 195 deletions

View File

@ -17,7 +17,6 @@ VITE_APP_RES_FILE_PATH = 'https://file.ysaix.com:7868/src/assets/textbook/booktx
VITE_APP_BUILD_BASE_PATH = 'https://file.ysaix.com:7868/'
# websocket 地址
# VITE_APP_WS_URL = 'wss://prev.ysaix.com:7868'
VITE_APP_WS_URL = 'wss://file.ysaix.com:7868'
# VITE_APP_WS_URL = 'ws://192.168.2.16:7865'

View File

@ -14,8 +14,7 @@ export default () => {
const courseId = classcourse?.id // 课堂id
const timgroupid = classcourse?.timgroupid // 群组id
const classcourseStore = useClasscourseStore() // 课堂信息-状态管理
// 上课状态才-初始化socket
if (!ChatWs.ws && !!courseId) ChatWs.init()
if (!ChatWs.ws) ChatWs.init()
// 开课消息
const startCourse = async() => {
// await API_classcourse.updateClasscourse({ id: classcourse.id, status: 'open' })

View File

@ -1,6 +1,5 @@
import { useScreenStore, useSlidesStore, useClasscourseStore } from '../store'
import { enterFullscreen, exitFullscreen, isFullscreen } from '../utils/fullscreen'
import { sessionStore } from '@/utils/store' // electron-store 状态管理
import ChatWs from '@/plugins/socket' // 聊天socket
export default () => {
@ -26,9 +25,6 @@ export default () => {
if (!!classcourse) { //DOTO 有课堂,执行退相关操作
console.log('退出放映状态')
ChatWs?.close() // 关闭ws
sessionStore.delete('curr.classcourse') // 清除课堂信息
sessionStore.delete('curr.resource') // 清除课件信息
sessionStore.delete('curr.isPublic') // 清除公屏状态
setTimeout(() => {
window.close() // 关闭窗口
}, 1000)

View File

@ -21,7 +21,6 @@ import { sessionStore } from '@/utils/store'
import { getSmarttalkPage } from '@/api/file'
import * as commUtils from '@/utils/comm.js'
import { getFileSuffix } from '@/utils/ruoyi.js'
import { PPTApi } from '../../../api'
const emit = defineEmits(['insertMaterial', 'close'])
@ -61,31 +60,73 @@ const fileUrl = computed(() => (item) =>{
}
})
//
const onInsert = async (item) =>{
loading.value = true
const res = await fetch(item.fileFullPath)
const bolb = await res.blob()
const file = commUtils.blobToFile(bolb, item.fileShowName)
try {
const data = await PPTApi.toRousrceUrl(file)
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
emit('insertMaterial',{ type: 'video', data })
emit('insertMaterial',{ type: 'video', file })
}
else{
emit('insertMaterial',{ type: 'img', data })
}
} finally {
loading.value = false
emit('insertMaterial',{ type: 'img', file })
}
}
const GetUrlParameters = (parameters) => {
let resData = "";
let url = document.location.toString();
let arrUrl = url.split("?");
//
if (arrUrl.length > 1) {
//
let parametersArr = arrUrl[1].split("&");
//
for (let i = 0; i <= parametersArr.length; i++) {
if (parametersArr[i]) {
//
let parameterStr = parametersArr[i].split("=");
if (parameters == parameterStr[0]) {
resData = parameterStr[1];
break;
}
}
}
}
return resData;
}
const proxyToBase64 = (url)=> {
const dourl = GetUrlParameters(url)
console.log(dourl,'dourl')
return
axios({
url: "/api/logo.png",
method: "get",
responseType: "blob",
}).then((res) => {
const reader = new FileReader();
reader.readAsDataURL(res.data);
reader.onload = () => {
console.log(reader.result);
};
});
}
//
const onClose = () =>{
emit('close')
}
onMounted(() => {
let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data);

View File

@ -281,10 +281,11 @@ const toggleNotesPanel = () => {
//
interface MaterialParams {
type: string,
data: string
file: any
}
const insertMaterial = async (item: MaterialParams) =>{
const { type, data } = item
const insertMaterial = (item: MaterialParams) =>{
const { type, file } = item
PPTApi.toRousrceUrl(file).then(data=>{
if(type == 'video'){
createVideoElement(data)
}
@ -292,6 +293,8 @@ const insertMaterial = async (item: MaterialParams) =>{
createImageElement(data)
}
materiaVisible.value = false
})
}
//

View File

@ -3,7 +3,7 @@
<div class="left">
<Popover trigger="click" placement="bottom-start" v-model:value="mainMenuVisible">
<template #content>
<!-- <FileInput accept=".pptist" @change="files => {
<FileInput accept=".pptist" @change="files => {
importSpecificFile(files)
mainMenuVisible = false
}">
@ -15,7 +15,7 @@
}">
<PopoverMenuItem>导入 pptx 文件</PopoverMenuItem>
</FileInput>
<PopoverMenuItem @click="setDialogForExport('pptx')">导出文件</PopoverMenuItem> -->
<PopoverMenuItem @click="setDialogForExport('pptx')">导出文件</PopoverMenuItem>
<PopoverMenuItem @click="resetSlides(); mainMenuVisible = false">重置幻灯片</PopoverMenuItem>
<!-- <PopoverMenuItem @click="goLink('https://github.com/pipipi-pikachu/PPTist/issues')">意见反馈</PopoverMenuItem> -->
<!-- <PopoverMenuItem @click="goLink('https://github.com/pipipi-pikachu/PPTist/blob/master/doc/Q&A.md')">常见问题</PopoverMenuItem> -->
@ -54,9 +54,9 @@
<div class="arrow-btn"><IconDown class="arrow" /></div>
</Popover>
</div>
<!-- <div class="menu-item" v-tooltip="'导出'" @click="setDialogForExport('pptx')">
<div class="menu-item" v-tooltip="'导出'" @click="setDialogForExport('pptx')">
<IconDownload class="icon" />
</div> -->
</div>
<div class="menu-item" v-tooltip="`${userStore.user.parentDeptName}-${userStore.user.nickName}`">
<el-avatar size="small" :src="avatar" />
</div>

View File

@ -88,15 +88,6 @@ export function updateClassworkdata(data) {
})
}
// 批阅后, 待所有学生都批改完成后自动结束当前作业为[已完成]
export function updateClassWorkDataAutoFinish(data) {
return request({
url: '/education/classworkdata/updAutoFinish',
method: 'put',
data: data
})
}
// 修改classwork
export function updateClasswork(data) {
return request({

View File

@ -415,7 +415,7 @@ const onEditSave = async (item) => {
}
//
const onSaveTemp = async (item) => {
const onSaveTemp = (item) => {
if (item.answer == '') return
const data = {
@ -425,10 +425,7 @@ const onSaveTemp = async (item) => {
content: item.answer,
ex1: curNode.id
}
const res = await tempSave(data)
if(!item.resultId){
item.resultId = res.data
}
tempSave(data).then(res => { })
}
// ### **

View File

@ -1,87 +0,0 @@
/**
* ppt 转换为图片
*/
import { h, render, getCurrentInstance } from 'vue'
import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库
import { PPTXFileToJson } from "@/AixPPTist/src/hooks/useImport"
import ThumbnailSlide from '@/AixPPTist/src/views/components/ThumbnailSlide/index.vue'
import { useSlidesStore } from '@/AixPPTist/src/store'
// 延时
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
/**
* @description: 渲染组件
* @param {*} node 节点或属性
* @param {*} props 属性
* @param {*} children 子元素
* @param {*} container 容器
*/
const renderComponent = (node, props = {}, children, container) => {
let vNode, body
if (!node) throw new Error('vNode is required')
if (typeof container == 'string') {
if (node == 'slide') {
vNode = h(ThumbnailSlide, props, children)
} else throw new Error('vNode has no corresponding component')
} else {
vNode = h(node, props, children)
}
if (!container) body = document.body // 默认为body
else { // 判断是否为字符串
if (typeof container == 'string') {
body = document.querySelector(container)
} else {
body = container
}
}
return render(vNode, body)
}
/**
* @description: 幻灯片转换为图片
* 提示icon组件找不到是应为 h() 渲染是底层创建的虚拟节点找不到全局组件
* @param {*} slides 幻灯片数据
* @param {*} options 配置 number 为幻灯片宽度 | object 为配置项
* @returns
*/
export const slidesToImg = (slides = [], options) => {
let width, option, ispng = true
if (typeof options =='number'){width = options; option = {}}
else {const { width: w, isPng, ...opt } = options;width = w; ispng=isPng; option = opt}
const slidesStore = useSlidesStore()
!!width && slidesStore.setViewportSize(width) // 设置幻灯片宽度
return new Promise(async(resolve) => {
const instance = getCurrentInstance()
console.log('instance', instance)
const slidesDom = []
for(const slide of slides) {
const props = { class: 'c-thumbnail', slide, size: 120, ...option }
const node = h(ThumbnailSlide, props)
slidesDom.push(node)
}
// 渲染组件到body
const props = { class: 'c-thumbnails', style:{position:'absolute',top:0,left:'-200vw'}}
renderComponent('div', props, slidesDom)
let imgs = []
const toImag = ispng? toPng : toJpeg
for(const slide of slidesDom) {
const img = await toImag(slide.el)
imgs.push(img)
}
// console.log('ppt生成图片: ', imgs)
// console.log('图片已生成,正在卸载组件')
!!width && slidesStore.setViewportSize(1000) // 设置幻灯片宽度-恢复
render(null, document.body) // 卸载组件
resolve(imgs)
})
}
/**
* description: ppt 文件转换为图片
* @param {*} file file 为文件对象| arrayBuffer 为数组
* @param {*} options 配置 number 为幻灯片宽度 | object 为配置项
* @returns
*/
export const pptToImg = async(file, options) => {
const { slides } = await PPTXFileToJson(file)
return slidesToImg(slides, options)
}

View File

@ -435,7 +435,7 @@ import useUserStore from '@/store/modules/user'
import { ref, reactive } from 'vue'
// import { Plus } from '@element-plus/icons-vue'
import { ElMessageBox, ElMessage } from 'element-plus'
import { getClassworkdata, updateClassworkevalList, updateClassWorkDataAutoFinish } from '@/api/classTask'
import { updateClassworkeval, updateClassworkdata, getClassworkdata, updateClassworkevalList } from '@/api/classTask'
import { getTimeDate } from '@/utils/date'
import ReFilePreview from '@/components/refile-preview/index.vue'
import { quizStrToList } from '@/utils/comm';
@ -890,7 +890,7 @@ const onSubmit = () => {
updatedate: getTimeDate(),// = year+'-'+month+'-'+day+' '+hh+':'+mm;
};
//
updateClassWorkDataAutoFinish(formd).then(res => {
updateClassworkdata(formd).then(res => {
})
//

View File

@ -83,8 +83,6 @@ import useUserStore from '@/store/modules/user' // 用户信息
import ChooseTextbook from '@/components/choose-textbook/index.vue'
import KjListItem from '@/views/prepare/container/kj-list-item.vue'
import FileImage from '@/components/file-image/index.vue'
import progressDialog from '@/views/teachingDesign/container/progress-dialog.vue'
import ThumbnailSlide from '@/AixPPTist/src/views/components/ThumbnailSlide/index.vue'
import {creatAPT, getSmarttalkPage, getModelInfo} from '@/api/file'
import {ArrowDown, Flag, Position} from '@element-plus/icons-vue'
import {asyncLocalFile, parseCataByNode} from "@/utils/talkFile";
@ -96,11 +94,11 @@ import {createWindow, toLinkLeftWeb} from "@/utils/tool";
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"; //
import useClassTaskStore from '@/store/modules/classTask'
import { slidesToImg } from '@/utils/ppt' // ppt
const router = useRouter()
const userStore = useUserStore().user //
@ -280,14 +278,12 @@ const handleFileChange = ()=> {
createAIPPTByFile(file)
}
}
// pptPPT线
const createAIPPTByFile = async (file)=> {
// pgDialog.value.visible = true
// pgDialog.value.pg.percentage = 0
pgDialog.value.visible = true
pgDialog.value.pg.percentage = 0
const resPptJson = await PPTXFileToJson(file)
const { def, slides, ...content } = resPptJson
//
const thumbnails = await slidesToImg(slides, content.width)
// || 线
let completed = 0
const total = slides.length
@ -339,7 +335,6 @@ const createAIPPTByFile = async (file)=> {
entpcourseid: resCourse.id,
title: '',
filetype: 'slide',
thumbnails, // -
slides: resSlides,
edituserid: userStore.userId
}

View File

@ -10,8 +10,8 @@
<div class="paragraphs">
{{ outputText }}
</div>
<el-button style="margin-bottom: 5px;" type="primary" @click="addMessage">{{ outputText ? '重新生成' : '生成大纲' }}</el-button>
<el-button style="margin-bottom: 5px;" type="primary" @click="activeStep = 1" :disabled="!outputText">下一步</el-button>
<el-button style="margin-bottom: 5px;" type="primary" @click="addMessage">从新生成</el-button>
<el-button style="margin-bottom: 5px;" type="primary" @click="activeStep = 1">下一步</el-button>
</el-card>
<el-card v-if="activeStep === 1">
<div style="padding-bottom: 10px">ppt模板选择</div>
@ -57,7 +57,7 @@
</el-row>
<div>
<el-button style="margin-bottom: 5px;" type="primary" @click="activeStep = 0">上一步</el-button>
<el-button style="margin-bottom: 5px;" type="primary" :loading="createPPTLoading" @click="outlineCreatePPT()">生成PPT</el-button>
<el-button style="margin-bottom: 5px;" type="primary" v-loading="createPPTLoading" @click="outlineCreatePPT()">生成PPT</el-button>
</div>
</el-card>
<el-card v-if="activeStep === 2">
@ -177,8 +177,6 @@ const outlineCreatePPT = () => {
};
checkProgress();
}).finally(()=>{
createPPTLoading.value = false
})
};

View File

@ -25,7 +25,7 @@
<c-form v-bind="classForm">
<template #item_classid="{prop, form}">
<span v-if="dt.ctCourse">{{ dt.ctCourse?.caption }}</span>
<el-select v-else v-model="form[prop]" placeholder="请选择班级" clearable>
<el-select v-else v-model="form[prop]" placeholder="请选择班级">
<el-option v-for="item in listData.classList" :value="item.id"
:label="`${item.caption} (${item.classstudentcount}人)`" />
</el-select>
@ -249,10 +249,10 @@ const getClasscourseList = async type => {
// isPublic
const createClasscourse = async (isPublic = false) => {
const { classid } = classForm.form
// if (!classid) {
// ElMessage.warning('')
// return
// }
if (!classid) {
ElMessage.warning('请选择班级')
return
}
dt.loading = true
const { entpcourseid, evalid, id, coursetitle } = myClassActive.value //
const curDate = commUtil.getDateNow('yyyy-MM-dd')
@ -372,9 +372,9 @@ const openPublicScreen = (classcourse, isPublic) => {
createWindow('open-win', {
url: '/pptist', //
close: () => {
sessionStore.delete('curr.resource') //
sessionStore.delete('curr.classcourse') //
sessionStore.delete('curr.isPublic') //
sessionStore.set('curr.resource', null) //
sessionStore.set('curr.classcourse', null) //
sessionStore.set('curr.isPublic', null) //
}
})
visible.value = false //

View File

@ -205,12 +205,13 @@ import TreeLog from '@/views/prepare/components/treeLog.vue'
import classStart from './container/class-start.vue' //
import MsgEnum from '@/plugins/imChat/msgEnum' // im
import * as commUtils from "@/utils/comm";
import msgUtils from "@/plugins/modal";
import * as Api_server from "@/api/apiService";
import msgUtils from "@/plugins/modal";
import * as API_entpcoursefile from "@/api/education/entpcoursefile";
import { slidesToImg } from '@/utils/ppt' // ppt
import ChatWs from '@/plugins/socket' // socket
if (!ChatWs.ws) ChatWs.init()
// import Chat from '@/utils/chat' // im
// if (!Chat.imChat) Chat.init()
const toolStore = useToolState()
const fs = require('fs')
@ -497,11 +498,11 @@ export default {
createWindow('open-win', {
url: '/pptist', //
close: () => {
sessionStore.delete('curr.resource') //
sessionStore.set('curr.resource', null) //
if (type=='edit') {
sessionStore.delete('curr.smarttalk') //
sessionStore.set('curr.smarttalk', null) //
this.asyncAllFile() //
} else sessionStore.delete('curr.classcourse') //
} else sessionStore.set('curr.classcourse', null) //
}
})
},
@ -572,9 +573,8 @@ export default {
},500)
})
},
async openFilePicker(){
openFilePicker(){
this.$refs.fileInput.click();
// const files = await commUtils.getFiles()
},
handleFileChange(){
const file = event.target.files[0];
@ -634,8 +634,6 @@ export default {
this.pgDialog.pg.percentage = 0
const resPptJson = await PPTXFileToJson(file)
const { def, slides, ...content } = resPptJson
//
const thumbnails = await slidesToImg(slides, content.width)
// || 线
let completed = 0
const total = slides.length
@ -688,7 +686,6 @@ export default {
title: '',
filetype: 'slide',
slides: resSlides,
thumbnails, //
edituserid: this.userStore.userId
}
const res_3 = await API_entpcoursefile.batchAddNew(params)

View File

@ -93,9 +93,6 @@ emitter.on('onGetMain', (item) => {
const emit = defineEmits([''])
const onSelect = (item) =>{
actId.value = item.id
item.child.forEach(el =>{
el.aiShow = false
})
emitter.emit('changeMode', item)
}

View File

@ -14,7 +14,8 @@
<el-option v-for="item in modeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-button type="primary" :disabled="!(resultList.length)" @click="getCompletion">一键研读</el-button>
<el-button type="danger" @click="onCreate">生成PPT</el-button>
<el-button type="primary">生成大纲</el-button>
<el-button type="danger" @click="pptDialog = true">生成PPT</el-button>
</div>
</div>
<div class="right-con flex" ref="listRef">
@ -94,7 +95,6 @@ import * as API_smarttalk from '@/api/file' // 文件相关api
import msgUtils from '@/plugins/modal'
import { getEntpcoursefile } from '@/api/education/entpcoursefile'
import { createWindow } from '@/utils/tool' //
import { slidesToImg } from '@/utils/ppt' // ppt
const userStore = useUserStore()
const pptDialog = ref(false)
@ -136,16 +136,6 @@ emitter.on('changeMode', (item) => {
getTempResult(item.id)
})
const onCreate = () =>{
let isAnswer = resultList.value.every(item => !item.answer)
if(isAnswer){
ElMessage.warning('请先进行研读')
return
}
pptDialog.value = true
}
//
const getCompletion = async () => {
@ -206,7 +196,7 @@ const handleCompleteText = async (answer, index) => {
}
//
const onSaveTemp = async (item) => {
const onSaveTemp = (item) => {
if (item.answer == '') return
const data = {
@ -216,11 +206,7 @@ const onSaveTemp = async (item) => {
content: item.answer,
ex1: curNode.id
}
const res = await tempSave(data)
if(!item.resultId){
item.resultId = res.data
}
tempSave(data).then(res => { })
}
const isWordDialog = ref(false)
@ -272,7 +258,7 @@ const listRef = ref()
//
const isStarted = ref([]);
const getTempResult = (id) => {
tempResult({ mainModelId: id, pageNum: 1, pageSize: 10000, ex1: curNode.id }).then(res => {
tempResult({ mainModelId: id }).then(res => {
let rows = res.rows
if (rows.length > 0) {
isStarted.value = new Array(rows.length).fill(true)
@ -328,7 +314,6 @@ const prompt = ref('')
const addAiPPT = async (res) => {
// res = { url: 'https://bjcdn.openstorage.cn/xinghuo-privatedata/%2Ftmp/apiTempFileba724e0344f74e1480535eedf3ebec661601807661085006275/%E9%87%91%E9%A9%AC%E5%A5%96%E5%B0%B4%E5%B0%AC%E4%BA%8B%E4%BB%B6%E5%88%86%E6%9E%90%E4%B8%8E%E5%BA%94%E5%AF%B9%E7%AD%96%E7%95%A5.pptx' }
let node = courseObj.node
pptDialog.value = false;
if (!node) return msgUtils.msgWarning('请选择章节?')
@ -347,8 +332,6 @@ const addAiPPT = async (res) => {
.then(async buffer => {
const resPptJson = await PPTXFileToJson(buffer)
const { def, slides, ...content } = resPptJson
//
const thumbnails = await slidesToImg(slides, content.width)
// || 线
let completed = 0
const total = slides.length
@ -368,7 +351,7 @@ const addAiPPT = async (res) => {
const smarttalk = await HTTP_SERVER_API('addSmarttalk', { fileId: parentid })
if (slides.length > 0) {
const resSlides = slides.map(({ id, ...slide }) => JSON.stringify(slide))
const params = { parentid, filetype: 'slide', title: '', thumbnails, slides: resSlides }
const params = { parentid, filetype: 'slide', title: '', slides: resSlides }
const res_3 = await HTTP_SERVER_API('batchAddNew', params)
if (res_3 && res_3.code == 200) {
msgUtils.msgSuccess('生成PPT课件成功')