Commit 5c3dbc0d authored by fanlin@91isoft.com's avatar fanlin@91isoft.com

Merge remote-tracking branch 'origin/master'

parents b185c3bb 8902032e
......@@ -66,17 +66,19 @@
</template>
<script>
import pdf from 'vue-pdf'
import {Loading} from 'vant'
import {Loading, Toast} from 'vant'
import {getSystem} from '@/utils/mt-utils.js'
const fullScreen = require('@assets/images/enlarge.png'),
exitFull = require('@assets/images/narrow.png')
export default {
components: {
pdf: pdf,
Loading
Loading,
[Toast.name]: Toast,
},
data() {
return {
realPages: 0,
isOutLine: window.location.href.indexOf('CourseTrainOut') > -1, // 是否为外链
src: '',
numPages: undefined,
......@@ -101,6 +103,12 @@ export default {
} else if (!isNaN(newPage)) {
this.page = this.numPages
}
if (this.realPages > 100 && this.page === 100) {
Toast({
message: '已超过最大预览页数,更多内容请在PC端下载后查看',
icon: require('@assets/images/success.png')
})
}
}
},
props: {
......@@ -290,6 +298,7 @@ export default {
this.loading = true
this.src = pdf.createLoadingTask(this.pdfSrc)
this.src.then(pdf => {
this.realPages = pdf.numPages
this.numPages = pdf.numPages > this.showPage ? this.showPage : pdf.numPages
this.page = this.startPage
this.$emit('loaded', pdf.numPages)
......
......@@ -192,11 +192,12 @@ export default {
activeIndex = this.activeIndex + Math.round(distance / interval)
}
// 判断当前移动距离特别小,判定为触碰事件,而不是滑动
/* if (distance <= 1) {
console.log(distance, interval, 'LLLLLLLLLLLLLLLLLLLLLLLLLLL')
if (distance < 1) {
// e.path 保存了触发当前事件的源数组、0号元素代表当前点击的option
// 通过当前点击的元素的offsetTop计算当前元素正确的索引值
activeIndex = Math.round((e.path[0].offsetTop - this.optionHeight * 2) / this.optionHeight)
} */
}
// 对activeIndex值进行进一步处理,保证其不会超出选项范围
activeIndex = activeIndex < 0 ? 0 : activeIndex > this.optionLength - 1 ? this.optionLength - 1 : activeIndex
// 执行判断并赋值索引
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment