资源模块修改 #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 = {
userId,
userName,
edustage: subjectVal.value,
edusubject: gradeVal.value
edustage: gradeVal.value,
edusubject: subjectVal.value
}
await updateUserInfo(data)
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-name">
<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="请输入文件名" />
<span>.{{ getFileSuffix(item.name) }}</span>
</div>

View File

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

View File

@ -8,7 +8,7 @@
}}</el-button>
</el-col>
<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-row>
<el-row class="resoure-btns">
@ -36,7 +36,6 @@
import useResoureStore from '../store'
const sourceStore = useResoureStore()
</script>
<style lang="scss" scoped>
.resoure-search {

View File

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

View File

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