lyc-dev #153

Merged
lyc merged 6 commits from lyc-dev into main 2024-08-23 11:22:54 +08:00
11 changed files with 888 additions and 24 deletions
Showing only changes of commit d003ecf8ce - Show all commits

View File

@ -0,0 +1,64 @@
//查询第三方课件的接口
import request from '@/utils/request'
//获取学科
export const getSubjects = (params) => {
return request({
url: '/smarttalk/cnjy/getSubjects',
method: 'get',
params
})
}
//获取教材版本
export const getTextbookVersion = (params) => {
return request({
url: '/smarttalk/cnjy/getVersions',
method: 'get',
params
})
}
//获得书籍
export const getTextbook = (params) => {
return request({
url: '/smarttalk/cnjy/getBooks',
method: 'get',
params
})
}
//获取书籍章节
export const getBook = (params) => {
return request({
url: '/smarttalk/cnjy/getChapters',
method: 'get',
params
})
}
//获取知识点信息
export const getKnowledge = (params) => {
return request({
url: '/smarttalk/cnjy/getKnowledgePoints',
method: 'get',
params
})
}
//查询列表资源
export const getBookList = (params) => {
return request({
url: '/smarttalk/cnjy/getDocuments',
method: 'post',
params
})
}
//获取图片路径
export const getImgPath = (params) => {
return request({
url: '/smarttalk/cnjy/getPreview',
method: 'get',
params
})
}

View File

