提交代码

This commit is contained in:
jiangzhe 2024-06-24 15:08:58 +08:00
parent 2d323fa8a0
commit d68213f110
13 changed files with 436 additions and 99 deletions

View File

@ -81,7 +81,7 @@ export interface HomeShowForm extends BaseEntity {
* 0-1-
*/
status?: number;
avatar?: string;
}
export interface HomeShowQuery extends PageQuery {
@ -121,10 +121,10 @@ export interface HomeShowQuery extends PageQuery {
*/
status?: number;
/**
*
*/
params?: any;
/**
*
*/
params?: any;
}

View File

@ -32,6 +32,69 @@ export function previewTxt(ossId: string | number): any {
});
}
export function previewPerson(ossId: string | number): any {
return request({
url: '/oss/person/preview/' + ossId,
method: 'post',
responseType: 'blob'
});
}
export function previewPersonTxt(ossId: string | number): any {
return request({
url: '/oss/person/preview/' + ossId,
method: 'post',
responseType: 'blob',
transformResponse: [
async function (data) {
return await transformData(data)
}
]
});
}
export function previewTextbook(ossId: string | number): any {
return request({
url: '/file/textbook/preview/' + ossId,
method: 'post',
responseType: 'blob'
});
}
export function previewTextbookTxt(ossId: string | number): any {
return request({
url: '/file/textbook/preview/' + ossId,
method: 'post',
responseType: 'blob',
transformResponse: [
async function (data) {
return await transformData(data)
}
]
});
}
export function previewResource(ossId: string | number): any {
return request({
url: '/file/resource/preview/' + ossId,
method: 'post',
responseType: 'blob'
});
}
export function previewResourceTxt(ossId: string | number): any {
return request({
url: '/file/resource/preview/' + ossId,
method: 'post',
responseType: 'blob',
transformResponse: [
async function (data) {
return await transformData(data)
}
]
});
}
const transformData = (data: any) => {
return new Promise((resolve) => {
let reader = new FileReader()

View File

@ -71,7 +71,7 @@ export const constantRoutes: RouteRecordRaw[] = [
path: '/index',
component: () => import('@/views/index.vue'),
name: 'Index',
meta: { title: '首页', icon: 'dashboard', affix: true }
meta: { title: '首页', icon: 'dashboard', affix: true}
}
]
},

View File

@ -71,6 +71,9 @@
<el-form-item label="教师名称" prop="teacherName">
<el-input v-model="form.teacherName" placeholder="请输入教师名称" />
</el-form-item>
<el-form-item label="头像" prop="avatar">
<image-upload v-model="form.avatar" :limit="1" />
</el-form-item>
<el-form-item label="年级名称" prop="gradeName">
<el-input v-model="form.gradeName" placeholder="请输入年级名称" />
</el-form-item>
@ -132,6 +135,7 @@ const initFormData: HomeShowForm = {
sort: undefined,
content: undefined,
status: undefined,
avatar: undefined
}
const data = reactive<PageData<HomeShowForm, HomeShowQuery>>({
form: { ...initFormData },

View File

@ -45,7 +45,11 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="标题" align="center" prop="title" />
<el-table-column label="排序" align="center" prop="sort" />
<el-table-column label="发布时间" align="center" prop="createTime" />
<el-table-column label="发布时间" align="center" prop="createTime">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="编辑" placement="top">
@ -228,6 +232,7 @@ const handleUpdate = async (row?: HomeTrendVO) => {
const _trendId = row?.trendId || ids.value[0]
const res = await getHomeTrend(_trendId);
Object.assign(form.value, res.data);
form.value.createBy = ''
dialog.visible = true;
dialog.title = "编辑学校动态";
}
@ -275,4 +280,4 @@ onMounted(() => {
.w100 {
width: 100%;
}
</style>
</style>

View File

@ -103,7 +103,8 @@
style="height: 100vh;width: 100vh;" v-if="currentFile.fileSuffix == '.xls' || currentFile.fileSuffix == '.xlsx'"
:src="file" />
<vue-office-pdf v-loading="fileLoading" element-loading-text="加载中..." v-if="currentFile.fileSuffix == '.pdf'"
<vue-office-pdf style="height: 100vh" v-loading="fileLoading" element-loading-text="加载中..."
v-if="currentFile.fileSuffix == '.pdf' || currentFile.fileSuffix == '.ppt' || currentFile.fileSuffix == '.pptx'"
:src="file" />
<div v-loading="fileLoading" element-loading-text="加载中..." v-if="currentFile.fileSuffix == '.txt'"
@ -149,7 +150,7 @@
</template>
<script setup name="Oss" lang="ts">
import { pagePerson, preview, previewTxt, delPerson, addPerson, copyPerson, movePerson } from '@/api/system/oss';
import { pagePerson, previewPerson, previewPersonTxt, delPerson, addPerson, copyPerson, movePerson } from '@/api/system/oss';
import { listCatalogPerson } from "@/api/resource/catalogPerson";
import { CatalogPersonVO } from '@/api/resource/catalogPerson/types';
import ImagePreview from '@/components/ImagePreview/index.vue';
@ -421,28 +422,33 @@ const file = ref('')
const fileLoading = ref(false)
const txt = ref('')
const imgUrl = ref('')
const handlePreview = async (row: OssVO) => {
const handlePreview = async (row: any) => {
file.value = ''
fileLoading.value = true
previewDialog.visible = true
currentFile.value = row
if (row.fileSuffix == '.txt') {
const fileRes = await previewTxt(row.ossId)
const fileRes = await previewPersonTxt(row.id)
console.log(fileRes)
txt.value = fileRes
} else if (imgSuffix.includes(row.fileSuffix)) {
const fileRes = await preview(row.ossId)
const fileRes = await previewPerson(row.id)
let blob = new Blob([fileRes], { type: `image/${row.fileSuffix.substring(1)}` })
imgUrl.value = URL.createObjectURL(blob)
} else if (fileSuffix.includes(row.fileSuffix)) {
const fileRes = await preview(row.ossId)
const fileRes = await previewPerson(row.id)
fileRes.arrayBuffer().then(res => file.value = res)
}
fileLoading.value = false
}
const handlePreviewClose = () => {
file.value = ''
txt.value = ''
}
const getlistCatalogPerson = async () => {
const res = await listCatalogPerson();
const data = proxy?.handleTree<CatalogPersonVO>(res.data, "catalogId", "parentId");

View File

@ -27,7 +27,7 @@
<el-table ref="catalogPersonTableRef" @row-click="handleRowClick" v-loading="loading"
:data="catalogPersonList" row-key="catalogId" :default-expand-all="isExpandAll"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
<el-table-column label="分类名称" align="center" prop="catalogName" />
<el-table-column label="分类名称" align="left" prop="catalogName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top">

View File

@ -18,7 +18,7 @@
</transition>
<el-row :gutter="20">
<el-col :span="8">
<el-col :span="12">
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
@ -35,8 +35,8 @@
<el-table ref="catalogResourceTableRef" @row-click="handleNodeClick" v-loading="loading"
:data="catalogResourceList" row-key="catalogId" :default-expand-all="isExpandAll"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
<el-table-column label="专题名称" align="center" prop="catalogName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="专题名称" align="left" prop="catalogName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
@ -55,7 +55,7 @@
</el-table>
</el-card>
</el-col>
<el-col :span="16">
<el-col :span="12">
<el-table v-loading="loadingTable" :data="catalogResourceTable">
<el-table-column label="分类名称" align="center" prop="catalogName" />
<el-table-column label="资源数量" align="center" prop="resourceNum" />
@ -64,11 +64,11 @@
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
v-hasPermi="['resource:catalogTextbook:edit']"></el-button>
v-hasPermi="['catalog:resource:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
v-hasPermi="['resource:catalogTextbook:remove']"></el-button>
v-hasPermi="['catalog:resource:remove']"></el-button>
</el-tooltip>
</template>
</el-table-column>

View File

@ -18,7 +18,7 @@
</transition>
<el-row :gutter="20">
<el-col :span="8">
<el-col :span="14">
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
@ -35,10 +35,10 @@
<el-table ref="catalogTextbookTableRef" @row-click="handleNodeClick" v-loading="loading"
:data="catalogTextbookList" row-key="catalogId" :default-expand-all="isExpandAll"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
<el-table-column label="教材名称" align="center" prop="catalogName" />
<el-table-column label="目录类型" align="center" prop="type">
<el-table-column label="教材名称" align="left" prop="catalogName" />
<el-table-column label="目录类型" align="center" prop="type" width="100">
<template #default="scope">
<el-tag v-if="scope.row.type === 1" type="success">暂定</el-tag>
<el-tag v-if="scope.row.type === 1" type="success">主目录</el-tag>
<el-tag v-if="scope.row.type === 2" type="success">学段</el-tag>
<el-tag v-if="scope.row.type === 3" type="success">年级</el-tag>
<el-tag v-if="scope.row.type === 4" type="success">学科</el-tag>
@ -47,7 +47,7 @@
<el-tag v-if="scope.row.type === 7" type="success">目录</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
@ -66,12 +66,12 @@
</el-table>
</el-card>
</el-col>
<el-col :span="16">
<el-col :span="10">
<el-table v-loading="loadingTable" :data="catalogTextbookTable">
<el-table-column label="分类名称" align="center" prop="catalogName" />
<el-table-column label="目录类型" align="center" prop="type">
<template #default="scope">
<el-tag v-if="scope.row.type === 1" type="success">暂定</el-tag>
<el-tag v-if="scope.row.type === 1" type="success">主目录</el-tag>
<el-tag v-if="scope.row.type === 2" type="success">学段</el-tag>
<el-tag v-if="scope.row.type === 3" type="success">年级</el-tag>
<el-tag v-if="scope.row.type === 4" type="success">学科</el-tag>
@ -86,11 +86,11 @@
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
v-hasPermi="['resource:catalogTextbook:edit']"></el-button>
v-hasPermi="['catalog:textbook:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
v-hasPermi="['resource:catalogTextbook:remove']"></el-button>
v-hasPermi="['catalog:textbook:remove']"></el-button>
</el-tooltip>
</template>
</el-table-column>
@ -180,7 +180,7 @@ const typeOptions = [
},
{
value: 1,
label: '暂定',
label: '主目录',
}
]

View File

@ -5,8 +5,8 @@
<div class="top">
<el-button type="" text="plain">全部专题资源</el-button>
<br>
<el-button :class="['btn-audit', isAudit && 'active']" type="" text="plain"
@click="handleAudit">待审核</el-button>
<el-button v-hasPermi="['file:textbook:awaitList']" :class="['btn-audit', isAudit && 'active']" type=""
text="plain" @click="handleAudit">待审核</el-button>
<el-tree ref="treeRef" v-loading="treeLoading" :data="treeData" :props="defaultProps" default-expand-all
@node-click="handleNode" />
</div>
@ -47,11 +47,11 @@
<template #header>
<el-row :gutter="10" class="mb8">
<el-col v-if="isUpload" :span="1.5">
<el-button v-hasPermi="['system:oss:upload']" type="primary" plain icon="Upload"
<el-button v-hasPermi="['file:resource:add']" type="primary" plain icon="Upload"
@click="handleFile">上传课件</el-button>
</el-col>
<el-col :span="1.5">
<el-button v-hasPermi="['system:oss:remove']" type="danger" plain icon="Delete" :disabled="multiple"
<el-button v-hasPermi="['file:resource:remove']" type="danger" plain icon="Delete" :disabled="multiple"
@click="handleDelete()">
删除
</el-button>
@ -75,30 +75,30 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="350">
<template #default="scope">
<el-tooltip v-if="isAudit" content="审核通过" placement="top">
<el-tooltip v-hasPermi="['file:resource:review']" v-if="isAudit" content="审核通过" placement="top">
<el-button link type="primary" icon="CopyDocument"
@click="handleAuditBtn(scope.row, 1)">审核通过</el-button>
</el-tooltip>
<el-tooltip v-if="isAudit" content="审核不通过" placement="top">
<el-tooltip v-hasPermi="['file:resource:review']" v-if="isAudit" content="审核不通过" placement="top">
<el-button link type="primary" icon="DocumentCopy"
@click="handleAuditBtn(scope.row, 0)">审核不通过</el-button>
</el-tooltip>
<el-tooltip content="预览" placement="top">
<el-tooltip v-hasPermi="['file:resource:preview']" content="预览" placement="top">
<el-button link type="primary" icon="View" @click="handlePreview(scope.row)">预览</el-button>
</el-tooltip>
<el-tooltip v-hasPermi="['system:oss:download']" content="下载" placement="top">
<el-tooltip v-hasPermi="['file:resource:download']" content="下载" placement="top">
<el-button link type="primary" icon="Download" @click="handleDownload(scope.row)">下载</el-button>
</el-tooltip>
<el-tooltip v-if="isTree" content="移动" placement="top">
<el-tooltip v-hasPermi="['file:resource:move']" v-if="isTree" content="移动" placement="top">
<el-button link type="primary" icon="CopyDocument" @click="handleMove(scope.row)">移动</el-button>
</el-tooltip>
<el-tooltip v-if="isTree" content="复制" placement="top">
<el-tooltip v-hasPermi="['file:resource:copy']" v-if="isTree" content="复制" placement="top">
<el-button link type="primary" icon="DocumentCopy" @click="handleCopy(scope.row)">复制</el-button>
</el-tooltip>
<el-tooltip v-if="isTree" content="删除" placement="top">
<el-button v-hasPermi="['system:oss:remove']" link type="primary" icon="Delete"
<el-button v-hasPermi="['file:resource:remove']" link type="primary" icon="Delete"
@click="handleDelete(scope.row)">删除</el-button>
</el-tooltip>
</template>
@ -125,7 +125,7 @@
</template>
</el-dialog>
<el-dialog v-model="previewDialog.visible" :title="previewDialog.title" width="900px" append-to-body>
<el-dialog v-model="previewDialog.visible" :title="previewDialog.title" width="900px" append-to-body @closed="handlePreviewClose">
<vue-office-docx v-loading="fileLoading" element-loading-text="加载中..."
v-if="currentFile.fileSuffix == '.doc' || currentFile.fileSuffix == '.docx'" :src="file" />
@ -133,7 +133,8 @@
style="height: 100vh;width: 100vh;"
v-if="currentFile.fileSuffix == '.xls' || currentFile.fileSuffix == '.xlsx'" :src="file" />
<vue-office-pdf v-loading="fileLoading" element-loading-text="加载中..." v-if="currentFile.fileSuffix == '.pdf'"
<vue-office-pdf style="height: 100vh" v-loading="fileLoading" element-loading-text="加载中..."
v-if="currentFile.fileSuffix == '.pdf' || currentFile.fileSuffix == '.ppt' || currentFile.fileSuffix == '.pptx'"
:src="file" />
<div v-loading="fileLoading" element-loading-text="加载中..." v-if="currentFile.fileSuffix == '.txt'"
@ -181,7 +182,7 @@
</template>
<script setup name="Oss" lang="ts">
import { pageResource, awaitResourceList, preview, previewTxt, delResource, addResource, reviewResource, copyResource, moveResource } from '@/api/system/oss';
import { pageResource, awaitResourceList, previewResource, previewResourceTxt, delResource, addResource, reviewResource, copyResource, moveResource } from '@/api/system/oss';
import ImagePreview from '@/components/ImagePreview/index.vue';
import FileMd5Upload from '@/components/FileMd5Upload/index.vue';
import { OssForm, OssQuery, OssVO } from '@/api/system/oss/types';
@ -533,28 +534,33 @@ const file = ref('')
const fileLoading = ref(false)
const txt = ref('')
const imgUrl = ref('')
const handlePreview = async (row: OssVO) => {
const handlePreview = async (row: any) => {
file.value = ''
fileLoading.value = true
previewDialog.visible = true
currentFile.value = row
if (row.fileSuffix == '.txt') {
const fileRes = await previewTxt(row.ossId)
const fileRes = await previewResourceTxt(row.id)
console.log(fileRes)
txt.value = fileRes
} else if (imgSuffix.includes(row.fileSuffix)) {
const fileRes = await preview(row.ossId)
const fileRes = await previewResource(row.id)
let blob = new Blob([fileRes], { type: `image/${row.fileSuffix.substring(1)}` })
imgUrl.value = URL.createObjectURL(blob)
} else if (fileSuffix.includes(row.fileSuffix)) {
const fileRes = await preview(row.ossId)
const fileRes = await previewResource(row.id)
fileRes.arrayBuffer().then(res => file.value = res)
}
fileLoading.value = false
}
const handlePreviewClose = () => {
file.value = ''
txt.value = ''
}
const treeLoading = ref(false)
/** 查询目录-同步教材列表 */
const getlistCatalogResource = async () => {

View File

@ -12,8 +12,8 @@
<div class="line"></div>
<el-button type="" text="plain">全部课件</el-button>
<br>
<el-button :class="['btn-audit', isAudit && 'active']" type="" text="plain"
@click="handleAudit">待审核</el-button>
<el-button v-hasPermi="['file:textbook:awaitList']" :class="['btn-audit', isAudit && 'active']" type=""
text="plain" @click="handleAudit">待审核</el-button>
<el-tree ref="treeRef" v-loading="treeLoading" :data="treeData" :props="defaultProps" default-expand-all
@node-click="handleNode" />
</div>
@ -54,11 +54,11 @@
<template #header>
<el-row :gutter="10" class="mb8">
<el-col v-if="isUpload" :span="1.5">
<el-button v-hasPermi="['system:oss:upload']" type="primary" plain icon="Upload"
<el-button v-hasPermi="['file:textbook:add']" type="primary" plain icon="Upload"
@click="handleFile">上传课件</el-button>
</el-col>
<el-col :span="1.5">
<el-button v-hasPermi="['system:oss:remove']" type="danger" plain icon="Delete" :disabled="multiple"
<el-button v-hasPermi="['file:textbook:remove']" type="danger" plain icon="Delete" :disabled="multiple"
@click="handleDelete()">
删除
</el-button>
@ -82,30 +82,30 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="350">
<template #default="scope">
<el-tooltip v-if="isAudit" content="审核通过" placement="top">
<el-tooltip v-if="isAudit" v-hasPermi="['file:textbook:review']" content="审核通过" placement="top">
<el-button link type="primary" icon="CopyDocument"
@click="handleAuditBtn(scope.row, 1)">审核通过</el-button>
</el-tooltip>
<el-tooltip v-if="isAudit" content="审核不通过" placement="top">
<el-tooltip v-if="isAudit" v-hasPermi="['file:textbook:review']" content="审核不通过" placement="top">
<el-button link type="primary" icon="DocumentCopy"
@click="handleAuditBtn(scope.row, 0)">审核不通过</el-button>
</el-tooltip>
<el-tooltip content="预览" placement="top">
<el-tooltip v-hasPermi="['file:textbook:preview']" content="预览" placement="top">
<el-button link type="primary" icon="View" @click="handlePreview(scope.row)">预览</el-button>
</el-tooltip>
<el-tooltip v-hasPermi="['system:oss:download']" content="下载" placement="top">
<el-tooltip v-hasPermi="['file:textbook:download']" content="下载" placement="top">
<el-button link type="primary" icon="Download" @click="handleDownload(scope.row)">下载</el-button>
</el-tooltip>
<el-tooltip v-if="isTree" content="移动" placement="top">
<el-tooltip v-hasPermi="['file:textbook:move']" v-if="isTree" content="移动" placement="top">
<el-button link type="primary" icon="CopyDocument" @click="handleMove(scope.row)">移动</el-button>
</el-tooltip>
<el-tooltip v-if="isTree" content="复制" placement="top">
<el-tooltip v-hasPermi="['file:textbook:copy']" v-if="isTree" content="复制" placement="top">
<el-button link type="primary" icon="DocumentCopy" @click="handleCopy(scope.row)">复制</el-button>
</el-tooltip>
<el-tooltip v-if="isTree" content="删除" placement="top">
<el-button v-hasPermi="['system:oss:remove']" link type="primary" icon="Delete"
<el-button v-hasPermi="['file:textbook:remove']" link type="primary" icon="Delete"
@click="handleDelete(scope.row)">删除</el-button>
</el-tooltip>
</template>
@ -132,7 +132,7 @@
</template>
</el-dialog>
<el-dialog v-model="previewDialog.visible" :title="previewDialog.title" width="900px" append-to-body>
<el-dialog v-model="previewDialog.visible" :title="previewDialog.title" width="900px" append-to-body @closed="handlePreviewClose">
<vue-office-docx v-loading="fileLoading" element-loading-text="加载中..."
v-if="currentFile.fileSuffix == '.doc' || currentFile.fileSuffix == '.docx'" :src="file" />
@ -140,7 +140,8 @@
style="height: 100vh;width: 100vh;"
v-if="currentFile.fileSuffix == '.xls' || currentFile.fileSuffix == '.xlsx'" :src="file" />
<vue-office-pdf v-loading="fileLoading" element-loading-text="加载中..." v-if="currentFile.fileSuffix == '.pdf'"
<vue-office-pdf style="height: 100vh" v-loading="fileLoading" element-loading-text="加载中..."
v-if="currentFile.fileSuffix == '.pdf' || currentFile.fileSuffix == '.ppt' || currentFile.fileSuffix == '.pptx'"
:src="file" />
<div v-loading="fileLoading" element-loading-text="加载中..." v-if="currentFile.fileSuffix == '.txt'"
@ -188,7 +189,7 @@
</template>
<script setup name="Oss" lang="ts">
import { pageTextbook, awaitTexbookList, preview, previewTxt, delTextbook, addTextbook, reviewTextbook, copyTextbook, moveTextbook } from '@/api/system/oss';
import { pageTextbook, awaitTexbookList, previewTextbook, previewTextbookTxt, delTextbook, addTextbook, reviewTextbook, copyTextbook, moveTextbook } from '@/api/system/oss';
import ImagePreview from '@/components/ImagePreview/index.vue';
import FileMd5Upload from '@/components/FileMd5Upload/index.vue';
import { OssForm, OssQuery, OssVO } from '@/api/system/oss/types';
@ -343,11 +344,6 @@ const getList = async () => {
showTable.value = true;
};
function checkFileSuffix(fileSuffix: string | string[]) {
const arr = [".png", ".jpg", ".jpeg"];
const suffixArray = Array.isArray(fileSuffix) ? fileSuffix : [fileSuffix];
return suffixArray.some(suffix => arr.includes(suffix.toLowerCase()));
}
/** 取消按钮 */
function cancel() {
dialog.visible = false;
@ -380,30 +376,6 @@ const handleHeaderClass = ({ column }: any): any => {
column.order = column.multiOrder;
};
const handleOrderChange = (prop: string, order: string) => {
let orderByArr = queryParams.value.orderByColumn ? queryParams.value.orderByColumn.split(',') : [];
let isAscArr = queryParams.value.isAsc ? queryParams.value.isAsc.split(',') : [];
let propIndex = orderByArr.indexOf(prop);
if (propIndex !== -1) {
if (order) {
//
isAscArr[propIndex] = order;
} else {
//ordernull
isAscArr.splice(propIndex, 1); //
orderByArr.splice(propIndex, 1); //
}
} else {
//
orderByArr.push(prop);
isAscArr.push(order);
}
//
queryParams.value.orderByColumn = orderByArr.join(',');
queryParams.value.isAsc = isAscArr.join(',');
getList();
};
/** 文件按钮操作 */
const handleFile = () => {
reset();
@ -428,7 +400,7 @@ const handleFileName = (val) => {
const submitForm = async () => {
const ossId = form.value.file
const catalogId = currentNode.value.catalogId
await addTextbook({ ossId, catalogId, fileName: fileName.value, type: catalogRadio.value })
await addTextbook({ ossId, catalogId, fileName: fileName.value, type: queryParams.value.type })
dialog.visible = false;
getList();
};
@ -540,28 +512,33 @@ const file = ref('')
const fileLoading = ref(false)
const txt = ref('')
const imgUrl = ref('')
const handlePreview = async (row: OssVO) => {
const handlePreview = async (row: any) => {
file.value = ''
fileLoading.value = true
previewDialog.visible = true
currentFile.value = row
if (row.fileSuffix == '.txt') {
const fileRes = await previewTxt(row.ossId)
const fileRes = await previewTextbookTxt(row.id)
console.log(fileRes)
txt.value = fileRes
} else if (imgSuffix.includes(row.fileSuffix)) {
const fileRes = await preview(row.ossId)
const fileRes = await previewTextbook(row.id)
let blob = new Blob([fileRes], { type: `image/${row.fileSuffix.substring(1)}` })
imgUrl.value = URL.createObjectURL(blob)
} else if (fileSuffix.includes(row.fileSuffix)) {
const fileRes = await preview(row.ossId)
const fileRes = await previewTextbook(row.id)
fileRes.arrayBuffer().then(res => file.value = res)
}
fileLoading.value = false
}
const handlePreviewClose = () => {
file.value = ''
txt.value = ''
}
const treeLoading = ref(false)
/** 查询目录-同步教材列表 */
const getListCatalogTextbook = async () => {

View File

@ -47,7 +47,7 @@
删除
</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-dropdown class="mt-[1px]">
<el-button plain type="info">
更多
@ -60,7 +60,7 @@
</el-dropdown-menu>
</template>
</el-dropdown>
</el-col>
</el-col> -->
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true"
@query-table="getList"></right-toolbar>
</el-row>

File diff suppressed because one or more lines are too long