zhuhao_dev #122

Merged
zhuhao merged 5 commits from zhuhao_dev into main 2024-08-13 11:28:29 +08:00
10 changed files with 281 additions and 94 deletions
Showing only changes of commit 732e4c9a64 - Show all commits

View File

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

View File

@ -118,18 +118,11 @@ const getSubjectContent = async () => {
entpcourseedituserid: userId, entpcourseedituserid: userId,
pageSize: 500 pageSize: 500
} }
let data; let data;
if (localStorage.getItem('evaluationList')) {
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
data = evaluationList.value
}
else {
const { rows } = await listEvaluation(params) const { rows } = await listEvaluation(params)
localStorage.setItem('evaluationList', JSON.stringify(rows)) localStorage.setItem('evaluationList', JSON.stringify(rows))
evaluationList.value = rows evaluationList.value = rows
data = rows data = rows
}
// //
getSubject() getSubject()

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', path: '/prepare',
component: () => import('@/views/prepare/index.vue'), component: () => import('@/views/prepare/index.vue'),
name: 'prepare', name: 'prepare',
meta: {title: '备课',keepAlive:true} meta: {title: '备课'}
}, },
{ {
path: '/teach', path: '/teach',

View File

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

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog v-model="dialogVisible" center top="10vh" width="600px" :show-close="false" append-to-body <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> <template #header>
<div class="homerwork-header flex"> <div class="homerwork-header flex">
<span>{{ title }}</span> <span>{{ title }}</span>
@ -288,7 +288,6 @@ export default {
modelValue(val) { modelValue(val) {
this.dialogVisible = val this.dialogVisible = val
if (val) { if (val) {
console.log(this.row,10000)
this.getGradeList() this.getGradeList()
} }
} }

View File

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

View File

@ -34,6 +34,8 @@
import { ref, getCurrentInstance } from 'vue' import { ref, getCurrentInstance } from 'vue'
import { updateUserProfile } from '@/api/system/user' import { updateUserProfile } from '@/api/system/user'
import { listEvaluation } from '@/api/subject/index' import { listEvaluation } from '@/api/subject/index'
import useUserStore from '@/store/modules/user'
import {ElMessage} from 'element-plus'
const props = defineProps({ const props = defineProps({
user: { user: {
@ -42,6 +44,7 @@ const props = defineProps({
}) })
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const userStore = useUserStore()
const rules = ref({ const rules = ref({
nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }], nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
@ -96,7 +99,17 @@ function submit() {
if (valid) { if (valid) {
console.log(props.user) console.log(props.user)
updateUserProfile(props.user).then((response) => { 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> <h3 class="title">{{ lesson }}</h3>
<div class="grade">{{ usertore.edusubject }}</div> <div class="grade">{{ usertore.edusubject }}</div>
</div> </div>
<!-- <i class="iconfont icon-xiangyou"></i> --> <i class="iconfont icon-xiangyou" @click="showLeft = !showLeft"></i>
</div> </div>
<div class="homework-list" v-loading="loading"> <div class="homework-list" v-loading="loading">
<el-scrollbar height="360px"> <el-scrollbar height="360px">
@ -48,16 +48,16 @@
<SetHomework v-model="setDialog" :title="'推送作业'" :entpcourseid="entpcourseid" :row="curRow" <SetHomework v-model="setDialog" :title="'推送作业'" :entpcourseid="entpcourseid" :row="curRow"
@on-close="closeHomework" /> @on-close="closeHomework" />
</div> </div>
<div class="homework" @click="showLeft = !showLeft" v-else> <div class="homework flex" v-else>
<div class="unit-top flex"> <div class="unit-top flex">
<div class="unit-top-left"> <div class="unit-top-left" @click="showLeft = !showLeft">
<i class="iconfont icon-xiangzuo"></i> <i class="iconfont icon-xiangzuo"></i>
<span>返回</span> <span>返回</span>
</div> </div>
<span class="unit-top-center">选择目录</span> <span class="unit-top-center">选择目录</span>
</div> </div>
<div> <div class="unit-content">
<!-- <Lesson/> --> <Lesson @changeChapter="changeChapter" />
</div> </div>
</div> </div>
</transition> </transition>
@ -72,10 +72,12 @@ import { homeworklist } from '@/api/teaching/classwork'
import { getSmarttalkPage, getPrepareById } from '@/api/file' import { getSmarttalkPage, getPrepareById } from '@/api/file'
import SetHomework from '@/views/prepare/container/set-homework.vue' import SetHomework from '@/views/prepare/container/set-homework.vue'
import FileImage from '@/components/file-image/index.vue' import FileImage from '@/components/file-image/index.vue'
import { useGetHomework } from '@/hooks/useGetHomework'
import { ipcMsgSend } from '@/utils/tool' import { ipcMsgSend } from '@/utils/tool'
import { useToolState } from '@/store/modules/tool' import { useToolState } from '@/store/modules/tool'
import { asyncLocalFile } from '@/utils/talkFile' import { asyncLocalFile } from '@/utils/talkFile'
import Lesson from './lesson.vue'; import Lesson from './lesson.vue';
import { parseCataByNode } from '@/utils/talkFile'
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
const route = useRoute(); const route = useRoute();
@ -108,13 +110,28 @@ const closeHomework = () => {
setDialog.value = false 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 = () => { const getResource = () => {
let data = toRaw(toolStore.curSubjectNode) let querySearch = toRaw(toolStore.curSubjectNode).querySearch
data.orderByColumn = 'uploadTime'
data.isAsc = 'desc' querySearch.orderByColumn = 'uploadTime'
data.pageSize = 500 querySearch.isAsc = 'desc'
getSmarttalkPage(data).then(res => { querySearch.pageSize = 500
getSmarttalkPage(querySearch).then(res => {
resourceList.value = res.rows resourceList.value = res.rows
}) })
@ -210,9 +227,9 @@ onMounted(() => {
entpcourseid.value = route.query.entpcourseid entpcourseid.value = route.query.entpcourseid
lesson.value = route.query.label lesson.value = route.query.label
getHomework() getHomework()
setTimeout(() => { setTimeout(()=>{
getResource() getResource()
}, 5000) },5000)
}) })
</script> </script>
@ -224,8 +241,9 @@ onMounted(() => {
.homework { .homework {
width: 100%; width: 100%;
height: 100%;
position: absolute; position: absolute;
flex-direction: column;
} }
.homework-content { .homework-content {
@ -317,6 +335,8 @@ onMounted(() => {
.unit-top-center{ .unit-top-center{
margin: 0 auto; margin: 0 auto;
} }
}
.unit-content{
height: calc(100% - 50px);
} }
</style> </style>

View File

@ -1,5 +1,6 @@
<template> <template>
<div>
<el-scrollbar>
<el-tree ref="refTree" :data="treeData" :props="defaultProps" node-key="id" <el-tree ref="refTree" :data="treeData" :props="defaultProps" node-key="id"
:default-expanded-keys="defaultExpandedKeys" :current-node-key="currentNodeId" highlight-current :default-expanded-keys="defaultExpandedKeys" :current-node-key="currentNodeId" highlight-current
@node-click="handleNodeClick"> @node-click="handleNodeClick">
@ -7,14 +8,16 @@
<span :title="node.label" class="tree-label">{{ node.label }}</span> <span :title="node.label" class="tree-label">{{ node.label }}</span>
</template> </template>
</el-tree> </el-tree>
</div> </el-scrollbar>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, nextTick, markRaw, toRaw } from 'vue' import { ref, onMounted, nextTick, markRaw, toRaw } from 'vue'
import { useToolState } from '@/store/modules/tool' import { useToolState } from '@/store/modules/tool'
import { parseCataByNode } from '@/utils/talkFile'
const emit = defineEmits(['changeChapter'])
const toolStore = useToolState() const toolStore = useToolState()
const treeData = ref([]) const treeData = ref([])
const defaultProps = { const defaultProps = {
@ -43,12 +46,9 @@ const getTreeData = () => {
// //
let volumeTwo = evaluationList.value.filter(item => item.level == 1 && item.semester == '下册') let volumeTwo = evaluationList.value.filter(item => item.level == 1 && item.semester == '下册')
// //
console.log(volumeOne,1)
console.log(volumeTwo,2)
let upData = transData(volumeOne) let upData = transData(volumeOne)
let downData = transData(volumeTwo) let downData = transData(volumeTwo)
console.log(upData)
console.log(downData)
if(upData.length && downData.length){ if(upData.length && downData.length){
treeData.value = [...upData,...downData] treeData.value = [...upData,...downData]
} }
@ -61,28 +61,50 @@ const getTreeData = () => {
} }
nextTick(() => { nextTick(() => {
let defaultKey let defaultKey
if(toolStore.curSubjectNode.levelSecondId){ if(toolStore.curSubjectNode.querySearch.levelSecondId){
defaultKey = toolStore.curSubjectNode.levelSecondId defaultKey = toolStore.curSubjectNode.querySearch.levelSecondId
} }
else{ else{
defaultKey = toolStore.curSubjectNode.levelFirstId defaultKey = toolStore.curSubjectNode.querySearch.levelFirstId
} }
defaultExpandedKeys.value = defaultKey currentNodeId.value = defaultKey
// currentNode.data = getLastLevelData(treeData.value)[0]
// currentNodeId.value = getLastLevelData(treeData.value)[0].id
// currentNodeName.value = getLastLevelData(treeData.value)[0].label
}) })
} }
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) => { const transData = (data) => {
let ary = [] let ary = []
data.forEach(item => { data.forEach(item => {
let obj = {} let obj = {}
console.log(item.rootid, '==========>',curBookId.value)
if (item.rootid == curBookId.value) { if (item.rootid == curBookId.value) {
obj.label = item.itemtitle obj.label = item.itemtitle
obj.id = item.id obj.id = item.id
@ -114,16 +136,36 @@ const transData = (data) => {
onMounted(()=>{ onMounted(()=>{
// console.log(toolStore.curSubjectNode,111) setTimeout(()=>{
let data = toRaw(toolStore.curSubjectNode)
// let data = toRaw(toolStore.curSubjectNode) curBookId.value = data.data.textBook.curBookId
// console.log(data,222) getTreeData()
},500)
// curBookId.value = toolStore.curSubjectNode.textbookId
// getTreeData()
}) })
</script> </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>