@ -0,0 +1,288 @@
<template>
<div class="book-wrap">
<el-scrollbar height="100%">
<div class="book-name">
<el-dropdown style="width: 100%;height: 100%">
<div class="el-dropdown-link flex" style="width: 100%;height: 100%;justify-content: space-between;align-items: center">
<span>{{titleName}}</span>
<i class="iconfont icon-xiangyou"></i>
</div>
<template #dropdown>
<div style="width: 300px;padding: 20px">
<ThirdIndex @getVertion="getVertion"></ThirdIndex>
</div>
</template>
</el-dropdown>
</div>
<div class="book-list" v-loading="treeLoading">
<el-tree ref="refTree" :data="treeData" :props="defaultProps" node-key="id"
:default-expanded-keys="defaultExpandedKeys" :current-node-key="node.currentNodeId" highlight-current
@node-click="handleNodeClick">
</el-tree>
</div>
</el-scrollbar>
</div>
</template>
<script setup>
import ThirdIndex from './third/index.vue'
import {nextTick, reactive, ref,onMounted,watch} from 'vue'
import {getBook, getTextbook} from '@/api/file/third'
import useThirdStore from '@/store/modules/thirdTextbook'
const useThird = useThirdStore()
const emit = defineEmits(['nodeClick'])
const titleName = ref('小学-语文')
//
const treeData = ref([])
//
const defaultExpandedKeys = ref([])
const treeLoading = ref(false)
const node = reactive({
//
currentNode:{
data:{}
},
// ID
currentNodeId:0,
//
currentNodeName:''
})
//bookid
const bookId = ref(0)
//
const getVertion = (data) => {
const arr = [...data]
treeData.value = arr.map(item => {
return {
level:0,
id: item.versionId,
name: item.versionName,
childs: []
}
})
nextTick(() => {
defaultExpandedKeys.value = [treeData.value[0].id]
node.currentNode.data = treeData.value[0]
node.currentNodeId = treeData.value[0].id
node.currentNodeName = treeData.value[0].name
treeLoading.value = false
})
}
//
const getCurrent = (data) => {
if(!data || data.length == 0) return
nextTick(() => {
defaultExpandedKeys.value = [data[0].id]
node.currentNode.data = data[0]
node.currentNodeId = data[0].id
node.currentNodeName = data[0].name
})
}
//
const textbook = async (item) => {
treeLoading.value = true
const res = await getTextbook({versionId:item.id})
if(res.code === 200){
item.childs = res.data.map(items => {
return {
level:1,
id: items.bookId,
name: items.bookName,
childs: []
}
})
getCurrent(item.childs)
treeLoading.value = false
}
}
//
const grade = async (item) => {
treeLoading.value = true
bookId.value = item.id
const res = await getBook({bookId:item.id})
if(res.code === 200){
item.childs = res.data.map(items => {
return {
...items,
}
})
getLastLevelData(item.childs)
getCurrent(item.childs)
treeLoading.value = false
}
}
const getLastLevelData = (tree) => {
let lastLevelData = [];
//
function traverseTree(nodes) {
nodes.forEach((node) => {
//
if (node.childs && node.childs.length > 0) {
traverseTree(node.childs);
} else {
//
lastLevelData.push(node);
}
});
}
//
traverseTree(tree);
//
return lastLevelData;
}
//
const handleNodeClick = (data,node) => {
/**
* data : 当前节点数据
* node : 当前节点对象 包含当前节点所有数据 parent属性 指向父节点Node对象
*/
switch(node.data.level){
case 0: textbook(data); break;
case 1: grade(data); break;
default: {
getCurrent(data.childs);
//
emit('nodeClick',{
chapterId:data.id,
bookId:bookId.value,
stage:data.stage,
subjectId:data.subjectId,
})
break;
}
}
}
//
onMounted(() => {
const info = localStorage.getItem('selectBookInfo')
if(info){
const {gradeName,subjectName} = JSON.parse(info)
titleName.value = `${gradeName}-${subjectName}`
}
treeLoading.value = true
})
//
watch(() => useThird,() => {
titleName.value = `${useThird.gradeName}-${useThird.subjectName}`
},{deep:true})
const defaultProps = {
children: 'childs',
label: 'name',
class: 'textbook-tree'
}
</script>
<style lang="scss" scoped>
.book-wrap {
width: 300px;
height: 100%;
background: #ffffff;
border-radius: 10px;
box-shadow: 0px 0px 20px 0px rgba(99, 99, 99, 0.06);
display: flex;
flex-direction: column;
position: relative;
.book-name {
background-color: #ffffff;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 45px;
padding: 0 15px;
z-index: 1;
justify-content: space-between;
align-items: center;
color: #3b3b3b;
cursor: pointer;
border-bottom: solid #f4f5f7 1px;
font-size: 15px;
font-weight: 600;
border-radius: 10px 10px 0 0;
}
.book-list {
padding: 45px 10px 0 10px;
flex: 1;
}
}
:deep(.choose-dialog) {
border-radius: 10px;
}
.choose-book-header {
justify-content: space-between;
font-size: 15px;
font-weight: bold;
.icon-guanbi {
font-size: 20px;
cursor: pointer;
}
}
.textbook-container {
.textbook-item {
padding: 10px 20px;
align-items: center;
border-radius: 5px;
cursor: pointer;
.book-name {
margin-left: 20px;
color: #3b3b3b;
font-size: 13px;
}
&:hover {
background: #f4f7f9;
}
}
.active-item {
background-color: #f4f7f9;
.book-name {
color: #368fff;
font-weight: bold
}
}
.textbook-img {
width: 55px;
height: 70px;
display: flex;
align-items: center;
justify-content: center;
}
}
:deep(.el-tree-node) {
.el-tree-node__content {
height: 40px;
border-radius: 10px;
&:hover {
background-color: #eaf3ff;
}
}
}
.tree-label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
:deep(.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content) {
background-color: #eaf3ff !important;
color: #409EFF
}
</style>

View File

@ -0,0 +1,67 @@
<template>
<el-tabs v-model="active" class="demo-tabs" @tab-change="handleClick">
<template v-for="(item,index) in gradeList" :key="index">
<el-tab-pane :label="item.label" :name="item.value">
<SelectSubject ref="selectSubject" :subjectList="subjectList" @clickTag="getTagId"></SelectSubject>
</el-tab-pane>
</template>
</el-tabs>
</template>
<script setup>
import {ref,onMounted} from 'vue'
import { gradeList } from '@/utils/resourceDict'
import SelectSubject from './selectSubject.vue'
import {getSubjects,getTextbookVersion} from '@/api/file/third'
import useThirdStore from '@/store/modules/thirdTextbook'
const useThird = useThirdStore()
const emit = defineEmits(['getVertion'])
const active = ref(useThird.activeGrade || gradeList[0].value)
//
const subjectList = ref([])
//id
const textbookVersionId = ref(0)
const handleClick = (tab) => {
getSubject(tab)
}
//
const getSubject = (value) => {
getSubjects({stage:value}).then(res => {
if(res.code === 200){
subjectList.value = [...res.data]
if(textbookVersionId.value === 0){
getTagId(subjectList.value[0])
}
}
})
}
//
const getTagId = (item) => {
textbookVersionId.value = item.subjectId
const currentIndex = gradeList.findIndex(item => item.value === active.value)
getTextbookVersion({stage:active.value,subjectId:textbookVersionId.value}).then(res => {
if(res.code === 200){
emit('getVertion',res.data)
useThird.getSelectBookInfo({...item,activeGrade:active.value,gradeName:gradeList[currentIndex].label})
localStorage.setItem('selectBookInfo',JSON.stringify({...item,activeGrade:active.value,gradeName:gradeList[currentIndex].label}))
}
})
}
onMounted(() => {
//
handleClick(active.value)
//
const info = localStorage.getItem('selectBookInfo')
if(info){
const {activeGrade,subjectId,subjectName} = JSON.parse(info)
active.value = activeGrade
//
getTagId({subjectId:subjectId,subjectName:subjectName})
}
})
</script>
<style scoped>
</style>

