lyc-dev #90

Merged
lyc merged 4 commits from lyc-dev into main 2024-08-01 11:27:40 +08:00
4 changed files with 240 additions and 7 deletions
Showing only changes of commit 510258361f - Show all commits

View File

@ -8,7 +8,7 @@
http-equiv="Content-Security-Policy" http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
/> --> /> -->
<meta http-equiv="Content-Security-Policy" content="connect-src *; default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src * 'self' data: blob:" /> <meta http-equiv="Content-Security-Policy" content="connect-src *; default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src * 'self' data: blob:" />
</head> </head>

View File

@ -67,7 +67,7 @@
<div class="item-popover" @click="closePopver(index)"> <div class="item-popover" @click="closePopver(index)">
<template v-if="item.uniquekey"> <template v-if="item.uniquekey">
<div class="item-popover-item"> <div class="item-popover-item">
<el-button text @click="editTalk(item, index)"> <el-button text @click="setHomeWork(item, index)">
<i class="iconfont icon-bianji"></i> <i class="iconfont icon-bianji"></i>
<span>布置</span> <span>布置</span>
</el-button> </el-button>
@ -145,10 +145,10 @@ export default {
} }
} }
}, },
emits: { 'on-move': null, 'on-delete': null }, emits: { 'on-move': null, 'on-delete': null, 'on-set': null },
data() { data() {
return { return {
listenList: [] listenList: [],
} }
}, },
methods: { methods: {
@ -230,6 +230,10 @@ export default {
} }
}) })
}) })
},
//
setHomeWork(item){
this.$emit('on-set', item)
} }
} }
} }

View File

@ -0,0 +1,215 @@
<template>
<el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false"
style="border-radius: 10px; padding: 10px 15px;">
<template #header>
<div class="homerwork-header flex">
<span>布置作业</span>
<i class="iconfont icon-guanbi" @click="cloneDialog"></i>
</div>
</template>
<div>
<el-form :model="form" label-width="80px">
<el-form-item label="班级">
<el-tree ref="treeRef" :data="treeData" :props="defaultProps" :load="getLoad" node-key="id"
@check="handleCheckChange" lazy show-checkbox />
</el-form-item>
<el-form-item label="选中学生">
<el-scrollbar max-height="200px">
<el-tag v-for="(tag, index) in studentList" :key="tag.studentid" closable type="primary"
@close="delStudent(index)">
{{ tag.name }}
</el-tag>
</el-scrollbar>
</el-form-item>
<el-form-item label="完成要求">
<el-radio-group v-model="form.feedtype">
<el-radio value="必做" size="large">必做</el-radio>
<el-radio value="选做" size="large">选做</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="截至时间">
<el-date-picker v-model="endTime" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="请选择截至时间"
@change="changeTime" />
</el-form-item>
<el-form-item label="推荐用时">
<el-input-number v-model="form.timelength" :min="1" :max="500" />
</el-form-item>
</el-form>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="cloneDialog">取消</el-button>
<el-button type="primary" @click="dialogVisible = false">
确定
</el-button>
</div>
</template>
</el-dialog>
</template>
<script>
import { listClassmain, listClassgroup } from '@/api/classManage/index'
import useUserStore from '@/store/modules/user'
import { uniqBy, cloneDeep } from 'lodash'
export default {
props: {
modelValue: {
type: Boolean,
default: false
}
},
data() {
return {
dialogVisible: false,
defaultProps: {
children: 'children',
label: 'label',
isLeaf: 'leaf',
},
treeData: [],
//
userInfo: null,
//
gradeList: [],
curGradeId: '',
//
groupList: [],
//
studentList: [],
//
form: {
feedtype: '必做',
endTime: '',
timelength: 1
},
endTime: ''
}
},
created() {
//
this.endTime = this.getCurrentDate() + ' ' + '10:00:00'
this.userInfo = useUserStore().user
this.getGradeList()
},
methods: {
//
getGradeList() {
listClassmain({ classuserid: this.userInfo.userId, pageSize: 100, status: 'open' }).then(res => {
let list = res.rows
list.forEach(item => {
item.label = item.caption
item.level = 0
item.children = []
item.classstudentlist = JSON.parse("[" + item.classstudentlist + "]")
})
console.log(list)
this.gradeList = list
this.treeData = list
})
},
getLoad(node, resolve) {
console.log(node.level)
if (node.level == 0) return resolve([])
if (node.level == 1) {
listClassgroup({ classid: node.key, orderby: 'orderidx', pageSize: 100 }).then(res => {
console.log(res)
if (res.rows.length > 0) {
let ary = []
res.rows.forEach(item => {
if (item.parentid === 0) {
let studentGroup = JSON.parse("[" + item.studentlist + "]")
studentGroup.forEach(el => {
el.label = el.name
el.leaf = true
el.level = 2,
el.id = el.studentid
})
ary.push({
label: item.groupname,
...item,
level: 1,
children: studentGroup
})
}
})
// console.log(ary)
resolve(ary)
}
else {
resolve([])
}
})
}
if (node.level == 2) {
resolve(node.data.children)
}
},
handleCheckChange(data, checked) {
this.studentList = []
//
let checkNodes = checked.checkedNodes
let ary = []
checkNodes.forEach(item => {
if (item.level == 0) {
ary = [...ary, ...(item.classstudentlist)]
}
if (item.level == 1) {
ary = [...ary, ...(item.children)]
}
if (item.level == 2) {
ary = [...ary, item]
}
})
this.studentList = uniqBy(ary, 'studentid')
},
//
delStudent(index) {
this.studentList.splice(index, 1)
},
//
cloneDialog() {
this.$emit('on-close')
},
//
changeTime(value) {
console.log(value, 100)
},
//
getCurrentDate() {
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth() + 1; // 0+1
const day = now.getDate()
return `${year}-${month.length == 2 ? month : '0' + month}-${day.length == 2 ? day : '0' + day}`;
}
},
watch: {
modelValue(val) {
this.dialogVisible = val
}
}
}
</script>
<style lang="scss" scoped>
.homerwork-header {
justify-content: space-between;
font-size: 15px;
font-weight: bold;
.icon-guanbi {
font-size: 20px;
cursor: pointer;
}
}
.el-tag {
margin-right: 10px;
margin-bottom: 10px;
}
</style>

