This commit is contained in:
zdg 2024-08-14 17:47:42 +08:00
parent 716c16928e
commit 758a4b09c9
1 changed files with 141 additions and 57 deletions

View File

@ -3,8 +3,14 @@
<ChooseTextbook @change-book="nodeClick" @node-click="nodeClick" /> <ChooseTextbook @change-book="nodeClick" @node-click="nodeClick" />
<div class="page-right"> <div class="page-right">
<div class="header-top flex"> <div class="header-top flex">
<div class="textbook-img" @click="navtoPdf"> <div class="textbook-img">
<el-image style="width: 80px; height: 110px" :src="curBookImg" /> <el-image style="width: 80px; height: 110px" :src="curBookImg" @click="navtoPdf" />
<el-progress
v-if="downloadNum > 0 && downloadNum < 100"
style="position: absolute; left: 0; z-index: 999"
type="circle"
:percentage="downloadNum"
/>
</div> </div>
<div class="top-item"> <div class="top-item">
<el-button class="btn" @click="handleOutLink('standard')">课标研读</el-button> <el-button class="btn" @click="handleOutLink('standard')">课标研读</el-button>
@ -12,9 +18,16 @@
<el-button class="btn" @click="handleOutLink('gk')">高考研读</el-button> <el-button class="btn" @click="handleOutLink('gk')">高考研读</el-button>
<el-button class="btn" @click="handleOutLink('aiModel')">教学大模型</el-button> <el-button class="btn" @click="handleOutLink('aiModel')">教学大模型</el-button>
</div> </div>
<el-button type="primary" class="to-class-btn" @click="openLesson"> <el-button
<i class="iconfont icon-lingdang"></i>上课</el-button :type="!curClassReserv.id ? 'info' : 'primary'"
:disabled="!curClassReserv.id"
class="to-class-btn"
@click="openLesson"
> >
<label><i class="iconfont icon-lingdang"></i>上课</label>
<label>{{ curClassReserv.classDay }} {{ getWeekday1(curClassReserv.classDay) }}</label>
<label>{{ curClassReserv.startTime }}-{{ curClassReserv.endTime }}</label>
</el-button>
<div class="top-zoom-style"></div> <div class="top-zoom-style"></div>
</div> </div>
<div class="prepare-body-header"> <div class="prepare-body-header">
@ -23,7 +36,13 @@
<el-popover placement="top-start" :width="250" trigger="hover"> <el-popover placement="top-start" :width="250" trigger="hover">
<template #default> <template #default>
<div> <div>
<el-button v-if="lastAsyncAllTime" type="success" size="small" :icon="Check" circle /> <el-button
v-if="lastAsyncAllTime"
type="success"
size="small"
:icon="Check"
circle
/>
{{ lastAsyncAllTime ? toTimeText(lastAsyncAllTime) + '同步成功' : '' }} {{ lastAsyncAllTime ? toTimeText(lastAsyncAllTime) + '同步成功' : '' }}
</div> </div>
</template> </template>
@ -41,7 +60,9 @@
<el-button @click="handleOutLink('feedback')">作业反馈</el-button> <el-button @click="handleOutLink('feedback')">作业反馈</el-button>
<el-button @click="handleOutLink('homeWork')">布置作业</el-button> <el-button @click="handleOutLink('homeWork')">布置作业</el-button>
<el-button @click="isDialogOpen = true">上传资料</el-button> <el-button @click="isDialogOpen = true">上传资料</el-button>
<el-button type="primary" style="margin-left: 10px" @click="createFile">新建课件</el-button> <el-button type="primary" style="margin-left: 10px" @click="createFile"
>新建课件</el-button
>
</div> </div>
</div> </div>
<el-checkbox-group <el-checkbox-group
@ -76,16 +97,32 @@
<el-checkbox v-if="!item.uniquekey" label="" :value="item" /> <el-checkbox v-if="!item.uniquekey" label="" :value="item" />
</file-list-item> </file-list-item>
</el-checkbox-group> </el-checkbox-group>
<file-oper-batch v-show="checkFileList.length > 0" <file-oper-batch
v-show="checkFileList.length > 0"
:indeterminate="checkFileList.length > 0 && checkFileList.length < currentFileList.length" :indeterminate="checkFileList.length > 0 && checkFileList.length < currentFileList.length"
:choose="checkFileList" :check-all="isCheckAll" @click-delete="clickDelete" @click-move="clickMove" :choose="checkFileList"
@cancel="checkFileList = []" @click-choose="clickChoose"></file-oper-batch> :check-all="isCheckAll"
@click-delete="clickDelete"
@click-move="clickMove"
@cancel="checkFileList = []"
@click-choose="clickChoose"
></file-oper-batch>
</div> </div>
<MoveFile v-model="isMoveDialogOpen" @on-submit="chooseMoveCata" /> <MoveFile v-model="isMoveDialogOpen" @on-submit="chooseMoveCata" />
<uploadDialog v-model="isDialogOpen" @submit-file="submitFile" /> <uploadDialog v-model="isDialogOpen" @submit-file="submitFile" />
<SetHomework v-model="setDialog" :entpcourseid="entpcourseid" :row="row" @on-close="closeHomework" /> <SetHomework
v-model="setDialog"
:entpcourseid="entpcourseid"
:row="row"
@on-close="closeHomework"
/>
</div> </div>
<reserv ref="reservDialog"></reserv> <reserv
ref="reservDialog"
:current-node="currentNode"
:book-id="uploadData.textbookId"
@add-success="initReserv"
></reserv>
</template> </template>
<script setup> <script setup>
import { Check } from '@element-plus/icons-vue' import { Check } from '@element-plus/icons-vue'
@ -112,7 +149,9 @@ import outLink from '@/utils/linkConfig'
import { createWindow } from '@/utils/tool' import { createWindow } from '@/utils/tool'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
import { delClasswork, addEntpcourse } from '@/api/teaching/classwork' import { delClasswork, addEntpcourse } from '@/api/teaching/classwork'
const fs = require('fs'); import { getSelfReserv, startClass } from '@/api/classManage'
const toolStore = useToolState()
const fs = require('fs')
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
export default { export default {
@ -138,7 +177,10 @@ export default {
fileList: [], fileList: [],
currentNode: {}, currentNode: {},
currentFileList: [], currentFileList: [],
currentWorkList: [],
curBookPath: '', curBookPath: '',
curClassReserv: {},
downloadNum: 0,
lastAsyncAllTime: '', lastAsyncAllTime: '',
uploadData: { uploadData: {
textbookId: null, textbookId: null,
@ -155,7 +197,7 @@ export default {
// //
setDialog: false, setDialog: false,
row: '', row: '',
isOpenHomework: false, isOpenHomework: false
} }
}, },
computed: { computed: {
@ -174,8 +216,15 @@ export default {
this.callback(param) this.callback(param)
}) })
this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime') this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime')
this.initReserv()
}, },
mounted() { mounted() {
this.$watch(
() => toolStore.isToolWin,
(newD, oldD) => {
setTimeout(this.initReserv, 500)
}
)
// electron // electron
const curWin = Remote.getCurrentWindow() const curWin = Remote.getCurrentWindow()
curWin.on('focus', ()=>{ curWin.on('focus', ()=>{
@ -195,11 +244,23 @@ export default {
// } // }
// }, // },
methods: { methods: {
initReserv() {
getSelfReserv().then((res) => {
let list = res.data.filter((item) => {
return item.status !== '已结束'
})
if (list.length > 0) {
this.curClassReserv = list[list.length - 1]
} else {
this.curClassReserv = {}
}
})
},
getBookPathFromServer() { getBookPathFromServer() {
let fileName = this.curBookPath let fileName = this.curBookPath
if (!fileName) return if (!fileName) return
fileName = fileName.replace('.txt', '.pdf') fileName = fileName.replace('.txt', '.pdf')
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject) => {
const userDataPath = Remote.app.getPath('userData') const userDataPath = Remote.app.getPath('userData')
const appRootFilePath = userDataPath + '\\selfFile\\' const appRootFilePath = userDataPath + '\\selfFile\\'
let filePath = appRootFilePath + fileName let filePath = appRootFilePath + fileName
@ -211,22 +272,27 @@ export default {
url: filePath, url: filePath,
fileName: fileName fileName: fileName
}) })
ipcRenderer.removeListener('download-file-default-prog' + fileName, this.progDownFile)
ipcRenderer.on('download-file-default-prog' + fileName, this.progDownFile)
ipcRenderer.once('download-file-default' + fileName, (e, isSuccess) => { ipcRenderer.once('download-file-default' + fileName, (e, isSuccess) => {
if (isSuccess === true) { if (isSuccess === true) {
resolve(appRootFilePath + fileName) resolve(fileName)
}else { } else {
ElMessage({ ElMessage({
type: 'info', type: 'info',
message: `下载教材失败!` message: `下载教材失败!`
}) })
} }
}) })
}else { } else {
resolve(appRootFilePath + fileName) resolve(fileName)
} }
}) })
}) })
}, },
progDownFile(e, num) {
this.downloadNum = num
},
createFile() { createFile() {
creatPPT(this.currentNode.label + '.pptx', this.uploadData).then((res) => { creatPPT(this.currentNode.label + '.pptx', this.uploadData).then((res) => {
this.currentFileList.unshift(res.resData) this.currentFileList.unshift(res.resData)
@ -357,9 +423,11 @@ export default {
this.uploadData.levelSecondId = cata[1] this.uploadData.levelSecondId = cata[1]
this.uploadData.levelThirdId = cata[2] this.uploadData.levelThirdId = cata[2]
this.uploadData.textbookId = data.textBook.curBookId this.uploadData.textbookId = data.textBook.curBookId
const toolStore = useToolState()
toolStore.curSubjectNode.data = data
toolStore.curSubjectNode.querySearch = this.uploadData
this.initHomeWork() this.initHomeWork()
await this.asyncAllFile() await this.asyncAllFile()
}, },
async initHomeWork() { async initHomeWork() {
@ -368,11 +436,10 @@ export default {
let { rows } = await this.getChapterId() let { rows } = await this.getChapterId()
if (rows.length > 0) { if (rows.length > 0) {
this.entpcourseid = rows[0].id this.entpcourseid = rows[0].id
} } else {
else{ await this.createEntpcourse()
await this.createEntpcourse() let { rows } = await this.getChapterId()
let { rows } = await this.getChapterId() this.entpcourseid = rows[0].id
this.entpcourseid = rows[0].id
} }
// //
@ -382,27 +449,27 @@ export default {
// entpcourse // entpcourse
createEntpcourse() { createEntpcourse() {
// web AIx // web AIx
var cform = {}; var cform = {}
cform.entpid = this.userStore.deptId; cform.entpid = this.userStore.deptId
cform.level = 1; cform.level = 1
cform.parentid = 0; cform.parentid = 0
cform.dictid = 0; cform.dictid = 0
cform.evalid = this.currentNode.id; cform.evalid = this.currentNode.id
cform.evalparentid = 0; cform.evalparentid = 0
cform.edusubject = this.currentNode.edusubject; cform.edusubject = this.currentNode.edusubject
cform.edudegree = this.currentNode.edudegree; cform.edudegree = this.currentNode.edudegree
cform.edustage = this.currentNode.edustage; cform.edustage = this.currentNode.edustage
cform.coursetype = '课标学科'; cform.coursetype = '课标学科'
cform.coursetitle = this.currentNode.itemtitle; cform.coursetitle = this.currentNode.itemtitle
cform.coursedesc = ''; cform.coursedesc = ''
cform.status = ''; cform.status = ''
cform.dflag = 0; cform.dflag = 0
cform.edituserid = this.userStore.userId; cform.edituserid = this.userStore.userId
cform.createblankfile = 'yes'; cform.createblankfile = 'yes'
return addEntpcourse(cform) return addEntpcourse(cform)
}, },
openReserv(){ openReserv() {
// this.$refs['reservDialog'].openDialog() this.$refs['reservDialog'].openDialog()
}, },
// //
handleOutLink(key) { handleOutLink(key) {
@ -502,6 +569,11 @@ export default {
this.currentWorkList = cloneDeep(list) this.currentWorkList = cloneDeep(list)
}) })
}, },
getWeekday1(date) {
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
const weekday = new Date(date).getDay()
return weekdays[weekday]
},
// //
openSet(row) { openSet(row) {
this.row = row this.row = row
@ -510,14 +582,16 @@ export default {
// //
delhomework(item) { delhomework(item) {
this.isLoading = true this.isLoading = true
delClasswork(item.id).then(async res => { delClasswork(item.id)
ElMessage.success('操作成功') .then(async (res) => {
this.isLoading = false ElMessage.success('操作成功')
await this.asyncAllFile() this.isLoading = false
this.getHomeWorkList() await this.asyncAllFile()
}).catch(() => { this.getHomeWorkList()
this.isLoading = false })
}) .catch(() => {
this.isLoading = false
})
}, },
closeHomework() { closeHomework() {
this.setDialog = false this.setDialog = false
@ -525,12 +599,11 @@ export default {
// PDF- // PDF-
async navtoPdf() { async navtoPdf() {
// if (toolStore.isPdfWin) return this.$message.error('') if (toolStore.isPdfWin) return this.$message.error('您当前已打开课本,请勿重复操作')
let path = await this.getBookPathFromServer() let path = await this.getBookPathFromServer()
// path=path.replace(/^.*[\\\/]/, ''); createWindow('open-PDF', {
// console.log(path) url: '/classBegins/index?textbookId=' + this.uploadData.textbookId + '&path=' + path
// console.log(this.uploadData.textbookId) })
createWindow('open-PDF', { url: '/classBegins/index?textbookId='+this.uploadData.textbookId+'&path='+ path })
}, },
// - // -
async openLesson() { async openLesson() {
@ -618,9 +691,14 @@ export default {
overflow: hidden; overflow: hidden;
margin-right: 20px; margin-right: 20px;
z-index: 1; z-index: 1;
position: relative;
&:hover { &:hover {
cursor: pointer; cursor: pointer;
} }
:deep(.el-progress-circle) {
width: 90px !important;
background-color: white;
}
} }
.top-item { .top-item {
@ -657,7 +735,13 @@ export default {
margin-left: 25px; margin-left: 25px;
font-size: 18px; font-size: 18px;
z-index: 1; z-index: 1;
& label:hover {
cursor: pointer !important;
}
& > :deep(span) {
flex-direction: column !important;
font-size: 12px;
}
.icon-lingdang { .icon-lingdang {
margin-right: 5px; margin-right: 5px;
color: #ffffff; color: #ffffff;