Merge pull request 'lyc-dev' (#90) from lyc-dev into main
This commit is contained in:
commit
d46b01cca2
|
@ -8,7 +8,7 @@
|
|||
http-equiv="Content-Security-Policy"
|
||||
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>
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
|
||||
<script setup>
|
||||
import { ref, reactive, toRaw, onMounted, nextTick, watch } from 'vue'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { listEvaluation } from '@/api/subject'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
|
@ -66,6 +68,8 @@ const props = defineProps({
|
|||
default: '移动至'
|
||||
}
|
||||
})
|
||||
const userStore = useUserStore()
|
||||
const { edustage, edusubject, userId } = userStore.user
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const bookVisible = ref(false)
|
||||
|
@ -106,10 +110,26 @@ watch(() => props.modelValue, (newVal) => {
|
|||
})
|
||||
|
||||
|
||||
const getSubjectContent = () => {
|
||||
const getSubjectContent = async () => {
|
||||
|
||||
const params = {
|
||||
edusubject,
|
||||
edustage,
|
||||
entpcourseedituserid: userId,
|
||||
pageSize: 500
|
||||
}
|
||||
|
||||
let data;
|
||||
if (localStorage.getItem('evaluationList')) {
|
||||
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
|
||||
let data = evaluationList.value
|
||||
data = evaluationList.value
|
||||
}
|
||||
else {
|
||||
const { rows } = await listEvaluation(params)
|
||||
localStorage.setItem('evaluationList', JSON.stringify(rows))
|
||||
evaluationList.value = rows
|
||||
data = rows
|
||||
}
|
||||
|
||||
//获取教材版本
|
||||
getSubject()
|
||||
|
@ -121,8 +141,18 @@ const getSubjectContent = () => {
|
|||
getTreeData()
|
||||
}
|
||||
|
||||
const getSubject = () => {
|
||||
const getSubject = async () => {
|
||||
subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
|
||||
|
||||
if (localStorage.getItem('subjectList')) {
|
||||
subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
|
||||
}
|
||||
else {
|
||||
const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 })
|
||||
subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject && isHaveUnit(item.id))
|
||||
localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
|
||||
}
|
||||
|
||||
// 默认第一个
|
||||
curBookName.value = subjectList.value[0].itemtitle
|
||||
curBookId.value = subjectList.value[0].id
|
||||
|
@ -297,6 +327,7 @@ onMounted(() => {
|
|||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #000;
|
||||
|
||||
.icon-close {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<div class="item-popover" @click="closePopver(index)">
|
||||
<template v-if="item.uniquekey">
|
||||
<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>
|
||||
<span>布置</span>
|
||||
</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() {
|
||||
return {
|
||||
listenList: []
|
||||
listenList: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -230,6 +230,10 @@ export default {
|
|||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
//布置
|
||||
setHomeWork(item){
|
||||
this.$emit('on-set', item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -47,7 +47,7 @@
|
|||
<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-move="onMoveSingleFile" @on-delete="deleteTalk" @on-set="openSet">
|
||||
<el-checkbox label="" :value="item" />
|
||||
</file-list-item>
|
||||
</el-checkbox-group>
|
||||
|
@ -58,6 +58,7 @@
|
|||
</div>
|
||||
<MoveFile v-model="isMoveDialogOpen" @on-submit="chooseMoveCata" />
|
||||
<uploadDialog v-model="isDialogOpen" @submit-file="submitFile" />
|
||||
<SetHomework v-model="setDialog" @on-close="closeHomework" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
|
@ -77,6 +78,7 @@ import { toTimeText } from '@/utils/date'
|
|||
import { ElMessage } from 'element-plus'
|
||||
import { parseCataByNode, creatPPT, asyncLocalFile } from '@/utils/talkFile'
|
||||
import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue'
|
||||
import SetHomework from './container/set-homework.vue'
|
||||
import outLink from '@/utils/linkConfig'
|
||||
import { createWindow } from '@/utils/tool'
|
||||
import { uniqBy, cloneDeep } from 'lodash'
|
||||
|
@ -85,7 +87,7 @@ const { ipcRenderer } = window.electron || {}
|
|||
|
||||
export default {
|
||||
name: 'Prepare',
|
||||
components: { ChooseTextbook, Refresh, uploadDialog, FileListItem, FileOperBatch, MoveFile },
|
||||
components: { ChooseTextbook, Refresh, uploadDialog, FileListItem, FileOperBatch, MoveFile, SetHomework },
|
||||
data() {
|
||||
return {
|
||||
moveFile: [],
|
||||
|
@ -111,7 +113,9 @@ export default {
|
|||
// 用户信息
|
||||
userStore: '',
|
||||
entpcourseid: '',
|
||||
timerId: null
|
||||
timerId: null,
|
||||
// 布置作业弹窗
|
||||
setDialog: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -363,6 +367,13 @@ export default {
|
|||
this.currentFileList = cloneDeep(ary)
|
||||
})
|
||||
},
|
||||
// 打开布置作业窗口
|
||||
openSet(){
|
||||
this.setDialog = true
|
||||
},
|
||||
closeHomework(){
|
||||
this.setDialog = false
|
||||
},
|
||||
// 打开PDF-课件
|
||||
navtoPdf() {
|
||||
createWindow('open-PDF', { url: '/classBegins/index' })
|
||||
|
|
Loading…
Reference in New Issue