zdg #96

Merged
zhengdegang merged 2 commits from zdg into main 2024-08-02 16:09:32 +08:00
7 changed files with 335 additions and 127 deletions
Showing only changes of commit 99c6fe85d4 - Show all commits

View File

@ -16,4 +16,21 @@ export function listEntpcourse(query) {
method: 'get', method: 'get',
params: query params: query
}) })
}
// 布置作业
export function saveByClassWorkArray(data) {
return request({
url: '/education/classwork/saveByClassWorkArray',
method: 'post',
data: data
})
}
// 删除classwork 作业
export function delClasswork(id) {
return request({
url: '/education/classwork/' + id,
method: 'delete'
})
} }

View File

@ -158,13 +158,19 @@ const getSubject = async () => {
curBookId.value = subjectList.value[0].id curBookId.value = subjectList.value[0].id
} }
const isHaveUnit = (id) => {
return evaluationList.value.some(item => {
return item.rootid == id
})
}
const getTreeData = () => { const getTreeData = () => {
// //
let upData = transData(volumeOne.value) let upData = transData(volumeOne.value)
let downData = transData(volumeTwo.value) let downData = transData(volumeTwo.value)
treeData.value = upData.length ? upData : downData treeData.value = upData.length ? upData : downData
defaultExpandedKeys.value = [treeData.value[0].id]
nextTick(() => { nextTick(() => {
defaultExpandedKeys.value = [treeData.value[0].id]
currentNodeId.value = getLastLevelData(treeData.value)[0].id currentNodeId.value = getLastLevelData(treeData.value)[0].id
currentNodeName.value = getLastLevelData(treeData.value)[0].label currentNodeName.value = getLastLevelData(treeData.value)[0].label
emitChangeBook() emitChangeBook()

View File

@ -6,36 +6,53 @@
</div> </div>
<div class="prepare-body-main-item-info" @click="openFileWin(item)"> <div class="prepare-body-main-item-info" @click="openFileWin(item)">
<div class="prepare-item-info-title" :title="item.fileShowName"> <div class="prepare-item-info-title" :title="item.fileShowName">
{{ item.fileShowName }} <div></div>
<div
style="
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 200px;
"
>
{{ item.fileShowName }}
</div>
</div> </div>
<div class="prepare-item-info-message"> <div class="prepare-item-info-message">
<div style="width: 60px"> <div style="width: 60px">
<template v-if="item.uniquekey"> <template v-if="item.uniquekey">
{{ item.worktype }} {{ item.worktype }}
</template> </template>
<template v-else> <template v-else>
<el-icon <el-icon
v-loading="item.async === 'on'" v-loading="item.async === 'on'"
style="background-color: green; border-radius: 20px; color: white; top: 2px" style="background-color: green; border-radius: 20px; color: white; top: 2px"
> >
<Check v-if="item.async === true" /> <Check v-if="item.async === true" />
<UploadFilled v-if="!item.async" /> <UploadFilled v-if="!item.async" />
</el-icon> </el-icon>
{{ item.async === true ? '已同步' : '' }} {{ item.async === true ? '已同步' : '' }}
{{ !item.async ? '待同步' : '' }} {{ !item.async ? '待同步' : '' }}
{{ item.async === 'on' ? '同步中' : '' }} {{ item.async === 'on' ? '同步中' : '' }}
</template> </template>
</div> </div>
<template v-if="item.fileSize">|</template> <template v-if="item.fileSize">|</template>
<div style="width: 70px" v-if="item.fileSize">{{ formatFileSize(item.fileSize) }}</div> <div v-if="item.fileSize" style="width: 70px">{{ formatFileSize(item.fileSize) }}</div>
<template v-if="item.uploadTime">|</template> <template v-if="item.uploadTime">|</template>
<div style="width: 70px" v-if="item.uploadTime">{{ toTimeText(item.uploadTime, true) }}</div> <div v-if="item.uploadTime" style="width: 70px">
{{ toTimeText(item.uploadTime, true) }}
</div>
<template v-if="item.levelFirstName">|&nbsp;</template> <template v-if="item.levelFirstName">|&nbsp;</template>
<div <div
v-if="item.levelFirstName" v-if="item.levelFirstName"
style=" style="
flex: 1; flex: 1;
text-align: left; text-align: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 200px;
" "
:title=" :title="
item.levelFirstName + item.levelFirstName +
@ -70,7 +87,7 @@
</el-button> </el-button>
</div> </div>
<div class="item-popover-item"> <div class="item-popover-item">
<el-button text @click="deleteTalk(item)"> <el-button text @click="deleteHomework(item)">
<i class="iconfont icon-shanchu"></i> <i class="iconfont icon-shanchu"></i>
<span>删除</span> <span>删除</span>
</el-button> </el-button>
@ -142,10 +159,10 @@ export default {
} }
} }
}, },
emits: { 'on-move': null, 'on-delete': null, 'on-set': null }, emits: { 'on-move': null, 'on-delete': null, 'on-set': null, 'on-delhomework': null },
data() { data() {
return { return {
listenList: [], listenList: []
} }
}, },
methods: { methods: {
@ -229,8 +246,12 @@ export default {
}) })
}, },
// //
setHomeWork(item){ setHomeWork(item) {
this.$emit('on-set', item) this.$emit('on-set', item)
},
//
deleteHomework(item){
this.$emit('on-delhomework', item)
} }
} }
} }
@ -259,9 +280,9 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.icon-zuoye{ .icon-zuoye {
font-size: 40px; font-size: 40px;
color: #707070 color: #707070;
} }
} }
@ -281,9 +302,7 @@ export default {
.prepare-item-info-title { .prepare-item-info-title {
text-align: left; text-align: left;
font-size: 16px; font-size: 16px;
white-space: nowrap; display: flex;
overflow: hidden;
text-overflow: ellipsis;
} }
.prepare-item-info-message { .prepare-item-info-message {

View File

@ -1,38 +1,39 @@
<template> <template>
<el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false" <el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false" append-to-body
style="border-radius: 10px; padding: 10px 15px;"> style="border-radius: 10px; padding: 10px 15px;">
<template #header> <template #header>
<div class="homerwork-header flex"> <div class="homerwork-header flex">
<span>布置作业</span> <span>布置作业</span>
<i class="iconfont icon-guanbi" @click="cloneDialog"></i> <i class="iconfont icon-guanbi" @click="cloneDialog"></i>
</div> </div>
</template> </template>
<div> <div v-loading="setLoading">
<el-form :model="form" label-width="80px"> <el-form :model="form" label-width="80px" ref="ruleForm" :rules="rules">
<el-form-item label="班级"> <el-form-item label="班级" prop="grade">
<el-tree ref="treeRef" :data="treeData" :props="defaultProps" :load="getLoad" node-key="id" <el-scrollbar max-height="200px" style="width: 100%;">
@check="handleCheckChange" lazy show-checkbox /> <el-tree ref="treeRef" :data="gradeList" :props="defaultProps" :load="getLoad" node-key="id"
@check="handleCheckChange" lazy show-checkbox />
</el-scrollbar>
</el-form-item> </el-form-item>
<el-form-item label="选中学生"> <el-form-item label="选中学生" prop="student">
<el-scrollbar max-height="200px"> <el-scrollbar max-height="200px">
<el-tag v-for="(tag, index) in studentList" :key="tag.studentid" closable type="primary" <el-tag v-for="(tag, index) in studentList" :key="tag.studentid" closable type="primary"
@close="delStudent(index)"> @close="delStudent(index)">
{{ tag.name }} {{ tag.name }}
</el-tag> </el-tag>
</el-scrollbar> </el-scrollbar>
</el-form-item> </el-form-item>
<el-form-item label="完成要求"> <el-form-item label="完成要求" prop="feedback">
<el-radio-group v-model="form.feedtype"> <el-radio-group v-model="form.feedback">
<el-radio value="必做" size="large">必做</el-radio> <el-radio value="必做" size="large">必做</el-radio>
<el-radio value="选做" size="large">选做</el-radio> <el-radio value="选做" size="large">选做</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="截至时间"> <el-form-item label="截止时间" prop="deaddate">
<el-date-picker v-model="endTime" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="请选择截至时间" <el-date-picker v-model="form.deaddate" value-format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
@change="changeTime" /> time-format="HH:mm" type="datetime" :clearable="false" placeholder="请选择截止时间" />
</el-form-item> </el-form-item>
<el-form-item label="推荐用时"> <el-form-item label="推荐用时" prop="timelength">
<el-input-number v-model="form.timelength" :min="1" :max="500" /> <el-input-number v-model="form.timelength" :min="1" :max="500" />
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -41,7 +42,7 @@
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="cloneDialog">取消</el-button> <el-button @click="cloneDialog">取消</el-button>
<el-button type="primary" @click="dialogVisible = false"> <el-button type="primary" @click="onSubmit('ruleForm')">
确定 确定
</el-button> </el-button>
</div> </div>
@ -50,17 +51,27 @@
</template> </template>
<script> <script>
import { ElMessage } from 'element-plus'
import { listClassmain, listClassgroup } from '@/api/classManage/index' import { listClassmain, listClassgroup } from '@/api/classManage/index'
import { saveByClassWorkArray } from '@/api/teaching/classwork'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { uniqBy, cloneDeep } from 'lodash' import { uniqBy, groupBy } from 'lodash'
export default { export default {
props: { props: {
modelValue: { modelValue: {
type: Boolean, type: Boolean,
default: false default: false
},
entpcourseid: {
default: ''
},
row: {
default: ''
} }
}, },
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
defaultProps: { defaultProps: {
@ -68,7 +79,7 @@ export default {
label: 'label', label: 'label',
isLeaf: 'leaf', isLeaf: 'leaf',
}, },
treeData: [], setLoading: false,
// //
userInfo: null, userInfo: null,
// //
@ -80,19 +91,26 @@ export default {
studentList: [], studentList: [],
// //
form: { form: {
feedtype: '必做', feedback: '必做',
endTime: '', deaddate: '',
timelength: 1 timelength: 1
}, },
endTime: '' //
rules: {
grade: [
{ validator: this.validateGrade, trigger: 'blur' }
],
student: [
{ validator: this.validateStudent, trigger: 'blur' }
]
}
} }
}, },
created() { created() {
// //
this.endTime = this.getCurrentDate() + ' ' + '10:00:00' this.form.deaddate = this.getCurrentDate() + ' ' + '10:00:00'
this.userInfo = useUserStore().user this.userInfo = useUserStore().user
this.getGradeList()
}, },
methods: { methods: {
// //
@ -104,28 +122,31 @@ export default {
item.level = 0 item.level = 0
item.children = [] item.children = []
item.classstudentlist = JSON.parse("[" + item.classstudentlist + "]") item.classstudentlist = JSON.parse("[" + item.classstudentlist + "]")
item.classstudentlist.forEach(el => {
el.classId = item.id
})
}) })
console.log(list)
this.gradeList = list this.gradeList = list
this.treeData = list
}) })
}, },
//
getLoad(node, resolve) { getLoad(node, resolve) {
console.log(node.level)
if (node.level == 0) return resolve([]) if (node.level == 0) return resolve([])
//
if (node.level == 1) { if (node.level == 1) {
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then(res => { listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then(res => {
console.log(res)
if (res.rows.length > 0) { if (res.rows.length > 0) {
let ary = [] let ary = []
res.rows.forEach(item => { res.rows.forEach(item => {
if (item.parentid === 0) { if (item.parentid === 0) {
//studentGroup
let studentGroup = JSON.parse("[" + item.studentlist + "]") let studentGroup = JSON.parse("[" + item.studentlist + "]")
studentGroup.forEach(el => { studentGroup.forEach(el => {
el.label = el.name el.label = el.name
el.leaf = true el.leaf = true
el.level = 2, el.level = 2,
el.id = el.studentid el.id = el.studentid
el.classId = item.classid
}) })
ary.push({ ary.push({
label: item.groupname, label: item.groupname,
@ -135,7 +156,6 @@ export default {
}) })
} }
}) })
// console.log(ary)
resolve(ary) resolve(ary)
} }
else { else {
@ -143,23 +163,28 @@ export default {
} }
}) })
} }
//
if (node.level == 2) { if (node.level == 2) {
resolve(node.data.children) resolve(node.data.children)
} }
}, },
//
handleCheckChange(data, checked) { handleCheckChange(data, checked) {
this.studentList = [] this.studentList = []
// //
let checkNodes = checked.checkedNodes let checkNodes = checked.checkedNodes
let ary = [] let ary = []
checkNodes.forEach(item => { checkNodes.forEach(item => {
//
if (item.level == 0) { if (item.level == 0) {
ary = [...ary, ...(item.classstudentlist)] ary = [...ary, ...(item.classstudentlist)]
} }
//
if (item.level == 1) { if (item.level == 1) {
ary = [...ary, ...(item.children)] ary = [...ary, ...(item.children)]
} }
//
if (item.level == 2) { if (item.level == 2) {
ary = [...ary, item] ary = [...ary, item]
} }
@ -170,13 +195,63 @@ export default {
delStudent(index) { delStudent(index) {
this.studentList.splice(index, 1) this.studentList.splice(index, 1)
}, },
onSubmit(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
/**
* 根据学生列表中的classId分班
* studentList 为选中的所有学生 这些学生可能来自不同班级
*/
let gradeObj = groupBy(this.studentList, 'classId')
//
let ary = []
for (const value in gradeObj) {
// AIx web
let obj = {
id: 0,
parentid: this.row.id,
classid: value,
classcourseid: 0,
entpcourseid: this.entpcourseid,
studentlist: JSON.stringify(gradeObj[value]),
feedback: this.form.feedback,
workkey: "",
timelength: this.form.timelength,
weights: 1,
deaddate: this.form.deaddate,
workdate: this.getCurrentDate(),
uniquekey: this.row.uniquekey,
entpcourseworklist: "[" + this.row.entpcourseworklist + "]",
needMsgNotifine: 'false',
msgkey: 'newclasswork',
title: "作业任务",
msgcontent: '',
teachername: this.userInfo.nickName,
unixstamp: new Date().getTime(),
}
ary.push(obj)
}
this.setLoading = true
saveByClassWorkArray({
classworkarray: JSON.stringify(ary)
}).then(() => {
this.setLoading = false
ElMessage.success('操作成功')
this.cloneDialog()
}).catch(()=>{
this.setLoading = false
})
} else {
return false
}
})
},
// //
cloneDialog() { cloneDialog() {
this.$emit('on-close') this.$emit('on-close')
}, this.studentList = []
// this.$refs['ruleForm'].resetFields();
changeTime(value) {
console.log(value, 100)
}, },
// //
getCurrentDate() { getCurrentDate() {
@ -185,13 +260,33 @@ export default {
const month = now.getMonth() + 1; // 0+1 const month = now.getMonth() + 1; // 0+1
const day = now.getDate() const day = now.getDate()
return `${year}-${month.length == 2 ? month : '0' + month}-${day.length == 2 ? day : '0' + day}`; return `${year}-${month.length == 2 ? month : '0' + month}-${day.length == 2 ? day : '0' + day}`;
} },
validateGrade(rule, value, callback) {
if (this.studentList.length == 0) {
callback(new Error('请勾选班级或者学生'));
}
else {
callback()
}
},
validateStudent(rule, value, callback) {
if (this.studentList.length == 0) {
callback(new Error('学生不能为空'));
}
else {
callback()
}
},
}, },
watch: { watch: {
modelValue(val) { modelValue(val) {
this.dialogVisible = val this.dialogVisible = val
if (val) {
this.getGradeList()
}
} }
} },
} }
</script> </script>
@ -212,4 +307,14 @@ export default {
margin-right: 10px; margin-right: 10px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.dialog-footer{
padding-bottom: 10px
}
:deep(.el-checkbox){
transform : scale(1.3)
}
:deep(.el-icon){
transform : scale(1.3)
}
</style> </style>

View File

@ -65,8 +65,9 @@
@on-move="onMoveSingleFile" @on-move="onMoveSingleFile"
@on-delete="deleteTalk" @on-delete="deleteTalk"
@on-set="openSet" @on-set="openSet"
@on-delhomework="delhomework"
> >
<el-checkbox label="" :value="item" /> <el-checkbox label="" :value="item" v-if="!item.uniquekey"/>
</file-list-item> </file-list-item>
</el-checkbox-group> </el-checkbox-group>
<file-oper-batch <file-oper-batch
@ -82,7 +83,7 @@
</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" @on-close="closeHomework" /> <SetHomework v-model="setDialog" :entpcourseid="entpcourseid" :row="row" @on-close="closeHomework" />
</div> </div>
</template> </template>
<script setup> <script setup>
@ -106,6 +107,7 @@ import SetHomework from './container/set-homework.vue'
import outLink from '@/utils/linkConfig' 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 } from '@/api/teaching/classwork'
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
@ -147,7 +149,8 @@ export default {
entpcourseid: '', entpcourseid: '',
timerId: null, timerId: null,
// //
setDialog: false setDialog: false,
row: ''
} }
}, },
computed: { computed: {
@ -309,9 +312,10 @@ export default {
this.uploadData.textbookId = data.textBook.curBookId this.uploadData.textbookId = data.textBook.curBookId
await this.asyncAllFile() await this.asyncAllFile()
if (this.uploadData.levelSecondId) { if (this.uploadData.levelSecondId) {
// ID // ID
const res = await this.getChapterId() const { rows } = await this.getChapterId()
this.entpcourseid = res.rows[0].id if(!rows.length) return
this.entpcourseid = rows[0].id
// //
this.getHomeWorkList() this.getHomeWorkList()
} }
@ -339,7 +343,7 @@ export default {
pageSize: 500 pageSize: 500
}) })
}, },
// //
createTimer() { createTimer() {
this.timerId = setInterval(() => { this.timerId = setInterval(() => {
this.getHomeWorkList() this.getHomeWorkList()
@ -412,9 +416,22 @@ export default {
}) })
}, },
// //
openSet() { openSet(row) {
this.row = row
this.setDialog = true this.setDialog = true
}, },
//
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
})
},
closeHomework() { closeHomework() {
this.setDialog = false this.setDialog = false
}, },