View File

@ -0,0 +1,30 @@
<template>
<template v-for="item in subjectList" :key="item.subjectId">
<el-tag
type="primary"
effect="dark"
round
style="cursor: pointer;margin-right: 5px;margin-top: 5px;"
@click="clickTag(item)"
>
{{ item.subjectName }}
</el-tag>
</template>
</template>
<script setup name="selectSubject">
const props = defineProps({
subjectList: {
type: Array,
default: () => []
}
})
const emit = defineEmits(['clickTag'])
const clickTag = (item) => {
emit('clickTag',item)
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,23 @@
import { defineStore } from 'pinia'
const useThirdStore = defineStore('third', {
state: () => ({
activeGrade:'',
gradeName:'',
subjectName:'',
textbookVersionId:''
}),
actions: {
// 登录
getSelectBookInfo(params){
this.activeGrade = params.activeGrade
this.gradeName = params.gradeName
this.subjectName = params.subjectName
this.textbookVersionId = params.textbookVersionId
}
},
persist: true
})
export default useThirdStore

View File

@ -7,7 +7,6 @@ export const hasPermission = (value, def = true) => {
if (!value) { if (!value) {
return def return def
} }
const allCodeList = useUserStore().roles const allCodeList = useUserStore().roles
// 如果不是数组直接判断pinia里的权限数组有没有相同的元素即可 // 如果不是数组直接判断pinia里的权限数组有没有相同的元素即可
if (!Array.isArray(value)) { if (!Array.isArray(value)) {

View File

@ -6,7 +6,11 @@ export const tabs = [
{ {
label: '校本资源', label: '校本资源',
value: '校本' value: '校本'
} },
{
label: '第三方资源',
value: '第三方'
},
] ]
@ -67,3 +71,41 @@ export const resourceType = [
value: '教案' value: '教案'
} }
] ]
// 年级划分
export const gradeList = [
{
label:'小学',
value:1
},
{
label:'初中',
value:2
},
{
label:'高中',
value:3
},
]
//课件类别
export const coursewareTypeList = [
{
label:'课件',
value:3
},
{
label:'教案',
value:8
},
{
label:'试卷',
value:7
},
{
label:'学案',
value:4
},
{
label:'素材',
value:6
},
]

View File

