123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- <template>
- <view class="container main">
- <view class="one" v-if="total>0">
- <scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-view" @scrolltolower="toPage"
- @scroll="toScroll">
- <view class="list-scroll-view">
- <view class="list" v-for="(item, index) in list" :key="index">
- <view class="value">
- <view class="title">编号:</view>
- <view class="label"> <text :user-select="true">{{item.no||'暂无'}}</text> </view>
- </view>
- <view class="value">
- <view class="title">赛事名称:</view>
- <view class="label">{{item.match_name||'暂无'}}</view>
- </view>
- <view class="value">
- <view class="title">报名时间:</view>
- <view class="label">{{item.time||'暂无'}}</view>
- </view>
- <view class="value" v-if="item.start_time">
- <view class="title">初审时间:</view>
- <view class="label">{{item.start_time||'暂无'}}</view>
- </view>
- <view class="value" v-if="item.score">
- <view class="title">初审分数:</view>
- <view class="label">{{item.score||'暂无'}}</view>
- </view>
- <view class="value" v-if="item.final_start_time">
- <view class="title">决赛时间:</view>
- <view class="label">{{item.final_start_time||'暂无'}}</view>
- </view>
- <view class="value" v-if="item.final_score">
- <view class="title">决赛分数:</view>
- <view class="label">{{item.final_score||'暂无'}}</view>
- </view>
- <view class="value">
- <view class="title">是否进入决赛:</view>
- <view class="label">{{getDict(item,'final_confirm')||'暂无'}}</view>
- </view>
- <view class="value">
- <view class="title">流程状态:</view>
- <view class="label">{{getDict(item,'ext_status')||'暂无'}}</view>
- </view>
- <view class="value">
- <view class="title">状态:</view>
- <view class="label">{{getDict(item,'status')||'暂无'}}</view>
- </view>
- <view class="bottom">
- <button class="button button_3" type="default" size="mini"
- @tap.stop="toView(item)">查看详情</button>
- <button v-if="item.ext_status=='0'&&item.status!='1'" class="button button_1" type="default"
- size="mini" @tap.stop="toEdit(item)">修改信息</button>
- <button v-if="item.ext_status=='5'&&item.final_confirm=='1'" class="button button_2"
- type="primary" size="mini" @tap.stop="toFinals(item)">决赛时间确认</button>
- </view>
- </view>
- <view class="is_bottom" v-if="is_bottom">
- <text>{{config.bottom_title||'到底了!'}}</text>
- </view>
- </view>
- </scroll-view>
- </view>
- <o-empty v-else />
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- user: {},
- config: {},
- list: [],
- total: 0,
- skip: 0,
- limit: 5,
- page: 0,
- // 数据是否触底
- is_bottom: false,
- scrollTop: 0,
- // 禁止滚动穿透
- show: false,
- statusList: [{
- value: '0',
- label: '待审核'
- }, {
- value: '1',
- label: '已通过'
- },
- {
- value: '-1',
- label: '已退回'
- }
- ],
- isList: [{
- value: '0',
- label: '是'
- }, {
- value: '1',
- label: '否'
- }],
- extList: []
- }
- },
- onLoad: async function(e) {
- const that = this;
- await that.searchToken();
- await that.searchOther();
- await that.searchConfig();
- },
- onShow: async function() {
- const that = this;
- that.clearPage();
- await that.search();
- },
- onPullDownRefresh: async function() {
- const that = this;
- that.clearPage();
- await that.search();
- uni.stopPullDownRefresh();
- },
- methods: {
- // 禁止滚动穿透
- change(e) {
- const that = this;
- that.show = e.show
- },
- // 用户信息
- searchToken() {
- const that = this;
- try {
- const res = uni.getStorageSync('token');
- if (res) {
- const user = that.$jwt(res);
- that.$set(that, `user`, user);
- }
- } catch (e) {}
- },
- async searchOther() {
- const that = this;
- let res;
- // 查询证件类型
- res = await that.$api(`/dictData`, 'GET', {
- code: 'extStatus',
- is_use: '0',
- })
- if (res.errcode == '0') {
- that.$set(that, `extList`, res.data)
- }
- },
- searchConfig() {
- const that = this;
- try {
- const res = uni.getStorageSync('config');
- if (res) that.$set(that, `config`, res);
- } catch (e) {}
- },
- // 查询
- async search() {
- const that = this;
- let info = {
- skip: that.skip,
- limit: that.limit,
- user_id: that.user.id
- }
- const res = await that.$api(`/matchReg`, 'GET', info)
- if (res.errcode == '0') {
- let list = [...that.list, ...res.data];
- that.$set(that, `list`, list)
- that.$set(that, `total`, res.total)
- } else {
- uni.showToast({
- title: res.errmsg,
- icon: 'none'
- });
- }
- },
- // 处理字典表
- getDict(item, model) {
- if (item) {
- const that = this;
- let res;
- if (model == 'status') res = that.statusList.find(i => i.value == item.status)
- if (model == 'ext_status') res = that.extList.find(i => i.value == item.ext_status)
- if (model == 'final_confirm') res = that.isList.find(i => i.value == item.final_confirm)
- if (res) return res.label
- else return '暂无'
- }
- },
- async toView(item) {
- uni.navigateTo({
- url: `/pagesMy/preliminary/view?id=${item.id||item._id}`
- })
- },
- async toEdit(item) {
- uni.navigateTo({
- url: `/pagesMy/preliminary/edit?id=${item.id||item._id}`
- })
- },
- async toFinals(item) {
- uni.navigateTo({
- url: `/pagesMy/preliminary/finals?id=${item.id||item._id}`
- })
- },
- // 分页
- toPage(e) {
- const that = this;
- let list = that.list;
- let limit = that.limit;
- if (that.total > list.length) {
- uni.showLoading({
- title: '加载中',
- mask: true
- })
- let page = that.page + 1;
- that.$set(that, `page`, page)
- let skip = page * limit;
- that.$set(that, `skip`, skip)
- that.search();
- uni.hideLoading();
- } else that.$set(that, `is_bottom`, true)
- },
- toScroll(e) {
- const that = this;
- let up = that.scrollTop;
- let num = Math.sign(up - e.detail.scrollTop);
- if (num == 1) that.$set(that, `is_bottom`, false);
- // 检查滚动位置是否达到div显示的条件
- if (e.detail.scrollTop >= 300 && !that.showDiv) {
- that.showDiv = true;
- } else if (e.detail.scrollTop < 300 && that.showDiv) {
- that.showDiv = false;
- }
- },
- // 清空列表
- clearPage() {
- const that = this;
- that.$set(that, `list`, [])
- that.$set(that, `skip`, 0)
- that.$set(that, `limit`, 5)
- that.$set(that, `page`, 0)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .main {
- .one {
- position: relative;
- flex-grow: 1;
- background-color: var(--f1Color);
- .list {
- background-color: var(--mainColor);
- border-bottom: 1px solid var(--f5Color);
- margin: 2vw 2vw 0 2vw;
- border-radius: 4px;
- padding: 3vw;
- .value {
- display: flex;
- align-items: center;
- .title {
- min-width: 70px;
- font-size: var(--font14Size);
- font-weight: bold;
- }
- .label {
- font-size: var(--font12Size);
- color: var(--f85Color);
- }
- }
- .bottom {
- margin: 2vw 0 0 0;
- text-align: center;
- .button {
- color: var(--mainColor);
- font-size: var(--font14Size);
- border-radius: 2vw;
- }
- .button_1 {
- background-color: var(--f3CColor);
- }
- .button_2 {
- background-color: var(--fF0Color);
- }
- .button_3 {
- margin: 0 2vw 0 0;
- background-color: var(--f3CColor);
- }
- }
- }
- }
- }
- .scroll-view {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- .list-scroll-view {
- display: flex;
- flex-direction: column;
- }
- }
- .is_bottom {
- width: 100%;
- text-align: center;
- text {
- padding: 2vw 0;
- display: inline-block;
- color: var(--f85Color);
- font-size: var(--font14Size);
- }
- }
- </style>
|