zdg #144

Merged
zhengdegang merged 24 commits from zdg into main 2024-08-16 13:42:41 +08:00
1 changed files with 141 additions and 57 deletions
Showing only changes of commit 758a4b09c9 - Show all commits

View File

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