123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <template>
- <view class="content">
- <view class="filter-box">
- <u-search placeholder="请输入关键字" v-model="filterText" @search="setFilterText" @custom="setFilterText"></u-search>
- </view>
- <scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="true"
- :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
- @refresherrestore="onRestore">
- <u-card :head-border-bottom="false" :foot-border-top="false" padding="0px" margin="10px" borderRadius="40" v-for="(item, index) in tableList"
- :key="index" class="card-box" @click="selectClass(item)">
- <view class="card-content" slot="head" style="padding-top: 10px;">
- <view class="card-name">{{item.name}}</view>
- </view>
- <view class="card-content" slot="body">
- <view class="card-info-text">
- <u-icon name="clock"></u-icon>
- {{item.classStartDate}} ~ {{item.classEndDate}}
- </view>
- <view class="card-info-text" v-for="(site, index2) in item.classExtrasList" :key="index2">
- <u-icon name="calendar" style="visibility: hidden;"></u-icon>
- <text>{{site.week}} {{site.startTime}}-{{site.endTime}}</text>
- </view>
- <view class="card-info-text">
- <u-icon name="map"></u-icon>
- {{item.address}}
- </view>
- </view>
- </u-card>
- <u-divider v-if="isOver" bg-color="transparent">没有更多了</u-divider>
- </scroll-view>
- <u-top-tips ref="uTips"></u-top-tips>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex'
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- computed: {
- ...mapGetters([
- 'mainColor'
- ])
- },
- data() {
- return {
- filterText: '',
- venueId: '',
- triggered: false,
- isOver: false,
- pageIndex: 1,
- tableList: [],
- }
- },
- onLoad(options) {
- this.venueId = options.venueId
- this.getTableList()
- },
- onReady() {},
- methods: {
- // 设置过滤字段
- setFilterText(value) {
- this.onRefresh()
- },
- // 下拉刷新
- onRefresh() {
- this.triggered = true
- this.isOver = false
- this.pageIndex = 1
- this.tableList = []
- this.getTableList()
- },
- // 重置下拉刷新状态
- onRestore() {
- this.triggered = 'restore'
- this.triggered = false
- },
- // 懒加载
- handleLoadMore() {
- if (!this.isOver) {
- this.pageIndex++
- this.getTableList()
- }
- },
- // 获取列表数据
- getTableList() {
- NET.request(API.getClassList, {
- name: this.filterText,
- venueId: this.venueId,
- page: this.pageIndex,
- size: 10,
- }, 'POST').then(res => {
- this.triggered = false
- this.tableList = this.tableList.concat(res.data.row)
- this.isOver = res.data.row.length != 10
- }).catch(error => {
- this.triggered = false
- this.$refs.uTips.show({
- title: error.message,
- type: 'warning',
- })
- })
- },
- // 跳转场馆详情
- selectClass(item) {
- uni.setStorage({
- key: 'defaultClass',
- data: {
- classId: item.id,
- className: item.name,
- }
- });
- uni.navigateBack()
- },
- },
- }
- </script>
- <style>
- page {
- width: 100%;
- height: 100%;
- background-color: #f7f7f7;
- }
- </style>
- <style lang="scss" scoped>
- @import "@/static/css/themes.scss";
- .content {
- width: 100%;
- float: left;
- .filter-box {
- height: 48px;
- padding: 10px 15px;
- background-color: #FFFFFF;
- }
- .scroll-box {
- width: 100%;
- height: calc(100vh - 48px);
- box-sizing: border-box;
- padding-bottom: 10px;
- .card-box {
- .card-content {
- padding: 5px 15px;
- }
- .card-name {
- height: 20px;
- display: inline-block;
- font-weight: bold;
- font-size: 14px;
- line-height: 20px;
- }
- .card-info-text {
- color: #999999;
- margin-bottom: 5px;
- /deep/.u-icon {
- margin-right: 5px;
- font-size: 14px;
- color: #000000;
- }
- }
- }
- }
- }
- </style>
|