|
@@ -36,12 +36,7 @@ async function getReportDetail(){
|
|
|
if(res.Ret===200){
|
|
|
reportInfo.value=res.Data
|
|
|
document.title=res.Data.Title
|
|
|
- attachmentsList.value = res.Data.AttachmentList
|
|
|
- ? res.Data.AttachmentList.map(item => ({
|
|
|
- ...item,
|
|
|
- FileSize: parseInt((item.FileSize||0)/1024)
|
|
|
- }))
|
|
|
- : []
|
|
|
+ attachmentsList.value = res.Data.AttachmentList || []
|
|
|
}
|
|
|
}
|
|
|
getReportDetail()
|
|
@@ -83,6 +78,24 @@ function handleCopyLink() {
|
|
|
}
|
|
|
|
|
|
|
|
|
+const configAnchors = [
|
|
|
+ 140,
|
|
|
+ Math.round(0.7 * window.innerHeight),
|
|
|
+]
|
|
|
+const panelHeight = ref(configAnchors[0])
|
|
|
+
|
|
|
+
|
|
|
+function formatSize(size) {
|
|
|
+ if (size >= 1024 * 1024) { // 超过1MB
|
|
|
+ return (size / (1024 * 1024)).toFixed(2) + ' MB';
|
|
|
+ } else if (size >= 1024) { // 超过1KB
|
|
|
+ return (size / 1024).toFixed(2) + ' KB';
|
|
|
+ } else {
|
|
|
+ return size + ' B'; // 小于1KB
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
function getFileIcon(name) {
|
|
|
let fileName=name.toLocaleLowerCase()
|
|
|
if(fileName.endsWith('.pdf')){
|
|
@@ -109,11 +122,16 @@ function getFileIcon(name) {
|
|
|
<div class="report-html-wrap" v-html="reportInfo.Abstract" v-if="reportInfo.Abstract"></div>
|
|
|
<div class="report-html-wrap" v-html="reportInfo.Content" v-if="reportInfo.Content"></div>
|
|
|
|
|
|
- <van-floating-panel :content-draggable="false" v-if="fileLen">
|
|
|
+ <van-floating-panel
|
|
|
+ :content-draggable="false"
|
|
|
+ v-if="fileLen"
|
|
|
+ v-model:height="panelHeight"
|
|
|
+ :anchors="configAnchors"
|
|
|
+ >
|
|
|
<div class="attachments-wrapper">
|
|
|
<div>
|
|
|
<svg-icon name="link_ico" size="20px"></svg-icon>
|
|
|
- 附件{{fileLen}}个({{totalSize}}KB)
|
|
|
+ 附件{{fileLen}}个({{formatSize(totalSize)}})
|
|
|
</div>
|
|
|
|
|
|
<ul class="list-cont">
|
|
@@ -121,7 +139,7 @@ function getFileIcon(name) {
|
|
|
<svg-icon class="file-ico" :name="getFileIcon(item.Title)"></svg-icon>
|
|
|
<div class="right-info">
|
|
|
<p class="van-ellipsis file-name">{{item.Title}}</p>
|
|
|
- <span style="color:#999">{{item.FileSize}}KB</span>
|
|
|
+ <span style="color:#999">{{formatSize(item.FileSize)}}</span>
|
|
|
</div>
|
|
|
</li>
|
|
|
</ul>
|
|
@@ -135,6 +153,8 @@ function getFileIcon(name) {
|
|
|
@click="handleCopyLink"
|
|
|
/>
|
|
|
|
|
|
+ <van-back-top bottom="100" right="10"/>
|
|
|
+
|
|
|
<!-- 预览-->
|
|
|
<van-popup
|
|
|
v-model:show="isShowPreview"
|
|
@@ -144,6 +164,7 @@ function getFileIcon(name) {
|
|
|
>
|
|
|
<PreViewFile v-if="isShowPreview" :url="previewUrl"/>
|
|
|
</van-popup>
|
|
|
+
|
|
|
</template>
|
|
|
|
|
|
<style lang="scss" scoped>
|