info.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <hc-sys navBarUi="white">
  3. <template #navBar>
  4. <hc-nav-back-bar title="声像资料详情">
  5. <text class="text-26" @click="editFormClick">编辑</text>
  6. </hc-nav-back-bar>
  7. </template>
  8. <!-- 轮播图 -->
  9. <template v-if="dataInfo.type === 1">
  10. <video class="h-8xl w-full" :src="dataInfo.imageUrl"/>
  11. </template>
  12. <swiper class="screen-swiper square-dot h-8xl" indicator-dots circular autoplay interval="5000" duration="500" v-if="dataInfo.type === 2">
  13. <swiper-item v-for="(item,index) in imageList" :key="index">
  14. <image :src="item" mode="aspectFill"/>
  15. </swiper-item>
  16. </swiper>
  17. <!-- 详情 -->
  18. <view class="relative bg-white">
  19. <view class="text-black text-36 hc-p">{{dataInfo.title}}</view>
  20. <view class="text-26 hc-p" un-border-t="1 solid gray-1">{{dataInfo.textContent}}</view>
  21. <view class="hc-flex hc-p text-26 text-black" un-border-t="1 solid gray-1">
  22. <view class="flex-1 hc-flex">
  23. <text class="i-iconoir-user"/>
  24. <text class="ml-0.5">{{ dataInfo.shootingUser }}</text>
  25. </view>
  26. <view class="flex-1 hc-flex-center">
  27. <text class="i-iconoir-clock"/>
  28. <text class="ml-0.5">{{ dataInfo.shootingTimeStr }}</text>
  29. </view>
  30. <view class="flex-1 hc-flex-end">
  31. <text class="i-iconoir-page"/>
  32. <text class="ml-0.5">{{ dataInfo.fileSize }}</text>
  33. </view>
  34. </view>
  35. </view>
  36. <template v-if="dataInfo.type === 2">
  37. <view class="hc-flex bg-white hc-p mt-2">
  38. <view class="flex-1 text-26">照片号</view>
  39. <text class="text-black">{{dataInfo.photoCode}}</text>
  40. </view>
  41. <view class="hc-flex bg-white hc-p">
  42. <view class="flex-1 text-26">底片号</view>
  43. <text class="text-black">{{dataInfo.filmCode}}</text>
  44. </view>
  45. <view class="hc-flex bg-white hc-p">
  46. <view class="flex-1 text-26">参见号</view>
  47. <text class="text-black">{{dataInfo.seeAlsoCode}}</text>
  48. </view>
  49. <view class="hc-flex bg-white hc-p mt-2" @click="viewPdfClick">
  50. <view class="flex-1 text-26">查看PDF文件</view>
  51. <text class="i-iconoir-nav-arrow-right"/>
  52. </view>
  53. </template>
  54. </hc-sys>
  55. </template>
  56. <script setup>
  57. import {ref} from "vue";
  58. import {onLoad} from '@dcloudio/uni-app'
  59. import mainApi from '~api/image/index';
  60. import {getObjValue, isString} from "js-fast-way";
  61. import {errorToast, toPdfPreview} from "@/utils/tools";
  62. const dataId = ref('');
  63. const dataInfo = ref({})
  64. const imageList = ref([])
  65. //页面启动
  66. onLoad(({id}) => {
  67. dataId.value = id ?? '';
  68. getInfoApi()
  69. })
  70. //获取详情
  71. const getInfoApi = async () => {
  72. dataInfo.value = {}
  73. imageList.value = []
  74. if (!dataId.value) {
  75. errorToast('参数异常,请退出重试')
  76. return false;
  77. }
  78. uni.showLoading({title: '获取数据中...', mask: true});
  79. const { data } = await mainApi.queryById({
  80. id: dataId.value
  81. })
  82. const res = getObjValue(data)
  83. console.log(res)
  84. dataInfo.value = res
  85. imageList.value = res.imageUrl.toString().split(',')
  86. uni.hideLoading();
  87. }
  88. //查看PDF文件
  89. const viewPdfClick = async () => {
  90. const { id, margePdfUrl } = dataInfo.value
  91. if (margePdfUrl) {
  92. await toPdfPreview(margePdfUrl)
  93. } else {
  94. const { data } = await mainApi.imageClassificationFile({id})
  95. const url = isString(data) ? data : ''
  96. if (url) {
  97. dataInfo.value.margePdfUrl = url
  98. await toPdfPreview(url)
  99. } else {
  100. errorToast('预览资料文件异常')
  101. }
  102. }
  103. }
  104. //编辑资料
  105. const editFormClick = () => {
  106. const { id } = dataInfo.value
  107. uni.navigateTo({
  108. url: `/pages/image/form?id=${id}`
  109. })
  110. }
  111. </script>