@ -7,12 +7,30 @@
@click="sourceStore.changeTab(item.value)">{{ item.label @click="sourceStore.changeTab(item.value)">{{ item.label
}}</el-button> }}</el-button>
</el-col> </el-col>
<el-col :span="12" class="search-box flex">
<el-input v-model="sourceStore.query.fileName" @input="sourceStore.changeName" style="width: 240px" <el-col :span="12" class="search-box flex" v-if="isThird">
<el-input v-model="sourceStore.thirdQuery.title" @input="onchangeInput()" style="width: 240px"
placeholder="请输入关键词" />
</el-col>
<el-col :span="12" class="search-box flex" v-else>
<el-input v-model="sourceStore.query.fileName" @input="onchangeInput()" style="width: 240px"
placeholder="请输入关键词" /> placeholder="请输入关键词" />
</el-col> </el-col>
</el-row> </el-row>
<el-row class="resoure-btns">
<!-- 第三方资源筛选-->
<el-row class="resoure-btns" v-if="isThird">
<el-col :span="24" class="query-row flex">
<div class="flex row-left">
<el-button v-for="item in coursewareTypeList" :key="item.id"
:type="sourceStore.thirdQuery.type == item.value ? 'primary' : ''" round
@click="sourceStore.thirdChangeType(item.value)">
{{item.label }}
</el-button>
</div>
</el-col>
</el-row>
<el-row class="resoure-btns" v-else>
<el-col :span="24" class="query-row flex"> <el-col :span="24" class="query-row flex">
<div class="flex row-left"> <el-select v-model="sourceStore.query.fileSuffix" @change="sourceStore.changeSuffix" <div class="flex row-left"> <el-select v-model="sourceStore.query.fileSuffix" @change="sourceStore.changeSuffix"
style="width: 110px"> style="width: 110px">
@ -30,13 +48,33 @@
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</template> </template>
<script setup> <script setup>
import {watch,ref} from 'vue'
import useResoureStore from '../store' import useResoureStore from '../store'
import {coursewareTypeList} from '@/utils/resourceDict'
const isThird = ref(false)
const sourceStore = useResoureStore() const sourceStore = useResoureStore()
//
const debounce = (fn, t) => {
let timer;
return function (...args) {
if (timer) clearTimeout(timer);
timer = setTimeout(() => fn.apply(this, args), t);
};
};
//
const debouncedChangeName = debounce(sourceStore.changeName, 300);
const onchangeInput = () => {
debouncedChangeName()
}
watch(() => sourceStore.query.fileSource,() => {
sourceStore.query.fileSource === '第三方'?isThird.value = true:isThird.value = false
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.resoure-search { .resoure-search {

View File

@ -0,0 +1,260 @@
<template>
<div v-loading="sourceStore.loading" class="resource-list">
<el-scrollbar>
<el-empty v-if="!sourceStore.thirdResult.list.length" description="暂无数据" />
<ul>
<li
v-for="item in sourceStore.thirdResult.list"
:key="item.itemId"
class="list-item"
@click="handleRow"
>
<div class="item-left flex">
<div style="position: relative" @click="clickImg(item.itemId)">
<FileImage :file-name="item.fileType" :size="50" />
<el-icon style="position: absolute;top: 1px;right: 5px"><Search /></el-icon>
</div>
<div class="flex item-left-content">
<div class="name flex" :title="item.title">
<div></div>
<div
style="
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 200px;
"
>
{{ item.title }}
</div>
</div>
<div class="item-tags flex" style="margin-bottom: 5px;">
<el-text type="info" size="small" class="mr-10">标签</el-text>
<el-tag type="info" size="small" class="mr-10">{{ item.year }}</el-tag>
<el-tag type="info" size="small" class="mr-10">{{ item.typeName }}</el-tag>
<el-tag type="info" size="small" class="mr-10">{{ item.provinceName }}</el-tag>
</div>
<div class="item-tags flex">
<el-text type="info" size="small" class="mr-10">
<el-icon><Clock/></el-icon>
{{ timestampToDate(item.dateline) }}
</el-text>
<el-text type="info" size="small" class="mr-10">
<el-icon><View /></el-icon>
{{ item.viewCount }}人看过
</el-text>
<el-text type="info" size="small" class="mr-10">
<el-icon><Folder /></el-icon>
{{ item.formatSize }}
</el-text>
</div>
</div>
</div>
</li>
</ul>
</el-scrollbar>
<div class="pagination-box">
<el-pagination
v-model:current-page="sourceStore.thirdQuery.page"
v-model:page-size="sourceStore.thirdQuery.perPage"
:page-sizes="[10, 20, 30, 50]"
background
layout="total, sizes, prev, pager, next, jumper"
:total="sourceStore.thirdResult.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
<el-dialog v-model="isViewImg" width="80%" :modal-append-to-body="false" :append-to-body="false">
<div class="demo-image__lazy">
<el-image v-for="(url,index) in srcList" :key="index" :src="url" lazy />
</div>
</el-dialog>
<!-- <video width="550" controls autoplay loop>-->
<!-- <source src="https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-360p.mp4" type="video/mp4" />-->
<!-- </video>-->
</div>
</template>
<script setup>
import { ref } from 'vue'
// import { ElMessage, ElMessageBox } from 'element-plus'
import { Clock,View,Folder,Search } from '@element-plus/icons-vue'
import FileImage from '@/components/file-image/index.vue'
import { getFileSuffix } from '@/utils/ruoyi'
import useUserStore from '@/store/modules/user'
import useResoureStore from '../store'
import {getImgPath} from "@/api/file/third";
const userstore = useUserStore()
const sourceStore = useResoureStore()
// const userInfo = userstore.user
//
const isViewImg = ref(false)
//
const srcList = ref([])
// change
const handleSizeChange = (limit) => {
sourceStore.thirdQuery.perPage = limit
sourceStore.handleQuery()
}
const handleCurrentChange = (page) => {
sourceStore.thirdQuery.page = page
sourceStore.handleQuery()
}
//
function timestampToDate(timestamp) {
// 10
if (timestamp.toString().length === 10) {
timestamp *= 1000;
}
const date = new Date(timestamp);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 01
const day = String(date.getDate()).padStart(2, '0'); //
return `${year}-${month}-${day}`;
}
//
const clickImg = (id) => {
srcList.value = []
getImgPath({itemId:id}).then(res => {
if(res.code === 200){
isViewImg.value = true
res.data.forEach(item => {
item.subsets.forEach(previewItem => {
previewItem.previewFiles.forEach(fileItem => {
srcList.value.push(fileItem.fileUrl)
})
})
})
}
})
}
</script>
<style lang="scss">
::v-deep(.el-popover) {
min-width: 50px;
width: 50px !important;
}
.custom-popover {
width: 80px !important;
min-width: 80px !important;
padding: 5px !important;
.item-popover-item {
padding: 5px 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
cursor: pointer;
.iconfont {
margin-right: 5px;
color: #a2a2a2;
}
}
}
.resource-list {
flex: 1;
display: flex;
flex-direction: column;
overflow: auto;
.list-item {
flex: 1;
padding: 10px 20px;
border-bottom: solid #f1f1f1 1px;
display: flex;
justify-content: space-between;
align-items: center;
cursor: pointer;
&:hover {
background-color: rgba(144, 147, 153, 0.2);
cursor: pointer;
}
.item-left {
align-items: center;
flex: 1;
.icon {
font-size: 50px;
}
.item-left-content {
margin-left: 10px;
flex-direction: column;
flex: 1;
text-align: left;
}
.name {
font-size: 14px;
color: #3b3b3b;
margin-bottom: 5px;
}
.line {
width: 1px;
height: 15px;
background-color: #d9dce2;
}
.item-tags {
align-items: center;
}
.mr-10 {
margin-right: 10px;
}
.gray-text {
color: #909399;
font-size: 13px;
}
}
&:last-child {
border-bottom: none;
}
.item-btns {
display: flex;
align-items: center;
:deep(.item-popover) {
font-size: 12px;
flex-direction: column;
p {
text-align: center;
}
}
.icon-shenglvehao {
cursor: pointer;
font-size: 18px;
font-weight: bold;
margin-right: 10px;
}
.icon-jiahao {
font-size: 12px;
margin-right: 3px;
font-weight: bold;
}
}
}
.pagination-box {
display: flex;
justify-content: center;
height: 65px;
}
}
</style>

View File

@ -1,7 +1,8 @@
<template> <template>
<div class="page-resource flex"> <div class="page-resource flex">
<!--左侧 教材 目录--> <!--左侧 教材 目录-->
<ChooseTextbook @change-book="getData" @node-click="getData" /> <Third v-if="isThird" @node-click="getDataOther"></Third>
<ChooseTextbook v-else @change-book="getData" @node-click="getData" />
<div class="page-right"> <div class="page-right">
<!-- 搜索 --> <!-- 搜索 -->
@ -18,7 +19,9 @@
> >
</ResoureSearch> </ResoureSearch>
<!-- 列表 --> <!-- 列表 -->
<ResoureList /> <!-- 第三方列表-->
<ThirdList v-if="isThird" />
<ResoureList v-else />
</div> </div>
</div> </div>
<!-- 上传弹窗 --> <!-- 上传弹窗 -->
@ -26,11 +29,13 @@
</template> </template>
<script setup> <script setup>
import { onMounted, ref, toRaw } from 'vue' import { onMounted, ref, toRaw,watch } from 'vue'
import useResoureStore from './store' import useResoureStore from './store'
import ChooseTextbook from '@/components/choose-textbook/index.vue' import ChooseTextbook from '@/components/choose-textbook/index.vue'
import Third from '@/components/choose-textbook/third.vue'
import ResoureSearch from './container/resoure-search.vue' import ResoureSearch from './container/resoure-search.vue'
import ResoureList from './container/resoure-list.vue' import ResoureList from './container/resoure-list.vue'
import ThirdList from './container/third-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'
import { createWindow } from '@/utils/tool' import { createWindow } from '@/utils/tool'
@ -41,9 +46,8 @@ const toolStore = useToolState()
const openDialog = () => { const openDialog = () => {
isDialogOpen.value = true isDialogOpen.value = true
} }
// onMounted(async () => { //
// console.log('toolStore: ', toolStore.windowState) const isThird = ref(false)
// })
// //
const getData = (data) => { const getData = (data) => {
@ -67,6 +71,13 @@ const getData = (data) => {
} }
sourceStore.handleQuery() sourceStore.handleQuery()
} }
const getDataOther = (data) => {
sourceStore.thirdQuery.chapterId = data.chapterId
sourceStore.thirdQuery.bookId = data.bookId
sourceStore.thirdQuery.stage = data.stage
sourceStore.thirdQuery.subjectId = data.subjectId
sourceStore.handleQuery()
}
// //
const submitFile = (data) => { const submitFile = (data) => {
@ -92,6 +103,9 @@ const fileCallBack = (res) => {
onMounted(() => { onMounted(() => {
sourceStore.getCreate() sourceStore.getCreate()
}) })
watch(() => sourceStore.query.fileSource,() => {
sourceStore.query.fileSource === '第三方'?isThird.value = true:isThird.value = false
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,5 +1,6 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { getSmarttalkPage } from '@/api/file/index' import { getSmarttalkPage } from '@/api/file/index'
import { getBookList } from '@/api/file/third'
import { tabs, resourceType, resourceFormat } from '@/utils/resourceDict' import { tabs, resourceType, resourceFormat } from '@/utils/resourceDict'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { hasPermission } from '@/utils/hasPermission' import { hasPermission } from '@/utils/hasPermission'
@ -60,15 +61,32 @@ export default defineStore('resource', {
isAsc: 'desc', isAsc: 'desc',
...structQuery ...structQuery
}, },
//第三方的查询条件
thirdQuery:{
page:1,
perPage:20,
chapterId:0,
bookId:0,
stage:0,
subjectId:0,
type:3,
title:''
},
result: { result: {
list: [], list: [],
total: 0 total: 0
} },
//第三方的数据单独处理
thirdResult:{
list: [],
total: 0,
},
}), }),
actions: { actions: {
handleQuery() { handleQuery() {
try { try {
this.loading = true this.loading = true
if(this.query.fileSource !== '第三方'){
let data = { ...this.query } let data = { ...this.query }
if (data.fileSuffix == -1) { if (data.fileSuffix == -1) {
data.fileSuffix = '' data.fileSuffix = ''
@ -77,6 +95,22 @@ export default defineStore('resource', {
this.result.total = res.total this.result.total = res.total
this.result.list = res.rows this.result.list = res.rows
}) })
}else{
let data = JSON.parse(JSON.stringify(this.thirdQuery))
if (data.title) {
data.title.trim()
}else{
data.title = null
}
getBookList(data).then((res) => {
if(res.code === 200){
if(res.data.code === 0){
this.thirdResult.total = res.data.page.totalCount
this.thirdResult.list = [...res.data.data]
}
}
})
}
} finally { } finally {
this.loading = false this.loading = false
} }
@ -90,6 +124,11 @@ export default defineStore('resource', {
this.query.fileFlag = val this.query.fileFlag = val
this.handleQuery() this.handleQuery()
}, },
thirdChangeType(val) {
this.thirdQuery.type = val
this.handleQuery()
},
//第三方的切换类型区别开
changeSuffix(val) { changeSuffix(val) {
this.query.fileSuffix = val this.query.fileSuffix = val
this.handleQuery() this.handleQuery()
@ -99,12 +138,12 @@ export default defineStore('resource', {
this.handleQuery() this.handleQuery()
}, },
getCreate(){ getCreate(){
if(this.query.fileSource == '平台'){ if(this.query.fileSource == '平台' || this.query.fileSource == '第三方' ){
this.isCreate = hasPermission(['platformmanager']) this.isCreate = hasPermission(['platformmanager'])
} }
else{ else{
this.isCreate = hasPermission(['schoolteacher','headmaster']) this.isCreate = hasPermission(['schoolteacher','headmaster'])
} }
} },
} }
}) })