资源模块修改
This commit is contained in:
parent
42f3689066
commit
bf9cf39355
|
@ -87,14 +87,25 @@ const getSubjectContent = async () => {
|
|||
entpcourseedituserid: userId,
|
||||
pageSize: 500
|
||||
}
|
||||
const { rows } = await listEvaluation(params)
|
||||
evaluationList.value = rows
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
//获取教材版本
|
||||
await getSubject()
|
||||
//上册
|
||||
volumeOne.value = rows.filter(item => item.level == 1 && item.semester == '上册')
|
||||
volumeOne.value = data.filter(item => item.level == 1 && item.semester == '上册')
|
||||
//下册
|
||||
volumeTwo.value = rows.filter(item => item.level == 1 && item.semester == '下册')
|
||||
volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '下册')
|
||||
|
||||
getTreeData()
|
||||
}
|
||||
|
@ -214,8 +225,15 @@ const transData = (data) => {
|
|||
|
||||
//获取教材
|
||||
const getSubject = async () => {
|
||||
const { rows } = await listEvaluation({ itemkey: "version", pageSize: 500 })
|
||||
subjectList.value = rows.filter(item => item.edustage == edustage && item.edusubject == edusubject && isHaveUnit(item.id))
|
||||
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
|
||||
|
|
|
@ -0,0 +1,179 @@
|
|||
<template>
|
||||
<el-dialog v-model="dialogValue" :show-close="false" width="630" :before-close="beforeClose"
|
||||
style="border-radius: 5px;padding-top: 0">
|
||||
<div class="dialog-title flex">
|
||||
<span>{{ title }}</span>
|
||||
<span>x</span>
|
||||
</div>
|
||||
<div class="book-name flex">
|
||||
<span>{{ curBookName }}</span>
|
||||
|
||||
</div>
|
||||
<template #footer>
|
||||
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, nextTick, watch, defineProps, defineEmits } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '移动至'
|
||||
}
|
||||
})
|
||||
|
||||
const dialogValue = ref(false)
|
||||
//教材
|
||||
const subjectList = ref([])
|
||||
const evaluationList = ref([])
|
||||
const treeData = ref([])
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'label',
|
||||
class: 'textbook-tree'
|
||||
}
|
||||
//当前教材ID
|
||||
const curBookId = ref(-1)
|
||||
//当前教材名称
|
||||
const curBookName = ref('')
|
||||
// 上册
|
||||
const volumeOne = ref([])
|
||||
// 下册
|
||||
const volumeTwo = ref([])
|
||||
// 当前选中的节点ID
|
||||
const currentNode = ref(0)
|
||||
// 当前选中的节点名称
|
||||
const currentNodeName = ref('')
|
||||
// 默认展开的节点
|
||||
const defaultExpandedKeys = ref([])
|
||||
// tree
|
||||
const refTree = ref(null)
|
||||
// 定义要发送的emit事件
|
||||
const emit = defineEmits(['update:modelValue',])
|
||||
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
dialogValue.value = newVal
|
||||
})
|
||||
|
||||
|
||||
const getSubjectContent = () => {
|
||||
|
||||
|
||||
evaluationList.value = JSON.parse(localStorage.getItem('evaluationList'))
|
||||
let data = evaluationList.value
|
||||
|
||||
|
||||
//获取教材版本
|
||||
getSubject()
|
||||
//上册
|
||||
volumeOne.value = data.filter(item => item.level == 1 && item.semester == '上册')
|
||||
//下册
|
||||
volumeTwo.value = data.filter(item => item.level == 1 && item.semester == '下册')
|
||||
|
||||
getTreeData()
|
||||
}
|
||||
|
||||
const getSubject = () => {
|
||||
subjectList.value = JSON.parse(localStorage.getItem('subjectList'))
|
||||
// 默认第一个
|
||||
curBookName.value = subjectList.value[0].itemtitle
|
||||
curBookId.value = subjectList.value[0].id
|
||||
}
|
||||
|
||||
const getTreeData = () => {
|
||||
//数据过滤
|
||||
let upData = transData(volumeOne.value)
|
||||
let downData = transData(volumeTwo.value)
|
||||
treeData.value = upData.length ? upData : downData
|
||||
defaultExpandedKeys.value = [treeData.value[0].id]
|
||||
nextTick(() => {
|
||||
currentNode.value = getLastLevelData(treeData.value)[0].id
|
||||
currentNodeName.value = getLastLevelData(treeData.value)[0].label
|
||||
// emitChangeBook()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const transData = (data) => {
|
||||
let ary = []
|
||||
|
||||
data.forEach(item => {
|
||||
let obj = {}
|
||||
|
||||
if (item.rootid == curBookId.value) {
|
||||
obj.label = item.itemtitle
|
||||
obj.id = item.id
|
||||
let ary2 = []
|
||||
evaluationList.value.forEach(el => {
|
||||
let obj2 = {}
|
||||
if (item.id == el.parentid) {
|
||||
obj2 = {
|
||||
label: el.itemtitle,
|
||||
id: el.id
|
||||
}
|
||||
ary2.push(obj2)
|
||||
}
|
||||
obj.children = ary2
|
||||
})
|
||||
ary.push(obj)
|
||||
}
|
||||
})
|
||||
return ary
|
||||
}
|
||||
// 获取最后一层数据
|
||||
const getLastLevelData = (tree) => {
|
||||
let lastLevelData = [];
|
||||
// 递归函数遍历树形结构
|
||||
function traverseTree(nodes) {
|
||||
nodes.forEach((node) => {
|
||||
// 如果当前节点有子节点,继续遍历
|
||||
if (node.children && node.children.length > 0) {
|
||||
traverseTree(node.children);
|
||||
} else {
|
||||
// 如果没有子节点,说明是最后一层的节点
|
||||
lastLevelData.push(node);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 调用递归函数开始遍历
|
||||
traverseTree(tree);
|
||||
|
||||
// 返回最后一层的数据
|
||||
return lastLevelData;
|
||||
}
|
||||
|
||||
// 关闭弹窗前
|
||||
const beforeClose = (done) => {
|
||||
emit('update:modelValue', false)
|
||||
done()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getSubjectContent()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dialog-title {
|
||||
justify-content: space-between;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.book-name {
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #0f0f0f;
|
||||
padding: 15px 0;
|
||||
}
|
||||
</style>
|
|
@ -90,7 +90,7 @@ const hanleFileChange = (file) => {
|
|||
|
||||
const fileType = file.raw.type
|
||||
if (!(audioTypes.includes(fileType) || videoTypes.includes(fileType) || wordTypes.includes(fileType) || pptTypes.includes(fileType) || pdfTypes.includes(fileType) || zipTypes.includes(fileType) || imgTypes.includes(fileType) || textTypes.includes(fileType))) {
|
||||
ElMessage.error('文件格式错误! 请上传图片、音频、视频、word、ppt、pdf、text、zip文件!')
|
||||
ElMessage.error('文件格式错误! 请上传图片、音频、视频、word、ppt、pdf、txt、zip文件!')
|
||||
return false
|
||||
}
|
||||
// 验证文件大小
|
||||
|
@ -100,7 +100,7 @@ const hanleFileChange = (file) => {
|
|||
return false
|
||||
}
|
||||
if (file.status === 'ready') {
|
||||
|
||||
|
||||
// 给一个默认的fileData
|
||||
file.fileData = {
|
||||
fileFlag: '课件',
|
||||
|
@ -110,7 +110,6 @@ const hanleFileChange = (file) => {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// 删除
|
||||
const delFile = (index) => {
|
||||
fileList.value.splice(index, 1)
|
||||
|
|
|
@ -179,6 +179,10 @@ export default {
|
|||
}
|
||||
.prepare-body-main-item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid rgba(131, 131, 127, 0.17);
|
||||
padding: 10px 0;
|
||||
.prepare-uploader-progress {
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
|
@ -189,10 +193,7 @@ export default {
|
|||
&:hover {
|
||||
background-color: rgba(144, 147, 153, 0.2);
|
||||
}
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid rgba(131, 131, 127, 0.17);
|
||||
padding: 10px 0;
|
||||
|
||||
.prepare-body-main-item-icon {
|
||||
width: 80px;
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ const useUserStore = defineStore(
|
|||
this.token = ''
|
||||
this.roles = []
|
||||
this.permissions = []
|
||||
localStorage.clear()
|
||||
removeToken()
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
<i class="iconfont icon-xiazai"></i>
|
||||
<span>下载</span>
|
||||
</div>
|
||||
<div class="item-popover-item" @click="moveFile(item)">
|
||||
<i class="iconfont icon-xiazai"></i>
|
||||
<span>移动至</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-popover>
|
||||
|
@ -54,19 +58,22 @@
|
|||
:page-sizes="[10, 20, 30, 50]" background layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="sourceStore.result.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||
</div>
|
||||
<MoveFile v-model="moveDialogVisible" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import FileImage from '@/components/file-image/index.vue'
|
||||
import { deleteSmarttalk, updateSmarttalk } from '@/api/file'
|
||||
import MoveFile from '@/components/move-file/index.vue'
|
||||
import { getFileSuffix } from '@/utils/ruoyi'
|
||||
import useResoureStore from '../store'
|
||||
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const sourceStore = useResoureStore()
|
||||
|
||||
const moveDialogVisible = ref(false)
|
||||
const handleSizeChange = () => { }
|
||||
const handleCurrentChange = () => { }
|
||||
|
||||
|
@ -109,6 +116,11 @@ const delRow = (item) => {
|
|||
}
|
||||
}
|
||||
|
||||
// 移动
|
||||
const moveFile = (item) => {
|
||||
moveDialogVisible.value = true
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
|
Loading…
Reference in New Issue