announcementDetails.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="uni-wrap">
  3. <uni-section class="mb-10" :title="annoDetail.announcementTitle" :sub-title="subTitle">
  4. <view class="uni-common-mt" style="background: #fff; padding: 20rpx">
  5. <rich-text :nodes="annoDetail.announcementBody"></rich-text>
  6. </view>
  7. </uni-section>
  8. </view>
  9. </template>
  10. <script>
  11. import { getDetialisById, announcementReat } from '@/api/index/index.js';
  12. export default {
  13. data() {
  14. return {
  15. annoDetail: {
  16. createBy: null,
  17. createTime: '2024-03-04 09:19:49',
  18. updateBy: null,
  19. updateTime: null,
  20. remark: null,
  21. id: '2',
  22. announcementTitle: '123',
  23. announcementBody: '<p><strong>这是内容</strong></p><p><strong><em>真的是内容</em></strong></p><p><strong><em><u>还是内容</u></em></strong></p><p><strong><em><u><span class="ql-cursor">\ufeff</span></u></em></strong><img src="/dev-api/profile/upload/2024/03/04/程序员_20240304091946A002.jpg"></p>',
  24. validityStartTime: '2024-03-03',
  25. validityEndTime: '2024-03-05',
  26. announcementImg: '/profile/upload/2024/03/04/程序员_20240304091901A001.jpg'
  27. },
  28. queryData:{
  29. userId: getApp().globalData.userId,
  30. annoId: null,
  31. }
  32. };
  33. },
  34. computed: {
  35. subTitle () {
  36. return this.annoDetail.updateBy !== null ? `${this.annoDetail.createTime} - ${this.annoDetail.updateBy}` : `${this.annoDetail.createTime} - ${this.annoDetail.createBy}`
  37. }
  38. },
  39. /**
  40. * 生命周期函数--监听页面加载
  41. */
  42. onLoad(options) {
  43. this.queryData.annoId = options.id
  44. this.getDetails(options.id);
  45. this.setDataType();
  46. },
  47. methods: {
  48. getDetails(annoId) {
  49. getDetialisById(annoId).then((res) => {
  50. this.annoDetail = res.data;
  51. });
  52. },
  53. setDataType(){
  54. announcementReat(this.queryData).then(res=>{
  55. console.log(res.msg)
  56. })
  57. }
  58. }
  59. };
  60. </script>
  61. <style lang="scss">
  62. $uni-success: #18bc37 !default;
  63. .uni-wrap {
  64. flex-direction: column;
  65. /* #ifdef H5 */
  66. height: calc(100vh - 44px);
  67. /* #endif */
  68. /* #ifndef H5 */
  69. height: 100vh;
  70. /* #endif */
  71. flex: 1;
  72. }
  73. .mb-10 {
  74. margin-bottom: 10px;
  75. }
  76. .decoration {
  77. width: 6px;
  78. height: 6px;
  79. margin-right: 4px;
  80. border-radius: 50%;
  81. background-color: $uni-success;
  82. }
  83. </style>