Merge pull request 'lyc-dev' (#90) from lyc-dev into main

This commit is contained in:
lyc 2024-08-01 11:27:38 +08:00
commit d46b01cca2
5 changed files with 273 additions and 12 deletions

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

@ -55,6 +55,8 @@
<script setup> <script setup>
import { ref, reactive, toRaw, onMounted, nextTick, watch } from 'vue' import { ref, reactive, toRaw, onMounted, nextTick, watch } from 'vue'
import useUserStore from '@/store/modules/user'
import { listEvaluation } from '@/api/subject'
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
@ -66,6 +68,8 @@ const props = defineProps({
default: '移动至' default: '移动至'
} }
}) })
const userStore = useUserStore()
const { edustage, edusubject, userId } = userStore.user
const dialogVisible = ref(false) const dialogVisible = ref(false)
const bookVisible = 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')) 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() getSubject()
@ -121,8 +141,18 @@ const getSubjectContent = () => {
getTreeData() getTreeData()
} }
const getSubject = () => { const getSubject = async () => {
subjectList.value = JSON.parse(localStorage.getItem('subjectList')) 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 curBookName.value = subjectList.value[0].itemtitle
curBookId.value = subjectList.value[0].id curBookId.value = subjectList.value[0].id
@ -297,7 +327,8 @@ onMounted(() => {
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
color: #000; color: #000;
.icon-close{
.icon-close {
cursor: pointer; cursor: pointer;
} }
} }

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: {
@ -363,6 +367,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' })