Compare commits
24 Commits
2531c25d7c
...
ac599a2c39
Author | SHA1 | Date |
---|---|---|
朱浩 | ac599a2c39 | |
lyc | fa7a44472b | |
lyc | 00871797bf | |
lyc | 85529ad81f | |
lyc | f9a87143aa | |
zhengdegang | 17ef183741 | |
zdg | d5833f6f03 | |
zdg | c93eeeb308 | |
zhengdegang | 0d48111e50 | |
zdg | ca57e72e9c | |
zhengdegang | 928a1401db | |
zdg | e0d3a6da6a | |
zdg | 1a9b426ec3 | |
lyc | d4cfedf883 | |
lyc | b5fd1f2a9d | |
lyc | c6477d5ca9 | |
lyc | 27ec047981 | |
zhengdegang | 7da4defed4 | |
zdg | 51cb1989a1 | |
zdg | 4ab4d5dff2 | |
lyc | 80d6e1c59c | |
lyc | 75c6777933 | |
朱浩 | a75f151b19 | |
朱浩 | 9e5527d822 |
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "aix-win",
|
"name": "aix-win",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"description": "An Electron application with Vue",
|
"description": "An Electron application with Vue",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "example.com",
|
"author": "example.com",
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
<div class="book-wrap">
|
<div class="book-wrap">
|
||||||
<el-scrollbar height="100%">
|
<el-scrollbar height="100%">
|
||||||
<div class="book-name flex" @click="dialogVisible = true">
|
<div class="book-name flex" @click="dialogVisible = true">
|
||||||
<span>{{ curBookName }}</span>
|
<span>{{ curBook.data.itemtitle }}</span>
|
||||||
<i class="iconfont icon-xiangyou"></i>
|
<i class="iconfont icon-xiangyou"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="book-list" v-loading="treeLoading">
|
<div class="book-list" v-loading="treeLoading">
|
||||||
<el-tree ref="refTree" :data="treeData" accordion :props="defaultProps" node-key="id"
|
<el-tree :data="treeData" accordion :props="defaultProps" node-key="id"
|
||||||
:default-expanded-keys="defaultExpandedKeys" :current-node-key="currentNodeId" highlight-current
|
:default-expanded-keys="defaultExpandedKeys" :current-node-key="curNode.data.id" highlight-current
|
||||||
@node-click="handleNodeClick">
|
@node-click="handleNodeClick">
|
||||||
<template #default="{ node }">
|
<template #default="{ node }">
|
||||||
<span :title="node.label" class="tree-label">{{ node.label }}</span>
|
<span :title="node.label" class="tree-label">{{ node.label }}</span>
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
<div class="textbook-container">
|
<div class="textbook-container">
|
||||||
<el-scrollbar height="450px">
|
<el-scrollbar height="450px">
|
||||||
<div class="textbook-item flex" v-for="item in subjectList" :class="curBookId == item.id ? 'active-item' : ''"
|
<div class="textbook-item flex" v-for="item in subjectList" :class="curBook.data.id == item.id ? 'active-item' : ''"
|
||||||
:key="item.id" @click="changeBook(item)">
|
:key="item.id" @click="changeBook(item)">
|
||||||
<img v-if="item.avartar" :src="item.avartar.indexOf('http') === 0 ? item.avartar : BaseUrl + item.avartar" class="textbook-img" alt="">
|
<img v-if="item.avartar" :src="item.avartar.indexOf('http') === 0 ? item.avartar : BaseUrl + item.avartar" class="textbook-img" alt="">
|
||||||
<div v-else class="textbook-img">
|
<div v-else class="textbook-img">
|
||||||
|
@ -42,173 +42,71 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, nextTick, toRaw, reactive, computed } from 'vue'
|
import { onMounted, ref, nextTick, toRaw, reactive } from 'vue';
|
||||||
import useUserStore from '@/store/modules/user'
|
import { cloneDeep } from 'lodash'
|
||||||
import { listEvaluation } from '@/api/subject'
|
import { useGetSubject } from '@/hooks/useGetSubject'
|
||||||
|
|
||||||
const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
||||||
// 定义要发送的emit事件
|
// 定义要发送的emit事件
|
||||||
const emit = defineEmits(['nodeClick', 'changeBook'])
|
const emit = defineEmits(['nodeClick', 'changeBook'])
|
||||||
// store
|
let useSubject = null
|
||||||
const userStore = useUserStore()
|
|
||||||
const { edustage, edusubject, userId } = userStore.user
|
|
||||||
//
|
|
||||||
const subjectList = ref([])
|
const subjectList = ref([])
|
||||||
const evaluationList = ref([])
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
// 当前教材下面单元内容数据
|
// 当前教材下面单元内容数据
|
||||||
const treeData = ref([])
|
const treeData = ref([])
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'label',
|
label: 'itemtitle',
|
||||||
class: 'textbook-tree'
|
class: 'textbook-tree'
|
||||||
}
|
}
|
||||||
|
// 当前选中的教材
|
||||||
/*let coverImgUrl = computed((item)=>{
|
const curBook = reactive({
|
||||||
if(!item.avartar){
|
data: {}
|
||||||
return ""
|
})
|
||||||
}
|
|
||||||
return item.avartar.indexOf('http') === 0 ? item.avartar : BaseUrl + item.avartar
|
|
||||||
})*/
|
|
||||||
const treeLoading = ref(false)
|
|
||||||
//当前教材ID
|
|
||||||
const curBookId = ref(-1)
|
|
||||||
//当前教材名称
|
|
||||||
const curBookName = ref('')
|
|
||||||
//当前教材封面图
|
|
||||||
const curBookImg = ref('')
|
|
||||||
//当前教材文件路径
|
|
||||||
const curBookPath = ref('')
|
|
||||||
// 上册
|
|
||||||
const volumeOne = ref([])
|
|
||||||
//
|
|
||||||
const volumeTwo = ref([])
|
|
||||||
|
|
||||||
// 当前节点
|
// 当前节点
|
||||||
const currentNode = reactive({
|
const curNode = reactive({
|
||||||
data:{}
|
data:{}
|
||||||
})
|
})
|
||||||
// 当前选中的节点ID
|
const treeLoading = ref(false)
|
||||||
const currentNodeId = ref(0)
|
|
||||||
// 当前选中的节点名称
|
|
||||||
const currentNodeName = ref('')
|
|
||||||
// 默认展开的节点
|
// 默认展开的节点
|
||||||
const defaultExpandedKeys = ref([])
|
const defaultExpandedKeys = ref([])
|
||||||
// tree
|
|
||||||
const refTree = ref(null)
|
|
||||||
|
|
||||||
|
|
||||||
//获取教材下面的单元 + 章节
|
|
||||||
const getSubjectContent = async () => {
|
|
||||||
treeLoading.value = true
|
|
||||||
const params = {
|
|
||||||
edusubject,
|
|
||||||
edustage,
|
|
||||||
// entpcourseedituserid: userId,
|
|
||||||
itemgroup: 'textbook',
|
|
||||||
orderby: 'orderidx asc',
|
|
||||||
pageSize: 10000
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(localStorage.getItem('evaluationList')){
|
|
||||||
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
localStorage.removeItem('defaultExpandedKeys')
|
|
||||||
localStorage.removeItem('currentNodeId')
|
|
||||||
const { rows } = await listEvaluation(params)
|
|
||||||
localStorage.setItem('evaluationList', JSON.stringify(rows))
|
|
||||||
evaluationList.value = rows
|
|
||||||
}
|
|
||||||
|
|
||||||
treeLoading.value = false
|
|
||||||
|
|
||||||
//获取教材版本
|
|
||||||
await getSubject()
|
|
||||||
//上册
|
|
||||||
/**
|
|
||||||
* 不区分上下册
|
|
||||||
* 2024/08/20调整
|
|
||||||
*/
|
|
||||||
// volumeOne.value = data.filter(item => item.level == 1 && item.semester == '上册')
|
|
||||||
// volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '下册')
|
|
||||||
getTreeData()
|
|
||||||
}
|
|
||||||
|
|
||||||
//选择教材
|
//选择教材
|
||||||
const changeBook = ({ id, itemtitle, avartar, fileurl }) => {
|
const changeBook = (data) => {
|
||||||
curBookId.value = id
|
curBook.data = data
|
||||||
curBookName.value = itemtitle
|
|
||||||
curBookImg.value = BaseUrl + avartar
|
|
||||||
curBookPath.value = fileurl
|
|
||||||
|
|
||||||
localStorage.removeItem('defaultExpandedKeys')
|
localStorage.setItem('curBook', JSON.stringify(data))
|
||||||
localStorage.removeItem('currentNodeId')
|
treeData.value = useSubject.getTreeData(data.id)
|
||||||
localStorage.setItem('curBook', JSON.stringify({id, itemtitle, avartar, fileurl}))
|
|
||||||
getTreeData()
|
//切换教材后默认展开第一个并选中
|
||||||
|
nextTick(() =>{
|
||||||
|
defaultExpandedKeys.value = [treeData.value[0].id]
|
||||||
|
curNode.data = getLastLevelData(treeData.value)[0]
|
||||||
|
|
||||||
|
localStorage.setItem('defaultExpandedKeys', JSON.stringify(defaultExpandedKeys.value))
|
||||||
|
localStorage.setItem('curNode',JSON.stringify(curNode.data))
|
||||||
|
emitChangeBook()
|
||||||
|
})
|
||||||
|
// 延迟关闭 视觉上选中
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
const getTreeData = () => {
|
|
||||||
//数据过滤
|
|
||||||
let upData = transData(evaluationList.value)
|
|
||||||
|
|
||||||
if(upData.length){
|
|
||||||
treeData.value = [...upData]
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
treeData.value = []
|
|
||||||
return
|
|
||||||
}
|
|
||||||
nextTick(() => {
|
|
||||||
|
|
||||||
let defaultCurNodeId = localStorage.getItem('currentNodeId')
|
|
||||||
if(defaultCurNodeId){
|
|
||||||
defaultCurNodeId = JSON.parse(defaultCurNodeId)
|
|
||||||
const data = findNode(defaultCurNodeId)
|
|
||||||
currentNode.data = findNode(defaultCurNodeId)
|
|
||||||
currentNodeId.value = data.id
|
|
||||||
currentNodeName.value = data.label
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
defaultExpandedKeys.value = [treeData.value[0].id]
|
|
||||||
currentNode.data = getLastLevelData(treeData.value)[0]
|
|
||||||
currentNodeId.value = getLastLevelData(treeData.value)[0].id
|
|
||||||
currentNodeName.value = getLastLevelData(treeData.value)[0].label
|
|
||||||
}
|
|
||||||
|
|
||||||
emitChangeBook()
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const emitChangeBook = () => {
|
|
||||||
let curNode = {
|
|
||||||
id: currentNodeId.value,
|
|
||||||
label: currentNodeName.value,
|
|
||||||
itemtitle: currentNode.data.itemtitle,
|
|
||||||
edudegree: currentNode.data.edudegree,
|
|
||||||
edustage: currentNode.data.edustage,
|
|
||||||
edusubject: currentNode.data.edusubject,
|
|
||||||
}
|
|
||||||
let parentNode = findParentByChildId(treeData.value, currentNodeId.value)
|
|
||||||
curNode.parentNode = toRaw(parentNode)
|
|
||||||
|
|
||||||
|
const emitChangeBook = async () => {
|
||||||
|
let curData = cloneDeep(toRaw(curNode.data))
|
||||||
|
let parentNode = findParentByChildId(treeData.value, curData.id)
|
||||||
|
curData.parentNode = toRaw(parentNode)
|
||||||
const data = {
|
const data = {
|
||||||
textBook: {
|
textBook: {
|
||||||
curBookId: curBookId.value,
|
curBookId: curBook.data.id,
|
||||||
curBookName: curBookName.value,
|
curBookName: curBook.data.itemtitle,
|
||||||
curBookImg: curBookImg.value,
|
curBookImg: BaseUrl + curBook.data.avartar,
|
||||||
curBookPath: curBookPath.value
|
curBookPath: curBook.data.fileurl
|
||||||
},
|
},
|
||||||
node: curNode
|
node: curData
|
||||||
}
|
}
|
||||||
|
|
||||||
localStorage.setItem('defaultExpandedKeys', JSON.stringify(defaultExpandedKeys.value))
|
|
||||||
localStorage.setItem('currentNodeId', JSON.stringify(currentNodeId.value))
|
|
||||||
emit('changeBook', data)
|
emit('changeBook', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,122 +154,77 @@ const findParentByChildId = (treeData, targetNodeId) => {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const findNode = (id) =>{
|
|
||||||
if(!id) return
|
|
||||||
return evaluationList.value.find( item => item.id == id)
|
|
||||||
}
|
|
||||||
|
|
||||||
const transData = (data) => {
|
|
||||||
let ary = []
|
|
||||||
data.forEach(item => {
|
|
||||||
let obj = {}
|
|
||||||
// 根据当前教材ID 过滤出对应的单元、章节
|
|
||||||
if (item.rootid == curBookId.value) {
|
|
||||||
if(item.level == 1){
|
|
||||||
obj.label = item.itemtitle
|
|
||||||
obj.id = item.id
|
|
||||||
obj.itemtitle = item.itemtitle
|
|
||||||
obj.edudegree = item.edudegree
|
|
||||||
obj.edustage = item.edustage
|
|
||||||
obj.edusubject = item.edusubject
|
|
||||||
let ary2 = []
|
|
||||||
evaluationList.value.forEach(el => {
|
|
||||||
let obj2 = {}
|
|
||||||
if (item.id == el.parentid) {
|
|
||||||
obj2 = {
|
|
||||||
label: el.itemtitle,
|
|
||||||
id: el.id,
|
|
||||||
itemtitle : el.itemtitle,
|
|
||||||
edudegree : el.edudegree,
|
|
||||||
edustage : el.edustage,
|
|
||||||
edusubject : el.edusubject,
|
|
||||||
}
|
|
||||||
ary2.push(obj2)
|
|
||||||
}
|
|
||||||
obj.children = ary2
|
|
||||||
})
|
|
||||||
ary.push(obj)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return ary
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取教材
|
|
||||||
const getSubject = async () => {
|
|
||||||
if(localStorage.getItem('subjectList')){
|
|
||||||
subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
const { rows } = await listEvaluation({ itemkey: "version", edusubject, edustage, pageSize: 10000,orderby: 'orderidx asc', })
|
|
||||||
|
|
||||||
// subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject)
|
|
||||||
subjectList.value = rows
|
|
||||||
localStorage.setItem('subjectList', JSON.stringify(subjectList.value))
|
|
||||||
}
|
|
||||||
|
|
||||||
// 默认第一个
|
|
||||||
if(!subjectList.value.length) return
|
|
||||||
let curBook = localStorage.getItem('curBook')
|
|
||||||
if(curBook){
|
|
||||||
curBook = JSON.parse(curBook)
|
|
||||||
curBookName.value = curBook.itemtitle
|
|
||||||
curBookId.value = curBook.id
|
|
||||||
curBookImg.value = BaseUrl + curBook.avartar
|
|
||||||
curBookPath.value = curBook.fileurl
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
curBookName.value = subjectList.value[0].itemtitle
|
|
||||||
curBookId.value = subjectList.value[0].id
|
|
||||||
curBookImg.value = BaseUrl + subjectList.value[0].avartar
|
|
||||||
curBookPath.value = subjectList.value[0].fileurl
|
|
||||||
localStorage.setItem('curBookId', curBookId.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const isHaveUnit = (id) => {
|
|
||||||
return evaluationList.value.some(item => {
|
|
||||||
return item.rootid == id
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const handleNodeClick = (data, node) => {
|
const handleNodeClick = (data, node) => {
|
||||||
/**
|
/**
|
||||||
* data : 当前节点数据
|
* data : 当前节点数据
|
||||||
* node : 当前节点对象 包含当前节点所有数据 parent属性 指向父节点Node对象
|
* node : 当前节点对象 包含当前节点所有数据 parent属性 指向父节点Node对象
|
||||||
*/
|
*/
|
||||||
|
const nodeData = cloneDeep(toRaw(data));
|
||||||
const nodeData = data;
|
|
||||||
const parentNode = node.parent.data;
|
const parentNode = node.parent.data;
|
||||||
|
// parentNode 为数组 则点击的是一级节点
|
||||||
if (Array.isArray(parentNode)) {
|
if (Array.isArray(parentNode)) {
|
||||||
|
//
|
||||||
nodeData.parentNode = null
|
nodeData.parentNode = null
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nodeData.parentNode = parentNode
|
// 否则 点击的为二级节点 parentNode 为它的父级节点
|
||||||
|
nodeData.parentNode = toRaw(parentNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
let curData = {
|
let curData = {
|
||||||
textBook: {
|
textBook: {
|
||||||
curBookId: curBookId.value,
|
curBookId: curBook.data.id,
|
||||||
curBookName: curBookName.value,
|
curBookName: curBook.data.itemtitle,
|
||||||
curBookImg: curBookImg.value,
|
curBookImg: BaseUrl + curBook.data.avartar,
|
||||||
curBookPath: curBookPath.value
|
curBookPath: curBook.data.fileurl
|
||||||
},
|
},
|
||||||
node: toRaw(nodeData)
|
node: toRaw(nodeData)
|
||||||
}
|
}
|
||||||
currentNode.data = curData
|
localStorage.setItem('defaultExpandedKeys', parentNode ? JSON.stringify([parentNode.id]) : JSON.stringify([data.id]))
|
||||||
|
localStorage.setItem('curNode', JSON.stringify(nodeData))
|
||||||
localStorage.setItem('defaultExpandedKeys', nodeData.parentNode ? JSON.stringify([parentNode.id]) : JSON.stringify([data.id]))
|
|
||||||
localStorage.setItem('currentNodeId', JSON.stringify(data.id))
|
|
||||||
|
|
||||||
emit('nodeClick', curData)
|
emit('nodeClick', curData)
|
||||||
|
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted( async () => {
|
||||||
getSubjectContent()
|
treeLoading.value = true
|
||||||
|
|
||||||
|
try{
|
||||||
|
useSubject = await useGetSubject()
|
||||||
|
subjectList.value = useSubject.subjectList
|
||||||
|
|
||||||
|
let book = localStorage.getItem('curBook')
|
||||||
|
if(book){
|
||||||
|
book = JSON.parse(book)
|
||||||
|
curBook.data = book
|
||||||
|
treeData.value = useSubject.getTreeData(book.id)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
curBook.data = useSubject.subjectList[0]
|
||||||
|
treeData.value = useSubject.treeData
|
||||||
|
}
|
||||||
|
// 设置展开并选中
|
||||||
|
nextTick(() =>{
|
||||||
|
// 取缓存
|
||||||
|
let node = localStorage.getItem('curNode')
|
||||||
|
if(node){
|
||||||
|
curNode.data = JSON.parse(node)
|
||||||
|
defaultExpandedKeys.value = JSON.parse(localStorage.getItem('defaultExpandedKeys'))
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
defaultExpandedKeys.value = [treeData.value[0].id]
|
||||||
|
curNode.data = getLastLevelData(treeData.value)[0]
|
||||||
|
//缓存记录当前展开以及选中节点
|
||||||
|
localStorage.setItem('defaultExpandedKeys', JSON.stringify(defaultExpandedKeys.value))
|
||||||
|
localStorage.setItem('curNode', JSON.stringify(curNode.data))
|
||||||
|
}
|
||||||
|
emitChangeBook()
|
||||||
|
})
|
||||||
|
|
||||||
|
} finally{
|
||||||
|
treeLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -137,7 +137,7 @@ const getSubjectContent = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const getSubject = async () => {
|
const getSubject = async () => {
|
||||||
subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
|
|
||||||
|
|
||||||
if (localStorage.getItem('subjectList')) {
|
if (localStorage.getItem('subjectList')) {
|
||||||
subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
|
subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
|
import { listEvaluation } from '@/api/subject'
|
||||||
|
|
||||||
|
export const useGetSubject = async () =>{
|
||||||
|
|
||||||
|
// user store
|
||||||
|
const userStore = useUserStore()
|
||||||
|
const { edustage, edusubject, userId } = userStore.user
|
||||||
|
const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
||||||
|
// 章节List
|
||||||
|
const unitList = ref([])
|
||||||
|
// 教材List
|
||||||
|
let subjectList = null
|
||||||
|
// 单元章节树结构
|
||||||
|
let treeData = null
|
||||||
|
|
||||||
|
|
||||||
|
// 根据 学科 + 学段 获取所有单元章节
|
||||||
|
const getSubjectUnit = async () =>{
|
||||||
|
let strUnit = localStorage.getItem('unitList')
|
||||||
|
if(strUnit){
|
||||||
|
unitList.value = JSON.parse(strUnit)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
const unitParams = {
|
||||||
|
edusubject,
|
||||||
|
edustage,
|
||||||
|
itemgroup: 'textbook',
|
||||||
|
orderby: 'orderidx asc',
|
||||||
|
pageSize: 10000
|
||||||
|
}
|
||||||
|
const { rows } = await listEvaluation(unitParams)
|
||||||
|
unitList.value = rows
|
||||||
|
localStorage.setItem('unitList', JSON.stringify(rows))
|
||||||
|
}
|
||||||
|
|
||||||
|
await getSubject()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取 学科 + 学段 获取教材
|
||||||
|
const getSubject = async () =>{
|
||||||
|
|
||||||
|
let strSubject = localStorage.getItem('subjectList')
|
||||||
|
if(strSubject){
|
||||||
|
subjectList = JSON.parse(strSubject)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
const subjectParams = {
|
||||||
|
itemkey: "version",
|
||||||
|
edusubject,
|
||||||
|
edustage,
|
||||||
|
pageSize: 10000,
|
||||||
|
orderby: 'orderidx asc'
|
||||||
|
}
|
||||||
|
const { rows } = await listEvaluation(subjectParams)
|
||||||
|
subjectList = rows
|
||||||
|
localStorage.setItem('subjectList', JSON.stringify(rows))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 默认选中第一个教材
|
||||||
|
if(subjectList && subjectList.length){
|
||||||
|
treeData = getTreeData(subjectList[0].id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 单元章节数据转为“树”结构
|
||||||
|
const getTreeData = (bookId) =>{
|
||||||
|
// 根据当前教材的id 查找出对应的章节
|
||||||
|
let data = unitList.value.filter(item => item.rootid == bookId && item.level == 1)
|
||||||
|
data.forEach( item => {
|
||||||
|
item.children = unitList.value.filter( item2 => item2.parentid == item.id && item2.level == 2)
|
||||||
|
})
|
||||||
|
return data
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
await getSubjectUnit()
|
||||||
|
|
||||||
|
return { subjectList, treeData, getTreeData }
|
||||||
|
|
||||||
|
}
|
|
@ -37,7 +37,7 @@
|
||||||
<div class="user-info flex">
|
<div class="user-info flex">
|
||||||
<span class="user-name">{{ userStore.user.nickName }}</span>
|
<span class="user-name">{{ userStore.user.nickName }}</span>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="user-depname">{{ userStore.user.deptName }}</div>
|
|
||||||
<el-dropdown @command="changeSubject">
|
<el-dropdown @command="changeSubject">
|
||||||
<div class="user-subject">{{ userStore.user.edusubject }}
|
<div class="user-subject">{{ userStore.user.edusubject }}
|
||||||
<el-icon class="el-icon--right"><arrow-down />
|
<el-icon class="el-icon--right"><arrow-down />
|
||||||
|
@ -52,6 +52,7 @@
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="user-depname">{{ userStore.user.deptName }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -72,6 +73,7 @@ import { updateUserInfo } from '@/api/system/user'
|
||||||
import outLink from '@/utils/linkConfig'
|
import outLink from '@/utils/linkConfig'
|
||||||
import logoIco from '@/assets/images/logo.png'
|
import logoIco from '@/assets/images/logo.png'
|
||||||
import { listEvaluation } from '@/api/classManage/index'
|
import { listEvaluation } from '@/api/classManage/index'
|
||||||
|
import { clearBookInfo } from '@/utils/ruoyi'
|
||||||
|
|
||||||
const { ipcRenderer } = window.electron || {}
|
const { ipcRenderer } = window.electron || {}
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
@ -190,6 +192,7 @@ function setLayout() {
|
||||||
}
|
}
|
||||||
// 切换学科
|
// 切换学科
|
||||||
const changeSubject = async (command) =>{
|
const changeSubject = async (command) =>{
|
||||||
|
clearBookInfo()
|
||||||
const { userId, userName, phonenumber, plainpwd } = userStore.user
|
const { userId, userName, phonenumber, plainpwd } = userStore.user
|
||||||
const data = {
|
const data = {
|
||||||
userId,
|
userId,
|
||||||
|
@ -200,8 +203,6 @@ const changeSubject = async (command) =>{
|
||||||
await updateUserInfo(data)
|
await updateUserInfo(data)
|
||||||
await userStore.login({username: phonenumber, password: plainpwd})
|
await userStore.login({username: phonenumber, password: plainpwd})
|
||||||
await userStore.getInfo()
|
await userStore.getInfo()
|
||||||
localStorage.removeItem('subjectList')
|
|
||||||
localStorage.removeItem('evaluationList')
|
|
||||||
router.go()
|
router.go()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +332,7 @@ onMounted(() => {
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
|
|
||||||
.user-depname {
|
.user-depname {
|
||||||
margin-right: 5px;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-subject {
|
.user-subject {
|
||||||
|
@ -351,8 +352,8 @@ onMounted(() => {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.user-avatar {
|
.user-avatar {
|
||||||
width: 35px;
|
width: 45px;
|
||||||
height: 35px;
|
height: 45px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ function stateSyncWatch(storeName, newState) {
|
||||||
// console.log('state-change-diffData', diffData)
|
// console.log('state-change-diffData', diffData)
|
||||||
try {
|
try {
|
||||||
for(const key in diffData) {
|
for(const key in diffData) {
|
||||||
const value = diffData[key]
|
const value = diffData[key] || null
|
||||||
const newValue = {} // 重新组装pinia需要的数据 {a:{b:1}} 这种
|
const newValue = {} // 重新组装pinia需要的数据 {a:{b:1}} 这种
|
||||||
const keyArr = key.split('.') || []
|
const keyArr = key.split('.') || []
|
||||||
keyArr.reduce((o,c,i)=>{o[c] = i === keyArr.length-1 ? value : {};return o[c]}, newValue)
|
keyArr.reduce((o,c,i)=>{o[c] = i === keyArr.length-1 ? value : {};return o[c]}, newValue)
|
||||||
|
@ -172,6 +172,8 @@ const getObjValue = (obj, key) => {
|
||||||
const findDifferences = (obj1, obj2) => {
|
const findDifferences = (obj1, obj2) => {
|
||||||
const differences = {};
|
const differences = {};
|
||||||
function compareObjects(o1, o2, path = '') {
|
function compareObjects(o1, o2, path = '') {
|
||||||
|
if (o1 == null) return
|
||||||
|
if (o2 == null) return
|
||||||
for (const key in o1) {
|
for (const key in o1) {
|
||||||
if (o1.hasOwnProperty(key)) {
|
if (o1.hasOwnProperty(key)) {
|
||||||
const newPath = path ? `${path}.${key}` : key;
|
const newPath = path ? `${path}.${key}` : key;
|
||||||
|
|
|
@ -257,3 +257,17 @@ export const getFileName = (filename) => {
|
||||||
if(!filename) return
|
if(!filename) return
|
||||||
return filename.replace(/\.[^/.]+$/, "");
|
return filename.replace(/\.[^/.]+$/, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 清除当前选中的教材 章节 相关信息
|
||||||
|
export const clearBookInfo = () =>{
|
||||||
|
//当前选中的教材
|
||||||
|
localStorage.removeItem('curBook')
|
||||||
|
// 当前选中的节点
|
||||||
|
localStorage.removeItem('curNode')
|
||||||
|
// 所有章节单元数据
|
||||||
|
localStorage.removeItem('unitList')
|
||||||
|
// 所有教材数据
|
||||||
|
localStorage.removeItem('subjectList')
|
||||||
|
// 展开的节点
|
||||||
|
localStorage.removeItem('defaultExpandedKeys')
|
||||||
|
}
|
|
@ -2,9 +2,9 @@
|
||||||
<div class="desktop-work-item">
|
<div class="desktop-work-item">
|
||||||
<div class="item-title flex">
|
<div class="item-title flex">
|
||||||
<span class="title">工作动态</span>
|
<span class="title">工作动态</span>
|
||||||
<el-radio-group v-model="type">
|
<!-- <el-radio-group v-model="type">
|
||||||
<el-radio-button label="全部" :value="-1" />
|
<el-radio-button label="全部" :value="-1" />
|
||||||
</el-radio-group>
|
</el-radio-group> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="item-content" v-loading="loading">
|
<div class="item-content" v-loading="loading">
|
||||||
<el-scrollbar height="500px">
|
<el-scrollbar height="500px">
|
||||||
|
|
|
@ -89,6 +89,8 @@ const userStore = useUserStore()
|
||||||
const visible = ref(false) // 是否打开窗口
|
const visible = ref(false) // 是否打开窗口
|
||||||
const myClassActive = ref({}) // 我的课件:准备上课的APT课件
|
const myClassActive = ref({}) // 我的课件:准备上课的APT课件
|
||||||
const imChatRef = ref(null) // im-chat ref
|
const imChatRef = ref(null) // im-chat ref
|
||||||
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
const classForm = reactive({ // 班级(左侧):表单数据 表单配置
|
const classForm = reactive({ // 班级(左侧):表单数据 表单配置
|
||||||
form: {}, itemOption: [], option: {}
|
form: {}, itemOption: [], option: {}
|
||||||
})
|
})
|
||||||
|
@ -137,6 +139,7 @@ const handleClose = async () => {
|
||||||
reset() // 重置数据
|
reset() // 重置数据
|
||||||
await chat?.logout()
|
await chat?.logout()
|
||||||
chat = null
|
chat = null
|
||||||
|
emit('close')
|
||||||
}
|
}
|
||||||
// 初始化-数据
|
// 初始化-数据
|
||||||
const initData = () => {
|
const initData = () => {
|
||||||
|
|
|
@ -52,8 +52,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="prepare-body-main-item-btn">
|
<div class="prepare-body-main-item-btn">
|
||||||
<el-button v-if="activeClassId==item.id" type="success" @click="clickStartClass(item)">上课中</el-button>
|
<!-- <el-button v-if="activeClassId==item.id" type="success" @click="clickStartClass(item)">上课中</el-button> -->
|
||||||
<el-button v-else type="primary" @click="clickStartClass(item)">上课</el-button>
|
<el-button type="primary" @click="clickStartClass(item)">上课</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="prepare-body-main-item-tool">
|
<div class="prepare-body-main-item-tool">
|
||||||
<el-popover
|
<el-popover
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-popover-item">
|
<div class="item-popover-item">
|
||||||
<el-button text @click="deleteTalk(item)" :disabled="activeClassId==item.id">
|
<el-button text @click="deleteTalk(item)">
|
||||||
<i class="iconfont icon-shanchu"></i>
|
<i class="iconfont icon-shanchu"></i>
|
||||||
<span>删除</span>
|
<span>删除</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
|
@ -86,7 +86,7 @@ import useUserStore from '@/store/modules/user'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { getCurrentTime, getAfterMinutes } from '@/utils/date'
|
import { getCurrentTime, getAfterMinutes } from '@/utils/date'
|
||||||
|
|
||||||
const emit = defineEmits(['addSuccess'])
|
const emit = defineEmits(['addSuccess','close'])
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
bookId: {
|
bookId: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -115,7 +115,7 @@ const updateForm = ref({})
|
||||||
watch(
|
watch(
|
||||||
() => props.currentNode,
|
() => props.currentNode,
|
||||||
(newValue, oldValue) => {
|
(newValue, oldValue) => {
|
||||||
form.name = newValue.label
|
form.name = newValue.itemtitle
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
const ruleForm = reactive({
|
const ruleForm = reactive({
|
||||||
|
@ -216,7 +216,9 @@ const openDialog = (data) => {
|
||||||
const closeDialog = () => {
|
const closeDialog = () => {
|
||||||
ruleFormDialog.value.resetFields()
|
ruleFormDialog.value.resetFields()
|
||||||
centerDialogVisible.value = false
|
centerDialogVisible.value = false
|
||||||
form.name = props.currentNode.label
|
form.name = props.currentNode.itemtitle
|
||||||
|
emit('close')
|
||||||
|
|
||||||
}
|
}
|
||||||
const classList = ref([])
|
const classList = ref([])
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
:key="index"
|
:key="index"
|
||||||
:item="item"
|
:item="item"
|
||||||
:index="index"
|
:index="index"
|
||||||
:activeClassId="activeClass?.id"
|
|
||||||
@on-delete="deleteTalk"
|
@on-delete="deleteTalk"
|
||||||
@on-start-class="startClass"
|
@on-start-class="startClass"
|
||||||
>
|
>
|
||||||
|
@ -159,9 +158,10 @@
|
||||||
:current-node="currentNode"
|
:current-node="currentNode"
|
||||||
:book-id="uploadData.textbookId"
|
:book-id="uploadData.textbookId"
|
||||||
@add-success="initReserv"
|
@add-success="initReserv"
|
||||||
|
@close="closeChange"
|
||||||
></reserv>
|
></reserv>
|
||||||
<!-- 上课配置 -->
|
<!-- 上课配置 -->
|
||||||
<class-start ref="calssRef"/>
|
<class-start ref="calssRef" @close="closeChange"/>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Check,Plus } from '@element-plus/icons-vue'
|
import { Check,Plus } from '@element-plus/icons-vue'
|
||||||
|
@ -305,10 +305,10 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
startClass(item) {
|
startClass(item) {
|
||||||
// console.log(item, sessionStore)
|
// console.log(item, sessionStore)
|
||||||
|
// 关闭状态,打开上课相关功能(已打开,忽略)
|
||||||
|
const id = sessionStore.has('activeClass.id') ? sessionStore.get('activeClass.id') : null
|
||||||
|
if (id && id == item.id) return ElMessage.warning('当前正在上课,请勿重复操作')
|
||||||
if(item.fileFlag === '课件') {
|
if(item.fileFlag === '课件') {
|
||||||
// 关闭状态,打开上课相关功能(已打开,忽略)
|
|
||||||
const id = sessionStore.has('activeClass.id') ? sessionStore.get('activeClass.id') : null
|
|
||||||
if (id && id == item.id) return ElMessage.warning('当前正在上课,请勿重复操作')
|
|
||||||
this.openReserv()
|
this.openReserv()
|
||||||
}
|
}
|
||||||
if(item.fileFlag === 'apt') {
|
if(item.fileFlag === 'apt') {
|
||||||
|
@ -319,6 +319,11 @@ export default {
|
||||||
sessionStore.set('activeClass', item)
|
sessionStore.set('activeClass', item)
|
||||||
this.activeClass = item
|
this.activeClass = item
|
||||||
},
|
},
|
||||||
|
closeChange() { // 上课弹窗被关闭-触发
|
||||||
|
console.log('关闭上课弹窗')
|
||||||
|
this.activeClass = null
|
||||||
|
sessionStore.delete('activeClass')
|
||||||
|
},
|
||||||
initReserv(id) {
|
initReserv(id) {
|
||||||
getClassInfo(id).then((res) => {
|
getClassInfo(id).then((res) => {
|
||||||
this.curClassReserv = res.data
|
this.curClassReserv = res.data
|
||||||
|
@ -363,7 +368,7 @@ export default {
|
||||||
this.downloadNum = num
|
this.downloadNum = num
|
||||||
},
|
},
|
||||||
createFile() {
|
createFile() {
|
||||||
creatPPT(this.currentNode.label + '.pptx', this.uploadData).then((res) => {
|
creatPPT(this.currentNode.itemtitle + '.pptx', this.uploadData).then((res) => {
|
||||||
this.currentFileList.unshift(res.resData)
|
this.currentFileList.unshift(res.resData)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -443,7 +448,7 @@ export default {
|
||||||
creatAPT({
|
creatAPT({
|
||||||
...this.uploadData,
|
...this.uploadData,
|
||||||
fileId: slideid,
|
fileId: slideid,
|
||||||
fileShowName: this.currentNode.label + '.apt'
|
fileShowName: this.currentNode.itemtitle + '.apt'
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
this.currentFileList.unshift(res.resData)
|
this.currentFileList.unshift(res.resData)
|
||||||
})
|
})
|
||||||
|
@ -660,7 +665,7 @@ export default {
|
||||||
'/tool/sphere?entpcourseid=' +
|
'/tool/sphere?entpcourseid=' +
|
||||||
this.entpcourseid +
|
this.entpcourseid +
|
||||||
'&label=' +
|
'&label=' +
|
||||||
this.currentNode.label +
|
this.currentNode.itemtitle +
|
||||||
'&reservId=' +
|
'&reservId=' +
|
||||||
id
|
id
|
||||||
})
|
})
|
||||||
|
|
|
@ -45,6 +45,7 @@ import {updateUserInfo } from '@/api/system/user'
|
||||||
import { listEvaluation } from '@/api/subject/index'
|
import { listEvaluation } from '@/api/subject/index'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import {ElMessage} from 'element-plus'
|
import {ElMessage} from 'element-plus'
|
||||||
|
import { clearBookInfo } from '@/utils/ruoyi'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
user: {
|
user: {
|
||||||
|
@ -137,8 +138,7 @@ function submit() {
|
||||||
userStore.login({username:props.user.userName,password:props.user.plainpwd}).then(() => {
|
userStore.login({username:props.user.userName,password:props.user.plainpwd}).then(() => {
|
||||||
userStore.getInfo().then(res => {
|
userStore.getInfo().then(res => {
|
||||||
if(res.code === 200){
|
if(res.code === 200){
|
||||||
localStorage.removeItem('subjectList')
|
clearBookInfo()
|
||||||
localStorage.removeItem('evaluationList')
|
|
||||||
ElMessage.success('修改成功')
|
ElMessage.success('修改成功')
|
||||||
}else{
|
}else{
|
||||||
ElMessage.error(response.msg)
|
ElMessage.error(response.msg)
|
||||||
|
|
|
@ -38,7 +38,7 @@ const curBookId = ref('')
|
||||||
const evaluationList = ref([])
|
const evaluationList = ref([])
|
||||||
|
|
||||||
const getTreeData = () => {
|
const getTreeData = () => {
|
||||||
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
|
evaluationList.value = JSON.parse(localStorage.getItem('unitList'))
|
||||||
|
|
||||||
//上册
|
//上册
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue