dqgzDangjiangongzuoInfo.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="dljt-page-box" v-if="data.info">
  3. <MtaNavbar></MtaNavbar>
  4. <view class="dljt-container-box">
  5. <!-- 详情页面 -->
  6. <view class="dljt-page-title">校园动态</view>
  7. <view class="dljt-page-content-box">
  8. <!-- 导航 -->
  9. <view class="dljt-breadcrumb-box">
  10. <view class="breadcrumb-text">首页</view>
  11. <icon class="breadcrumb-jt"></icon>
  12. <view class="breadcrumb-text">校园动态</view>
  13. <icon class="breadcrumb-jt"></icon>
  14. <view class="breadcrumb-active">学院新闻</view>
  15. </view>
  16. <view class="dljt-detail-box">
  17. <!-- 标题 -->
  18. <view class="detail-title">{{data.info.title}}</view>
  19. <!-- 时间 -->
  20. <view class="detail-data">{{formatDate.join('-') }}</view>
  21. <!-- 富文本 -->
  22. <MtaMpHtml class="dljt-editor-box" :content="data.info.content" ></MtaMpHtml>
  23. <!-- PDF -->
  24. <MtaPDFVue class="dljt-pdf-box" :pdfUrl="pdfUrl"></MtaPDFVue>
  25. <!-- 文件下载 -->
  26. <div class="return-footer-box">
  27. <view class="dljt-down-btn" @click="handleDownFile"></view>
  28. </div>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 底部导航 -->
  33. <MtaFooter></MtaFooter>
  34. </view>
  35. </template>
  36. <script setup>
  37. import {
  38. ref,
  39. reactive,
  40. computed,
  41. onMounted,
  42. onUnmounted
  43. } from "vue";
  44. import {
  45. onLoad
  46. } from "@dcloudio/uni-app"
  47. import * as httpApi from "@/api/common.js"
  48. import {formatDateToYearMonthDay } from "@/utils/common.js"
  49. import MtaMpHtml from "@/components/MTAMpHtml/MtaMpHtml.vue"
  50. import MtaPDFVue from "@/components/MtaPDF.vue";
  51. import MtaFooter from "@/components/MtaFooter.vue"
  52. const data = reactive({
  53. info: null,
  54. id: null
  55. })
  56. const isFullscreen = ref(false)
  57. const formatDate = computed(() => {
  58. if (data.info && data.info.createTime) {
  59. return formatDateToYearMonthDay(data.info.createTime)
  60. }
  61. return []
  62. })
  63. const pdfUrl = "https://kf3.mtavip.com/api/upload/resource/uploadFile60eebb8881e94278bc46bedba12aece6.pdf"
  64. onLoad(({
  65. id
  66. }) => {
  67. data.id = id;
  68. pageInit();
  69. })
  70. onMounted(() => {
  71. // 监听全屏变化
  72. document.addEventListener('fullscreenchange', handleFullscreenChange)
  73. document.addEventListener('webkitfullscreenchange', handleFullscreenChange)
  74. })
  75. onUnmounted(() => {
  76. document.removeEventListener('fullscreenchange', handleFullscreenChange)
  77. document.removeEventListener('webkitfullscreenchange', handleFullscreenChange)
  78. })
  79. function handleFullscreen(e) {
  80. // 处理全屏事件
  81. isFullscreen.value = e.detail.fullscreen
  82. }
  83. function handleFullscreenChange() {
  84. // 检查当前是否处于全屏状态
  85. const fullscreenElement = document.fullscreenElement ||
  86. document.webkitFullscreenElement
  87. if (!fullscreenElement) {
  88. // 如果退出全屏
  89. isFullscreen.value = false
  90. }
  91. }
  92. function handleDownFile() {
  93. window.location.href = pdfUrl;
  94. }
  95. function pageInit() {
  96. httpApi.getDangjianGongzuoInfo({
  97. id: data.id
  98. }).then(res => {
  99. data.info = res.data;
  100. console.log('dddd', data.info)
  101. })
  102. }
  103. </script>
  104. <style lang="scss">
  105. </style>