diff --git a/README.md b/README.md index fe9f7ff..61c3aa1 100644 --- a/README.md +++ b/README.md @@ -51,38 +51,104 @@

体验地址:http://81.69.247.172/#/

+> 管理员账号:admin123 管理员密码: admin123 + ### 开源地址 前端项目 - -https://github.com/Jarrettluo/all-documents-vue.git + +https://github.com/Jarrettluo/all-docs-vue.git - 后端项目 - -https://github.com/Jarrettluo/document-sharing-site.git + +https://github.com/Jarrettluo/all-docs 选择mongoDB作为主要的数据库,存储文档和文件。 -后端技术:SpringBoot + MongoDB + ES +后端技术:`SpringBoot` + `MongoDB` + `ES` + `Redis` -前端技术:Vue + axios +前端技术:`Vue` + `axios` + `iView` + `...` -- docx预览方案:docx +- pdf 预览方案: `pdfjs-dist` -- ppt预览方案:暂无 +- docx预览方案(对doc支持非常差):`docx-preview` -- excel预览方案:xx +- ppt预览方案(后端生成pdf后预览):`pdfjs-dist` - +- excel预览方案:`vue-office/excel` -## 路线图 +## 快速体验 +> 在ubuntu 18.04 环境下测试通过 +```shell +# 克隆项目 +git clone https://github.com/Jarrettluo/all-docs.git + +# 切换为管理员 +su root + +# 切换到工作目录 +cd all-docs && cd docker + +# 修改文件权限 +chmod +x auto.sh + +# 启动脚本 +sudo ./auto.sh +``` +注意:因为快速体验是采用默认参数进行安装,使用的版本也可能比较旧,因此建议不要在生产环境中使用。 + +## 开发者浏览 +all-docs项目是一个前后端分离项目。 +如果只是想启动前端项目可以采用如下步骤: +```shell +# 拉取项目 +git clone https://github.com/Jarrettluo/all-docs-vue + +# 切换分支(如果有必要的话,默认是master分支) +git checkout develop + +# 找到 路径为:./src/api/request.js 并 修改request.js +# 其中baseURL就是默认的用户地址 +baseURL: 'http://81.69.247.172:8082/api/v1.0', + +# 安装依赖 +npm install + +# 其中服务 +npm serve +``` -查看 [open issues](https://github.com/othneildrew/Best-README-Template/issues) 。 +成功以后控制台可以看到如下内容: +```shell + App running at: + - Local: http://localhost:8080 + - Network: http://ip:8080 +``` +作者开发环境如下,供参考: +```shell +$ node -v +v14.16.1 + +$ npm -v +6.14.12 +``` + +### 项目部署 + +- [全文档在Windows环境下部署](https://github.com/Jarrettluo/document-sharing-site/blob/main/deploy/depoly_win_zh.md) +- [全文档在Linux环境下部署--待补充](https://github.com/Jarrettluo/document-sharing-site/blob/main/deploy/deploy_linux_zh.md) +- [全文档使用Docker部署--待补充](https://github.com/Jarrettluo/document-sharing-site/blob/main/deploy/deploy_docker_zh.md) +- [全文档使用Docker-Compose部署](https://github.com/Jarrettluo/document-sharing-site/blob/main/deploy/deploy_docker_compose_zh.md) + + + + +## 路线图 +暂无 @@ -108,16 +174,15 @@ https://github.com/Jarrettluo/document-sharing-site.git ## 联系我 -欢迎加入微信交流群,一起玩😄 +欢迎加入微信交流群,一起玩😄,如果微信群二维码失效,可以加我微信拉你进群。 -imGroup +imGroup > 如果有二次开发或者私有部署需求,请联系我 (添加微信请备注"全文档") - -imGroup +imGroup Jarrett Luo - luojiarui2@163.com @@ -127,7 +192,12 @@ Jarrett Luo - luojiarui2@163.com ## 致谢 -- 暂无 +感谢天南地北的朋友支持,让项目不断维护更新! + +如果您觉得项目带给您一些启发或者帮助,欢迎大赏支持! + +imGroup + diff --git a/images/WechatIMG349.jpg b/images/WechatIMG349.jpg new file mode 100644 index 0000000..a9e2b0c Binary files /dev/null and b/images/WechatIMG349.jpg differ diff --git a/images/WechatIMG350.jpg b/images/WechatIMG350.jpg new file mode 100644 index 0000000..0c59994 Binary files /dev/null and b/images/WechatIMG350.jpg differ diff --git a/images/WechatIMG351.jpg b/images/WechatIMG351.jpg new file mode 100644 index 0000000..f5d390f Binary files /dev/null and b/images/WechatIMG351.jpg differ diff --git a/src/components/AvatarUploader/Index.vue b/src/components/AvatarUploader/Index.vue index 8ed16fe..d6b3436 100644 --- a/src/components/AvatarUploader/Index.vue +++ b/src/components/AvatarUploader/Index.vue @@ -148,7 +148,9 @@ export default { client_alioss: {}, }; }, - + props: { + img_url: {type: String, requires: true} + }, created() { }, mounted() { @@ -158,10 +160,9 @@ export default { //打开编辑头像窗口 openEditAvatarDialog() { this.isVisible_editAvatarDialog = true; - if (this.previews.url) { - this.previews.url = ""; - this.options.img = ""; - } + this.urlToBase64(this.img_url).then(res => { + this.options.img = res; + }) }, // 实时预览函数 realTime(data) { @@ -232,6 +233,33 @@ export default { } return new File([u8arr], filename, {type: mime}); }, + + /** + * url转base64 + * @param {String} url - url地址 + */ + urlToBase64(url) { + return new Promise ((resolve,reject) => { + let image = new Image(); + image.onload = function() { + let canvas = document.createElement('canvas'); + canvas.width = this.naturalWidth; + canvas.height = this.naturalHeight; + // 将图片插入画布并开始绘制 + canvas.getContext('2d').drawImage(image, 0, 0); + // result + let result = canvas.toDataURL('image/png') + resolve(result); + }; + // CORS 策略,会存在跨域问题https://stackoverflow.com/questions/20424279/canvas-todataurl-securityerror + image.setAttribute("crossOrigin",'Anonymous'); + image.src = url; + // 图片加载失败的错误处理 + image.onerror = () => { + reject(new Error('转换失败')); + }; + }); + } }, watch: {}, }; diff --git a/src/home/Index.vue b/src/home/Index.vue index 7f7c4ec..424b70a 100644 --- a/src/home/Index.vue +++ b/src/home/Index.vue @@ -4,14 +4,16 @@
+ {{ type | userType }} @@ -116,7 +118,10 @@ export default { tokenExpired: false, img1: require('@/assets/source/heart.png'), img2: require('@/assets/source/folder.png'), - img3: require('@/assets/source/upload.png') + img3: require('@/assets/source/upload.png'), + + username: localStorage.getItem('username'), + type: localStorage.getItem("type") } }, computed: { @@ -136,6 +141,18 @@ export default { } else { return BackendUrl() + "/files/image2/" + value; } + }, + userType(type) { + if (type === "ADMIN") { + return "管理员" + } + return "" + }, + userNameTooLong(name) { + if (name.length > 10) { + return name.slice(0, 4) + "..." + name.slice(-4) + } + return name; } }, methods: { @@ -240,6 +257,7 @@ export default { display: flex; justify-content: flex-start; padding: 5px 5px 0 5px; + color: #2c3e50; span { height: 36px; @@ -247,7 +265,6 @@ export default { font-size: 14px; font-family: PingFangSC-Regular, PingFang SC, serif; font-weight: 400; - color: #000000; padding-right: 10px; } diff --git a/src/home/SearchGroup.vue b/src/home/SearchGroup.vue index 5318592..01af647 100644 --- a/src/home/SearchGroup.vue +++ b/src/home/SearchGroup.vue @@ -281,7 +281,7 @@ export default { top: 0px; line-height: 28px; font-size: 12px; - color: blue; + color: #0067eb; padding: 0px 8px; } } diff --git a/src/main.js b/src/main.js index e6828ba..33c516f 100644 --- a/src/main.js +++ b/src/main.js @@ -17,12 +17,12 @@ Vue.component('tags-input', VoerroTagsInput); Vue.use(VueRouter); Vue.use(iView); -import jm from 'vue-jsmind' - -Vue.use(jm) -if (window.jsMind) { - Vue.prototype.jsMind = window.jsMind -} +// import jm from 'vue-jsmind' +// +// Vue.use(jm) +// if (window.jsMind) { +// Vue.prototype.jsMind = window.jsMind +// } Vue.prototype.$axios = Api; diff --git a/src/views/About.vue b/src/views/About.vue deleted file mode 100644 index 3fa2807..0000000 --- a/src/views/About.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/src/views/Home.vue b/src/views/Home.vue deleted file mode 100644 index 34968f2..0000000 --- a/src/views/Home.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - diff --git a/src/views/filterDoc/DocPage.vue b/src/views/filterDoc/DocPage.vue index 2b27e6b..4919a7b 100644 --- a/src/views/filterDoc/DocPage.vue +++ b/src/views/filterDoc/DocPage.vue @@ -7,7 +7,15 @@ +
+ + +
Loading
+
+
@@ -31,11 +39,14 @@ export default { docList: [], total: 100, pageNum: 1, - pageSize: 24, + pageSize: 60, tagId: '', cateId: '', keyword: '', - spinShow: true + spinShow: true, + + loadedPages: [], // 已经查询过的页数存放地址 + key: new Date() } }, props: ["requestType"], @@ -53,6 +64,9 @@ export default { if (this.pageNum > this.total / this.pageSize) { return; } + if (this.loadedPages.includes(this.pageNum)) { + return; + } let param = { cateId: this.cateId, tagId: this.tagId, @@ -60,14 +74,18 @@ export default { page: this.pageNum, rows: this.pageSize } + this.loadedPages.push(this.pageNum) if (this.requestType === 'collect') { CategoryRequest.getMyCollectList(param).then(res => { if (res.code === 200) { let result = res.data; - this.docList = result.data + result.data.forEach(item => { + this.docList.push(item) + }) this.pageNum = result.pageNum + 1; this.total = result.total; - this.pageSize = result.pageSize + this.pageSize = result.pageSize; + this.pageNum ++; } this.spinShow = false }).catch(err => { @@ -77,8 +95,11 @@ export default { CategoryRequest.getMyUploadList(param).then(res => { if (res.code === 200) { let result = res.data; - this.docList = result.data + result.data.forEach(item => { + this.docList.push(item) + }) this.pageNum = result.pageNum + 1; + this.pageNum ++; this.total = result.total; this.pageSize = result.pageSize } @@ -90,14 +111,11 @@ export default { CategoryRequest.getDocList(param).then(res => { if (res.code === 200) { let result = res.data; - if (this.pageNum == 1) { - this.docList = result.data - } else { - result.data.forEach(item => { - this.docList.push(item) - }) - } + result.data.forEach(item => { + this.docList.push(item) + }) this.pageNum = result.pageNum + 1; + this.pageNum ++; this.total = result.total; this.pageSize = result.pageSize } @@ -109,14 +127,38 @@ export default { }, changeCate(cateId) { + this.spinShow = true; + this.pageNum = 1; + this.docList = []; + this.loadedPages = []; + this.total = 100; + this.pageSize = 60; + this.key = new Date(); + this.cateId = cateId this.getRecentDocList() }, changeKeyWord(keyword) { + this.spinShow = true; + this.pageNum = 1; + this.docList = []; + this.loadedPages = []; + this.total = 100; + this.pageSize = 60; + this.key = new Date(); + this.keyword = keyword this.getRecentDocList() }, changeTag(tagId) { + this.spinShow = true; + this.pageNum = 1; + this.docList = []; + this.loadedPages = []; + this.total = 100; + this.pageSize = 60; + this.key = new Date(); + this.tagId = tagId this.getRecentDocList() }, @@ -145,4 +187,22 @@ export default { } +.demo-spin-col .circular { + width:25px; + height:25px; +} +.demo-spin-icon-load{ + animation: ani-demo-spin 1s linear infinite; +} +@keyframes ani-demo-spin { + from { transform: rotate(0deg);} + 50% { transform: rotate(180deg);} + to { transform: rotate(360deg);} +} +.demo-spin-col{ + height: 100px; + position: relative; + border: 1px solid #eee; +} + \ No newline at end of file diff --git a/src/views/filterDoc/FilterListPage.vue b/src/views/filterDoc/FilterListPage.vue index 9c25b56..fe5a02f 100644 --- a/src/views/filterDoc/FilterListPage.vue +++ b/src/views/filterDoc/FilterListPage.vue @@ -32,6 +32,9 @@ export default { return { pageNum: 1, flag: false, + + isLoading: false, + prevScrollTop2: 0, // 用于跟踪前一个滚动位置 } }, components: { @@ -57,18 +60,17 @@ export default { }, handleScroll(event) { this.flag = true - const listWrapper = event.target; - const scrollBottom = listWrapper.scrollHeight - listWrapper.scrollTop - listWrapper.clientHeight; - let down = true; - if (scrollBottom <= 0 && down) { // 当距离底部小于50像素时触发加载数据 - this.pageNum += 1; - this.flag = false - down = false - // setTimeout(() => { - // 调用加载新数据的方法 - this.$emit("on-page-change", this.pageNum); - // }, 500) + const container = event.target; + const currentScrollTop = container.scrollTop; + if ( + currentScrollTop > this.prevScrollTop2 && // 检查滚动方向是向下 + container.scrollHeight - container.scrollTop <= container.clientHeight + 10 && + !this.isLoading + ) { + this.flag = false + this.$emit("on-page-change", this.pageNum); + this.prevScrollTop2 = currentScrollTop; // 更新前一个滚动位置 } }, } diff --git a/src/views/filterDoc/TagFilter.vue b/src/views/filterDoc/TagFilter.vue index 5886d44..6b397f8 100644 --- a/src/views/filterDoc/TagFilter.vue +++ b/src/views/filterDoc/TagFilter.vue @@ -52,7 +52,7 @@ export default { return; } this.listLoading = false - this.tagNames = [{id: "ALL", name: "全部分类", createDate: '', updateDate: ''}] + this.tagNames = [{id: "ALL", name: "不限", createDate: '', updateDate: ''}] if (response.data.length > 0) { response.data.forEach(item => { if (item.name.length > 8) { @@ -99,6 +99,7 @@ export default { .tag-item { padding-right: 20px; cursor: pointer; + font-size: 14px; &:hover { color: #F2A500; diff --git a/src/views/homePage/Banner.vue b/src/views/homePage/Banner.vue index a195915..e9310d9 100644 --- a/src/views/homePage/Banner.vue +++ b/src/views/homePage/Banner.vue @@ -36,7 +36,7 @@ export default { color: rgba(16, 16, 16, 100); font-size: 14px; text-align: center; - font-family: Roboto; + font-family: Roboto,sans-serif; border: 1px solid rgba(244, 219, 101, 100); } diff --git a/src/views/preview/xMind.vue b/src/views/preview/xMind.vue index 889e056..641ea03 100644 --- a/src/views/preview/xMind.vue +++ b/src/views/preview/xMind.vue @@ -99,6 +99,15 @@ -