作者 lihongjuan

修改轮播图,下拉加载

... ... @@ -22,7 +22,7 @@ Page({
noMore:!1,
imgUrls: [],
indicatorDots: false,
autoplay: false,
autoplay: true,
interval: 2000,
duration: 1000,
currentSwiper: 0,
... ... @@ -46,6 +46,26 @@ Page({
}), this.policyType(), this.getBanner();
},
getUserInfo() {
let d = this, url = '/api/user/index';
app.post(url, {}).then((r) => {
console.log(r.noticeNum)
d.setData({ userInfo: r.userInfo, noticeNum: r.noticeNum })
if (r.noticeNum != 0) {
let num = r.noticeNum
num = num.toString()
wx.setTabBarBadge({
index: 4,
text: num
})
} else {
wx.hideTabBarRedDot({
index: 4,
})
}
})
},
//获取轮播图
getopbanner(){
let that=this;
... ... @@ -128,7 +148,7 @@ Page({
page: res.current_page,
lastPage: res.last_page,
ifData: !0,
noMore: res.last_page==res.per_page?!0:!1
noMore: res.last_page==res.current_page?!0:!1
})
!e.data.list.concat(res.data).length?e.setData({
ifData:!1
... ... @@ -154,7 +174,8 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getopbanner()
this.getopbanner();
this.getUserInfo()
},
/**
... ... @@ -180,6 +201,7 @@ Page({
page:1
})
t.getList(t.data.category_id,1)
t.getopbanner()
},
/**
... ... @@ -191,6 +213,7 @@ Page({
page:t.data.page+1
}),t.getList(t.data.category_id,t.data.page)) : wx.showToast({
title: '没有更多了',
icon:'none'
})
},
... ...
... ... @@ -6,7 +6,7 @@
<view class="swiper_image" wx:if="{{imgUrls.length!=0}}">
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange">
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange" data-current="{{index}}" circular="true">
<block wx:for="{{imgUrls}}" wx:key="doct">
<swiper-item style="border-radius:10px;" >
<image src="{{item.banner}}" data-index='{{index}}' class="slide-image" bindtap='viewImg' width="355" height="150" data-src="{{item.url}}" data-id="{{item.id}}" bindtap='bannerDetail'/>
... ...
... ... @@ -48,7 +48,7 @@ page {
}
.menu_item {
padding: 0 33rpx;
padding: 0 20rpx;
display: inline-block;
text-align: center;
}
... ...
... ... @@ -20,7 +20,12 @@ Page({
list: [],
ifData: !1,
noMore: !1,
top:''
top:'',
interval: 2000,
duration: 1000,
currentSwiper:0,
indicatorDots: false,
autoplay: true,
},
/**
... ... @@ -38,7 +43,12 @@ Page({
}
}), this.policyType(), this.getBanner();
},
swiperChange: function (e) {
this.setData({
currentSwiper: e.detail.current
})
},
//获取轮播图
getopbanner() {
let that=this
... ... @@ -97,19 +107,20 @@ Page({
}) : '', b.getList(e.currentTarget.id, 1)
},
getList(id, page) {
let e = this, url = '/api/Party/index', params = {
let t = this, url = '/api/Party/index', params = {
category_id: id,
page: page,
header: true
}, list = page == 1 ? [] : t.data.list; app.post(url, params).then((res) => {
e.setData({
console.log(res)
t.setData({
list: list.concat(res.data),
page: res.current_page,
lastPage: res.last_page,
ifData: !0,
noMore: res.last_page == res.per_page ? !0 : !1
noMore: res.last_page == res.current_page ? !0 : !1
})
!e.data.list.concat(res.data).length ? e.setData({
!t.data.list.concat(res.data).length ? t.setData({
ifData: !1
}) : ''
wx.stopPullDownRefresh();
... ... @@ -125,6 +136,26 @@ Page({
// + '&content=' + JSON.stringify(e.currentTarget.dataset.content)
})
},
getUserInfo() {
let d = this, url = '/api/user/index';
app.post(url, {}).then((r) => {
console.log(r.noticeNum)
d.setData({ userInfo: r.userInfo, noticeNum: r.noticeNum })
if (r.noticeNum != 0) {
let num = r.noticeNum
num = num.toString()
wx.setTabBarBadge({
index: 4,
text: num
})
} else {
wx.hideTabBarRedDot({
index: 4,
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成 v
*/
... ... @@ -136,7 +167,8 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getopbanner()
this.getopbanner();
this.getUserInfo()
},
/**
... ... @@ -162,6 +194,8 @@ Page({
page: 1
})
t.getList(t.data.category_id, 1)
t.getopbanner();
},
/**
... ... @@ -173,6 +207,7 @@ Page({
page: t.data.page + 1
}), t.getList(t.data.category_id, t.data.page)) : wx.showToast({
title: '没有更多了',
icon:'none'
})
},
... ...
... ... @@ -2,9 +2,9 @@
<view class='top_view'>
<view class="swiper_image" wx:if="{{imgUrls.length!=0}}">
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" >
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange" circular="true">
<block wx:for="{{imgUrls}}" wx:key="doct">
<swiper-item style="border-radius:10px;" >
<swiper-item style="border-radius:10px;">
<image src="{{item.image}}" data-index='{{index}}' class="slide-image" bindtap='viewImg' width="355" height="150" data-src="{{item.url}}" data-id="{{item.id}}" bindtap='bannerDetail' data-title="{{item.title}}" data-content="{{item.content}}"/>
</swiper-item>
</block>
... ... @@ -12,7 +12,7 @@
<view class="dots">
<block wx:for="{{imgUrls}}" wx:key="">
<view class="dot{{index == currentSwiper ? ' active' : ''}}"></view>
<view class="dot {{index == currentSwiper ? 'dotactive' : ''}}"></view>
</block>
</view>
... ...
... ... @@ -42,7 +42,7 @@ page{
}
.menu_item{
padding:0 33rpx;
padding:0 20rpx;
display: inline-block;
text-align: center;
}
... ... @@ -194,7 +194,7 @@ page{
/*选中以后的小圆点样式 */
.active {
.dotactive {
width: 16rpx;
height: 16rpx;
border-radius: 50%;
... ...
let A = getApp();
let A = getApp();
Page({
/**
... ... @@ -183,16 +183,39 @@ Page({
url: '',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
getUserInfo() {
let d = this, url = '/api/user/index';
A.post(url, {}).then((r) => {
console.log(r.noticeNum)
d.setData({ userInfo: r.userInfo, noticeNum: r.noticeNum })
if (r.noticeNum != 0) {
let num = r.noticeNum
num = num.toString()
wx.setTabBarBadge({
index: 4,
text: num
})
} else {
wx.hideTabBarRedDot({
index: 4,
})
}
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getUserInfo();
this.checkstatus();
this.setData({
zixunList: [],
... ... @@ -200,7 +223,8 @@ Page({
page: 1,
show:!0
})
this.data.currentTab=='0'?this.getzixun():this.postList()
this.data.currentTab=='0'?this.getzixun():this.postList();
},
/**
... ...
... ... @@ -20,7 +20,8 @@ Page({
navScrollLeft:0,
noMore:!0,
beautiful_switch:0,
selectindex:0
selectindex:0,
heigh:"200rpx"
},
changeShow(){
this.setData({
... ... @@ -168,7 +169,39 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.getUserInfo
let heigh = wx.getSystemInfoSync().windowHeight;
console.log('89898989',heigh)
if (heigh==555){
this.setData({
heigh:'204rpx'
})
} else if (heigh ==624){
this.setData({
heigh: '222rpx'
})
} else if (heigh == 594){
this.setData({
heigh: '245rpx'
})
}else if (heigh == 584){
this.setData({
heigh: '248rpx'
})
} else if(heigh ==609) {
this.setData({
heigh: '228rpx'
})
}else if (heigh == 514) {
this.setData({
heigh: '200rpx'
})
}else{
this.setData({
heigh: '200rpx'
})
}
},
/**
... ...
... ... @@ -48,7 +48,7 @@
<image class='label_img' hidden='{{!item.recommend_switch}}' src='/images/zuire@2x.png'></image>
<text class='label_info' hidden='{{!item.recommend_switch}}'>推荐</text>
<image src='{{item.logo_image}}' mode='aspectFill' class='top_logo'></image>
<image src='{{item.logo_image}}' mode='aspectFill' class='top_logo' style="height:{{heigh}}"></image>
... ...
... ... @@ -31,7 +31,7 @@ page {
color: #999;
display: inline-block;
position: relative;
padding: 0 12rpx;
padding: 0 14rpx;
height: 100%;
text-align: center;
}
... ...