View File

@ -47,7 +47,7 @@
<el-checkbox-group v-model="checkFileList" class="prepare-body-main" <el-checkbox-group v-model="checkFileList" class="prepare-body-main"
:style="{ 'margin-bottom': checkFileList.length > 0 ? '40px' : '0' }"> :style="{ 'margin-bottom': checkFileList.length > 0 ? '40px' : '0' }">
<file-list-item v-for="(item, index) in currentFileList" :key="index" :item="item" :index="index" <file-list-item v-for="(item, index) in currentFileList" :key="index" :item="item" :index="index"
@on-move="onMoveSingleFile" @on-delete="deleteTalk"> @on-move="onMoveSingleFile" @on-delete="deleteTalk" @on-set="openSet">
<el-checkbox label="" :value="item" /> <el-checkbox label="" :value="item" />
</file-list-item> </file-list-item>
</el-checkbox-group> </el-checkbox-group>
@ -58,6 +58,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" />
</div> </div>
</template> </template>
<script setup> <script setup>
@ -77,6 +78,7 @@ import { toTimeText } from '@/utils/date'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile' import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile'
import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue' import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue'
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'
@ -85,7 +87,7 @@ const { ipcRenderer } = window.electron || {}
export default { export default {
name: 'Prepare', name: 'Prepare',
components: { ChooseTextbook, Refresh, uploadDialog, FileListItem, FileOperBatch, MoveFile }, components: { ChooseTextbook, Refresh, uploadDialog, FileListItem, FileOperBatch, MoveFile, SetHomework },
data() { data() {
return { return {
moveFile: [], moveFile: [],
@ -111,7 +113,9 @@ export default {
// //
userStore: '', userStore: '',
entpcourseid: '', entpcourseid: '',
timerId: null timerId: null,
//
setDialog: false
} }
}, },
computed: { computed: {
@ -265,6 +269,9 @@ export default {
this.uploadData.levelThirdId = cata[2] this.uploadData.levelThirdId = cata[2]
this.uploadData.textbookId = data.textBook.curBookId this.uploadData.textbookId = data.textBook.curBookId
this.asyncAllFile() this.asyncAllFile()
if(this.timerId){
clearInterval(this.timerId)
}
if (this.uploadData.levelSecondId) { if (this.uploadData.levelSecondId) {
// ID // ID
const res = await this.getChapterId() const res = await this.getChapterId()
@ -361,6 +368,13 @@ export default {
this.currentFileList = cloneDeep(ary) this.currentFileList = cloneDeep(ary)
}) })
}, },
//
openSet(){
this.setDialog = true
},
closeHomework(){
this.setDialog = false
},
// PDF- // PDF-
navtoPdf() { navtoPdf() {
createWindow('open-PDF', { url: '/classBegins/index' }) createWindow('open-PDF', { url: '/classBegins/index' })