signup-index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view>
  3. <scroll-view scroll-x class="bg-white nav">
  4. <view class="flex text-center">
  5. <view class="cu-item flex-sub" :class="'all'==tabCur?'text-blue cur':''" @tap="tabSelect" data-id="all">
  6. 全部
  7. </view>
  8. <view class="cu-item flex-sub" :class="0==tabCur?'text-blue cur':''" @tap="tabSelect" :data-id="0">
  9. 待审核
  10. </view>
  11. <view class="cu-item flex-sub" :class="1==tabCur?'text-blue cur':''" @tap="tabSelect" :data-id="1">
  12. 已通过
  13. </view>
  14. <view class="cu-item flex-sub" :class="2==tabCur?'text-blue cur':''" @tap="tabSelect" :data-id="2">
  15. 被拒绝
  16. </view>
  17. </view>
  18. </scroll-view>
  19. <view class="">
  20. <!-- 报名列表 -->
  21. <view class="paper-card" v-for="(item, index) in list" :key="index">
  22. <navigator :url="'detail?id='+item.room_id" hover-class="none">
  23. <tui-card :title="{text: item.room.name, size: 30, color: '#7A7A7A'}" :header="item.room.name"
  24. :tag="getTagStyle(item)">
  25. <template v-slot:body>
  26. <view class="tui-default">
  27. <view class="">
  28. {{item.room.contents}}
  29. </view>
  30. </view>
  31. </template>
  32. <template v-slot:footer>
  33. <view class="tui-default">
  34. <view class="">
  35. 考试时间:{{item.room.start_time|format_date}} - {{item.room.end_time|format_date}}
  36. </view>
  37. <!-- <text>报名方式:</text>
  38. <text class="cu-tag" :class="[getSignupModeClass(item)]">{{item.room.signup_mode_text}}</text>
  39. <view class="cu-capsule round m-l-30" v-if="item.room.is_makeup">
  40. <view class='cu-tag bg-blue '>
  41. 可补考
  42. </view>
  43. <view class="cu-tag line-blue">
  44. {{item.room.makeup_count}}次
  45. </view>
  46. </view>
  47. <text class="cu-tag m-l-30" :class="[getMakeupModeClass(item)]">{{item.makeup_mode_text}}</text> -->
  48. </view>
  49. </template>
  50. </tui-card>
  51. </navigator>
  52. </view>
  53. <!-- 加载状态条 -->
  54. <view class="cu-load bg-grey" :class="loadFlag" v-show="!has_more"></view>
  55. </view>
  56. <!-- <view class="cu-card article">
  57. <view class="cu-item shadow borderBottom" v-for="(item, index) in list" :key="index" @click="goDetail(item.id)">
  58. <view class="title"><view class="text-cut">{{item.title}}</view></view>
  59. <view class="content">
  60. <image :src="item.tImg" mode="aspectFit"></image>
  61. <view class="desc">
  62. <view class="text-content">{{item.introduceText}}</view>
  63. <view class="margin-top-xs">
  64. <view class="text-gray light sm round fl">{{item.time}}</view>
  65. <view class="text-gray light sm round fr">
  66. <text class="text-gray cuIcon-mark" style="font-size: 34rpx;"></text>
  67. <text>{{item.read}}</text>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="cu-load bg-grey" :class="loadFlag" v-show="!has_more"></view>
  74. </view> -->
  75. <login ref="login" v-on:succ="getList"></login>
  76. </view>
  77. </template>
  78. <script>
  79. export default {
  80. data() {
  81. return {
  82. tabCur: 'all',
  83. // scrollLeft: 0
  84. list: [],
  85. has_more: false,
  86. current_page: 1,
  87. loadFlag: 'loading',
  88. }
  89. },
  90. computed: {
  91. getTagStyle(item) {
  92. return function(item) {
  93. let style = {
  94. text: item.status_text,
  95. size: 24
  96. }
  97. switch (parseInt(item.status)) {
  98. case 0:
  99. style['color'] = '#f37b1d'
  100. break;
  101. case 1:
  102. style['color'] = '#39b54a'
  103. break;
  104. case 2:
  105. style['color'] = '#e54d42'
  106. break;
  107. }
  108. console.log('style', style)
  109. return style
  110. }
  111. },
  112. // 报名方式样式
  113. getSignupModeClass(item) {
  114. return function(item) {
  115. switch (item.signup_mode) {
  116. case 'NORMAL':
  117. return 'bg-green'
  118. case 'PASSWORD':
  119. return 'bg-bule'
  120. case 'AUDIT':
  121. return 'bg-purple'
  122. }
  123. }
  124. },
  125. // 补考方式样式
  126. getMakeupModeClass(item) {
  127. return function(item) {
  128. if (item.is_makeup) {
  129. return 'bg-green'
  130. }
  131. return 'bg-bule'
  132. }
  133. },
  134. },
  135. onLoad() {
  136. this.getList()
  137. },
  138. async onReachBottom() {
  139. console.log("onReachBottom")
  140. if (this.has_more) {
  141. this.current_page++
  142. this.getPaper()
  143. }
  144. },
  145. methods: {
  146. getList() {
  147. this.http('room_signup/index', {
  148. page: this.current_page,
  149. status: this.tabCur
  150. }, 'get').then(res => {
  151. if (res && res.data) {
  152. if (this.current_page == 1) {
  153. this.list = res.data.list.data
  154. } else {
  155. this.list = this.list.concat(res.data.list.data)
  156. }
  157. console.log('list', this.list)
  158. this.has_more = res.data.list.has_more
  159. this.current_page = res.data.list.current_page
  160. this.loadFlag = 'over'
  161. }
  162. })
  163. },
  164. tabSelect(e) {
  165. this.tabCur = e.currentTarget.dataset.id
  166. // this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
  167. // 重置页码
  168. this.current_page = 1
  169. this.getList()
  170. },
  171. goDetail(id) {
  172. uni.navigateTo({
  173. url: 'detail?id=' + id,
  174. })
  175. }
  176. }
  177. }
  178. </script>
  179. <style>
  180. .paper-contains {
  181. margin-top: 50px;
  182. }
  183. .paper-card {
  184. margin: 20rpx 0;
  185. }
  186. .tui-title {
  187. width: 100%;
  188. padding: 70rpx 30rpx 30rpx 30rpx;
  189. box-sizing: border-box;
  190. font-size: 30rpx;
  191. line-height: 30rpx;
  192. color: #666;
  193. }
  194. .tui-default {
  195. padding: 20rpx 30rpx;
  196. }
  197. .tui-article {
  198. position: relative;
  199. }
  200. .tui-article-img {
  201. width: 100%;
  202. height: 300rpx;
  203. display: block;
  204. }
  205. .tui-article-title {
  206. position: absolute;
  207. left: 0;
  208. bottom: 0;
  209. color: #fff;
  210. font-size: 32rpx;
  211. font-weight: 500;
  212. box-sizing: border-box;
  213. padding: 20rpx 30rpx;
  214. background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.6));
  215. }
  216. .tui-cell-title {
  217. font-size: 32rpx;
  218. font-weight: 500;
  219. padding: 0 10rpx;
  220. word-break: break-all;
  221. word-wrap: break-word;
  222. }
  223. .tui-cell-img {
  224. height: 160rpx;
  225. width: 160rpx;
  226. }
  227. .tui-flex {
  228. display: flex;
  229. align-items: center;
  230. justify-content: space-between;
  231. }
  232. .tui-mr {
  233. margin-right: 20rpx;
  234. }
  235. .tui-flex-pic {
  236. display: flex;
  237. display: -webkit-flex;
  238. justify-content: space-between;
  239. flex-direction: row;
  240. flex-wrap: wrap;
  241. box-sizing: border-box;
  242. background: #fff;
  243. padding: 0 120rpx;
  244. }
  245. .tui-flex-pic image {
  246. width: 32%;
  247. margin-bottom: 2%;
  248. }
  249. .tui-content {
  250. padding: 0rpx 30rpx 20rpx 120rpx;
  251. box-sizing: border-box;
  252. font-size: 34rpx;
  253. font-weight: 400;
  254. color: #333;
  255. }
  256. .tui-color-gray {
  257. color: #ccc;
  258. }
  259. .tui-pleft {
  260. padding-left: 120rpx;
  261. }
  262. </style>