Browse Source

【接口对接】首页 消息列表 确认消息列表 消息列表详情 发现列表 发现列表详情 推荐列表分类 推荐 列表接口

test
Enzo 4 years ago
parent
commit
f9c84666b5
  1. 15
      common/api.js
  2. 4
      components/lf-waterfall/lf-waterfall.vue
  3. 209
      pages/channel/index.vue
  4. 67
      pages/discover/discover.vue
  5. 76
      pages/index/index.vue
  6. 88
      pages/message/index.vue
  7. 156
      pages/recommList/index.vue

15
common/api.js

@ -10,8 +10,23 @@ export const API_WXLOGIN = '/api/login'; //登录
export const API_INDEX = '/api/index'; //首页
export const API_FAVOURITE = '/api/agent_product/guess'; //猜你喜欢
export const API_CHANNEL = '/api/channel/list'; //频道列表
export const API_EDITCHANNEL = '/api/user_channel/update'; //编辑频道
export const API_FINDARTICLE = '/api/article/list'; //发现文章列表
export const API_FINDARTICLEDETAILS = '/api/article/show'; //发现文章详情
export const API_ADVICELIST = '/api/agent_product/list'; //推荐列表
export const API_CATEGORYLIST = '/api/category/list'; //推荐分类
export const API_ADVICEDETAILS = '/api/agent_product/show'; //推荐列表详情
export const API_MESSAGELIST = '/api/message/list'; //消息列表
export const API_MESSAGEDETAILS = '/api/message/show'; //消息详情
export const API_CHECKNEWS = '/api/message/read'; //消息标记为已读

4
components/lf-waterfall/lf-waterfall.vue

@ -4,7 +4,7 @@
<template v-slot:left="{leftList}">
<view class="list-warter" v-for="(item, index) in leftList" :key="index" @click="onClick">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{item.saleitem.sale}</view>
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
@ -21,7 +21,7 @@
<template v-slot:right="{rightList}">
<view class="list-warter" v-for="(item, index) in rightList" :key="index" @click="onClick">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{item.sale}</view>
<view class="list-label">已售{{item.sale}}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">

209
pages/channel/index.vue

