list.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view class='apply-list'>
  3. <view class="apply-record">
  4. <mescroll-uni ref="mescrollUni" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption" top="40" height="100%" :fixed="false">
  5. <view class="list-item" v-for="(item, index) in signlist" :key="index">
  6. <view class="cover-box"></view>
  7. <view class="item-time">
  8. {{ item.createTime | dateFormat('YYYY年MM月DD日') }}
  9. </view>
  10. <view class="item-content">
  11. <view class="top flex">
  12. <view class="item-left">
  13. <image v-if="item.competitionChild && item.competitionChild.coverImg" class="bg-white" :src="item.competitionChild.coverImg.thumbnailUrl" mode="aspectFill" />
  14. </view>
  15. <view class="item-right">
  16. <view class="title">{{item.competitionChild.name}}</view>
  17. <view class="school text-cut" v-if="item.school && item.school.schoolName" >{{item.school.schoolName}}</view>
  18. <view class="school text-cut" v-else>{{item.schoolName }}</view>
  19. </view>
  20. </view>
  21. <view class="bottom flex justify-between align-center">
  22. <view class="bottom-left">
  23. <view class="name">
  24. <text class="label">参赛选手:</text>
  25. <text class="txt">{{item.baby.babyName}}</text>
  26. </view>
  27. <view class="level">
  28. <text class="label">组别:</text>
  29. <text class="txt">{{item.classLevel | filterLevel}}</text>
  30. </view>
  31. </view>
  32. <button class="cu-btn round detail active" @tap.stop="handleDetail(item.competitionChildId, item.type)">查看详情</button>
  33. </view>
  34. <view v-if="item.competitionChild" :class="['status', 'status' + item.competitionChild.state]">{{ item.competitionChild.state | filterStatus }}</view>
  35. <!-- {{ item.competitionChild.name }} -->
  36. </view>
  37. </view>
  38. </mescroll-uni>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import { signUpList } from '@/api/apply';
  44. import MescrollUni from '@/components/mescroll-uni/mescroll-uni';
  45. export default {
  46. data() {
  47. return {
  48. signlist: [],
  49. downOption: {
  50. },
  51. upOption:{
  52. page: {
  53. size: 10 // 每页数据的数量,默认10
  54. },
  55. noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  56. empty: {
  57. tip: '暂无动态',
  58. icon: 'http://vote-teacher-video.luojigou.vip/Fpkyt0Hw7r57A37JRjEuEZ3947HI',
  59. top: '0rpx'
  60. }
  61. },
  62. page: {
  63. num: 1,
  64. size: 10
  65. },
  66. }
  67. },
  68. filters: {
  69. filterStatus(val) {
  70. switch (val) { //0 未开始 1进行中 2已结束
  71. case 0:
  72. return '待开始'
  73. case 1:
  74. return '正在进行'
  75. case 2:
  76. return '已结束'
  77. default:
  78. return '已取消'
  79. }
  80. },
  81. filterLevel(val) {
  82. switch (val){
  83. case -1:
  84. return '托班'
  85. case 0:
  86. return '小班'
  87. case 1:
  88. return '中班'
  89. case 2:
  90. return '大班'
  91. default:
  92. return '待定'
  93. }
  94. }
  95. },
  96. onLoad() {
  97. // this.initData()
  98. },
  99. onShow() {},
  100. components: {
  101. MescrollUni
  102. },
  103. methods: {
  104. initData() {
  105. this.$http
  106. .get(signUpList, {
  107. isPage: 1,
  108. page: this.page.num,
  109. pageSize: this.page.size
  110. })
  111. .then(res => {
  112. // const rows = res.data.entityList || [];
  113. // if(rows.length>0) {
  114. // this.signlist = rows;
  115. // }
  116. const { entityList, total, currentPage, pageSize } = res.data;
  117. let curPageLen = entityList.length;
  118. let totalPage = pageSize;
  119. let totalSize = total;
  120. // 接口返回的是否有下一页 (true/false)
  121. let hasNext = true;
  122. if(this.page.num == 1) this.signlist = [];
  123. this.signlist = this.signlist.concat(entityList);
  124. this.$refs.mescrollUni.mescroll.endByPage(curPageLen, totalPage);
  125. })
  126. .catch(() => {
  127. console.log('catch');
  128. })
  129. },
  130. handleDetail(id, type) { // type 0 线上 1线下
  131. this.$mRouter.push({
  132. route: `/pages/apply/detail?id=${id}&type=${type}`
  133. })
  134. },
  135. // 上拉加载的回调
  136. upCallback(mescroll) {
  137. this.page.num = mescroll.num;
  138. this.page.size = mescroll.size;
  139. this.initData();
  140. },
  141. // 下拉刷新的回调
  142. downCallback(mescroll) {
  143. this.$refs.mescrollUni.mescroll.resetUpScroll()
  144. },
  145. mescrollInit(mescroll) {
  146. // console.log('mescrollInit', mescroll);
  147. }
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scope>
  152. .apply-list {
  153. background: #FFFFFF;
  154. .list-item {
  155. position: relative;
  156. margin-left: 42upx;
  157. padding-left: 26upx;
  158. padding-bottom: 72upx;
  159. border-left: 4upx dashed #EBEBEB;
  160. .item-time {
  161. font-size: 24upx;
  162. font-family: PingFangSC-Regular, PingFang SC;
  163. font-weight: 400;
  164. color: #999999;
  165. line-height: 28upx;
  166. }
  167. .item-content {
  168. position: relative;
  169. margin-top: 32upx;
  170. width: 658upx;
  171. padding: 44upx 26upx 58upx;
  172. background: #FFFFFF;
  173. box-shadow: 0px 4upx 22upx 0px rgba(190, 224, 190, 0.3);
  174. border-radius: 40upx;
  175. .top {
  176. border-bottom: 2upx solid rgba(153, 153, 153, 0.1);
  177. padding-bottom: 34upx;
  178. }
  179. .bottom {
  180. padding: 34upx 0 0 18upx;
  181. .bottom-left {
  182. .label {
  183. font-family: PingFangSC-Regular, PingFang SC;
  184. font-size: 24upx;
  185. color: #999999;
  186. }
  187. .txt {
  188. font-family: PingFangSC-Regular, PingFang SC;
  189. font-size: 28upx;
  190. color: #333333;
  191. }
  192. }
  193. }
  194. .item-left {
  195. font-size: 0;
  196. margin-right: 26upx;
  197. image {
  198. width: 212upx;
  199. height: 160upx;
  200. border-radius: 40upx;
  201. }
  202. }
  203. .item-right {
  204. max-width: 374upx;
  205. padding: 10upx 0 34upx;
  206. .title {
  207. font-size: 24upx;
  208. font-family: PingFangSC-Regular, PingFang SC;
  209. font-weight: 400;
  210. color: #999999;
  211. line-height: 36upx;
  212. }
  213. .school {
  214. margin-top: 18upx;
  215. font-size: 32upx;
  216. font-family: PingFangSC-Medium, PingFang SC;
  217. font-weight: 500;
  218. color: #333333;
  219. line-height: 44upx;
  220. }
  221. }
  222. .detail {
  223. font-size: 28upx;
  224. font-family: PingFangSC-Medium, PingFang SC;
  225. font-weight: 500;
  226. color: #FFFFFF;
  227. line-height: 28upx;
  228. height: 56upx;
  229. width: 180upx;
  230. &.active {
  231. background: #23D321;
  232. box-shadow: 0px 4upx 12upx 0px rgba(35, 211, 33, 0.43);
  233. border-radius: 200upx;
  234. }
  235. }
  236. .status {
  237. position: absolute;
  238. right: 0;
  239. top: 0;
  240. // width: 86upx;
  241. display: inline-block;
  242. padding: 0 12upx;
  243. height: 48upx;
  244. line-height: 48upx;
  245. border-radius: 0 40upx 0 40upx;
  246. font-size: 22upx;
  247. font-family: YouSheBiaoTiHei;
  248. color: #FFFFFF;
  249. text-align: center;
  250. }
  251. .status0 {
  252. background: linear-gradient(169deg, #FFC761 0%, #FF9632 100%);
  253. }
  254. .status1 {
  255. background: linear-gradient(172deg, #37F135 0%, #23D321 100%);
  256. }
  257. .status2 {
  258. background: #F2F2F2;
  259. color: #999999;
  260. }
  261. }
  262. .cover-box {
  263. position: absolute;
  264. top: 0;
  265. left: 0;
  266. transform: translateX(-14upx);
  267. width: 24upx;
  268. height: 24upx;
  269. background: #FFFFFF;
  270. box-shadow: 0px 4upx 20upx 0px #CDFCCD;
  271. border: 6upx solid #23D321;
  272. border-radius: 50%;
  273. }
  274. }
  275. }
  276. </style>