上课作业

This commit is contained in:
lyc 2024-08-09 09:43:14 +08:00
parent 0e34b6a1e9
commit 258a99bc36
3 changed files with 65 additions and 100 deletions

View File

@ -1,6 +1,5 @@
<template> <template>
<el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false" append-to-body <el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false" append-to-body style="border-radius: 10px; padding: 10px 15px;">
:z-index="999999" style="border-radius: 10px; padding: 10px 15px;">
<template #header> <template #header>
<div class="homerwork-header flex"> <div class="homerwork-header flex">
<span>{{ title }}</span> <span>{{ title }}</span>

View File

@ -23,13 +23,7 @@
<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 <el-button v-if="lastAsyncAllTime" type="success" size="small" :icon="Check" circle />
v-if="lastAsyncAllTime"
type="success"
size="small"
:icon="Check"
circle
/>
{{ lastAsyncAllTime ? toTimeText(lastAsyncAllTime) + '同步成功' : '' }} {{ lastAsyncAllTime ? toTimeText(lastAsyncAllTime) + '同步成功' : '' }}
</div> </div>
</template> </template>
@ -47,60 +41,24 @@
<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 type="primary" style="margin-left: 10px" @click="createFile">新建课件</el-button>
>新建课件</el-button
>
</div> </div>
</div> </div>
<el-checkbox-group <el-checkbox-group v-model="checkFileList" class="prepare-body-main"
v-model="checkFileList" :style="{ 'margin-bottom': checkFileList.length > 0 ? '40px' : '0' }">
class="prepare-body-main" <file-list-item v-for="(item, index) in currentFileList" :key="index" :item="item" :index="index"
:style="{ 'margin-bottom': checkFileList.length > 0 ? '40px' : '0' }" @on-move="onMoveSingleFile" @on-delete="deleteTalk" @on-set="openSet" @on-delhomework="delhomework">
> <el-checkbox label="" :value="item" v-if="!item.uniquekey" />
<file-list-item
v-for="(item, index) in currentFileList"
:key="index"
:item="item"
:index="index"
@on-move="onMoveSingleFile"
@on-delete="deleteTalk"
@on-set="openSet"
@on-delhomework="delhomework"
>
<el-checkbox v-if="!item.uniquekey" label="" :value="item" />
</file-list-item>
<file-list-item
v-for="(item, index) in currentWorkList"
:key="'work_' + index"
:item="item"
:index="index"
@on-move="onMoveSingleFile"
@on-delete="deleteTalk"
@on-set="openSet"
@on-delhomework="delhomework"
>
<el-checkbox v-if="!item.uniquekey" label="" :value="item" />
</file-list-item> </file-list-item>
</el-checkbox-group> </el-checkbox-group>
<file-oper-batch <file-oper-batch v-show="checkFileList.length > 0"
v-show="checkFileList.length > 0"
:indeterminate="checkFileList.length > 0 && checkFileList.length < currentFileList.length" :indeterminate="checkFileList.length > 0 && checkFileList.length < currentFileList.length"
:choose="checkFileList" :choose="checkFileList" :check-all="isCheckAll" @click-delete="clickDelete" @click-move="clickMove"
:check-all="isCheckAll" @cancel="checkFileList = []" @click-choose="clickChoose"></file-oper-batch>
@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 <SetHomework v-model="setDialog" :entpcourseid="entpcourseid" :row="row" @on-close="closeHomework" />
v-model="setDialog"
:entpcourseid="entpcourseid"
:row="row"
@on-close="closeHomework"
/>
</div> </div>
<reserv ref="reservDialog"></reserv> <reserv ref="reservDialog"></reserv>
</template> </template>
@ -129,7 +87,7 @@ import outLink from '@/utils/linkConfig'
import { createWindow } from '@/utils/tool' import { createWindow } from '@/utils/tool'
import { uniqBy, cloneDeep } from 'lodash' import { uniqBy, cloneDeep } from 'lodash'
import { delClasswork, addEntpcourse } from '@/api/teaching/classwork' import { delClasswork, addEntpcourse } from '@/api/teaching/classwork'
const fs = require('fs') const fs = require('fs');
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
export default { export default {
@ -155,7 +113,6 @@ export default {
fileList: [], fileList: [],
currentNode: {}, currentNode: {},
currentFileList: [], currentFileList: [],
currentWorkList: [],
curBookPath: '', curBookPath: '',
lastAsyncAllTime: '', lastAsyncAllTime: '',
uploadData: { uploadData: {
@ -199,7 +156,7 @@ export default {
}) })
this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime') this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime')
}, },
mounted() {}, mounted() { },
activated() { activated() {
if (this.uploadData.textbookId !== null) { if (this.uploadData.textbookId !== null) {
this.asyncAllFile() this.asyncAllFile()
@ -211,7 +168,7 @@ export default {
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
@ -226,14 +183,14 @@ export default {
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(appRootFilePath + fileName)
} else { }else {
ElMessage({ ElMessage({
type: 'info', type: 'info',
message: `下载教材失败!` message: `下载教材失败!`
}) })
} }
}) })
} else { }else {
resolve(appRootFilePath + fileName) resolve(appRootFilePath + fileName)
} }
}) })
@ -370,9 +327,9 @@ export default {
this.uploadData.textbookId = data.textBook.curBookId this.uploadData.textbookId = data.textBook.curBookId
this.initHomeWork() this.initHomeWork()
await this.asyncAllFile() await this.asyncAllFile()
}, },
async initHomeWork() { async initHomeWork() {
this.currentWorkList = []
if (this.timerId) { if (this.timerId) {
clearInterval(this.timerId) clearInterval(this.timerId)
} }
@ -381,10 +338,11 @@ 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 { }
await this.createEntpcourse() else{
let { rows } = await this.getChapterId() await this.createEntpcourse()
this.entpcourseid = rows[0].id let { rows } = await this.getChapterId()
this.entpcourseid = rows[0].id
} }
// //
@ -393,27 +351,28 @@ export default {
}, },
// entpcourse // entpcourse
createEntpcourse() { createEntpcourse() {
var cform = {} // web AIx
cform.entpid = this.userStore.deptId var cform = {};
cform.level = 1 cform.entpid = this.userStore.deptId;
cform.parentid = 0 cform.level = 1;
cform.dictid = 0 cform.parentid = 0;
cform.evalid = this.currentNode.id cform.dictid = 0;
cform.evalparentid = 0 cform.evalid = this.currentNode.id;
cform.edusubject = this.currentNode.edusubject cform.evalparentid = 0;
cform.edudegree = this.currentNode.edudegree cform.edusubject = this.currentNode.edusubject;
cform.edustage = this.currentNode.edustage cform.edudegree = this.currentNode.edudegree;
cform.coursetype = '课标学科' cform.edustage = this.currentNode.edustage;
cform.coursetitle = this.currentNode.itemtitle cform.coursetype = '课标学科';
cform.coursedesc = '' cform.coursetitle = this.currentNode.itemtitle;
cform.status = '' cform.coursedesc = '';
cform.dflag = 0 cform.status = '';
cform.edituserid = this.userStore.userId cform.dflag = 0;
cform.createblankfile = 'yes' cform.edituserid = this.userStore.userId;
cform.createblankfile = 'yes';
return addEntpcourse(cform) return addEntpcourse(cform)
}, },
openReserv() { openReserv(){
this.$refs['reservDialog'].openDialog() // this.$refs['reservDialog'].openDialog()
}, },
// //
handleOutLink(key) { handleOutLink(key) {
@ -505,9 +464,9 @@ export default {
} }
} }
// //
let ary = uniqBy([...list], 'id') let ary = uniqBy([...this.currentFileList, ...list], 'id')
// //
this.currentWorkList = cloneDeep(ary) this.currentFileList = cloneDeep(ary)
}) })
}, },
// //
@ -518,16 +477,14 @@ export default {
// //
delhomework(item) { delhomework(item) {
this.isLoading = true this.isLoading = true
delClasswork(item.id) delClasswork(item.id).then(async res => {
.then(async (res) => { ElMessage.success('操作成功')
ElMessage.success('操作成功') this.isLoading = false
this.isLoading = false await this.asyncAllFile()
await this.asyncAllFile() this.getHomeWorkList()
this.getHomeWorkList() }).catch(() => {
}) this.isLoading = false
.catch(() => { })
this.isLoading = false
})
}, },
closeHomework() { closeHomework() {
this.setDialog = false this.setDialog = false
@ -546,7 +503,7 @@ export default {
openLesson() { openLesson() {
const toolStore = useToolState() const toolStore = useToolState()
if (toolStore.isToolWin) return this.$message.error('您当前已开始上课,请勿重复操作') if (toolStore.isToolWin) return this.$message.error('您当前已开始上课,请勿重复操作')
createWindow('tool-sphere', { url: '/tool/sphere?entpcourseid=' + this.entpcourseid }) createWindow('tool-sphere', { url: '/tool/sphere?entpcourseid=' + this.entpcourseid +'&label=' + this.currentNode.label })
} }
} }
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="homework-content"> <div class="homework-content">
<div class="homework-top"> <div class="homework-top">
<h3 class="title">沁园春-长沙</h3> <h3 class="title">{{ lesson }}</h3>
<div class="grade">{{ usertore.edusubject}}</div> <div class="grade">{{ usertore.edusubject}}</div>
</div> </div>
<div class="homework-list" v-loading="loading"> <div class="homework-list" v-loading="loading">
@ -34,12 +34,14 @@ import { ref, onMounted } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { homeworklist } from '@/api/teaching/classwork' import { homeworklist } from '@/api/teaching/classwork'
import { getSmarttalkPage } from '@/api/file'
import SetHomework from '@/views/prepare/container/set-homework.vue' import SetHomework from '@/views/prepare/container/set-homework.vue'
import { ipcMsgSend } from '@/utils/tool' import { ipcMsgSend } from '@/utils/tool'
const route = useRoute(); const route = useRoute();
const usertore = useUserStore().user const usertore = useUserStore().user
const entpcourseid = ref('') const entpcourseid = ref('')
const lesson = ref('')
const loading = ref(false) const loading = ref(false)
// //
const dataList = ref([]) const dataList = ref([])
@ -62,6 +64,12 @@ const closeHomework = ()=>{
setDialog.value = false setDialog.value = false
} }
//
const getResource = ()=>{
// getSmarttalkPage().then()
}
//
const getHomework = () => { const getHomework = () => {
loading.value = true loading.value = true
try { try {
@ -132,9 +140,10 @@ const getHomework = () => {
} }
} }
onMounted(() => { onMounted(() => {
console.log(route.query)
entpcourseid.value = route.query.entpcourseid entpcourseid.value = route.query.entpcourseid
lesson.value = route.query.label
getHomework() getHomework()
}) })
</script> </script>