@ -13,60 +13,19 @@
</view>
</view>
<!-- 机票酒店 -->
<view class="title lf-m-t-40">
<image src="../../static/images/plane_ticket.png" class="icon-img"></image>
<text class="lf-m-l-10">机票酒店</text>
</view>
<view class="lf-flex-wrap lf-p-l-5 select-box">
<view class="select-item" hover-class="lf-opacity"
v-for="(item, index) in plane_ticket_list" :key="index"
v-if="!item.checked" @click="activaItem(item, index, 'plane_ticket_list')">{{ item.name }}
</view>
</view>
<!-- 旅游度假 -->
<view class="title lf-m-t-40">
<image src="../../static/images/travel.png" class="icon-img"></image>
<text class="lf-m-l-10">旅游度假</text>
</view>
<view class="lf-flex-wrap lf-p-l-5 select-box">
<view class="select-item" hover-class="lf-opacity"
v-for="(item, index) in travel_list" :key="index"
v-if="!item.checked" @click="activaItem(item, index, 'travel_list')">{{ item.name }}
</view>
</view>
<!-- 接送服务 -->
<view class="title lf-m-t-40">
<image src="../../static/images/jieson.png" class="icon-img"></image>
<text class="lf-m-l-10">接送服务</text>
</view>
<view class="lf-flex-wrap lf-p-l-5 select-box">
<view class="select-item" hover-class="lf-opacity"
v-for="(item, index) in jieson_list" :key="index"
v-if="!item.checked" @click="activaItem(item, index, 'jieson_list')">{{ item.name }}
<view v-for="(item,index) of channel_list">
<view class="title lf-m-t-40">
<image src="../../static/images/plane_ticket.png" class="icon-img"></image>
<text class="lf-m-l-10">{{item.name}}</text>
</view>
</view>
<!-- 其他精选 -->
<view class="title lf-m-t-40">
<image src="../../static/images/other.png" class="icon-img"></image>
<text class="lf-m-l-10">其他精选</text>
</view>
<view class="lf-flex-wrap lf-p-l-5 select-box">
<view class="select-item" hover-class="lf-opacity"
v-for="(item, index) in other_list" :key="index"
v-if="!item.checked" @click="activaItem(item, index, 'other_list')">{{ item.name }}
</view>
</view>
<!-- 攻略社区 -->
<view class="title lf-m-t-40">
<image src="../../static/images/strategy.png" class="icon-img"></image>
<text class="lf-m-l-10">攻略社区</text>
</view>
<view class="lf-flex-wrap lf-p-l-5 select-box">
<view class="select-item" hover-class="lf-opacity"
v-for="(item, index) in strategy_list" :key="index"
v-if="!item.checked" @click="activaItem(item, index, 'strategy_list')">{{ item.name }}
<view class="lf-flex-wrap lf-p-l-5 select-box">
<view class="select-item" hover-class="lf-opacity"
v-for="(item2, index2) in item.content" :key="index2"
v-if="!item2.checked" @click="activaItem(item2, index2, index, item)">{{ item2.name }}
</view>
</view>
</view>
</view>
</template>
@ -75,121 +34,77 @@
data(){
return {
select_list: {}, //
plane_ticket_list: [{
name: '多地比价',
key: 'a1',
checked: false
},{
name: '降价提醒',
key: 'a2',
checked: false
},{
name: '团体机票',
key: 'a3',
checked: false
}], //
travel_list: [{
name: '周边游',
checked: false
},{
name: '国内游',
checked: false
},{
name: '主题玩法',
checked: false
},{
name: '尾单特卖',
checked: false
},{
name: '邮轮',
checked: false
},{
name: '汽车·船票',
checked: false
},{
name: '定制游',
checked: false
}], //
jieson_list: [{
name: '接送机',
checked: false
},{
name: '接送火车',
checked: false
},{
name: '打车',
checked: false
},{
name: '按天包车',
checked: false
},{
name: '定制包车',
checked: false
},{
name: '国内租车',
checked: false
},{
name: '境外租车',
checked: false
}], //
other_list: [{
name: '每日签到',
checked: false
},{
name: '会员中心',
checked: false
},{
name: '任务中心',
checked: false
},{
name: '智慧旅游',
checked: false
},{
name: '兑换会员',
checked: false
},{
name: '旅盟',
checked: false
}], //
strategy_list: [{
name: '旅游攻略',
checked: false
},{
name: '玩法指南',
checked: false
},{
name: '有问必答',
checked: false
}]
channel_list: [],
chanel_id: [],
}
},
onLoad(){
this.getChannel()
},
methods: {
updateChannel() {
this.$http(this.API.API_EDITCHANNEL,{channels: this.chanel_id},{showLoading:false}).then(res => {
console.log(res)
}).catch(err => {
})
},
//
getChannel() {
this.$http(this.API.API_CHANNEL).then(res => {
let list = [];
res.data.forEach(item => {
if(item.pid == 0) {
item.content = [];
list.push(item);
}
})
this.channel_list = list;
res.data.forEach(item => {
this.channel_list.forEach((item2,index) => {
if(item.pid == item2.id) {
this.channel_list[index].content.push(item);
this.channel_list[index].content.forEach((item3,index3) => {
this.$set(this.channel_list[index].content[index3],'checked',false)
})
}
})
})
}).catch(err => {
})
},
//
activaItem(item, index, list_name){
activaItem(item2, index2, index, item){
let select_list = this.select_list;
if(!select_list[item.name]){
if(Object.keys(select_list).length > 12){
if(!select_list[item2.name]){
if(Object.keys(select_list).length > 11){
this.$msg('最多只能添加12个频道哦')
}else{
this.select_list[item.name] = list_name;
this[list_name][index].checked = true;
this.select_list[item2.name] = {p_index: index, c_index: index2};
this.chanel_id.push(item2.id);
this.channel_list[index].content[index2].checked = true;
}
}
this.updateChannel();
},
//
cancelItem(key){
//
let list = this[this.select_list[key]];
list.forEach(item => {
if(item.name == key){
item.checked = false;
let item = this.select_list[key];
let list = this.channel_list[item.p_index].content[item.c_index];
let id = this.channel_list[item.p_index].content[item.c_index].id;
list.checked = false;
// this.chanel_id.filter(t => t != id)
this.chanel_id.forEach((item,index) => {
if(this.chanel_id[index] == id) {
this.chanel_id.splice(index, 1)
}
});
//
delete this.select_list[key];
this.updateChannel();
}
}
}

67
pages/discover/discover.vue

@ -1,44 +1,67 @@
<template>
<view class="page-color">
<view class="padding-lr lf-p-t-30 lf-p-b-30">
<view class="bg-red card-discover lf-m-b-30">
<view @click="$url('/pages/notice/article')">
<image src="../../static/images/empty.png" mode="aspectFill" style="width: 686rpx;height: 300rpx;"></image>
<view class="padding-lr lf-p-t-30">
<view class="card-discover lf-m-b-30" v-for="(item,index) of article_list" :key="index">
<view @click="$url('/pages/notice/article?article_id='+item.big.id)">
<image :src="item.big.image" mode="aspectFill" style="width: 686rpx;height: 300rpx;"></image>
</view>
<view class="flex-direction bg-white discover-radius">
<view class="flex align-center text-center lf-p-30 solid-bottom" v-for="i of 3" @click="$url('/pages/notice/article')">
<view class="flex align-center text-center lf-p-30 solid-bottom" v-for="(i,index) of item.children" @click="$url('/pages/notice/article?article_id='+i.id)">
<view>
<image src="../../static/logo.png" mode="aspectFill" style="width: 100rpx;height: 100rpx;"></image>
</view>
<view class="lf-line-2 lf-color-333 lf-font-28 lf-text-left lf-m-l-20" style="line-height: 44rpx;">
南澳站·潮玩旅游胜地 身处亚热带风情心享甜美假日/玩转南澳
</view>
</view>
</view>
</view>
<view class="bg-red card-discover lf-m-b-30">
<view @click="$url('/pages/notice/article')">
<image src="../../static/images/empty.png" mode="aspectFill" style="width: 686rpx;height: 300rpx;"></image>
</view>
<view class="flex-direction bg-white discover-radius">
<view class="flex align-center text-center lf-p-30 solid-bottom" v-for="i of 3" @click="$url('/pages/notice/article')">
<view>
<image src="../../static/logo.png" mode="aspectFill" style="width: 100rpx;height: 100rpx;"></image>
</view>
<view class="lf-line-2 lf-color-333 lf-font-28 lf-text-left lf-m-l-20" style="line-height: 44rpx;">
南澳站·潮玩旅游胜地 身处亚热带风情心享甜美假日/玩转南澳
{{i.title}}
</view>
</view>
</view>
</view>
</view>
<!-- 加载 -->
<view class="loading-more lf-p-b-40">
<text v-if="article_list.length" :class="{'loading-more-text': loadingClass}">{{ loadingText }}</text>
<lf-nocontent v-else></lf-nocontent>
</view>
<!-- 回到顶部 -->
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
</view>
</template>
<script>
export default {
data() {
return {
page: 1,
article_list: [],
loadingClass: true,
loadingText: '正在加载中',
isPage: false
}
},
methods: {
getArticle() {
this.$http(this.API.API_FINDARTICLE,{page: this.page}).then(res => {
let isPage = res.data.next_page_url == null?false:true;
this.isPage = isPage;
if(!isPage){
this.loadingClass = false;
this.loadingText = '没有更多数据啦~';
}
if(this.page == 1){
this.article_list = res.data.data;
}else{
this.article_list.push(...res.data.data);
}
console.log(res)
}).catch(err => {
})
},
},
onLoad() {
this.getArticle()
}
}
</script>
<style scoped>

76
pages/index/index.vue

@ -34,7 +34,7 @@
<!-- 中间广告模块 -->
<swiper class="lf-m-t-40 ad" :current="banner_current" >
<swiper-item @click="clickAD">
<image src="https://picsum.photos/375/230" class="lf-w-100 lf-h-100"></image>
<image :src="home_ad1" class="lf-w-100 lf-h-100"></image>
</swiper-item>
</swiper>
<!-- 人气爆款 -->
@ -48,31 +48,25 @@
<view class="recomm lf-m-t-20 lf-m-b-30">
<view class="lf-row-between">
<view class="max-recomm-img" @click="$url('/pages/activityList/index')">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
<image :src="hot_list[0].product.picture" class="lf-w-100 lf-h-100"></image>
<view class="recomm-title">
<view class="lf-line-2 lf-m-b-10">土耳其双人游飞机往返酒店五星级各大热门景点豪华双人游纯江湖救急</view>
<lf-price price="3999.00"></lf-price>
<view class="lf-line-2 lf-m-b-10">{{hot_list[0].product.title}}</view>
<lf-price :price="hot_number" v-if="hot_number"></lf-price>
<!-- <view class="lf-font-42 lf-font-bold lf-m-t-10" style="color: #FF0000;">3999.00</view> -->
</view>
</view>
<view>
<view class="recomm-img" @click="$url('/pages/activityList/index')">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
<image :src="hot_list[1].product.picture" class="lf-w-100 lf-h-100"></image>
</view>
<view class="recomm-img lf-m-t-10" @click="$url('/pages/activityList/index')">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
<image :src="hot_list[2].product.picture" class="lf-w-100 lf-h-100"></image>
</view>
</view>
</view>
<view class="lf-row-between lf-m-t-10">
<view class="recomm-img" @click="$url('/pages/activityList/index')">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
</view>
<view class="recomm-img" @click="$url('/pages/activityList/index')">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
</view>
<view class="recomm-img" @click="$url('/pages/activityList/index')">
<image src="../../static/logo.png" class="lf-w-100 lf-h-100"></image>
<view class="recomm-img" @click="$url('/pages/activityList/index')" v-for="(item,index) of hot_list" v-if="index>2">
<image :src="item.product.picture" class="lf-w-100 lf-h-100"></image>
</view>
</view>
</view>
@ -122,52 +116,18 @@
channel_list: [],
current: 0,
loading_class: false,
hot_list: [],
loading_text: '已加载全部数据~',
home_ad1: '',
list: [
{
price: 35,
title: '北国风光,千里冰封,万里雪飘',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23327_s.jpg',
},
{
price: 75,
title: '望长城内外,惟余莽莽',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23325_s.jpg',
},
{
price: 385,
title: '大河上下,顿失滔滔',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
},
{
price: 784,
title: '欲与天公试比高',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/zzpic23369_s.jpg',
},
{
price: 7891,
title: '须晴日,看红装素裹,分外妖娆',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2130_s.jpg',
},
{
price: 2341,
shop: '李白杜甫白居易旗舰店',
title: '江山如此多娇,引无数英雄竞折腰',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23346_s.jpg',
}
],
hot_number: '',
list: [],
notice: []
}
},
onLoad() {
// this.addRandomData();
this.getIndexData()
this.getFavourite()
},
methods: {
//
@ -180,10 +140,20 @@
this.recomm_list.push(item);
}
},
//
getFavourite() {
this.$http(this.API.API_FAVOURITE).then(res => {
this.recomm_list = res.data.data
console.log(res)
}).catch(err => {
})
},
getIndexData() {
this.$http(this.API.API_INDEX).then(res => {
this.notice = res.data?.notice
this.recomm_list = res.data?.hots
this.hot_list = res.data?.hots
this.hot_number = parseInt(this.hot_list[0].price)
this.banner = res.data?.slide
this.channel_list = res.data?.my_channels
this.home_ad1 = res.data?.home_ad1

88
pages/message/index.vue

@ -1,14 +1,15 @@
<template>
<view>
<view class="card" v-for="(item, index) in list" :key="index" @click="$url('/pages/message/detail')">
<view class="card" v-for="(item, index) in list" :key="index" @click="goDetails(item.id)">
<view class="lf-row-between lf-m-b-20">
<view class="lf-color-black lf-flex">
<text class="hot"></text>
<text class="hot" v-if="item.is_read == 0"></text>
<text class="gray" v-else></text>
<text class="lf-font-28 lf-m-l-10">收到一条新消息</text>
</view>
<view class="lf-color-gray lf-font-22">2021-7-6 23:34:53 </view>
<view class="lf-color-gray lf-font-22">{{timer(item.created_at*1000) || ''}} </view>
</view>
<view class="lf-font-24 lf-color-555">南澳站·潮玩旅游胜地 身处亚热带风情/玩转南澳南澳站·潮玩旅游胜地 身处亚热带风情/玩转南澳</view>
<view class="lf-font-24 lf-color-555">{{item.title}}</view>
</view>
<!-- 加载 -->
<view class="loading-more">
@ -26,20 +27,81 @@
return {
list: [1, 2],
loadingClass: true,
loadingText: '正在加载中'
loadingText: '正在加载中',
page: 1,
isPage: false
}
},
onLoad(){
this.getMessageList()
},
methods: {
timer(value, fmt) {
if(!value) return;
let newTime = new Date(value)
if(!fmt){
fmt = 'yyyy-MM-dd hh:mm';
}
if(/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (newTime.getFullYear() + '').substr(4 - RegExp.$1.length));
}
let o = {
'M+': newTime.getMonth() + 1,
'd+': newTime.getDate(),
'h+': newTime.getHours(),
'm+': newTime.getMinutes(),
's+': newTime.getSeconds()
};
function padLeftZero(str) {
return ('00'+str).substr(str.length);
}
//
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
// console.log(`${k}`)
let str = o[k] + '';
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
}
}
return fmt;
},
goDetails(id) {
this.$http(this.API.API_CHECKNEWS,{id: id}).then(res => {
this.$url('/pages/message/detail?news_id='+item.id)
}).catch(err => {
})
},
getMessageList() {
this.$http(this.API.API_MESSAGELIST,{page: this.page}).then(res => {
let isPage = res.data.next_page_url == null?false:true;
this.isPage = isPage;
if(!isPage){
this.loadingClass = false;
this.loadingText = '没有更多数据啦~';
}
if(this.page == 1){
this.list = res.data.data;
}else{
this.list.push(...res.data.data);
}
uni.stopPullDownRefresh();
console.log(this.list)
}).catch(err => {
})
}
},
onReachBottom(){
if(this.isPage){
this.page = this.page + 1;
this.getMessageList();
}
},
onPullDownRefresh(){
uni.stopPullDownRefresh();
this.getMessageList()
}
}
</script>
@ -67,6 +129,14 @@
border-radius: 50rpx;
background-color: #FF0000;
}
.gray {
display: inline-block;
margin-right: 10rpx;
width: 15rpx;
height: 15rpx;
border-radius: 50rpx;
background-color: #999;
}
}
.lf-font-22{
font-size: 22rpx;

156
pages/recommList/index.vue

@ -3,13 +3,13 @@
<view class="lf-p-t-20 head" v-if="tab_list.length">
<u-tabs :list="tab_list" :is-scroll="true" :current="current" @change="tabChange"></u-tabs>
</view>
<swiper :style="{height: 'calc('+ windowHeight +'px - 238rpx)', width: '750rpx'}" :current="current" @change="swiperChange">
<swiper :style="{height: 'calc('+ windowHeight +'px - 60rpx)', width: '750rpx'}" :current="current" @change="swiperChange">
<swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex">
<scroll-view class="com" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher" @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
<scroll-view class="com" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="tabItem.isRefresher" @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
<view class="lf-m-t-20"></view>
<lf-waterfall :list="tabItem.list"></lf-waterfall>
<view class="loading-more lf-m-b-10">
<text class="loading-more-text" v-if="tabItem.list.length">正在加载</text>
<text :class="{'loading-more-text': tabItem.loadingClass}" v-if="tabItem.list.length">{{tabItem.loadingText}}</text>
<lf-nocontent v-else></lf-nocontent>
</view>
</scroll-view>
@ -22,108 +22,100 @@
export default {
data(){
return {
tab_list: [{
name: '推荐',
list: []
},{
name: '酒店',
list: []
},{
name: '景点',
list: []
},{
name: '国内游',
list: []
},{
name: '国际游',
list: []
},{
name: '跟团游',
list: []
}],
tab_list: [],
current: 0,
windowHeight: 0,
isRefresher: false, // scroll-view
list: [
{
price: 35,
title: '北国风光,千里冰封,万里雪飘',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23327_s.jpg',
},
{
price: 75,
title: '望长城内外,惟余莽莽',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23325_s.jpg',
},
{
price: 385,
title: '大河上下,顿失滔滔',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
},
{
price: 784,
title: '欲与天公试比高',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/zzpic23369_s.jpg',
},
{
price: 7891,
title: '须晴日,看红装素裹,分外妖娆',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2130_s.jpg',
},
{
price: 2341,
shop: '李白杜甫白居易旗舰店',
title: '江山如此多娇,引无数英雄竞折腰',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23346_s.jpg',
}
]
}
},
onLoad(){
this.windowHeight = getApp().globalData.windowHeight;
this.addRandomData();
this.getCategory()
},
methods: {
addRandomData() {
for(let i = 0; i < 10; i++) {
let index = this.$u.random(0, this.list.length - 1);
//
let item = JSON.parse(JSON.stringify(this.list[index]))
item.id = this.$u.guid();
this.tab_list[0].list.push(item);
}
getCategory(options = {}) {
this.$http(this.API.API_CATEGORYLIST).then(res => {
let res_list = res.data || [];
let tab_list = res_list.map(item => {
return {
id: item.id,
name: item.name,
list: [],
isRefresher: false,
loadingClass: true,
loadingText: '正在加载中',
page: 1,
isPage: true
}
});
if(options.type == 'pageRefresh'){
uni.stopPullDownRefresh();
}else if(options.type == 'scrollRefresh'){
this.tab_list[this.current].isRefresher = false;
}
this.tab_list = tab_list;
this.getData()
}).catch(err => {
})
},
getData() {
let tab_item = this.tab_list[this.current];
if(this.$shared.isValueType(tab_item) == 'undefined') return;
this.$http(this.API.API_ADVICELIST,{page: tab_item.page,category_id: tab_item.id}).then(res => {
let isPage = res.data.next_page_url == null?false:true;
tab_item.isPage = isPage;
if(!isPage){
tab_item.loadingClass = false;
tab_item.loadingText = '没有更多数据啦~';
}
console.log('page',tab_item.page)
if(tab_item.page == 1){
console.log('zhix1')
tab_item.list = res.data.data;
console.log('zhix1数据',tab_item.list)
}else{
console.log('zhix2')
tab_item.list.push(...res.data.data);
console.log('zhix2数据',tab_item.list)
}
}).catch(err => {
})
},
tabChange(current){
this.current = current;
tabChange(index){
this.current = index;
if(this.tab_list[index].list.length <= 0){
this.getData(); // tab
}
},
//
swiperChange(event){
this.current = event.detail.current;
// if(event.detail.source == '') return; //
// if(this.tab_list[event.detail.current].list.length <= 0){
// this.getGoodsList(); // tab
// }
if(event.detail.source == '') return; //
if(this.tab_list[event.detail.current].list.length <= 0){
this.getData(); // tab
}
},
//
onScrolltolower(){
return;
let tab_item = this.tab_list[this.current];
if(tab_item.isPage){
tab_item.page = tab_item.page + 1;
this.getGoodsList();
this.getData();
}
},
// scroll-view
onRefresherrefresh(){
this.isRefresher = true;
return;
this.getCategoryList({type: 'scrollRefresh'});
}
this.$u.throttle(() => {
this.tab_list[this.current].isRefresher = true;
this.getCategory({type: 'scrollRefresh'});
}, 200);
},
// page
onPullDownRefresh(){
//
this.getCategory({type: 'pageRefresh'});
},
}
}
</script>

Loading…
Cancel
Save