From 41fc6cbceb2a4117aa88d34a70a142d0f28a7398 Mon Sep 17 00:00:00 2001 From: unknown <qq1940665526@163.com> Date: 星期二, 11 六月 2024 19:02:33 +0800 Subject: [PATCH] 优化 --- src/components/pdfview/index.vue | 82 +++++----------------------------------- src/App.vue | 2 src/books/sportsAndHealth/view/components/index.vue | 2 3 files changed, 13 insertions(+), 73 deletions(-) diff --git a/src/App.vue b/src/App.vue index f7e94b6..81ff827 100644 --- a/src/App.vue +++ b/src/App.vue @@ -72,7 +72,7 @@ // embedded // english // artAndDance - this.config.resourceCtx + "childHealth" + this.config.resourceCtx + "sportsAndHealth" ); // 娴嬭瘯璇曡30椤� // this.activeBook.tryPageCount = 10; diff --git a/src/books/sportsAndHealth/view/components/index.vue b/src/books/sportsAndHealth/view/components/index.vue index b8d881e..8b6a584 100644 --- a/src/books/sportsAndHealth/view/components/index.vue +++ b/src/books/sportsAndHealth/view/components/index.vue @@ -188,7 +188,7 @@ }, mounted() { // 榛樿鍔犺浇绔犺妭 - this.showCatalogList = [3]; + this.showCatalogList = [1]; // 婊氬姩鐩戝惉鑺傛祦 this.throttledScrollHandler = _.throttle( this.scrollFun, diff --git a/src/components/pdfview/index.vue b/src/components/pdfview/index.vue index 04edf5e..fa18ac8 100644 --- a/src/components/pdfview/index.vue +++ b/src/components/pdfview/index.vue @@ -51,7 +51,7 @@ }, }, }, - created(){ + created() { this.getFileInfo(); }, methods: { @@ -108,82 +108,22 @@ }, getFileInfo() { // 鑾峰彇鐩綍 - // this.MG.file - // .GetPdfToc({ md5: this.md5 }) - // .then((tocRes) => { - // console.log(tocRes, "3232---3232----32"); - // if (tocRes && tocRes.length && tocRes[0]) { - // let tocDataList = []; - // for (let i = 0; i < tocRes.length; i++) { - // const tacItem = tocRes[i]; - // if (tacItem) { - // let itemInfo = tacItem.split(" "); - // let obj = { - // page: itemInfo[0], - // level: itemInfo[1], - // title: itemInfo[2] + " ( " + itemInfo[0] + " )", - // children: [], - // }; - // tocDataList.push(obj); - // } - // } - // let cLevel = 0; - // let tocData = []; - // let generateList = []; // 鐢ㄤ簬妫�绱㈢殑Data - // let memorySrc = null; - // for (let j = 0; j < tocDataList.length; j++) { - // const tocItem = tocDataList[j]; - // if (tocItem.level == 0) { - // tocItem.key = tocData.length; - // tocData.push(tocItem); - // generateList.push(tocItem); - // cLevel = 0; - // } else if (tocItem.level == cLevel) { - // tocItem.key = memorySrc.key + "-" + memorySrc.children.length; - // memorySrc.children.push(tocItem); - // generateList.push(tocItem); - // } else if (tocItem.level > cLevel) { - // memorySrc = this.handleDocData(tocData, cLevel); - // tocItem.key = memorySrc.key + "-" + memorySrc.children.length; - // memorySrc.children.push(tocItem); - // generateList.push(tocItem); - // cLevel = tocItem.level; - // } else if (tocItem.level < cLevel) { - // memorySrc = this.handleDocData(tocData, tocItem.level - 1); - // tocItem.key = memorySrc.key + "-" + memorySrc.children.length; - // memorySrc.children.push(tocItem); - // generateList.push(tocItem); - // cLevel = tocItem.level; - // } - // } - // this.tocData = tocData; - // this.generateList = generateList; - // console.log(tocData, generateList, 1221212121211); - // } - - // 鑾峰彇鎬婚〉鏁� - this.MG.file - .getPdfInfo({ md5: this.md5 }) - .then((res) => { - console.log(res, 79879879879797979); - this.totalPage = res.totalPages; - this.getPageImage(this.currentPage - 1); - }) - .catch((err) => { - console.error(err); - }); - // }) - // .catch((err) => { - // console.error(err); - // }); + this.MG.file + .getPdfInfo({ md5: this.md5 }) + .then((res) => { + this.totalPage = res.totalPages; + this.getPageImage(this.currentPage); + }) + .catch((err) => { + console.error(err); + }); }, getPageImage(page) { - console.log(page, "page"); const ctx = process.env.VUE_APP_API_URL; this.fileLoading = true; this.currentPageSrc = ctx + - "/file/Preview/GetPageImage" + + "/file/GetPdfPageImage" + "?md5=" + this.md5 + "&index=" + -- Gitblit v1.9.1