You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
3.0 KiB

3 months ago
3 months ago
6 days ago
3 months ago
3 months ago
3 months ago
6 days ago
3 months ago
6 days ago
3 months ago
3 months ago
3 months ago
3 months ago
6 days ago
3 months ago
  1. <template>
  2. <view class="content padding">
  3. <view class="tit">{{ info.title }}</view>
  4. <view class="fileList">
  5. <view class="file" v-for="(item,index) in info.attachmentList" :key="index">
  6. <!-- <view class="link oneRowText">附件 {{ index+1 }} ----------------------------------------------------------------</view> -->
  7. <view class="link oneRowText">{{ item.name || index }}</view>
  8. <view class="lookLink" @click="goWebview(item)">查看附件</view>
  9. </view>
  10. </view>
  11. <u-parse :content="info.content" :tagStyle="style"></u-parse>
  12. <view class="timeDesc" v-if="info.timeDesc">创建时间 {{ info.timeDesc }}</view>
  13. </view>
  14. </template>
  15. <script setup>
  16. import { ref } from 'vue'
  17. // let attachmentList = ["https://lyjp-bucket-main.oss-cn-beijing.aliyuncs.com/6f4db7615fff8c35085cdb53976af6afec0b96d857c27cda487487564b7efefb.xls","https://lyjp-bucket-main.oss-cn-beijing.aliyuncs.com/2ec7359a66a38526cbb214adef8c75e39bfd2f17bbf75b5c0547041d333580eb.xls"]
  18. import {
  19. onLoad,
  20. onPullDownRefresh,
  21. } from '@dcloudio/uni-app'
  22. import { getNoticeDetail } from '@/config/api.js'
  23. let articleId = ''
  24. const info = ref('')
  25. async function getNoticeDetailFn() {
  26. const {data: res} = await getNoticeDetail({articleId})
  27. info.value = res
  28. }
  29. function goWebview(item) {
  30. let url = item.url || item
  31. uni.downloadFile({
  32. url,
  33. success: function (res) {
  34. var filePath = res.tempFilePath;
  35. uni.openDocument({
  36. filePath: filePath,
  37. showMenu: true,
  38. success: function (res) {
  39. console.log('打开文档成功');
  40. },
  41. success: function (res) {
  42. console.log('打开失败成功');
  43. }
  44. });
  45. },
  46. fail: (err)=> {
  47. console.log(err);
  48. uni.$u.toast('下载失败')
  49. },
  50. });
  51. return
  52. uni.showLoading({
  53. title: '正在下载'
  54. })
  55. uni.downloadFile({
  56. url: item,
  57. success: (res) => {
  58. if (res.statusCode === 200) {
  59. uni.$u.toast('下载成功')
  60. }
  61. },
  62. fail: (err)=> {
  63. console.log(err);
  64. uni.$u.toast('下载失败')
  65. },
  66. complete: (err)=> { uni.hideLoading(); console.log(err) }
  67. })
  68. }
  69. onLoad((option)=>{
  70. articleId = option.id
  71. getNoticeDetailFn()
  72. })
  73. onPullDownRefresh(async()=>{
  74. await getNoticeDetailFn()
  75. uni.stopPullDownRefresh()
  76. })
  77. </script>
  78. <style lang="scss" scoped>
  79. .tit {
  80. font-size: 32rpx;
  81. font-weight: 700;
  82. padding: 20rpx 0;
  83. text-align: center;
  84. }
  85. .timeDesc {
  86. text-align: right;
  87. font-size: 28rpx;
  88. color: #999;
  89. padding: 30px 0;
  90. }
  91. .fileList {
  92. padding: 0 32rpx;
  93. .file {
  94. display: flex;
  95. align-items: center;
  96. padding: 10rpx 0;
  97. .link {
  98. font-size: 24rpx;
  99. color: #9C9C9C;
  100. flex: 1;
  101. }
  102. .lookLink {
  103. width: 132rpx;
  104. height: 44rpx;
  105. background: #DE3A26;
  106. border-radius: 22rpx;
  107. font-size: 24rpx;
  108. color: #fff;
  109. text-align: center;
  110. line-height: 44rpx;
  111. margin-left: 20rpx;
  112. &.boder {
  113. border: 1px solid #DE3A26;
  114. color: $themC;
  115. background-color: #fff;
  116. }
  117. }
  118. }
  119. }
  120. </style>