优化加载条

(cherry picked from commit 4698a690b2f9d79f4586b2959d466fcc89046760)
This commit is contained in:
Xia Zekun
2024-09-06 17:25:23 +08:00
committed by mzaxd
parent b48765c83d
commit 682492c310
3 changed files with 28 additions and 9 deletions
+2
View File
@@ -10,6 +10,7 @@
:right-text="isChinese ? $t('chinese') : $t('english')" :right-text="isChinese ? $t('chinese') : $t('english')"
@click-left="handleBack" @click-left="handleBack"
@click-right="handleChangeLang" @click-right="handleChangeLang"
:z-index="2"
/> />
<div class="scroll-box" :class="{'no-nav-bar': !hasNavBar}"> <div class="scroll-box" :class="{'no-nav-bar': !hasNavBar}">
<router-view @titleChange="titleChange" /> <router-view @titleChange="titleChange" />
@@ -22,6 +23,7 @@ import Vue from 'vue'
import { Locale } from 'vant' import { Locale } from 'vant'
import zhCN from 'vant/es/locale/lang/zh-CN' import zhCN from 'vant/es/locale/lang/zh-CN'
import enUS from 'vant/es/locale/lang/en-US' import enUS from 'vant/es/locale/lang/en-US'
// eslint-disable-next-line camelcase
import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN' import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN'
import * as dd from 'dingtalk-jsapi' // 解决document.title import * as dd from 'dingtalk-jsapi' // 解决document.title
+20 -9
View File
@@ -1,29 +1,40 @@
<template> <template>
<!-- <div class="iframe-container">--> <div class="iframe-container">
<iframe :src="previewUrl" class="responsive-iframe"></iframe> <van-overlay :show="loading">
<!-- </div>--> <van-loading type="spinner" class="center-flex"/>
</van-overlay>
<iframe :src="previewUrl" class="responsive-iframe" @load="onIframeLoad"></iframe>
</div>
</template> </template>
<script> <script>
export default { export default {
data () { data () {
return { return {
previewUrl: '' previewUrl: '',
loading: true
} }
}, },
mounted () { mounted () {
this.previewUrl = this.$route.params.previewUrl this.previewUrl = this.$route.params.previewUrl
console.log('file preview mounted', this.previewUrl) console.log('file preview mounted', this.previewUrl)
},
methods: {
onIframeLoad () {
console.log('iframe加载完成')
this.loading = false
// 在这里可以执行iframe加载完成后的操作
}
} }
} }
</script> </script>
<style> <style>
.iframe-container { .iframe-container {
position: fixed; /*position: fixed;*/
top: 0; /*top: 0;*/
left: 0; /*left: 0;*/
width: 100%; /*width: 100%;*/
height: 100vh; height: calc(100vh - 0.88rem);
-webkit-overflow-scrolling: touch; /* 当手指从触摸屏上移开,会保持一段时间的滚动 */ -webkit-overflow-scrolling: touch; /* 当手指从触摸屏上移开,会保持一段时间的滚动 */
overflow-y: scroll; overflow-y: scroll;
} }
+6
View File
@@ -167,6 +167,7 @@ import {
isCanLookDetail isCanLookDetail
} from '@/api/enterpriseStandardLibraryApi' } from '@/api/enterpriseStandardLibraryApi'
import Vue from 'vue' import Vue from 'vue'
// eslint-disable-next-line no-unused-vars
import { previewPdf } from '@/utils/previewPdf' import { previewPdf } from '@/utils/previewPdf'
import { dealUrl } from '@/utils/kkFilePreview' import { dealUrl } from '@/utils/kkFilePreview'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
@@ -601,12 +602,14 @@ export default {
*/ */
async filePreview13 (record) { async filePreview13 (record) {
console.log('filePreview', record) console.log('filePreview', record)
this.loading = true
// 获取并处理过程稿件数据 // 获取并处理过程稿件数据
let res = await this.getFormFunc({ type: 1 }) let res = await this.getFormFunc({ type: 1 })
if (!res.success) { if (!res.success) {
// this.$message.warn(res.message) // this.$message.warn(res.message)
Toast(res.message) Toast(res.message)
console.log('getFormFunc error:', res) console.log('getFormFunc error:', res)
this.loading = false
return return
} }
console.log('res.result', res.result) console.log('res.result', res.result)
@@ -628,6 +631,7 @@ export default {
// this.$message.warn(res.message) // this.$message.warn(res.message)
console.log('getDocumentInfoFunc error:', res) console.log('getDocumentInfoFunc error:', res)
Toast('找不到该数据的文件信息') Toast('找不到该数据的文件信息')
this.loading = false
return return
} }
const detailData = Object.assign({}, res.result || {}) const detailData = Object.assign({}, res.result || {})
@@ -676,6 +680,7 @@ export default {
console.log('没有找到符合要求的文件!') console.log('没有找到符合要求的文件!')
// this.$message.error('该标准暂无预览文件,请联系标准管理员。') // this.$message.error('该标准暂无预览文件,请联系标准管理员。')
Toast('该标准暂无预览文件,请联系标准管理员。') Toast('该标准暂无预览文件,请联系标准管理员。')
this.loading = false
return return
} }
console.log('seletedFile', file) console.log('seletedFile', file)
@@ -696,6 +701,7 @@ export default {
url = dealUrl(fileFullUrl) url = dealUrl(fileFullUrl)
// } // }
console.log('url', url) console.log('url', url)
this.loading = false
// window.open(url) // window.open(url)
this.$router.push({ name: 'filePreview', params: { previewUrl: url } }) this.$router.push({ name: 'filePreview', params: { previewUrl: url } })
}, },