index.vue 8.2 KB

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