activitylist.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="container">
  3. <!-- 返回按钮 -->
  4. <back text="详情列表"></back>
  5. <view style="margin: 20rpx;">
  6. <u-skeleton :rows="detailList.length" :rowsHeight="height" :loading="loading">
  7. </u-skeleton>
  8. </view>
  9. <view class="detail-box" v-if="!loading">
  10. <view class="detail-item" v-for="(item,index) in detailList" :key="index" @click="navSingleData(item)">
  11. <view class="flex" style="width: 100%;height: 90rpx;">
  12. <view class="flex" style="margin: -30rpx 0 0 10rpx;">
  13. <view class="index"
  14. :style="{backgroundColor: item.survey.progress === 'finish'||item.vote.progress === 'finish'? '#23b46c': '#f9c752' }">
  15. </view>
  16. <view class="name">{{item.survey.name||item.vote.name}}</view>
  17. </view>
  18. <view class="t-icon t-icon-yiwancheng1"
  19. v-if="item.survey.progress === 'finish'||item.vote.progress === 'finish'"
  20. style="margin-left: auto; width: 90rpx; height: 90rpx;"></view>
  21. <view class="t-icon t-icon-jinhangzhong-copy"
  22. v-if="item.survey.progress === 'going'||item.vote.progress === 'going'"
  23. style="margin-left: auto; width: 90rpx; height: 90rpx;"></view>
  24. </view>
  25. <!-- 正文 -->
  26. <view class="content-box">
  27. <view style="display:flex;flex-direction: column;padding: 0 30rpx;">
  28. <rich-text class="subtitle-info" style="margin-bottom: 15rpx;"
  29. :nodes="item.survey.description||item.vote.description">
  30. </rich-text>
  31. <view class="flex">
  32. <view class="subtitle">布置老师:</view>
  33. <view class="subtitle-info" style="margin-left: 10rpx;">
  34. {{item.survey.creatorId||item.vote.creatorId}}
  35. </view>
  36. <view class="subtitle" style="margin-left: 20rpx;">截止时间:</view>
  37. <view class="subtitle-info" style="margin-left: 10rpx;" v-if="item.survey">
  38. {{$timestampToTime(item.survey.endTime)}}
  39. </view>
  40. <view class="subtitle-info" style="margin-left: 10rpx;" v-if="item.vote">
  41. {{$timestampToTime(item.vote.endTime)}}
  42. </view>
  43. </view>
  44. </view>
  45. <!-- 内容 -->
  46. <view class="content-detail-box">
  47. <!-- 问卷 -->
  48. <view class="title-box"
  49. :style="{backgroundColor: item.survey.progress === 'finish'? '#23b46c': '#f9c752' }"
  50. v-if="item.survey">
  51. <view class="content-subtitle">问卷详情</view>
  52. </view>
  53. <view class="flex" style="justify-content: space-around;">
  54. <view class="option-box"
  55. :style="{backgroundColor: item.survey.progress === 'finish'? '#23b46c': '#f9c752' }"
  56. v-for="(option,i) in item.survey.answers[0]" :key="i">
  57. <view class="content-subtitle" style="font-size: 30rpx;">{{option}}</view>
  58. </view>
  59. </view>
  60. <!-- 投票 -->
  61. <view class="title-box"
  62. :style="{backgroundColor: item.vote.progress === 'finish'? '#23b46c': '#f9c752' }"
  63. v-if="item.vote">
  64. <view class="content-subtitle">{{item.vote.secret ? '匿名投票':'普通投票'}}</view>
  65. </view>
  66. <view class="flex" style="justify-content: space-around;">
  67. <view class="flex-colum" v-for="(option,j) in item.vote.options" :key="j">
  68. <rich-text class="subtitle-info" style="margin-bottom: 15rpx;" :nodes="option.value">
  69. </rich-text>
  70. <view class="option-box"
  71. :style="{backgroundColor: item.vote.progress === 'finish'? '#23b46c': '#f9c752' }">
  72. <view class="content-subtitle" style="font-size: 30rpx;">{{option.code}}</view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import {
  84. mapState,
  85. mapMutations
  86. } from 'vuex'
  87. export default {
  88. computed: {
  89. ...mapState('m_children', ['detailList'])
  90. },
  91. data() {
  92. return {
  93. //骨架页配置
  94. loading: true,
  95. height: ['200px', '200px', '200px', '200px', '200px', '200px', '200px', '200px', '200px', '200px'],
  96. };
  97. },
  98. onLoad(options) {
  99. uni.$u.sleep(1500).then(() => {
  100. this.loading = false
  101. })
  102. },
  103. methods: {
  104. ...mapMutations('m_children', ['updateDetail']),
  105. //导航到详情页面
  106. navSingleData(item){
  107. this.updateDetail(item)
  108. uni.navigateTo({
  109. url: `/subpkg/detail/activity`
  110. })
  111. },
  112. }
  113. }
  114. </script>
  115. <style lang="scss">
  116. @import '@/subpkg/common/detaillistpage.scss';
  117. .flex-colum{
  118. display: flex;
  119. flex-direction: column;
  120. align-items: center;
  121. }
  122. </style>