StoryList.vue 6.29 KB
// 研学游记
<template>
  <div id="SelectionStory">
    <van-list
      v-if="StoryList.length > 0"
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      :immediate-check="false"
      @load="GetStoryList"
    >
      <StoryList :list="StoryList"></StoryList>
    </van-list>
    <van-empty v-if="finished && StoryList.length == 0" :image="require('@/assets/empty.png')" description="暂无游记" />
    <van-icon name="back-top" class="backtop" @click="backTop" />
  </div>
</template>

<script>
import StoryList from './c_StoryList.vue'
export default {
  data() {
    return {
      searchValue: '',
      frequencyId: '', //频道标签
      pageLoading: true,
      pageSize: 10,
      pageNum: 1,
      loading: false,
      finished: false,

      StoryList: [],
    }
  },
  mounted() {
    let userInfo = localStorage.getItem('userInfo')
    if (userInfo) {
      this.userInfo = JSON.parse(userInfo)
      this.GetStoryList()
    }
  },
  methods: {
    // 获取研学游记
    GetStoryList() {
      if (this.pageNum == 1) {
        this.$toast.loading({
          message: '加载中...',
          duration: 0,
          forbidClick: true,
        })
      }
      this.yxAxios
        .get(
          `${this.yanxueUrl}/api/StudiesWap/GetStoryList?userId=${this.userInfo.centerNo}&pageIndex=${this.pageNum}&pageSize=${this.pageSize}`
        )
        .then((res) => {
          this.$toast.clear()
          let data = res.data
          console.log('游记列表:', data)
          if (data.status == 1) {
            this.loading = false
            if (this.pageSize * this.pageNum >= data.data.count) {
              this.finished = true
            } else {
              this.pageNum++
            }
            this.StoryList = this.StoryList.concat(data.data.items)
          } else {
            this.$toast(data.message)
          }
        })
    },

    // 下拉刷新
    onRefresh() {
      this.pageNum = 1
      this.GetStoryList()
    },

    // 返回顶部
    backTop() {
      document.getElementById('SelectionStory').scrollIntoView()
    },

  },
  components: {
    StoryList,
  },
}
</script>
<style lang="scss">
#SelectionStory {
  width: 100%;
  min-height: 100%;
  background: #fff;
  padding-bottom: 40px;
  box-sizing: border-box;
  .drop_down_box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .drop_down {
    }
    .filter {
      flex-shrink: 0;
      font-size: 28px;
      padding: 0 30px;
    }
  }
  .characteristic_label {
    white-space: nowrap;
    overflow-x: auto;
    padding: 0 30px;
    padding-top: 20px;
    &::-webkit-scrollbar {
      display: none;
    }
    span {
      display: inline-block;
      padding: 10px;
      font-size: 24px;
      background: #f5f6fa;
      border-radius: 8px;
      border: 1px solid #f5f6fa;
      margin-right: 12px;
      &.active {
        background: #ebf4ff;
        color: #1373ea;
        border-color: #1373ea;
      }
    }
    .abroad {
      padding: 18px 0;
      .padding_box {
        padding: 0 28px;
        padding-bottom: 16px;
      }
      .uni_item_mini {
        position: relative;
        margin-top: 16px;
        display: inline-block;
        width: 336px;
        vertical-align: top;
        &:nth-of-type(2n-1) {
          margin-right: 22px;
          clear: both;
        }
        .img_box {
          position: relative;
          border-radius: 16px;
          overflow: hidden;
          width: 336px;
          height: 420px;
          background-size: cover;
          background-position: center;
          .time {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            line-height: 52px;
            font-size: 21px;
            font-weight: bold;
            background: rgba(0, 0, 0, 0.27);
            border-radius: 16px;
            color: #fff;
            text-align: center;
            white-space: nowrap;
          }
          .bottom {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            box-sizing: border-box;
            padding: 0 20px;
            background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
            color: #fff;
            .level {
              display: block;
              font-size: 26px;
            }
            .count {
              display: inline-block;
              font-size: 20px;
              padding: 2px 10px;
              background: rgba(0, 0, 0, 0.3);
              border-radius: 10px;
              margin-top: 8px;
              margin-bottom: 14px;
            }
            .score {
              font-size: 42px;
              line-height: 58px;
              position: absolute;
              right: 18px;
              bottom: 22px;
              color: #ffe930;
            }
          }
        }
        .content {
          margin-top: 6px;
          .title {
            display: -webkit-box;
            font-size: 28px;
            line-height: 40px;
            -webkit-line-clamp: 2;
            text-overflow: ellipsis;
            overflow: hidden;
            -webkit-box-orient: vertical;
            margin-top: 20px;
          }
          .address {
            font-size: 24px;
            margin-top: 8px;
          }
          .tag_box {
            padding-top: 6px;
            .tag {
              display: inline-block;
              margin-bottom: 10px;
              margin-right: 10px;
              color: #4092ff;
              font-size: 20px;
              border-radius: 4px;
              border: 2px solid #4092ff;
              padding: 0px 6px;
            }
          }
        }
      }
      .line {
        width: 100%;
        height: 16px;
        background: #f5f6fa;
      }
    }
  }
  .page_loading {
    font-size: 24px;
    text-align: center;
    padding-top: 40px;
  }
  .backtop {
    position: fixed;
    bottom: 100px;
    right: 40px;
    font-size: 60px;
    background: #eee;
    border-radius: 10px;
    padding: 10px;
  }
  .van-empty{
    padding-top: 30vh;
  }
  .van-tab {
    font-size: 32px;
  }
  .van-dropdown-menu__bar {
    box-shadow: none;
  }
  .van-dropdown-menu__item {
    flex: none;
    // width: 180px;
    margin-right: 40px;
  }
  .van-dropdown-menu__title {
    font-size: 28px;
    color: #999;
  }
  .van-cell {
    color: #999;
  }
}
</style>