From f2b41bd2ff704147aec2b9eee875925e086b932b Mon Sep 17 00:00:00 2001 From: binbin_pan Date: Tue, 10 Sep 2024 13:41:39 +0800 Subject: [PATCH] =?UTF-8?q?pdf=E5=A2=9E=E5=8A=A0=E5=80=92=E8=AE=A1?= =?UTF-8?q?=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hybrid/html/local.html | 11 +++++- hybrid/html/local.js | 1 + hybrid/html/web/viewer.html | 48 ++++++++++++++++++++++++++- pages/YNEduApp/learnProj/pdfStudy.vue | 26 +++++++++------ 4 files changed, 74 insertions(+), 12 deletions(-) create mode 100644 hybrid/html/local.js diff --git a/hybrid/html/local.html b/hybrid/html/local.html index 9a21210..0cf488f 100644 --- a/hybrid/html/local.html +++ b/hybrid/html/local.html @@ -28,10 +28,18 @@ padding: 10px; color: #999999; } + .tip { + font-size: 50px; + position: fixed; + top: 50px; + right: 0; + z-index: 99999999; + }

web-view 组件加载本地 html 示例,仅在 App 环境下生效。点击下列按钮,跳转至其它页面。

+
你看看
@@ -44,7 +52,8 @@
- + + + diff --git a/pages/YNEduApp/learnProj/pdfStudy.vue b/pages/YNEduApp/learnProj/pdfStudy.vue index 3d321ff..4f3314a 100644 --- a/pages/YNEduApp/learnProj/pdfStudy.vue +++ b/pages/YNEduApp/learnProj/pdfStudy.vue @@ -17,7 +17,9 @@ export default { isShow: true, path: '', params: {}, - timer: null + timer: null, + // 剩余时间 + surplusTime: null } }, onLoad(opt) { @@ -26,25 +28,29 @@ export default { this.params = JSON.parse(JSON.stringify(opt)) this.params.studyDuration = Number(opt.studyDuration) this.params.allStudyDuration = Number(opt.allStudyDuration) - // 如果路径中带有http或者https则直接使用路径,否则拼接路径 - if (opt.path.indexOf('http') !== -1) { - this.path = opt.path - } else { - this.path = config.fileUrl + opt.path - } - console.log('🚀 ~ onLoad ~ this.params:', this.path) - console.log('🚀 ~ onLoad ~ this.params:', Number(opt.studyDuration), Number(opt.allStudyDuration)) if (Number(opt.studyDuration) < Number(opt.allStudyDuration)) { + this.surplusTime = Number(opt.allStudyDuration) - Number(opt.studyDuration) + console.log('🚀 ~ onLoad ~ surplusTime:', this.surplusTime) setTimeout(() => { this.countDown() - }, 1000) + }, 1300) } else { + this.surplusTime = 0 // 提示-学习时长已满 uni.showToast({ title: '学习时长已满, 随时可以结束学习', icon: 'none' }) } + // 如果路径中带有http或者https则直接使用路径,否则拼接路径 + if (opt.path.indexOf('http') !== -1) { + this.path = opt.path + '?surplusTime=' + JSON.stringify(this.surplusTime) + } else { + this.path = config.fileUrl + opt.path + '?surplusTime=' + JSON.stringify(this.surplusTime) + } + console.log('🚀 ~ onLoad ~ this.params:', this.path) + console.log('🚀 ~ onLoad ~ this.params:', Number(opt.studyDuration), Number(opt.allStudyDuration)) + }, onHide() { clearInterval(this.timer)