提交 6dc69893 authored 作者: 龙菲's avatar 龙菲

完善外部资源和内部资源

上级 995c38bd
......@@ -204,6 +204,7 @@
opacity: 0.5;
}
</style>
</head>
<body>
......
......@@ -1545,9 +1545,9 @@
this._intentStates = new Map();
this.destroyed = false;
this._annotations = [];
this.getAnnotations().then((t) => {
this._annotations = t;
});
// this.getAnnotations().then((t) => {
// this._annotations = t;
// });
}
get pageNumber() {
return this._pageIndex + 1;
......@@ -1556,7 +1556,16 @@
return this._annotations;
}
addAnnotation(annotations) {
this._annotations = [...this._annotations, annotations];
if (Array.isArray(annotations)) {
this._annotations = [...this._annotations, ...annotations];
} else {
this._annotations = [...this._annotations, annotations];
}
}
rAddAnnotation(annotations) {
const ids = annotations.map((o) => o.id);
const ds = [...this._annotations].filter((o) => !ids.includes(o.id));
this._annotations = [...ds, ...annotations];
}
removeAnnotation(id) {
this._annotations = [...this._annotations].filter(
......@@ -15917,7 +15926,7 @@
rect.setAttribute("height", rectHeight * 0.1);
} else if (this.data.annotationType === 12) {
rect.setAttribute("x", x);
rect.setAttribute("y", y + rectHeight * 0.55);
rect.setAttribute("y", y + rectHeight * 0.5);
rect.setAttribute("width", rectWidth);
rect.setAttribute("height", rectHeight * 0.1);
} else {
......@@ -17808,7 +17817,7 @@
}
render() {
if (!this.data.popupRef) {
this._createPopup();
// this._createPopup();
}
this.container.classList.add("squigglyAnnotation");
return this.container;
......@@ -18037,7 +18046,6 @@
parent: this,
elements: null,
};
console.log(16556, annotations);
for (const data of annotations) {
if (data.noHTML) {
continue;
......
......@@ -3,6 +3,7 @@
* 资源社区相关接口
*/
import request from '@/utils/request'
import qs from 'qs'
const baseUrl = '/v1/api'
......@@ -42,4 +43,15 @@ export const getThesisList = (params) => {
method: 'get',
params
})
}
\ No newline at end of file
}
// 内部资源列表查询
export const getInnerFileList = (data) => {
return request({
url: baseUrl + '/paper/getInnerFileList',
method: 'post',
data: qs.stringify(data),
headers: { 'content-type': 'application/x-www-form-urlencoded' }
})
}
......@@ -214,7 +214,7 @@ export default {
};
// 我的收藏界面只显示已收藏的
if (this.fileType == this.MY_COLLECT) {
if (this.fileType == this.MY_COLLECT.code) {
data.removeFlag = this.COLLECTED;
}
const params = new URLSearchParams();
......
......@@ -158,7 +158,7 @@
<li
class="right-menu-item"
@click="handleClickAddFolderBtn"
v-if="[MY_CREATE, TEMPLATE_MANAGE, MY_COLLECT].includes(fileType)"
v-if="[MY_CREATE.code, TEMPLATE_MANAGE.code, MY_COLLECT.code].includes(fileType)"
>
<i class="el-icon-folder-add"></i> 新建文件夹
</li>
......@@ -168,7 +168,7 @@
<li
class="right-menu-item"
@click="handleCreateFileByTemplate('docx')"
v-if="[MY_CREATE, TEMPLATE_MANAGE].includes(fileType)"
v-if="[MY_CREATE.code, TEMPLATE_MANAGE.code].includes(fileType)"
>
<img :src="wordImg" />新建Word文档
</li>
......@@ -178,7 +178,7 @@
<li class="right-menu-item" @click="handleCreateFile('pptx')">
<img :src="pptImg" />新建 PPT 演示文稿
</li> -->
<span v-if="[MY_CREATE, TEMPLATE_MANAGE].includes(fileType)">
<span v-if="[MY_CREATE.code, TEMPLATE_MANAGE.code].includes(fileType)">
<el-divider />
<li
class="right-menu-item"
......@@ -268,11 +268,11 @@ export default {
// 取消收藏按钮是否显示
cancelCollectBtnShow() {
return this.fileType == this.MY_COLLECT; //我的收藏才显示
return this.fileType == this.MY_COLLECT.code; //我的收藏才显示
},
// 删除按钮是否显示
deleteBtnShow() {
return this.fileType != this.MY_COLLECT; //我的收藏不能删除
return this.fileType != this.MY_COLLECT.code; //我的收藏不能删除
},
// 还原按钮是否显示
restoreBtnShow() {
......@@ -288,11 +288,11 @@ export default {
},
// 重命名按钮是否显示
renameBtnShow() {
return this.fileType != this.MY_COLLECT; //我的收藏不能重命名
return this.fileType != this.MY_COLLECT.code; //我的收藏不能重命名
},
// 分享按钮是否显示
shareBtnShow() {
return this.fileType != this.TEMPLATE_MANAGE; //模板管理不能分享
return this.fileType != this.TEMPLATE_MANAGE.code; //模板管理不能分享
},
// 下载按钮是否显示
downloadBtnShow() {
......@@ -602,7 +602,7 @@ export default {
* @param {string} 文件扩展名 docx xlsx pptx
*/
handleCreateFileByTemplate(extendName) {
const isShowTemplateRatio = this.fileType != this.TEMPLATE_MANAGE;
const isShowTemplateRatio = this.fileType != this.TEMPLATE_MANAGE.code;
this.$openDialog
.addFileByTemplate({
extendName,
......
......@@ -9,7 +9,7 @@
class="create-operate-group"
v-if="
(!selectedFiles.length || !isBatchOperation) &&
[MY_CREATE, TEMPLATE_MANAGE].includes(fileType)
[MY_CREATE.code, TEMPLATE_MANAGE.code].includes(fileType)
"
>
<!-- 上传模块 -->
......@@ -53,7 +53,7 @@
</el-dropdown-item>
<!-- 只有我的创作采用到新建word文档 -->
<el-dropdown-item
v-if="[MY_CREATE, TEMPLATE_MANAGE].includes(fileType)"
v-if="[MY_CREATE.code, TEMPLATE_MANAGE.code].includes(fileType)"
divided
@click.native="handleCreateFile('docx')"
>
......@@ -79,7 +79,7 @@
<el-button
v-if="
(!selectedFiles.length || !isBatchOperation) &&
[MY_COLLECT].includes(fileType)
[MY_COLLECT.code].includes(fileType)
"
size="mini"
type="primary"
......@@ -89,6 +89,20 @@
>新建文件夹</el-button
>
<!-- 内部资源只需要用到上传文件 -->
<!-- <el-button
v-if="
(!selectedFiles.length || !isBatchOperation) &&
[INTERNAL_RESOURCE.code].includes(fileType)
"
size="mini"
type="primary"
icon="el-icon-upload2"
id="uploadFileId"
@click.native="handleUploadFileBtnClick(FILE_UPLOAD)"
>上传文件</el-button
> -->
<div class="batch-operate-group">
<el-button-group v-if="isBatchOperation">
<el-button
......@@ -120,13 +134,13 @@
<el-button
size="mini"
type="primary"
v-if="selectedFiles.length && fileType != MY_COLLECT"
v-if="selectedFiles.length && fileType != MY_COLLECT.code"
icon="el-icon-delete"
@click="handleBatchDeleteBtnClick"
>批量删除</el-button
>
<el-button
v-if="selectedFiles.length && fileType == MY_COLLECT"
v-if="selectedFiles.length && fileType == MY_COLLECT.code"
size="mini"
type="primary"
icon="el-icon-delete"
......@@ -391,7 +405,7 @@ export default {
* @param {string} extendName 文件扩展名 docx xlsx pptx
*/
handleCreateFile(extendName) {
let isShowTemplateRatio = this.fileType != this.TEMPLATE_MANAGE; //是否要展示模板选项,我的创作展示,模板管理不展示
let isShowTemplateRatio = this.fileType != this.TEMPLATE_MANAGE.code; //是否要展示模板选项,我的创作展示,模板管理不展示
this.$openDialog
.addFileByTemplate({
extendName,
......
// // 文件模块类别
// export const fileTypeConstant = {
// MY_CREATE: 10,//我的创作
// TEMPLATE_MANAGE: 11,//模板管理
// MY_COLLECT: 12,//我的收藏
// INTERNAL_RESOURCE: 13,//内部资源
// }
// 文件模块类别
export const fileTypeConstant = {
MY_CREATE: 10,//我的创作
TEMPLATE_MANAGE: 11,//模板管理
MY_COLLECT: 12,//我的收藏
MY_CREATE: {
code: 10,
path: '/我的创作'
},
TEMPLATE_MANAGE: {
code: 11,
path: '/模板管理'
},
MY_COLLECT: {
code: 12,
path: "/我的收藏"
},
INTERNAL_RESOURCE: {
code: 13,
path: '/内部资源'
}
}
// 展示模式
export const displayModeConstant = {
TABLE: 0,//列表
......
......@@ -25,7 +25,7 @@
<el-tooltip content="文档地址" effect="dark" placement="bottom">
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
</el-tooltip> -->
<el-tooltip content="cajViwer下载" effect="dark" placement="bottom">
<el-tooltip content="caj阅读器下载" effect="dark" placement="bottom">
<svg-icon
icon-class="caj-logo"
style="font-size: 30px; margin: 0 8px; cursor: pointer"
......@@ -73,7 +73,7 @@ import SizeSelect from "@/components/SizeSelect";
import Search from "@/components/HeaderSearch";
import RuoYiGit from "@/components/RuoYi/Git";
import RuoYiDoc from "@/components/RuoYi/Doc";
import { handleDownloadCajViewer } from "@/utils/file";
export default {
components: {
Breadcrumb,
......@@ -105,6 +105,8 @@ export default {
},
},
methods: {
// 下载caj阅读器
handleDownloadCajViewer,
toggleSideBar() {
this.$store.dispatch("app/toggleSideBar");
},
......@@ -121,15 +123,6 @@ export default {
})
.catch(() => {});
},
handleDownloadCajViewer() {
let a = document.createElement("a");
a.href = "/caj-viewer/CAJViewer 8.1_x64-setup.exe";
a.download = "CAJViewer 8.1_x64-setup.exe";
a.style.display = "none";
document.body.appendChild(a);
a.click();
a.remove();
},
},
};
</script>
......
......@@ -155,3 +155,13 @@ export function openFile(file, $el, localStorage, flag = false) {
}
}
export function handleDownloadCajViewer() {
let a = document.createElement("a");
a.href = "/caj-viewer/CAJViewer 8.1_x64-setup.exe";
a.download = "CAJViewer 8.1_x64-setup.exe";
a.style.display = "none";
document.body.appendChild(a);
a.click();
a.remove();
}
......@@ -24,8 +24,8 @@ export default {
// 修改查询参数,例如,给 "filePath" 参数设置新的值
// 10-我的创作 11-模板管理
const newFileType = TEMPLATE_MANAGE;
const newFilePath = "/模板管理";
const newFileType = TEMPLATE_MANAGE.code;
const newFilePath = TEMPLATE_MANAGE.path;
const newQueryParams = {
...currentQueryParams,
fileType: newFileType,
......
......@@ -22,8 +22,8 @@ export default {
const currentQueryParams = this.$route.query;
// 修改查询参数,例如,给 "filePath" 参数设置新的值
const newFileType = MY_COLLECT;
const newFilePath = "/我的收藏";
const newFileType = MY_COLLECT.code;
const newFilePath = MY_COLLECT.path;
const newQueryParams = {
...currentQueryParams,
fileType: newFileType,
......
......@@ -22,8 +22,8 @@ export default {
const currentQueryParams = this.$route.query;
// 修改查询参数,例如,给 "filePath" 参数设置新的值
const newFileType = MY_CREATE;
const newFilePath = "/我的创作";
const newFileType = MY_CREATE.code;
const newFilePath = MY_CREATE.path;
const newQueryParams = {
...currentQueryParams,
fileType: newFileType,
......
<template>
<el-dialog :visible.async="visible" title="提示">
请使用下载文件后,使用CajViewer打开,<el-link
>点击此处下载CajViewer</el-link
>
</el-dialog>
</template>
<script>
export default {
data() {
return {
visible: false,
};
},
mounted() {},
methods: {},
};
</script>
<style scoped lang="scss"></style>
......@@ -12,7 +12,7 @@
</div>
<div class="search-input">
<el-input
placeholder="输入关键词搜索,马上在线阅读"
placeholder="输入关键词搜索,马上阅读"
v-model="keyword"
clearable
@keyup.native.enter="handleSearch"
......
<template>
<div class="table">
<div class="mb8">
<div class="tools">
<!-- <el-button
type="primary"
plain
......@@ -17,6 +17,27 @@
@click.native="handleMultiDownload"
>批量下载</el-button
>
<el-button
v-if="previewType == 'caj'"
type="text"
size="mini"
class="caj"
@click="handleDownloadCajViewer"
>
<svg-icon icon-class="caj-logo" style="font-size: 24px"></svg-icon>
下载Caj阅读器
</el-button>
<el-button
v-if="previewType == 'pdf'"
class="upload"
size="mini"
type="primary"
icon="el-icon-upload2"
id="uploadFileId"
@click.native="handleUploadFileBtnClick(FILE_UPLOAD)"
>上传文件</el-button
>
</div>
<el-table
v-loading="loading"
......@@ -85,14 +106,16 @@
{{ scope.row.collected ? "已收藏" : "收藏" }}
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
<!-- <el-link
type="primary"
icon="el-icon-view"
@click="handleOpenFile(scope.row)"
>
预览
</el-link>
<el-divider direction="vertical"></el-divider>
</el-link> -->
<!-- <el-divider direction="vertical"></el-divider> -->
<el-link
target="_blank"
type="primary"
......@@ -106,10 +129,9 @@
</el-table-column>
</el-table>
<pagination
v-show="list.totalElements > 0"
:total="list.totalElements"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="list[totalKey]"
:page.sync="list[currentKey]"
:limit.sync="list[sizeKey]"
@pagination="getList"
/>
<!-- 多选文件下载,页面隐藏 -->
......@@ -118,18 +140,32 @@
</template>
<script>
// import { list } from "../../mockData";
import { addFavorite, cancelCollect } from "@/api/user/collect";
import { handleDownloadCajViewer } from "@/utils/file";
import { uploadModeConstant, fileTypeConstant } from "@/constants/index";
const { INTERNAL_RESOURCE } = fileTypeConstant;
export default {
props: {
list: {
type: Object,
default: () => ({
records: [],
totalElements: 0,
pageCount: 10,
pageNo: 1,
}),
default: () => ({}),
},
// 第三方资源暂时用Caj,内部资源预览使用pdf
previewType: {
type: String,
default: "pdf",
},
currentKey: {
type: String,
default: "current",
},
sizeKey: {
type: String,
default: "size",
},
totalKey: {
type: String,
default: "total",
},
},
data() {
......@@ -142,23 +178,8 @@ export default {
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
pageNo: 1,
pageCount: 10,
totalElements: 0,
keyword: "", //文件名称
},
// 批量取消的弹窗可见性
multiCancelVisible: false,
...uploadModeConstant,
INTERNAL_RESOURCE,
};
},
computed: {
......@@ -175,8 +196,10 @@ export default {
this.getList();
},
methods: {
// 下载caj阅读器
handleDownloadCajViewer,
getList() {
this.$emit("getList", this.queryParams);
this.$emit("getList");
},
// 多选框选中数据
handleSelectionChange(selection) {
......@@ -184,11 +207,11 @@ export default {
this.single = selection.length != 1;
this.multiple = !selection.length;
},
// 点击打开文件
handleOpenFile(file) {
this.$file.handleFileNameClickNew(file);
},
// 获取下载地址
getDownloadFilePath(file) {
return file.weburl;
......@@ -239,7 +262,6 @@ export default {
removeFlag: null,
};
}
// console.log(file);
let res = await request(params);
if (res.code == 200) {
let message = file.collected ? "取消收藏成功!" : "收藏成功!";
......@@ -261,5 +283,17 @@ export default {
padding: 20px;
background-color: #fff;
border-radius: 4px;
.tools {
margin-bottom: 8px;
display: flex;
justify-content: space-between;
align-items: center;
::v-deep .caj {
& > span {
display: flex;
align-items: center;
}
}
}
}
</style>
<template>
<div class="app-container container">
<SearchBar ref="SearchBar" @search="loadData" />
<Table ref="Table" :list="list" @getList="loadData" v-loading="loading" />
<Table
ref="Table"
:list="list"
@getList="loadData"
v-loading="loading"
previewType="caj"
currentKey="pageNo"
sizeKey="pageCount"
totalKey="totalElements"
/>
</div>
</template>
<script>
import SearchBar from "../components/searchBar/index.vue";
import Table from "../components/table/index.vue";
import SearchBar from "./components/searchBar/index.vue";
import Table from "./components/table/index.vue";
import {
getNewspaperList,
getPeriodicalsList, //期刊
......@@ -34,7 +43,7 @@ export default {
async loadData() {
this.loading = true;
const { activeTab, keyword, currentYear } = this.$refs.SearchBar;
const { pageNo, pageCount } = this.$refs.Table.queryParams;
const { pageNo, pageCount } = this.list;
const params = {
keyword,
pageNo,
......@@ -65,6 +74,8 @@ export default {
let res = await request(params);
if (res.code == 200) {
this.list = res.data;
this.list.pageCount = Number(this.list.pageCount)
this.list.pageNo = Number(this.list.pageNo)
this.loading = false;
}
},
......
......@@ -11,39 +11,258 @@
>搜索
</el-button>
</div>
<Table :list="list" @getList="loadData" v-loading="loading" />
<div class="table">
<el-button
class="upload"
size="mini"
type="primary"
icon="el-icon-upload2"
id="uploadFileId"
@click.native="handleUploadFileBtnClick(FILE_UPLOAD)"
>上传文件</el-button
>
<el-button
type="primary"
plain
size="mini"
:disabled="multiple"
@click.native="handleMultiDownload"
>批量下载</el-button
>
<el-table
v-loading="loading"
:data="list.records"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="文件名称"
align="center"
prop="name"
show-overflow-tooltip
>
<template slot-scope="scope">
<div class="fileName">
<img :src="$file.setFileImg(scope.row)" />
<el-link @click="handleOpenFile(scope.row)">
{{ scope.row.fileName }}
</el-link>
</div>
</template>
</el-table-column>
<el-table-column
label="作者"
align="center"
prop="author"
show-overflow-tooltip
>
</el-table-column>
<!-- <el-table-column
show-overflow-tooltip
label="年份"
prop="year"
align="center"
/> -->
<el-table-column
show-overflow-tooltip
label="机构"
prop="organize"
align="center"
>
</el-table-column>
<el-table-column
label="文件大小"
align="center"
prop="fileSize"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ $file.calculateFileSize(scope.row.fileSize) }}
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-link
type="primary"
:icon="
scope.row.collected ? 'el-icon-star-on' : 'el-icon-star-off'
"
@click="handleCollect(scope.row)"
>
{{ scope.row.collected ? "已收藏" : "收藏" }}
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
type="primary"
icon="el-icon-view"
@click="handleOpenFile(scope.row)"
>
预览
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link
target="_blank"
type="primary"
icon="el-icon-download"
:href="$file.getDownloadFilePath(scope.row)"
:download="scope.row.fileName + '.' + scope.row.extendName"
>
下载
</el-link>
</template>
</el-table-column>
</el-table>
<pagination
:total="list.total"
:page.sync="list.current"
:limit.sync="list.size"
@pagination="loadData"
/>
</div>
</div>
</template>
<script>
import Table from "../components/table/index.vue";
import { getInnerFileList } from "@/api/resource";
import { uploadModeConstant, fileTypeConstant } from "@/constants/index";
const { INTERNAL_RESOURCE } = fileTypeConstant;
export default {
components: {
Table,
},
data() {
return {
keyword: "",
list: {
records: [],
totalElements: 0,
pageCount: 10,
pageNo: 1,
total: 0,
size: 10,
current: 1,
},
INTERNAL_RESOURCE,
// 遮罩层
loading: false,
// 选中数组
selectedFiles: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
...uploadModeConstant,
INTERNAL_RESOURCE,
};
},
computed: {
// 批量下载文件链接
batchDownloadLink() {
return `${
process.env.VUE_APP_BASE_API
}/v1/api/folder/transfer/batchDownloadFile?userFileIds=${this.selectedFiles
.map((item) => item.userFileId)
.join(",")}`;
},
},
mounted() {
this.loadData();
},
methods: {
handleSearch(keyword) {
console.log("search", keyword);
this.loadData();
},
// 点击打开文件
handleOpenFile(file) {
this.$file.handleFileNameClickNew(file);
},
async loadData() {
this.loading = true;
const { size, current } = this.list;
let params = {
fileType: this.INTERNAL_RESOURCE.code,
filePath: this.INTERNAL_RESOURCE.path,
currentPage: current,
pageCount: size,
fileName: this.keyword,
};
let res = await getInnerFileList(params);
this.loading = false;
if (res.code == 200) {
this.list = res.data;
this.list.current = Number(this.list.current);
this.list.size = Number(this.list.size);
}
},
// 多选框选中数据
handleSelectionChange(selection) {
this.selectedFiles = selection;
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/**
* 上传文件按钮点击事件
* @description 通过Bus通信,开启全局上传文件流程
* @param {boolean} uploadWay 上传方式 0-文件上传 1-文件夹上传 2-粘贴图片或拖拽上传
*/
handleUploadFileBtnClick(uploadWay) {
const params = { filePath: this.INTERNAL_RESOURCE.path, isDir: 0 };
this.$openBox.uploadFile({
params,
uploadWay,
serviceEl: this,
callType: 1, // callType 调用此服务的方式:1 - 顶部栏,2 - 右键菜单
});
},
// 点击收藏
handleCollect(row) {
console.log("点击收藏", row);
this.loading = true;
const { extendName, fileName } = row;
const filePath = "/我的收藏";
const WORD = ["docx", "doc"]; //暂时只考虑新建word的情况
let filetype = "w";
// const PDF = ["pdf", "doc"];
// const EXCEL = ["xlsx", "xls"];
if (WORD.includes(row.extendName)) {
filetype = "w";
}
const params = {
filetype,
extendName,
filePath,
fileName,
isTemplate: false,
templateId: "",
};
newfile(params)
.then((res) => {
this.loading = false;
if (res.code == 200) {
this.$message.success("收藏成功!");
}
})
.catch(() => {
this.loading = false;
});
},
loadData() {},
},
};
</script>
<style lang="scss" scoped>
.container {
background-color: #f7f8fa;
padding: 20px 40px;
padding: 20px;
}
.upload {
margin-bottom: 10px;
}
.search-input {
display: flex;
......@@ -60,4 +279,27 @@ export default {
}
}
}
.table {
margin: 0 0 20px;
padding: 20px;
background-color: #fff;
border-radius: 4px;
.tools {
margin-bottom: 8px;
display: flex;
justify-content: space-between;
align-items: center;
}
}
.fileName {
display: flex;
justify-content: center;
align-items: center;
img {
width: 18px;
height: 18px;
object-fit: contain;
margin-right: 4px;
}
}
</style>
......@@ -143,8 +143,6 @@ import { shareStatusConstant, shareTypeConstant } from "./constant";
import { fileTypeConstant } from "@/constants";
import { mapGetters } from "vuex";
const { PUBLIC_SHARE } = shareTypeConstant;
const { MY_COLLECT } = fileTypeConstant;
export default {
name: "myShare",
dicts: ["share_type", "share_status"],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论