swapList.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="page-view">
  3. <top-return :color="'#FFF'" text="活动列表"></top-return>
  4. <view class="bg-box2"></view>
  5. <!-- 页面标题内容 -->
  6. <view class="top-box">
  7. <view class="flex-baseline">
  8. <view class="info-title" style="margin-left: 0;">{{dayTime.split('月')[0]}}</view>
  9. <view class="info-subtitle">月</view>
  10. <view class="info-title">{{dayTime.split('月')[1]}}</view>
  11. <view class="info-subtitle">日</view>
  12. <view class="info-subtitle" style="margin-left: 20rpx;">已完成</view>
  13. <view class="info-title">{{value}}%</view>
  14. </view>
  15. <view class="flex-baseline">
  16. <view class="data-subtitle" style="margin-left: 0;">当前共</view>
  17. <view class="data-title">{{swapData.length}}</view>
  18. <view class="data-subtitle">场活动</view>
  19. </view>
  20. </view>
  21. <view class="card-view">
  22. <view class="card-item" v-for="(item,index) in swapData" :key="index" @click="navSwapReport(index)">
  23. <view class="card-title">
  24. <view class="t-icon t-icon-swapfont"></view>
  25. <view class="YS-title" style="font-size: 45rpx;">{{item.survey.name||item.vote.name}}</view>
  26. <view
  27. :class="[item.survey.progress === 'finish'||item.vote.progress === 'finish'?'t-icon t-icon-yiwancheng1':'t-icon t-icon-jinhangzhong-copy','state-seal']"
  28. style="width: 55px;height: 55px;margin-left: auto;margin-right: -20rpx;"></view>
  29. </view>
  30. <view class="card-info">
  31. <view class="flex-baseline">
  32. <view class="info-type">布置老师:</view>
  33. <view class="YS-title" style="margin-left: 10rpx;">
  34. {{item.survey.creatorId||item.vote.creatorId}}</view>
  35. <view class="info-type" style="margin-left: 20rpx;">截至时间:</view>
  36. <view class="YS-title" style="margin-left: 10rpx;" v-if="item.survey">
  37. {{$timeStampToTime(item.survey.endTime)}}</view>
  38. <view class="YS-title" style="margin-left: 10rpx;" v-if="item.vote">
  39. {{$timeStampToTime(item.vote.endTime)}}</view>
  40. </view>
  41. <view class="flex-row" style="margin-top: 20rpx;">
  42. <u-parse class="YS-title" style="font-size: 30rpx;"
  43. :content="item.survey.description||item.vote.description" :selectable="true"></u-parse>
  44. </view>
  45. </view>
  46. <!-- 正文 -->
  47. <view class="content-box">
  48. <!-- 问卷 -->
  49. <view class="title-box"
  50. :style="{backgroundColor: item.survey.progress === 'finish'? '#23b46c': '#FF6D31' }"
  51. v-if="item.survey">
  52. <view class="title-text">问卷详情</view>
  53. </view>
  54. <view class="flex-row" style="justify-content: space-around;">
  55. <view class="option-box"
  56. :style="{backgroundColor: item.survey.progress === 'finish'? '#23b46c': '#FF6D31' }"
  57. v-for="(option,i) in item.survey.answers[0]" :key="i">
  58. <view class="content-subtitle">{{option}}</view>
  59. </view>
  60. </view>
  61. <!-- 投票 -->
  62. <view class="title-box"
  63. :style="{backgroundColor: item.vote.progress === 'finish'? '#23b46c': '#FF6D31' }"
  64. v-if="item.vote">
  65. <view class="title-text">{{item.vote.secret ? '匿名投票':'普通投票'}}</view>
  66. </view>
  67. <view class="flex-row" style="justify-content: space-around;">
  68. <view class="flex-column" style="align-items: center;" v-for="(option,j) in item.vote.options"
  69. :key="j">
  70. <u-parse class="title" style="font-size: 30rpx;margin-bottom: 15rpx;"
  71. :content="option.value"></u-parse>
  72. <view class="option-box"
  73. :style="{backgroundColor: item.vote.progress === 'finish'? '#23b46c': '#FF6D31' }">
  74. <view class="content-subtitle">{{option.code}}</view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import {
  85. mapState,
  86. mapMutations
  87. } from 'vuex'
  88. export default {
  89. computed: {
  90. ...mapState('m_children', ['swapData'])
  91. },
  92. data() {
  93. return {
  94. value: '',
  95. dayTime: ''
  96. }
  97. },
  98. onLoad(parameter) {
  99. this.value = parameter.value
  100. this.dayTime = (new Date()).format('M-d').replace('-', '月')
  101. },
  102. methods: {
  103. fixNum(num) {
  104. return num.toFixed(2)
  105. },
  106. navSwapReport(index) {
  107. uni.navigateTo({
  108. url: `/subpkg/datalist/swapReport?index=${index}`
  109. })
  110. }
  111. }
  112. }
  113. </script>
  114. <style lang="scss">
  115. @import 'data_pages.scss';
  116. @import 'top_info.scss';
  117. .option-box {
  118. display: flex;
  119. align-items: center;
  120. justify-content: center;
  121. width: 120rpx;
  122. height: 50rpx;
  123. border-radius: 10rpx;
  124. padding: 5rpx;
  125. }
  126. </style>