上课作业
This commit is contained in:
parent
0e34b6a1e9
commit
258a99bc36
|
@ -1,6 +1,5 @@
|
|||
<template>
|
||||
<el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false" append-to-body
|
||||
:z-index="999999" style="border-radius: 10px; padding: 10px 15px;">
|
||||
<el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false" append-to-body style="border-radius: 10px; padding: 10px 15px;">
|
||||
<template #header>
|
||||
<div class="homerwork-header flex">
|
||||
<span>{{ title }}</span>
|
||||
|
|
|
@ -23,13 +23,7 @@
|
|||
<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>
|
||||
|
@ -47,60 +41,24 @@
|
|||
<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
|
||||
v-model="checkFileList"
|
||||
class="prepare-body-main"
|
||||
:style="{ 'margin-bottom': checkFileList.length > 0 ? '40px' : '0' }"
|
||||
>
|
||||
<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" />
|
||||
<el-checkbox-group v-model="checkFileList" class="prepare-body-main"
|
||||
:style="{ 'margin-bottom': checkFileList.length > 0 ? '40px' : '0' }">
|
||||
<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 label="" :value="item" v-if="!item.uniquekey" />
|
||||
</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>
|
||||
</template>
|
||||
|
@ -129,7 +87,7 @@ import outLink from '@/utils/linkConfig'
|
|||
import { createWindow } from '@/utils/tool'
|
||||
import { uniqBy, cloneDeep } from 'lodash'
|
||||
import { delClasswork, addEntpcourse } from '@/api/teaching/classwork'
|
||||
const fs = require('fs')
|
||||
const fs = require('fs');
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
|
||||
export default {
|
||||
|
@ -155,7 +113,6 @@ export default {
|
|||
fileList: [],
|
||||
currentNode: {},
|
||||
currentFileList: [],
|
||||
currentWorkList: [],
|
||||
curBookPath: '',
|
||||
lastAsyncAllTime: '',
|
||||
uploadData: {
|
||||
|
@ -199,7 +156,7 @@ export default {
|
|||
})
|
||||
this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime')
|
||||
},
|
||||
mounted() {},
|
||||
mounted() { },
|
||||
activated() {
|
||||
if (this.uploadData.textbookId !== null) {
|
||||
this.asyncAllFile()
|
||||
|
@ -211,7 +168,7 @@ export default {
|
|||
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
|
||||
|
@ -226,14 +183,14 @@ export default {
|
|||
ipcRenderer.once('download-file-default' + fileName, (e, isSuccess) => {
|
||||
if (isSuccess === true) {
|
||||
resolve(appRootFilePath + fileName)
|
||||
} else {
|
||||
}else {
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: `下载教材失败!`
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
}else {
|
||||
resolve(appRootFilePath + fileName)
|
||||
}
|
||||
})
|
||||
|
@ -370,9 +327,9 @@ export default {
|
|||
this.uploadData.textbookId = data.textBook.curBookId
|
||||
this.initHomeWork()
|
||||
await this.asyncAllFile()
|
||||
|
||||
},
|
||||
async initHomeWork() {
|
||||
this.currentWorkList = []
|
||||
if (this.timerId) {
|
||||
clearInterval(this.timerId)
|
||||
}
|
||||
|
@ -381,10 +338,11 @@ 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
|
||||
}
|
||||
|
||||
// 查询作业
|
||||
|
@ -393,27 +351,28 @@ export default {
|
|||
},
|
||||
// 创建新的entpcourse
|
||||
createEntpcourse() {
|
||||
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'
|
||||
// 参照 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';
|
||||
return addEntpcourse(cform)
|
||||
},
|
||||
openReserv() {
|
||||
this.$refs['reservDialog'].openDialog()
|
||||
openReserv(){
|
||||
// this.$refs['reservDialog'].openDialog()
|
||||
},
|
||||
// 打开外部链接
|
||||
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) {
|
||||
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
|
||||
|
@ -546,7 +503,7 @@ export default {
|
|||
openLesson() {
|
||||
const toolStore = useToolState()
|
||||
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 })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="homework-content">
|
||||
<div class="homework-top">
|
||||
<h3 class="title">沁园春-长沙</h3>
|
||||
<h3 class="title">{{ lesson }}</h3>
|
||||
<div class="grade">{{ usertore.edusubject}}</div>
|
||||
</div>
|
||||
<div class="homework-list" v-loading="loading">
|
||||
|
@ -34,12 +34,14 @@ import { ref, onMounted } from 'vue';
|
|||
import { useRoute } from 'vue-router';
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { homeworklist } from '@/api/teaching/classwork'
|
||||
import { getSmarttalkPage } from '@/api/file'
|
||||
import SetHomework from '@/views/prepare/container/set-homework.vue'
|
||||
import { ipcMsgSend } from '@/utils/tool'
|
||||
|
||||
const route = useRoute();
|
||||
const usertore = useUserStore().user
|
||||
const entpcourseid = ref('')
|
||||
const lesson = ref('')
|
||||
const loading = ref(false)
|
||||
//作业数据
|
||||
const dataList = ref([])
|
||||
|
@ -62,6 +64,12 @@ const closeHomework = ()=>{
|
|||
setDialog.value = false
|
||||
}
|
||||
|
||||
// 获取资源数据
|
||||
const getResource = ()=>{
|
||||
// getSmarttalkPage().then()
|
||||
}
|
||||
|
||||
// 获取作业数据
|
||||
const getHomework = () => {
|
||||
loading.value = true
|
||||
try {
|
||||
|
@ -132,9 +140,10 @@ const getHomework = () => {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
console.log(route.query)
|
||||
entpcourseid.value = route.query.entpcourseid
|
||||
lesson.value = route.query.label
|
||||
getHomework()
|
||||
})
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue