dqgzDangjiangongzuoInfo.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view v-if="data.info">
  3. <!-- 详情页面 -->
  4. <view>校园动态</view>
  5. <!-- 导航 -->
  6. <view>首页>校园动态>学院新闻</view>
  7. <!-- 标题 -->
  8. <view>{{data.info.title}}</view>
  9. <!-- 时间 -->
  10. <view>{{formatDate.join('-') }}</view>
  11. <!-- 富文本 -->
  12. <mp-html :content="data.info.content" />
  13. <!-- PDF -->
  14. <web-view
  15. v-if="pdfUrl"
  16. :src="pdfUrl"
  17. class="web-view"
  18. ></web-view>
  19. </view>
  20. </template>
  21. <script setup>
  22. import {
  23. ref,
  24. reactive,
  25. computed
  26. } from "vue";
  27. import {
  28. onLoad
  29. } from "@dcloudio/uni-app"
  30. import * as httpApi from "@/api/common.js"
  31. import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html'
  32. import {formatDateToYearMonthDay } from "@/utils/common.js"
  33. const data = reactive({
  34. info: null,
  35. id: null
  36. })
  37. const formatDate = computed(() => {
  38. if (data.info && data.info.createTime) {
  39. return formatDateToYearMonthDay(data.info.createTime)
  40. }
  41. return []
  42. })
  43. const pdfUrl = "https://kf3.mtavip.com/api/upload/resource/uploadFile60eebb8881e94278bc46bedba12aece6.pdf"
  44. onLoad(({
  45. id
  46. }) => {
  47. data.id = id;
  48. pageInit();
  49. })
  50. function pageInit() {
  51. httpApi.getDangjianGongzuoInfo({
  52. id: data.id
  53. }).then(res => {
  54. data.info = res.data;
  55. console.log('dddd', data.info)
  56. })
  57. }
  58. </script>
  59. <style lang="scss">
  60. .web-view {
  61. height: 200px;
  62. margin-top: 20px
  63. }
  64. </style>