View File

@ -1,13 +1,31 @@
<template> <template>
<div class="resource-list" v-loading="sourceStore.loading"> <div v-loading="sourceStore.loading" class="resource-list">
<el-scrollbar height="400px"> <el-scrollbar>
<el-empty description="暂无数据" v-if="!sourceStore.result.list.length" /> <el-empty v-if="!sourceStore.result.list.length" description="暂无数据" />
<ul> <ul>
<li class="list-item" v-for="item in sourceStore.result.list" :key="item.id" @click="handleRow"> <li
v-for="item in sourceStore.result.list"
:key="item.id"
class="list-item"
@click="handleRow"
>
<div class="item-left flex"> <div class="item-left flex">
<FileImage :fileName="item.fileShowName" :size="50" /> <FileImage :file-name="item.fileShowName" :size="50" />
<div class="flex item-left-content"> <div class="flex item-left-content">
<div class="name flex">{{ item.fileShowName }}</div> <div class="name flex" :title="item.fileShowName">
<div></div>
<div
style="
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 200px;
"
>
{{ item.fileShowName }}
</div>
</div>
<div class="item-tags flex"> <div class="item-tags flex">
<el-tag type="info" class="mr-10">{{ item.fileFlag }}</el-tag> <el-tag type="info" class="mr-10">{{ item.fileFlag }}</el-tag>
<el-tag type="info" class="mr-10">{{ getFileSuffix(item.fileShowName) }}</el-tag> <el-tag type="info" class="mr-10">{{ getFileSuffix(item.fileShowName) }}</el-tag>
@ -18,10 +36,16 @@
</div> </div>
</div> </div>
<div class="item-btns" @click.stop> <div class="item-btns" @click.stop>
<el-popover placement="bottom-end" trigger="hover" popper-class="custom-popover" <el-popover
:visible="item.showPopover"> placement="bottom-end"
trigger="hover"
popper-class="custom-popover"
:visible="item.showPopover"
>
<template #reference> <template #reference>
<el-button link type="primary"> <i class="iconfont icon-shenglvehao"></i></el-button> <el-button link type="primary">
<i class="iconfont icon-shenglvehao"></i
></el-button>
</template> </template>
<template #default> <template #default>
<div class="item-popover"> <div class="item-popover">
@ -29,7 +53,11 @@
<i class="iconfont icon-bianji"></i> <i class="iconfont icon-bianji"></i>
<span>编辑</span> <span>编辑</span>
</div> </div>
<div class="item-popover-item" v-if="userInfo.userId == item.uploadUserId" @click="delRow(item)"> <div
v-if="userInfo.userId == item.uploadUserId"
class="item-popover-item"
@click="delRow(item)"
>
<i class="iconfont icon-shanchu"></i> <i class="iconfont icon-shanchu"></i>
<span>删除</span> <span>删除</span>
</div> </div>
@ -37,24 +65,29 @@
<i class="iconfont icon-xiazai"></i> <i class="iconfont icon-xiazai"></i>
<span>下载</span> <span>下载</span>
</div> </div>
</div> </div>
</template> </template>
</el-popover> </el-popover>
<el-button size="small" plain round type="primary" @click="addLesson(item)"> <el-button size="small" plain round type="primary" @click="addLesson(item)">
<i class="iconfont icon-jiahao"></i> <i class="iconfont icon-jiahao"></i>
备课</el-button> 备课</el-button
>
</div> </div>
</li> </li>
</ul> </ul>
</el-scrollbar> </el-scrollbar>
<div class="pagination-box"> <div class="pagination-box">
<el-pagination v-model:current-page="sourceStore.query.pageNum" v-model:page-size="sourceStore.query.pageSize" <el-pagination
:page-sizes="[10, 20, 30, 50]" background layout="total, sizes, prev, pager, next, jumper" v-model:current-page="sourceStore.query.pageNum"
:total="sourceStore.result.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" /> v-model:page-size="sourceStore.query.pageSize"
:page-sizes="[10, 20, 30, 50]"
background
layout="total, sizes, prev, pager, next, jumper"
:total="sourceStore.result.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div> </div>
</div> </div>
</template> </template>
@ -69,17 +102,17 @@ import useUserStore from '@/store/modules/user'
import useResoureStore from '../store' import useResoureStore from '../store'
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
const userstore = useUserStore() const userstore = useUserStore()
const sourceStore = useResoureStore() const sourceStore = useResoureStore()
const userInfo = userstore.user const userInfo = userstore.user
// change // change
const handleSizeChange = (limit) => { const handleSizeChange = (limit) => {
sourceStore.query.pageSize = limit sourceStore.query.pageSize = limit
sourceStore.handleQuery() sourceStore.handleQuery()
} }
const handleCurrentChange = (page) => { const handleCurrentChange = (page) => {
sourceStore.query.pageNum = page sourceStore.query.pageNum = page
sourceStore.handleQuery() sourceStore.handleQuery()
} }
@ -108,7 +141,7 @@ const editRow = (item) => {
} }
}) })
}) })
.catch(() => { }) .catch(() => {})
} }
// //
const delRow = (item) => { const delRow = (item) => {
@ -128,7 +161,7 @@ const addLesson = ({ id }) => {
let data = { let data = {
id, id,
fileRoot: '备课', fileRoot: '备课',
...(toRaw(sourceStore.nodeData)), ...toRaw(sourceStore.nodeData)
} }
// //
for (let key in data) { for (let key in data) {
@ -136,19 +169,18 @@ const addLesson = ({ id }) => {
delete data[key] delete data[key]
} }
} }
try { try {
sourceStore.loading = true sourceStore.loading = true
addFileToPrepare(data).then(() => { addFileToPrepare(data).then(() => {
ElMessage.success('操作成功') ElMessage.success('操作成功')
}) })
} } finally {
finally {
sourceStore.loading = false sourceStore.loading = false
} }
} }
// //
const handleRow = () =>{ const handleRow = () => {
ElMessage.warning('请先加入备课,在备课里面进行预览!') ElMessage.warning('请先加入备课,在备课里面进行预览!')
} }
</script> </script>
@ -181,6 +213,10 @@ const handleRow = () =>{
} }
.resource-list { .resource-list {
flex: 1;
display: flex;
flex-direction: column;
overflow: auto;
.list-item { .list-item {
flex: 1; flex: 1;
padding: 10px 20px; padding: 10px 20px;
@ -189,10 +225,13 @@ const handleRow = () =>{
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
&:hover {
background-color: rgba(144, 147, 153, 0.2);
cursor: pointer;
}
.item-left { .item-left {
align-items: center; align-items: center;
flex: 1;
.icon { .icon {
font-size: 50px; font-size: 50px;
} }
@ -200,12 +239,14 @@ const handleRow = () =>{
.item-left-content { .item-left-content {
margin-left: 10px; margin-left: 10px;
flex-direction: column; flex-direction: column;
flex: 1;
text-align: left;
} }
.name { .name {
font-size: 14px; font-size: 14px;
color: #3b3b3b; color: #3b3b3b;
margin-bottom: 10px margin-bottom: 10px;
} }
.line { .line {
@ -226,7 +267,6 @@ const handleRow = () =>{
color: #909399; color: #909399;
font-size: 13px; font-size: 13px;
} }
} }
&:last-child { &:last-child {
@ -258,15 +298,13 @@ const handleRow = () =>{
margin-right: 3px; margin-right: 3px;
font-weight: bold; font-weight: bold;
} }
} }
} }
.pagination-box { .pagination-box {
margin-top: 20px;
display: flex; display: flex;
justify-content: center; justify-content: center;
height: 65px;
} }
} }
</style> </style>

View File

@ -1,21 +1,28 @@
<template> <template>
<div class="page-resource flex"> <div class="page-resource flex">
<!--左侧 教材 目录--> <!--左侧 教材 目录-->
<ChooseTextbook @changeBook="getData" @nodeClick="getData" /> <ChooseTextbook @change-book="getData" @node-click="getData" />
<div class="page-right"> <div class="page-right">
<!-- 搜索 --> <!-- 搜索 -->
<ResoureSearch #add> <ResoureSearch #add>
<el-button v-if="sourceStore.isCreate" type="primary" round @click="openDialog" class="create-btn"> <el-button
v-if="sourceStore.isCreate"
type="primary"
round
class="create-btn"
@click="openDialog"
>
<i class="iconfont icon-jiahao"></i> <i class="iconfont icon-jiahao"></i>
新建资源</el-button> 新建资源</el-button
>
</ResoureSearch> </ResoureSearch>
<!-- 列表 --> <!-- 列表 -->
<ResoureList /> <ResoureList />
</div> </div>
</div> </div>
<!-- 上传弹窗 --> <!-- 上传弹窗 -->
<uploadDialog v-model="isDialogOpen" @submitFile="submitFile" /> <uploadDialog v-model="isDialogOpen" @submit-file="submitFile" />
<!-- <el-button @click="testClick">测试</el-button> --> <!-- <el-button @click="testClick">测试</el-button> -->
</template> </template>
@ -40,7 +47,7 @@ onMounted(async () => {
// const res = await ipcMsgSend('tool-sphere:create', params) // const res = await ipcMsgSend('tool-sphere:create', params)
// console.log('', res) // console.log('', res)
}) })
const testClick = async() => { const testClick = async () => {
const win = await createWindow('tool-sphere', { url: '/tool/sphere' }) const win = await createWindow('tool-sphere', { url: '/tool/sphere' })
console.log('消息返回:', win) console.log('消息返回:', win)
} }
@ -48,12 +55,11 @@ const testClick = async() => {
const getData = (data) => { const getData = (data) => {
const { textBook, node } = data const { textBook, node } = data
let textbookId = textBook.curBookId let textbookId = textBook.curBookId
let levelSecondId = node.id let levelSecondId = node.id
let levelFirstId let levelFirstId
if(node.parentNode){ if (node.parentNode) {
levelFirstId = node.parentNode.id levelFirstId = node.parentNode.id
} } else {
else{
levelFirstId = node.id levelFirstId = node.id
levelSecondId = '' levelSecondId = ''
} }
@ -63,7 +69,7 @@ const getData = (data) => {
sourceStore.nodeData = { sourceStore.nodeData = {
textbookId, textbookId,
levelFirstId, levelFirstId,
levelSecondId, levelSecondId
} }
sourceStore.handleQuery() sourceStore.handleQuery()
} }
@ -73,7 +79,7 @@ const submitFile = (data) => {
let fileList = toRaw(data) let fileList = toRaw(data)
const { textbookId, levelFirstId, levelSecondId, fileSource, fileRoot } = sourceStore.query const { textbookId, levelFirstId, levelSecondId, fileSource, fileRoot } = sourceStore.query
// //
fileList.forEach(item => { fileList.forEach((item) => {
let fileData = { textbookId, levelFirstId, levelSecondId, fileSource, fileRoot } let fileData = { textbookId, levelFirstId, levelSecondId, fileSource, fileRoot }
fileData.fileShowName = item.fileData.fileShowName fileData.fileShowName = item.fileData.fileShowName
fileData.fileFlag = item.fileData.fileFlag fileData.fileFlag = item.fileData.fileFlag
@ -83,17 +89,15 @@ const submitFile = (data) => {
uploaderState().pushFile(fileList) uploaderState().pushFile(fileList)
} }
const fileCallBack = (res) => { const fileCallBack = (res) => {
if (res.code == 200) { if (res.code == 200) {
sourceStore.handleQuery() sourceStore.handleQuery()
} }
} }
onMounted(()=>{ onMounted(() => {
sourceStore.getCreate() sourceStore.getCreate()
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -103,6 +107,8 @@ onMounted(()=>{
.page-right { .page-right {
min-width: 0; min-width: 0;
display: flex;
flex-direction: column;
flex: 1; flex: 1;
margin-left: 20px; margin-left: 20px;
height: 100%; height: 100%;
@ -111,12 +117,12 @@ onMounted(()=>{
box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06); box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
} }
.icon-jiahao { .icon-jiahao {
font-size: 12px; font-size: 12px;
margin-right: 3px; margin-right: 3px;
font-weight: bold; font-weight: bold;
} }
} }
.create-btn{ .create-btn {
font-size: 13px; font-size: 13px;
padding: 5px 13px; padding: 5px 13px;
} }