Merge branch 'main' into zhuhao_dev

This commit is contained in:
朱浩 2024-08-12 16:53:44 +08:00
commit 732e4c9a64
10 changed files with 281 additions and 94 deletions

View File

@ -42,7 +42,7 @@
</template>
<script setup>
import { onMounted, ref, nextTick, toRaw, reactive } from 'vue';
import { onMounted, ref, nextTick, toRaw, reactive,watch } from 'vue';
import useUserStore from '@/store/modules/user'
import { listEvaluation } from '@/api/subject'
@ -102,21 +102,11 @@ const getSubjectContent = async () => {
}
let data;
if (localStorage.getItem('evaluationList')) {
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
data = evaluationList.value
treeLoading.value = false
}
else {
try {
const { rows } = await listEvaluation(params)
localStorage.setItem('evaluationList', JSON.stringify(rows))
evaluationList.value = rows
data = rows
} finally {
treeLoading.value = false
}
}
const { rows } = await listEvaluation(params)
localStorage.setItem('evaluationList', JSON.stringify(rows))
evaluationList.value = rows
data = rows
treeLoading.value = false
//
await getSubject()
@ -266,14 +256,10 @@ const transData = (data) => {
//
const getSubject = async () => {
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))
}
const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 })
subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject)
localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
//
if(!subjectList.value.length) return
@ -284,11 +270,11 @@ const getSubject = async () => {
}
const isHaveUnit = (id) => {
return evaluationList.value.some(item => {
return item.rootid == id
})
}
// const isHaveUnit = (id) => {
// return evaluationList.value.some(item => {
// return item.rootid == id
// })
// }
const handleNodeClick = (data, node) => {
@ -319,7 +305,9 @@ const handleNodeClick = (data, node) => {
currentNode.data = curData
emit('nodeClick', curData)
}
watch(() => userStore.edusubject, () => {
console.log(userStore.edusubject,'userStore.edusubject')
})
onMounted(() => {
getSubjectContent()
})

View File

@ -118,18 +118,11 @@ const getSubjectContent = async () => {
entpcourseedituserid: userId,
pageSize: 500
}
let data;
if (localStorage.getItem('evaluationList')) {
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
data = evaluationList.value
}
else {
const { rows } = await listEvaluation(params)
localStorage.setItem('evaluationList', JSON.stringify(rows))
evaluationList.value = rows
data = rows
}
const { rows } = await listEvaluation(params)
localStorage.setItem('evaluationList', JSON.stringify(rows))
evaluationList.value = rows
data = rows
//
getSubject()
@ -428,4 +421,4 @@ onMounted(() => {
color: #409EFF;
font-weight: bold
}
</style>
</style>

View File

@ -0,0 +1,124 @@
import useUserStore from '@/store/modules/user'
import { homeworklist, listEntpcourse } from '@/api/teaching/classwork'
const userStore = useUserStore()
// 当前选中教材章节节点
let curNode = null
// 查询作业列表所需要的ID
let chapterId = null
export const useGetHomework = async (node) => {
/**
* node
*/
if (!node) return
curNode = node
// 获取查询作业列表所需ID
let { rows } = await getChapterId()
if (rows.length > 0) {
chapterId = rows[0].id
} else {
// 没有则 传教新的entpcourse 再次查询
await createEntpcourse()
let { rows } = await getChapterId()
chapterId = rows[0].id
}
return await getHomeWorkList()
}
// 根据教材章节ID 查询作业列表所需ID
const getChapterId = () => {
return listEntpcourse({
evalid: curNode.id ? curNode.id : curNode.parentNode.id,
edituserid: userStore.user.userId,
pageSize: 500
})
}
// 创建新的entpcourse
const createEntpcourse = () => {
// 参照 web AIx 传入参数
var cform = {}
cform.entpid = userStore.deptId
cform.level = 1
cform.parentid = 0
cform.dictid = 0
cform.evalid = curNode.id
cform.evalparentid = 0
cform.edusubject = curNode.edusubject
cform.edudegree = curNode.edudegree
cform.edustage = curNode.edustage
cform.coursetype = '课标学科'
cform.coursetitle = curNode.itemtitle
cform.coursedesc = ''
cform.status = ''
cform.dflag = 0
cform.edituserid = userStore.userId
cform.createblankfile = 'yes'
return addEntpcourse(cform)
}
const getHomeWorkList = async () => {
return await homeworklist({
entpcourseid: chapterId,
edituserid: userStore.user.userId,
pageSize: 100
}).then((res) => {
//以下代码 参照AIx web端 作业布置
let list = []
for (var i = 0; i < res.rows.length; i++) {
res.rows[i].taskconfig = []
// 找child
for (var j = 0; j < res.rows.length; j++) {
if (res.rows[j].parentid == res.rows[i].id) {
var ss = []
if (res.rows[j].classworkdatastudentids != null) {
ss = JSON.parse('[' + res.rows[j].classworkdatastudentids + ']')
}
var js = {
id: res.rows[j].id,
classid: res.rows[j].classid,
classcaption: res.rows[j].classcaption,
parentid: 0,
worktype: '',
workkey: res.rows[j].workkey,
worktag: '',
entpcourseid: 0,
evalid: 0,
edusubject: '',
edudegree: '',
workdate: '',
title: '',
workcodes: '',
studentlist: ss,
deaddate: res.rows[j].deaddate,
timelength: res.rows[j].timelength,
weights: res.rows[j].weights,
feedtype: res.rows[j].feedtype
}
res.rows[i].taskconfig.push(js)
}
}
res.rows[i].fileShowName = res.rows[i].uniquekey
// 注意slideid>0的这一些作业是添加到PPT页面的所以在作业管理中不能出现
// 2024-05-15酉阳jackyshen
if (res.rows[i].classid == 0 && res.rows[i].slideid == 0) {
list.push(res.rows[i])
}
// 如果是习题训练任务,则检查一共有多少道
if (res.rows[i].entpcourseworklist != '') {
res.rows[i].entpcourseworklistarray = JSON.parse('[' + res.rows[i].entpcourseworklist + ']')
} else {
res.rows[i].entpcourseworklistarray = []
}
}
return list
})
}

View File

@ -31,7 +31,7 @@ export const constantRoutes = [
path: '/prepare',
component: () => import('@/views/prepare/index.vue'),
name: 'prepare',
meta: {title: '备课',keepAlive:true}
meta: {title: '备课'}
},
{
path: '/teach',

View File

@ -9,6 +9,10 @@ export const useToolState = defineStore('tool', {
showBoardAll: false, // 全屏画板-是否显示
isPdfWin: false, // pdf窗口是否打开
isToolWin: false, // 工具窗口是否打开
curSubjectNode: {
data: {}, // 当前教材节点 (包含当前教材 单元)
querySearch: {} // 查询资源所需参数
}
}),
actions: {
}

View File

@ -1,6 +1,6 @@
<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;">
style="border-radius: 10px; padding: 10px 15px;">
<template #header>
<div class="homerwork-header flex">
<span>{{ title }}</span>
@ -288,7 +288,6 @@ export default {
modelValue(val) {
this.dialogVisible = val
if (val) {
console.log(this.row,10000)
this.getGradeList()
}
}

View File

@ -169,13 +169,13 @@ export default {
setTimeout(this.initReserv, 500)
})
},
activated() {
if (this.uploadData.textbookId !== null) {
this.asyncAllFile()
this.initHomeWork()
this.initReserv()
}
},
// activated() {
// if (this.uploadData.textbookId !== null) {
// this.asyncAllFile()
// this.initHomeWork()
// this.initReserv()
// }
// },
methods: {
initReserv() {
getSelfReserv().then((res) => {
@ -355,6 +355,9 @@ export default {
this.uploadData.levelSecondId = cata[1]
this.uploadData.levelThirdId = cata[2]
this.uploadData.textbookId = data.textBook.curBookId
const toolStore = useToolState()
toolStore.curSubjectNode.data = data
toolStore.curSubjectNode.querySearch = this.uploadData
this.initHomeWork()
await this.asyncAllFile()
@ -421,6 +424,7 @@ export default {
},
// ID ID
getChapterId() {
console.log(this.userStore,'this.userStore')
return listEntpcourse({
evalid: this.uploadData.levelSecondId,
edituserid: this.userStore.userId,
@ -431,7 +435,7 @@ export default {
createTimer() {
this.timerId = setInterval(() => {
this.getHomeWorkList()
}, 1500)
}, 2500)
},
//
getHomeWorkList() {

View File

@ -34,6 +34,8 @@
import { ref, getCurrentInstance } from 'vue'
import { updateUserProfile } from '@/api/system/user'
import { listEvaluation } from '@/api/subject/index'
import useUserStore from '@/store/modules/user'
import {ElMessage} from 'element-plus'
const props = defineProps({
user: {
@ -42,6 +44,7 @@ const props = defineProps({
})
const { proxy } = getCurrentInstance()
const userStore = useUserStore()
const rules = ref({
nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
@ -96,7 +99,17 @@ function submit() {
if (valid) {
console.log(props.user)
updateUserProfile(props.user).then((response) => {
proxy.$modal.msgSuccess('修改成功')
if(response.code == 200){
userStore.getInfo().then(res => {
if(res.code === 200){
ElMessage.success('修改成功')
}else{
ElMessage.error(response.msg)
}
})
}else{
ElMessage.error(response.msg)
}
})
}
})

View File

@ -8,7 +8,7 @@
<h3 class="title">{{ lesson }}</h3>
<div class="grade">{{ usertore.edusubject }}</div>
</div>
<!-- <i class="iconfont icon-xiangyou"></i> -->
<i class="iconfont icon-xiangyou" @click="showLeft = !showLeft"></i>
</div>
<div class="homework-list" v-loading="loading">
<el-scrollbar height="360px">
@ -48,16 +48,16 @@
<SetHomework v-model="setDialog" :title="'推送作业'" :entpcourseid="entpcourseid" :row="curRow"
@on-close="closeHomework" />
</div>
<div class="homework" @click="showLeft = !showLeft" v-else>
<div class="homework flex" v-else>
<div class="unit-top flex">
<div class="unit-top-left">
<div class="unit-top-left" @click="showLeft = !showLeft">
<i class="iconfont icon-xiangzuo"></i>
<span>返回</span>
</div>
<span class="unit-top-center">选择目录</span>
</div>
<div>
<!-- <Lesson/> -->
<div class="unit-content">
<Lesson @changeChapter="changeChapter" />
</div>
</div>
</transition>
@ -72,10 +72,12 @@ import { homeworklist } from '@/api/teaching/classwork'
import { getSmarttalkPage, getPrepareById } from '@/api/file'
import SetHomework from '@/views/prepare/container/set-homework.vue'
import FileImage from '@/components/file-image/index.vue'
import { useGetHomework } from '@/hooks/useGetHomework'
import { ipcMsgSend } from '@/utils/tool'
import { useToolState } from '@/store/modules/tool'
import { asyncLocalFile } from '@/utils/talkFile'
import Lesson from './lesson.vue';
import { parseCataByNode } from '@/utils/talkFile'
const { ipcRenderer } = window.electron || {}
const route = useRoute();
@ -108,13 +110,28 @@ const closeHomework = () => {
setDialog.value = false
}
const changeChapter = async (data)=>{
const res = await useGetHomework(data)
dataList.value = res
let cata = parseCataByNode(data)
toolStore.curSubjectNode.querySearch.levelFirstId = cata[0]
toolStore.curSubjectNode.querySearch.levelSecondId = cata[1]
lesson.value = data.label
showLeft.value = !showLeft.value
getResource()
}
//
const getResource = () => {
let data = toRaw(toolStore.curSubjectNode)
data.orderByColumn = 'uploadTime'
data.isAsc = 'desc'
data.pageSize = 500
getSmarttalkPage(data).then(res => {
let querySearch = toRaw(toolStore.curSubjectNode).querySearch
querySearch.orderByColumn = 'uploadTime'
querySearch.isAsc = 'desc'
querySearch.pageSize = 500
getSmarttalkPage(querySearch).then(res => {
resourceList.value = res.rows
})
@ -210,9 +227,9 @@ onMounted(() => {
entpcourseid.value = route.query.entpcourseid
lesson.value = route.query.label
getHomework()
setTimeout(() => {
setTimeout(()=>{
getResource()
}, 5000)
},5000)
})
</script>
@ -224,8 +241,9 @@ onMounted(() => {
.homework {
width: 100%;
height: 100%;
position: absolute;
flex-direction: column;
}
.homework-content {
@ -317,6 +335,8 @@ onMounted(() => {
.unit-top-center{
margin: 0 auto;
}
}
.unit-content{
height: calc(100% - 50px);
}
</style>

View File

@ -1,5 +1,6 @@
<template>
<div>
<el-scrollbar>
<el-tree ref="refTree" :data="treeData" :props="defaultProps" node-key="id"
:default-expanded-keys="defaultExpandedKeys" :current-node-key="currentNodeId" highlight-current
@node-click="handleNodeClick">
@ -7,14 +8,16 @@
<span :title="node.label" class="tree-label">{{ node.label }}</span>
</template>
</el-tree>
</div>
</el-scrollbar>
</template>
<script setup>
import { ref, onMounted, nextTick, markRaw, toRaw } from 'vue'
import { useToolState } from '@/store/modules/tool'
import { parseCataByNode } from '@/utils/talkFile'
const emit = defineEmits(['changeChapter'])
const toolStore = useToolState()
const treeData = ref([])
const defaultProps = {
@ -43,12 +46,9 @@ const getTreeData = () => {
//
let volumeTwo = evaluationList.value.filter(item => item.level == 1 && item.semester == '下册')
//
console.log(volumeOne,1)
console.log(volumeTwo,2)
let upData = transData(volumeOne)
let downData = transData(volumeTwo)
console.log(upData)
console.log(downData)
if(upData.length && downData.length){
treeData.value = [...upData,...downData]
}
@ -61,28 +61,50 @@ const getTreeData = () => {
}
nextTick(() => {
let defaultKey
if(toolStore.curSubjectNode.levelSecondId){
defaultKey = toolStore.curSubjectNode.levelSecondId
if(toolStore.curSubjectNode.querySearch.levelSecondId){
defaultKey = toolStore.curSubjectNode.querySearch.levelSecondId
}
else{
defaultKey = toolStore.curSubjectNode.levelFirstId
defaultKey = toolStore.curSubjectNode.querySearch.levelFirstId
}
defaultExpandedKeys.value = defaultKey
// currentNode.data = getLastLevelData(treeData.value)[0]
// currentNodeId.value = getLastLevelData(treeData.value)[0].id
// currentNodeName.value = getLastLevelData(treeData.value)[0].label
currentNodeId.value = defaultKey
})
}
const handleNodeClick = ()=>{}
const handleNodeClick = (data, node) => {
/**
* data : 当前节点数据
* node : 当前节点对象 包含当前节点所有数据 parent属性 指向父节点Node对象
*/
const nodeData = data;
const parentNode = node.parent.data;
if (Array.isArray(parentNode)) {
nodeData.parentNode = null
}
else {
nodeData.parentNode = parentNode
}
emit('changeChapter', toRaw(nodeData))
}
// ID ID
const getChapterId = () => {
return listEntpcourse({
evalid: this.uploadData.levelSecondId,
edituserid: this.userStore.userId,
pageSize: 500
})
}
const transData = (data) => {
let ary = []
data.forEach(item => {
let obj = {}
console.log(item.rootid, '==========>',curBookId.value)
if (item.rootid == curBookId.value) {
obj.label = item.itemtitle
obj.id = item.id
@ -114,16 +136,36 @@ const transData = (data) => {
onMounted(()=>{
// console.log(toolStore.curSubjectNode,111)
// let data = toRaw(toolStore.curSubjectNode)
// console.log(data,222)
// curBookId.value = toolStore.curSubjectNode.textbookId
// getTreeData()
setTimeout(()=>{
let data = toRaw(toolStore.curSubjectNode)
curBookId.value = data.data.textBook.curBookId
getTreeData()
},500)
})
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.el-tree{
background-color: #121212
}
:deep(.el-tree-node) {
.el-tree-node__content {
height: 45px;
color: #EFEFEF;
//#368FFF
&:hover {
background-color: #272728;
}
}
}
:deep(.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content) {
background-color: #121212 !important;
color: #409EFF
}
:deep(.el-scrollbar__view){
height: 100%;
}
</style>