log.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <app-layout>
  3. <view class='top'>
  4. <image :src='stepImg.app_image.activity_log_bg'></image>
  5. <view class='total'>
  6. <view class='total-num'>{{info.total_currency}}</view>
  7. <view>总获得奖励</view>
  8. </view>
  9. <view class='data'>
  10. <view class='location'>
  11. <view class='data-num'>{{info.total_bout}}</view>
  12. <view>参赛次数</view>
  13. </view>
  14. <view class='location'>
  15. <view class='data-num'>{{info.bout}}</view>
  16. <view>达标次数</view>
  17. </view>
  18. <view class='location'>
  19. <view class='data-num'>{{info.bout_ratio}}%</view>
  20. <view>达标率</view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class='log'>参赛记录</view>
  25. <view class='list' v-for="item in list" :key="item">
  26. <view class='list-title'>
  27. <view class='title-left'>{{item.activity.step_num}}步-<view class='title-name'>{{item.activity.title}}</view>挑战赛</view>
  28. <view class='loser' v-if='item.status == 0'>{{item.activity.now_time_status ? '进行中': '未开始'}}</view>
  29. <view class='wait' v-else-if='item.status == 1'>已达标</view>
  30. <view class='finish' v-else-if='item.status == 2'>已结算</view>
  31. <view class='finish' v-else-if='item.status == 3'>未完成</view>
  32. <view class='finish' v-else-if='item.status == 4'>已解散</view>
  33. </view>
  34. <view class='list-body'>
  35. <view class='list-num'>{{item.user_num == null ? 0 : item.user_num}}</view>
  36. <view>完成步数</view>
  37. </view>
  38. <view class='list-body'>
  39. <view class='list-num'>{{item.reward_currency}}</view>
  40. <view>奖励金额</view>
  41. </view>
  42. </view>
  43. </app-layout>
  44. </template>
  45. <script>
  46. import { mapState } from "vuex";
  47. export default {
  48. data() {
  49. return {
  50. page: 2,
  51. list: [],
  52. info: [],
  53. time: null,
  54. }
  55. },
  56. computed: {
  57. ...mapState({
  58. stepImg: state => state.mallConfig.plugin.step,
  59. userInfo: state => state.user.info,
  60. })
  61. },
  62. methods: {
  63. getList() {
  64. let that = this;
  65. that.$request({
  66. url: that.$api.step.activity_log,
  67. }).then(response=>{
  68. that.$hideLoading();
  69. if(response.code == 0) {
  70. that.list = response.data.list;
  71. that.info = response.data.info;
  72. for(let i = 0;i < list.length;i++) {
  73. list[i].start = true;
  74. let begin = list[i].activity.begin_at.replace("-","").replace("-","");
  75. if (begin < that.data.time) {
  76. list[i].start = false;
  77. }
  78. }
  79. that.list.forEach(function(row,index){
  80. row.start = true;
  81. if(new Date(row.begin_at).getTime() < that.time) {
  82. row.start = false;
  83. }
  84. })
  85. }else {
  86. uni.showToast({
  87. title: response.msg,
  88. icon: 'none',
  89. duration: 1000
  90. });
  91. }
  92. }).catch(response => {
  93. that.$hideLoading();
  94. });
  95. },
  96. },
  97. onLoad(options) { this.$commonLoad.onload(options);
  98. let that = this;
  99. that.time = new Date().getTime();
  100. that.getList();
  101. }
  102. }
  103. </script>
  104. <style scoped lang="scss">
  105. .top {
  106. height: #{408rpx};
  107. width: 100%;
  108. text-align: center;
  109. color: #fff;
  110. font-size: #{24rpx};
  111. position: relative;
  112. }
  113. .top image {
  114. height: #{408rpx};
  115. width: 100%;
  116. }
  117. .total {
  118. position: absolute;
  119. top: #{80rpx};
  120. width: 100%;
  121. }
  122. .total-num {
  123. font-size: #{72rpx};
  124. font-family: 'DIN';
  125. margin-bottom: #{18rpx};
  126. }
  127. .data {
  128. position: absolute;
  129. bottom: #{80rpx};
  130. width: 100%;
  131. }
  132. .location {
  133. float: left;
  134. width: 33.33%;
  135. }
  136. .data-num {
  137. font-size: #{44rpx};
  138. font-family: 'DIN';
  139. margin-bottom: #{9rpx};
  140. }
  141. .log {
  142. height: #{64rpx};
  143. color: #999;
  144. font-size: #{30rpx};
  145. padding-left: #{24rpx};
  146. background-color: #f7f7f7;
  147. line-height: #{64rpx};
  148. }
  149. .list {
  150. height: #{254rpx};
  151. width: 100%;
  152. background-color: white;
  153. color: #999;
  154. font-size: #{30rpx};
  155. padding: #{28rpx} #{24rpx};
  156. margin-bottom: #{20rpx};
  157. }
  158. .list-title {
  159. height: #{48rpx};
  160. width: 100%;
  161. }
  162. .title-left {
  163. float: left;
  164. color: #353535;
  165. font-size: #{30rpx};
  166. display: flex;
  167. width: 80%;
  168. }
  169. .wait {
  170. height: #{48rpx};
  171. width: #{94rpx};
  172. background-color: #feeeee;
  173. color: #ff4544;
  174. font-size: #{24rpx};
  175. line-height: #{48rpx};
  176. text-align: center;
  177. float: right;
  178. }
  179. .finish {
  180. height: #{48rpx};
  181. width: #{94rpx};
  182. background-color: #fff2e2;
  183. color: #ff9d1e;
  184. font-size: #{24rpx};
  185. line-height: #{48rpx};
  186. text-align: center;
  187. float: right;
  188. }
  189. .loser {
  190. height: #{48rpx};
  191. width: #{94rpx};
  192. background-color: #eee;
  193. color: #999;
  194. font-size: #{24rpx};
  195. line-height: #{48rpx};
  196. text-align: center;
  197. float: right;
  198. }
  199. .list-body {
  200. width: 50%;
  201. padding: #{40rpx} 0 #{50rpx};
  202. float: left;
  203. text-align: center;
  204. }
  205. .list-num {
  206. font-size: #{46rpx};
  207. color: #ff9d1e;
  208. font-family: 'DIN';
  209. margin-bottom: #{16rpx};
  210. }
  211. .loading {
  212. color: #353535;
  213. text-align: center;
  214. height: #{80rpx};
  215. line-height: #{80rpx};
  216. }
  217. .title-name {
  218. max-width: 65%;
  219. overflow: hidden;
  220. text-overflow: ellipsis;
  221. white-space: nowrap;
  222. }
  223. </style>