资源模块修改 #32

Merged
lyc merged 7 commits from lyc-dev into main 2024-07-18 09:32:37 +08:00
6 changed files with 28 additions and 36 deletions

View File

@ -112,8 +112,8 @@ const editUserInfo = async () =>{
const data = { const data = {
userId, userId,
userName, userName,
edustage: subjectVal.value, edustage: gradeVal.value,
edusubject: gradeVal.value edusubject: subjectVal.value
} }
await updateUserInfo(data) await updateUserInfo(data)
await userStore.getInfo() await userStore.getInfo()

View File

@ -16,7 +16,7 @@
<div class="file-list-item flex" v-for="(item, index) in fileList" :key="item.uid"> <div class="file-list-item flex" v-for="(item, index) in fileList" :key="item.uid">
<div class="file-name"> <div class="file-name">
<span class="name">标题</span> <span class="name">标题</span>
<FileImage :fileName="item.name" size="50"/> <FileImage :fileName="item.name" :size="50"/>
<el-input class="file-input" v-model="item.fileData.name" placeholder="请输入文件名" /> <el-input class="file-input" v-model="item.fileData.name" placeholder="请输入文件名" />
<span>.{{ getFileSuffix(item.name) }}</span> <span>.{{ getFileSuffix(item.name) }}</span>
</div> </div>

View File

@ -3,7 +3,7 @@
<el-scrollbar height="400px"> <el-scrollbar height="400px">
<el-empty description="暂无数据" v-if="!sourceStore.result.list.length" /> <el-empty description="暂无数据" v-if="!sourceStore.result.list.length" />
<ul> <ul>
<li class="list-item" v-for="item in sourceStore.result.list" :key="item.id"> <li class="list-item" v-for="item in sourceStore.result.list" :key="item.id" @click="handleRow">
<div class="item-left flex"> <div class="item-left flex">
<FileImage :fileName="item.fileShowName" :size="50" /> <FileImage :fileName="item.fileShowName" :size="50" />
<div class="flex item-left-content"> <div class="flex item-left-content">
@ -123,7 +123,7 @@ const delRow = (item) => {
const addLesson = ({ id }) => { const addLesson = ({ id }) => {
let data = { let data = {
id, id,
fileRoot: '资源', fileRoot: '备课',
...(toRaw(sourceStore.nodeData)), ...(toRaw(sourceStore.nodeData)),
} }
// //
@ -144,7 +144,10 @@ const addLesson = ({ id }) => {
} }
} }
//
const handleRow = () =>{
ElMessage.warning('请先加入备课,在备课里面进行预览!')
}
</script> </script>
<style> <style>

View File

@ -8,7 +8,7 @@
}}</el-button> }}</el-button>
</el-col> </el-col>
<el-col :span="12" class="search-box flex"> <el-col :span="12" class="search-box flex">
<el-input v-model="sourceStore.searchKey" style="width: 240px" placeholder="请输入关键词" /> <el-input v-model="sourceStore.query.fileName" @input="sourceStore.changeName" style="width: 240px" placeholder="请输入关键词" />
</el-col> </el-col>
</el-row> </el-row>
<el-row class="resoure-btns"> <el-row class="resoure-btns">
@ -36,7 +36,6 @@
import useResoureStore from '../store' import useResoureStore from '../store'
const sourceStore = useResoureStore() const sourceStore = useResoureStore()
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.resoure-search { .resoure-search {

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="page-resource flex"> <div class="page-resource flex">
<!--左侧 教材 目录--> <!--左侧 教材 目录-->
<ChooseTextbook @changeBook="changeBook" @nodeClick="nodeClick" /> <ChooseTextbook @changeBook="getData" @nodeClick="getData" />
<div class="page-right"> <div class="page-right">
<!-- 搜索 --> <!-- 搜索 -->
@ -27,7 +27,6 @@ import ResoureList from './container/resoure-list.vue'
import uploadDialog from '@/components/upload-dialog/index.vue' import uploadDialog from '@/components/upload-dialog/index.vue'
import uploaderState from '@/store/modules/uploader' import uploaderState from '@/store/modules/uploader'
const sourceStore = useResoureStore() const sourceStore = useResoureStore()
const isDialogOpen = ref(false) const isDialogOpen = ref(false)
@ -35,39 +34,27 @@ const openDialog = () => {
isDialogOpen.value = true isDialogOpen.value = true
} }
const onSubmit = (data)=>{
console.log(data)
}
//
const changeBook = (data) => {
getData(data)
}
//
const nodeClick = (data) => {
getData(data)
}
// //
const getData = (data) => { const getData = (data) => {
const { textBook, node } = data const { textBook, node } = data
let textbookId = textBook.curBookId let textbookId = textBook.curBookId
console.log(textbookId) let levelSecondId = node.id
let levelFirstId = node.id let levelFirstId
let levelSecondId = node.parentNode ? node.parentNode.id : '' if(node.parentNode){
sourceStore.query = { levelFirstId = node.parentNode.id
levelFirstId,
levelSecondId,
...sourceStore.query
} }
else{
levelFirstId = node.id
levelSecondId = ''
}
sourceStore.query.levelFirstId = levelFirstId
sourceStore.query.levelSecondId = levelSecondId
sourceStore.query.textbookId = textbookId sourceStore.query.textbookId = textbookId
sourceStore.nodeData = { sourceStore.nodeData = {
textbookId, textbookId,
levelFirstId, levelFirstId,
levelSecondId, levelSecondId,
} }
sourceStore.handleQuery() sourceStore.handleQuery()
} }

View File

@ -38,10 +38,7 @@ export default defineStore('resource', {
resourceTypeList, resourceTypeList,
resourceFormatList, resourceFormatList,
curFormat: -1,
searchKey: '', searchKey: '',
// 新建资源
isCreate: false,
//节点数据 //节点数据
nodeData:{}, nodeData:{},
@ -55,6 +52,7 @@ export default defineStore('resource', {
// 资源类型 课件 素材 教案 // 资源类型 课件 素材 教案
fileFlag: '', fileFlag: '',
fileRoot: '资源', fileRoot: '资源',
fileName: '',
orderByColumn: 'uploadTime', orderByColumn: 'uploadTime',
isAsc: 'desc', isAsc: 'desc',
...structQuery ...structQuery
@ -91,6 +89,11 @@ export default defineStore('resource', {
changeSuffix(val){ changeSuffix(val){
this.query.fileSuffix = val this.query.fileSuffix = val
this.handleQuery() this.handleQuery()
} },
// 关键词搜索
changeName(){
console.log(this.query.fileName)
this.handleQuery()
},
} }
}) })