123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <template>
- <view class="container">
- <!-- <view class="top">
- 普及培训
- </view> -->
- <swiper class="swiper-box" duration="300" @change="changeTab">
- <swiper-item class="tab-content">
- <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
- <!-- 空白页 -->
- <empty v-if="loadingType === true && list.length === 0"></empty>
- <!-- 订单列表 -->
- <view class="order-item" @click="ToDetail(item)" v-for="(item, index) in list" :key="index">
- <view class="list-cell">
- <image class="image" :src="item.img"></image>
- <view class="list-tpl">{{ item.title }}</view>
- </view>
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import empty from '@/components/empty';
- import uniPopup from '@/components/uni-popup/uni-popup.vue';
- import { training } from '@/api/index.js';
- export default {
- components: {
- uniLoadMore,
- empty,
- uniPopup
- },
- data() {
- return {
- page: 1, //当前页数
- limit: 6, //每次信息条数
- list: [],
- loadingType: 'more', //加载更多状态
- };
- },
- onLoad() {
- console.log(22)
- this.loadData();
- },
- methods: {
- //获取订单列表
- loadData(type) {
- //这里是将订单挂载到tab列表下
- let obj = this;
- if (type != 'refresh') {
- console.log(obj.loadingType, '456');
- //没有更多数据直接跳出方法
- if (obj.loadingType === 'nomore') {
- return;
- } else {
- // 设置当前为数据载入中
- obj.loadingType = 'loading';
- }
- } else {
- //当重新加载数据时更新状态为可继续添加数据
- obj.loadingType = 'more';
- }
- training({})
- .then(data => {
- if (type === 'refresh') {
- obj.list = [];
- }
- let arr = data.data
- obj.list = obj.list.concat(arr);
- //判断是否还有下一页,有是more 没有是nomore
- if (obj.limit == arr.length) {
- obj.page++;
- obj.loadingType = 'more';
- } else {
- obj.loadingType = 'nomore';
- }
- // 判断是否为刷新数据
- if (type === 'refresh') {
- console.log('refresh');
- // 判断是否为点击搜索按钮跳转加载
- if (obj.loading == 1) {
- uni.hideLoading();
- } else {
- uni.stopPullDownRefresh();
- }
- }
- })
- .catch(e => {
- obj.loadingType = 'nomore';
- uni.hideLoading();
- });
- },
- //跳转到详情
- ToDetail(e) {
- let type = e.type;
- let id = e.id;
- uni.navigateTo({
- url: '/pages/train/sign?type=' + type+'&id='+id
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- background: #F2F2F2;
- height: 100%;
- padding-bottom: (25vw/7.5);
- }
- .container {
- height: 100%;
- .top{
- background-color: #FFFFFF;
- height: (88vw/7.5);
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: (36vw/7.5);
- font-weight: 500;
- color: #333333;
- }
- .swiper-box {
- height:100%;
- .list-scroll-content {
- height:100%;
- }
- }
- }
- .scroll-list {
- width: 100%;
- overflow: hidden;
- white-space: nowrap;
- background-color: #ffffff;
- font-size: (32vw/7.5);
- .scoll-box {
- text-align: center;
- display: inline-block;
- margin: (0vw/7.5) (38vw/7.5);
- padding: (15vw/7.5) 0;
- .scoll-img {
- width: (130vw/7.5);
- height: (85vw/7.5);
- border-radius: 100%;
- image {
- width: (85vw/7.5);
- height: 100%;
- border-radius: 100%;
- }
- }
- .scoll-name {
- padding-top: (15vw/7.5);
- }
- &.active {
- color: #ef3d28;
- border-bottom: (6vw/7.5) solid #ef3d28;
- }
- }
- }
- .order-item {
- width: 100%;
- padding: (0vw/7.5) (25vw/7.5);
- padding-top: (25vw/7.5) !important;
- .list-cell {
- background-color: #ffffff;
- border-radius: (20vw/7.5);
- width: 100%;
- box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.06);
- .image {
- width: 100%;
- height: (300vw/7.5);
- border-top-left-radius: (25vw/7.5);
- border-top-right-radius: (25vw/7.5);
- }
- .list-tpl {
- padding: (25vw/7.5) (25vw/7.5);
- padding-bottom: (35vw/7.5) !important;
- font-size: (34vw/7.5);
- color: #222222;
- font-weight:500;
- }
- }
- }
- </style>
|