index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <view class="container main">
  3. <view class="one" v-if="total>0">
  4. <scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-view" @scrolltolower="toPage"
  5. @scroll="toScroll">
  6. <view class="list-scroll-view">
  7. <view class="list" v-for="(item, index) in list" :key="index">
  8. <view class="value">
  9. <view class="title">编号:</view>
  10. <view class="label"> <text :user-select="true">{{item.no||'暂无'}}</text> </view>
  11. </view>
  12. <view class="value">
  13. <view class="title">赛事名称:</view>
  14. <view class="label">{{item.match_name||'暂无'}}</view>
  15. </view>
  16. <view class="value">
  17. <view class="title">报名时间:</view>
  18. <view class="label">{{item.time||'暂无'}}</view>
  19. </view>
  20. <view class="value" v-if="item.start_time">
  21. <view class="title">初审时间:</view>
  22. <view class="label">{{item.start_time||'暂无'}}</view>
  23. </view>
  24. <view class="value" v-if="item.score">
  25. <view class="title">初审分数:</view>
  26. <view class="label">{{item.score||'暂无'}}</view>
  27. </view>
  28. <view class="value" v-if="item.final_start_time">
  29. <view class="title">决赛时间:</view>
  30. <view class="label">{{item.final_start_time||'暂无'}}</view>
  31. </view>
  32. <view class="value" v-if="item.final_score">
  33. <view class="title">决赛分数:</view>
  34. <view class="label">{{item.final_score||'暂无'}}</view>
  35. </view>
  36. <view class="value">
  37. <view class="title">是否进入决赛:</view>
  38. <view class="label">{{getDict(item,'final_confirm')||'暂无'}}</view>
  39. </view>
  40. <view class="value">
  41. <view class="title">流程状态:</view>
  42. <view class="label">{{getDict(item,'ext_status')||'暂无'}}</view>
  43. </view>
  44. <view class="value">
  45. <view class="title">状态:</view>
  46. <view class="label">{{getDict(item,'status')||'暂无'}}</view>
  47. </view>
  48. <view class="bottom">
  49. <button v-if="item.ext_status=='0'&&item.status!='1'" class="button button_1" type="default"
  50. size="mini" @tap.stop="toEdit(item)">修改信息</button>
  51. <button v-if="item.ext_status=='5'&&item.final_confirm=='1'" class="button button_2"
  52. type="primary" size="mini" @tap.stop="toFinals(item)">决赛时间确认</button>
  53. </view>
  54. </view>
  55. <view class="is_bottom" v-if="is_bottom">
  56. <text>{{config.bottom_title||'到底了!'}}</text>
  57. </view>
  58. </view>
  59. </scroll-view>
  60. </view>
  61. <o-empty v-else />
  62. </view>
  63. </template>
  64. <script>
  65. export default {
  66. data() {
  67. return {
  68. user: {},
  69. config: {},
  70. list: [],
  71. total: 0,
  72. skip: 0,
  73. limit: 5,
  74. page: 0,
  75. // 数据是否触底
  76. is_bottom: false,
  77. scrollTop: 0,
  78. // 禁止滚动穿透
  79. show: false,
  80. statusList: [{
  81. value: '0',
  82. label: '待审核'
  83. }, {
  84. value: '1',
  85. label: '已通过'
  86. },
  87. {
  88. value: '-1',
  89. label: '已退回'
  90. }
  91. ],
  92. isList: [{
  93. value: '0',
  94. label: '是'
  95. }, {
  96. value: '1',
  97. label: '否'
  98. }],
  99. extList: []
  100. }
  101. },
  102. onLoad: async function(e) {
  103. const that = this;
  104. await that.searchToken();
  105. await that.searchOther();
  106. await that.searchConfig();
  107. },
  108. onShow: async function() {
  109. const that = this;
  110. that.clearPage();
  111. await that.search();
  112. },
  113. onPullDownRefresh: async function() {
  114. const that = this;
  115. that.clearPage();
  116. await that.search();
  117. uni.stopPullDownRefresh();
  118. },
  119. methods: {
  120. // 禁止滚动穿透
  121. change(e) {
  122. const that = this;
  123. that.show = e.show
  124. },
  125. // 用户信息
  126. searchToken() {
  127. const that = this;
  128. try {
  129. const res = uni.getStorageSync('token');
  130. if (res) {
  131. const user = that.$jwt(res);
  132. that.$set(that, `user`, user);
  133. }
  134. } catch (e) {}
  135. },
  136. async searchOther() {
  137. const that = this;
  138. let res;
  139. // 查询证件类型
  140. res = await that.$api(`/dictData`, 'GET', {
  141. code: 'extStatus',
  142. is_use: '0',
  143. })
  144. if (res.errcode == '0') {
  145. that.$set(that, `extList`, res.data)
  146. }
  147. },
  148. searchConfig() {
  149. const that = this;
  150. try {
  151. const res = uni.getStorageSync('config');
  152. if (res) that.$set(that, `config`, res);
  153. } catch (e) {}
  154. },
  155. // 查询
  156. async search() {
  157. const that = this;
  158. let info = {
  159. skip: that.skip,
  160. limit: that.limit,
  161. user_id: that.user.id
  162. }
  163. const res = await that.$api(`/matchReg`, 'GET', info)
  164. if (res.errcode == '0') {
  165. let list = [...that.list, ...res.data];
  166. that.$set(that, `list`, list)
  167. that.$set(that, `total`, res.total)
  168. } else {
  169. uni.showToast({
  170. title: res.errmsg,
  171. icon: 'none'
  172. });
  173. }
  174. },
  175. // 处理字典表
  176. getDict(item, model) {
  177. if (item) {
  178. const that = this;
  179. let res;
  180. if (model == 'status') res = that.statusList.find(i => i.value == item.status)
  181. if (model == 'ext_status') res = that.extList.find(i => i.value == item.ext_status)
  182. if (model == 'final_confirm') res = that.isList.find(i => i.value == item.final_confirm)
  183. if (res) return res.label
  184. else return '暂无'
  185. }
  186. },
  187. async toEdit(item) {
  188. uni.navigateTo({
  189. url: `/pagesMy/preliminary/edit?id=${item.id||item._id}`
  190. })
  191. },
  192. async toFinals(item) {
  193. uni.navigateTo({
  194. url: `/pagesMy/preliminary/finals?id=${item.id||item._id}`
  195. })
  196. },
  197. // 分页
  198. toPage(e) {
  199. const that = this;
  200. let list = that.list;
  201. let limit = that.limit;
  202. if (that.total > list.length) {
  203. uni.showLoading({
  204. title: '加载中',
  205. mask: true
  206. })
  207. let page = that.page + 1;
  208. that.$set(that, `page`, page)
  209. let skip = page * limit;
  210. that.$set(that, `skip`, skip)
  211. that.search();
  212. uni.hideLoading();
  213. } else that.$set(that, `is_bottom`, true)
  214. },
  215. toScroll(e) {
  216. const that = this;
  217. let up = that.scrollTop;
  218. let num = Math.sign(up - e.detail.scrollTop);
  219. if (num == 1) that.$set(that, `is_bottom`, false);
  220. // 检查滚动位置是否达到div显示的条件
  221. if (e.detail.scrollTop >= 300 && !that.showDiv) {
  222. that.showDiv = true;
  223. } else if (e.detail.scrollTop < 300 && that.showDiv) {
  224. that.showDiv = false;
  225. }
  226. },
  227. // 清空列表
  228. clearPage() {
  229. const that = this;
  230. that.$set(that, `list`, [])
  231. that.$set(that, `skip`, 0)
  232. that.$set(that, `limit`, 5)
  233. that.$set(that, `page`, 0)
  234. }
  235. }
  236. }
  237. </script>
  238. <style lang="scss" scoped>
  239. .main {
  240. .one {
  241. position: relative;
  242. flex-grow: 1;
  243. background-color: var(--f1Color);
  244. .list {
  245. background-color: var(--mainColor);
  246. border-bottom: 1px solid var(--f5Color);
  247. margin: 2vw 2vw 0 2vw;
  248. border-radius: 4px;
  249. padding: 3vw;
  250. .value {
  251. display: flex;
  252. align-items: center;
  253. .title {
  254. min-width: 70px;
  255. font-size: var(--font14Size);
  256. font-weight: bold;
  257. }
  258. .label {
  259. font-size: var(--font12Size);
  260. color: var(--f85Color);
  261. }
  262. }
  263. .bottom {
  264. margin: 2vw 0 0 0;
  265. text-align: center;
  266. .button {
  267. color: var(--mainColor);
  268. font-size: var(--font14Size);
  269. border-radius: 2vw;
  270. }
  271. .button_1 {
  272. margin: 0 2vw 0 0;
  273. background-color: var(--f3CColor);
  274. }
  275. .button_2 {
  276. background-color: var(--fF0Color);
  277. }
  278. }
  279. }
  280. }
  281. }
  282. .scroll-view {
  283. position: absolute;
  284. top: 0;
  285. left: 0;
  286. right: 0;
  287. bottom: 0;
  288. .list-scroll-view {
  289. display: flex;
  290. flex-direction: column;
  291. }
  292. }
  293. .is_bottom {
  294. width: 100%;
  295. text-align: center;
  296. text {
  297. padding: 2vw 0;
  298. display: inline-block;
  299. color: var(--f85Color);
  300. font-size: var(--font14Size);
  301. }
  302. }
  303. </style>