diff --git a/dist (3).zip b/dist (3).zip new file mode 100644 index 0000000..7986f17 Binary files /dev/null and b/dist (3).zip differ diff --git a/dist (4).zip b/dist (4).zip new file mode 100644 index 0000000..a9b7cd3 Binary files /dev/null and b/dist (4).zip differ diff --git a/dist (5).zip b/dist (5).zip new file mode 100644 index 0000000..f3dfc0b Binary files /dev/null and b/dist (5).zip differ diff --git a/dist (6).zip b/dist (6).zip new file mode 100644 index 0000000..bef79c9 Binary files /dev/null and b/dist (6).zip differ diff --git a/dist (7).zip b/dist (7).zip new file mode 100644 index 0000000..67d2eae Binary files /dev/null and b/dist (7).zip differ diff --git a/dist.zip b/dist.zip new file mode 100644 index 0000000..73234f4 Binary files /dev/null and b/dist.zip differ diff --git a/package.json b/package.json index 76651ec..17d2fe0 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,10 @@ }, "dependencies": { "@onlyoffice/document-editor-vue": "^1.1.1", + "@vue-office/docx": "^1.0.0", + "@vue-office/excel": "^1.0.0", + "@vue-office/pdf": "^1.0.0", + "@vue/composition-api": "^1.7.1", "axios": "0.18.1", "core-js": "^3.26.1", "docx-preview": "^0.1.14", diff --git a/public/index.html b/public/index.html index 066ba82..dceb76e 100644 --- a/public/index.html +++ b/public/index.html @@ -5,7 +5,7 @@ - + <%= webpackConfig.name %> diff --git a/src/assets/file_icon/exe.svg b/src/assets/file_icon/exe.svg new file mode 100644 index 0000000..c5044bb --- /dev/null +++ b/src/assets/file_icon/exe.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/logo.svg b/src/assets/logo.svg new file mode 100644 index 0000000..5857f4c --- /dev/null +++ b/src/assets/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 6df44f5..44d499b 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -100,6 +100,7 @@ export default { this.userAvatar = res.data.userDetails.profilePhoto; this.userName = res.data.user.name; this.isLogin = true; + localStorage.setItem("dep",res.data.user.dep) }else { Message.warning("登录失败,请重新登录"); this.toLogin() diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index c188e6a..80c995b 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -17,20 +17,20 @@ - - - - + + + + + + + - - - + + + - - + + diff --git a/src/router/index.js b/src/router/index.js index a674474..2620a97 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -47,7 +47,7 @@ export const constantRoutes = [ { path: '/', component: Layout, - redirect: '/fileListV2/1', + redirect: '/fileListV3', hidden: true, children: [ { diff --git a/src/styles/index.scss b/src/styles/index.scss index cfd7f68..318182f 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -63,4 +63,5 @@ div:focus { .app-container { padding: 20px; height: 100vh; + } diff --git a/src/views/fileList/FileListV3.vue b/src/views/fileList/FileListV3.vue index f578069..e4e9904 100644 --- a/src/views/fileList/FileListV3.vue +++ b/src/views/fileList/FileListV3.vue @@ -4,9 +4,10 @@ @@ -34,7 +35,7 @@ @@ -71,9 +72,7 @@ - - 确 定 - + @@ -106,12 +105,14 @@ type="success" description="如果出现文件内容乱码问题,请检查所上传的文档中西文字体是否匹配(中文文字对应中文字体)" style="margin-bottom: 10px;font-size: 20px"/> - + + +
-
+
@@ -121,53 +122,7 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -181,9 +136,14 @@ import pageUtils from '@/utils/pageUtils' import { Message } from 'element-ui' import { getFilesInfoByName, getFilesInfoByType } from '@/utils/http/interface' import { toBase64 } from 'js-base64' - +import VueOfficeDocx from '@vue-office/docx' +import VueOfficePdf from '@vue-office/pdf' export default { name: 'FileList', + components:{ + VueOfficeDocx, + VueOfficePdf + }, filters: { statusFilter(status) { const statusMap = { @@ -298,7 +258,16 @@ export default { // } // 浏览查看 viewDialogVisible:false, - viewUrl:null + viewUrl:null, + + //在线浏览的文件信息 + viewFileData:null, + + //在线浏览文件类型 + isWord:false, + isPdf:false, + //用户IP + ip:null, } }, created() { @@ -323,6 +292,7 @@ export default { + //提示 showInfo(){ if (this.showInfoStatus == false) { @@ -374,17 +344,14 @@ export default { }, - viewFile(link){ - var url = 'http://127.0.0.1:8043/api/' + link; //要预览文件的访问地址 - this.viewUrl='http://114.116.228.69:8041/onlinePreview?url='+encodeURIComponent(toBase64(url)) - this.viewDialogVisible = true - // - // window.open(); - }, + + //关闭在线浏览 viewHandleClose(){ this.viewDialogVisible = false this.viewUrl = null + this.isPdf = false + this.isWord = false }, //关闭上传弹窗 @@ -472,6 +439,11 @@ export default { return require('@/assets/file_icon/excel3.svg') case 'pdf': return require('@/assets/file_icon/pdf3.svg') + case 'zip': + case 'rar': + return require('@/assets/file_icon/zip.svg') + case 'exe': + return require('@/assets/file_icon/exe.svg') default: return require("@/assets/file_icon/unu.svg") } @@ -501,9 +473,47 @@ export default { // 判断是否为文件夹 if (file.directory){ //是 进入 - this.path = this.path + file.name + "/" - this.getFilesDirMeta() - this.fileLevel = this.fileLevel + 1 + //检测用户信息 这块逻辑放到后端更好 + var dep = localStorage.getItem('dep') + if (file.name === '一室') { + console.log(file.name) + + if (dep ==='一室' || dep === '管理员'){ + //继续访问下一层 + this.path = this.path + file.name + "/" + this.getFilesDirMeta() + this.fileLevel = this.fileLevel + 1 + }else{ + //无权访问 提示信息 后续可做成输入密码授权访问 + Message.warning("抱歉,您无权限访问,您的部门是:"+ dep) + } + }else if (file.name === '二室') { + if (dep === '二室'|| dep === '管理员'){ + //继续访问下一层 + this.path = this.path + file.name + "/" + this.getFilesDirMeta() + this.fileLevel = this.fileLevel + 1 + }else { + //无权访问 提示信息 后续可做成输入密码授权访问 + Message.warning("抱歉,您无权限访问,您的部门是:"+ dep) + } + }else if (file.name === '四室') { + if (dep === '四室'|| dep === '管理员'){ + //继续访问下一层 + this.path = this.path + file.name + "/" + this.getFilesDirMeta() + this.fileLevel = this.fileLevel + 1 + }else { + //无权访问 提示信息 后续可做成输入密码授权访问 + Message.warning("抱歉,您无权限访问,您的部门是:"+ dep) + } + }else { + //不做限制 + this.path = this.path + file.name + "/" + this.getFilesDirMeta() + this.fileLevel = this.fileLevel + 1 + } + }else { //不是 直接下载 @@ -516,6 +526,13 @@ export default { console.log(file.name) console.log(file.directory) }, + saveFileData(file){ + //目前只用于在线浏览 保存文件url信息、判断文件是什么类型 + //保存文件信息 用于判断文件类型 + this.viewFileData = file + + this.viewUrl ="http://"+ window.location.host + "/api/files"+this.path + file.name,file.name + }, //返回上一层 back2Up(){ //先判断是否处于根目录 @@ -550,7 +567,29 @@ export default { Message.warning("添加文件夹失败,该文件夹可能已经存在~") } }) - } + }, + // 在线浏览 + onlineView(){ + if (this.viewFileData.directory){ + // 是文件夹 提示无法展示 + Message.warning("您选择的是文件夹 无法在线浏览") + }else { + //文件 判断文件类型 + if (this.viewFileData.name.endsWith('.docx')) { + //word文档 + this.isWord = true + this.viewDialogVisible = true + }else if (this.viewFileData.name.endsWith('.pdf')){ + this.isPdf = true + this.viewDialogVisible = true + }else { + Message.warning("您的文件暂不支持在线浏览 请下载查看") + } + } + + + }, + }, mounted() { diff --git a/src/views/login/index.vue b/src/views/login/index.vue index c16e4f0..de3c264 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -146,7 +146,7 @@ export default { localStorage.setItem("role", res.auth[0].authority); this.loading = true Message.success("登录成功") - pageUtils.openPage(this.$router,"/fileListV2/1"); //跳转至主页 + pageUtils.openPage(this.$router,"/fileListV3"); //跳转至主页 } // Cookies.set("token", res.data.token); // 放置token到Cookie diff --git a/src/views/onlyOfficeTest/OnlyOfficeTest.vue b/src/views/onlyOfficeTest/OnlyOfficeTest.vue index 3eb36b1..f84a5e9 100644 --- a/src/views/onlyOfficeTest/OnlyOfficeTest.vue +++ b/src/views/onlyOfficeTest/OnlyOfficeTest.vue @@ -53,7 +53,7 @@ export default{ // getAction('/file/selectById', { id: this.id }).then(res => { this.option.isEdit = true this.option.lang = 'zh-CN' - this.option.url = 'http://114.116.228.69:8043/api/files/ZPABOZ-%E7%BA%A2%E5%B1%B1%E5%BC%80%E6%BA%90%E5%B9%B3%E5%8F%B0%E7%AE%A1%E7%90%86%E5%91%98%E6%9D%83%E9%99%90%E5%88%86%E7%B1%BB%E7%BB%9F%E8%AE%A121.1.3.xlsx' + // this.option.url = 'http://114.116.228.69:8043/api/files/ZPABOZ-%E7%BA%A2%E5%B1%B1%E5%BC%80%E6%BA%90%E5%B9%B3%E5%8F%B0%E7%AE%A1%E7%90%86%E5%91%98%E6%9D%83%E9%99%90%E5%88%86%E7%B1%BB%E7%BB%9F%E8%AE%A121.1.3.xlsx' this.option.title = '123' this.option.fileType = 'xlsx' this.option.isPrint = false diff --git a/src/views/userManage/UserManage.vue b/src/views/userManage/UserManage.vue index 8ac756e..4a0ba7f 100644 --- a/src/views/userManage/UserManage.vue +++ b/src/views/userManage/UserManage.vue @@ -12,7 +12,7 @@
@@ -26,6 +26,9 @@ + + + @@ -91,6 +94,11 @@ + + +