cxc-szcx-uniapp/pages/document/detail.vue

120 lines
2.1 KiB
Vue
Raw Normal View History

2025-01-12 10:49:20 +00:00
<template>
<view :class="['content',{'gray':store.isgray==1}]">
<view class="title_box">
<view class="title">
{{detail._title}}
</view>
<view class="time">
{{detail._time}}
</view>
</view>
<view class="document f-row">
<text class="">
附件
</text>
<view class="f-col">
<view v-if="ifH5">
<!-- 在线预览 by -->
<view class="" style="padding: 5rpx 0;" @click="onlinePreview(`/pages/document/onlinePreview?data=${JSON.stringify(item)}`)"
v-for="item,i in detail?.pdf?.split(',')">
{{item}}
</view>
</view>
<view v-else>
<view class="" style="padding: 5rpx 0;" @click="opendocument(item)"
v-for="item,i in detail?.pdf?.split(',')">
{{item}}
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref
} from 'vue'
import {
onLoad
} from '@dcloudio/uni-app';
import {
opendocument
} from '@/utils/index.js';
import {
useStore
} from '@/store';
const store = useStore();
const detail = ref({})
//判断是否h5 by 闵
var ifH5 = false;
const onlinePreview = (url)=>{ //在线预览文件 by 闵
uni.navigateTo({
url
})
}
onLoad((options) => {
detail.value = JSON.parse(options.data)
if (options.id == 0) {
detail.value.pdf = detail.value.wjbt
} else if (options.id == 2) {
if (detail.value.jdwj) {
detail.value.pdf = detail.value.jdwj + ',' + detail.value.sszd
} else {
detail.value.pdf = detail.value.sszd
}
} else if (options.id == 3) {
detail.value.pdf = detail.value.mingcheng
}
//#ifdef H5 || MP-WEIXIN
ifH5 = true;
//#endif
})
</script>
<style>
/* page{
background-color: #f8f8f8;
} */
</style>
<style lang="scss" scoped>
.content {
padding: 0 30rpx;
}
.title_box {
.title {
font-size: 32rpx;
color: #333333;
padding: 30rpx 0 20rpx 0;
}
.time {
font-size: 24rpx;
color: #888888;
padding-bottom: 30rpx;
}
}
.document {
text {
font-size: 28rpx;
color: #333333;
white-space: nowrap;
}
view {
font-size: 28rpx;
color: #5A79F8;
text-decoration: underline;
}
}
</style>