银花优选微信小程序修改后的最新版本代码
This commit is contained in:
121
pages/mybonus/index.js
Normal file
121
pages/mybonus/index.js
Normal file
@@ -0,0 +1,121 @@
|
||||
|
||||
var app = getApp()
|
||||
var that=null
|
||||
var sopenFrame=null
|
||||
Page( {
|
||||
data: {
|
||||
bonusImg: '../../images/iconfont-dingdan.png',
|
||||
tipWords: '亲,暂时没有数据哦!',
|
||||
bonusHidden:false,
|
||||
nobonusHidden:true,
|
||||
loadingHidden:false,
|
||||
mybonus:[],
|
||||
Start: 0,
|
||||
nav:0,
|
||||
title:""
|
||||
},
|
||||
|
||||
onLoad: function(options) {
|
||||
that = this;
|
||||
var t=options.t;
|
||||
that.setData({
|
||||
nav: t
|
||||
})
|
||||
that.clearCache();//清本页缓存
|
||||
that.getlist(0)
|
||||
}, // 下拉刷新
|
||||
onPullDownRefresh: function () {
|
||||
//在当前页面显示导航条加载动画
|
||||
wx.showNavigationBarLoading();
|
||||
//显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
|
||||
wx.showLoading({
|
||||
title: '刷新中...',
|
||||
})
|
||||
that.clearCache();
|
||||
that.getlist(1);//第一次加载数据
|
||||
},
|
||||
|
||||
// 页面上拉触底事件(上拉加载更多)
|
||||
onReachBottom: function () {
|
||||
that.setData({
|
||||
loadingHidden:false
|
||||
});
|
||||
that.getlist(2);//后台获取新数据并追加渲染
|
||||
},
|
||||
|
||||
// 清缓存
|
||||
clearCache:function(){
|
||||
that.setData({
|
||||
bonusHidden:false,
|
||||
nobonusHidden:true,
|
||||
loadingHidden:false,
|
||||
Start: 0,
|
||||
mybonus:[]
|
||||
});
|
||||
},getlist: function(gp) {
|
||||
var userId = wx.getStorageSync("userId")
|
||||
var LoginId = wx.getStorageSync("LoginId")
|
||||
wx.request({
|
||||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||||
data: {
|
||||
action:"getjianjinlist",
|
||||
t:that.data.nav,
|
||||
Start:that.data.Start,
|
||||
userId:(userId==null?"":userId),
|
||||
LoginId:(LoginId==null?"":LoginId)
|
||||
},
|
||||
method:"GET",
|
||||
dataType:"json",
|
||||
header: {
|
||||
"content-type": "application/json" // 默认值
|
||||
},
|
||||
success (res) {
|
||||
if(res.data.status==1){
|
||||
var tmpArr = null;
|
||||
tmpArr = that.data.mybonus;
|
||||
tmpArr.push.apply(tmpArr,res.data.data);
|
||||
that.setData({
|
||||
mybonus: tmpArr,
|
||||
Start: that.data.Start+res.data.data.length,
|
||||
loadingHidden:true
|
||||
})
|
||||
if(gp==0||gp==1){
|
||||
var title=res.data.categorys[(that.data.nav-1)].title;
|
||||
|
||||
that.setData({
|
||||
title:title
|
||||
})
|
||||
wx.setNavigationBarTitle({
|
||||
title: title
|
||||
})
|
||||
if(res.data.data.length>0){
|
||||
that.setData({
|
||||
bonusHidden:false,
|
||||
nobonusHidden:true
|
||||
|
||||
})
|
||||
}else{
|
||||
that.setData({
|
||||
bonusHidden:true,
|
||||
nobonusHidden:false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
if(gp==1){
|
||||
//隐藏loading 提示框
|
||||
wx.hideLoading();
|
||||
//隐藏导航条加载动画
|
||||
wx.hideNavigationBarLoading();
|
||||
//停止下拉刷新
|
||||
wx.stopPullDownRefresh();
|
||||
}
|
||||
}
|
||||
})
|
||||
},onbonus:function(e) {
|
||||
var data = e.currentTarget.dataset.id
|
||||
wx.navigateTo({
|
||||
url: "../mybonus0/index?" + data
|
||||
})
|
||||
}
|
||||
})
|
||||
3
pages/mybonus/index.json
Normal file
3
pages/mybonus/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
26
pages/mybonus/index.wxml
Normal file
26
pages/mybonus/index.wxml
Normal file
@@ -0,0 +1,26 @@
|
||||
<view class="container">
|
||||
<view class="mybonus-box" hidden="{{bonusHidden}}">
|
||||
<view class="mybonus-item mybonus-title">
|
||||
<text class="time">日期</text>
|
||||
<text class="je">{{title}}</text>
|
||||
<view></view>
|
||||
</view>
|
||||
<block wx:for="{{mybonus}}" wx:for-index="index">
|
||||
<view class="mybonus-item" bindtap="onbonus" data-id="t={{nav}}&addtime={{item.addtime}}">
|
||||
<text class="time">{{item.addtime}}</text>
|
||||
<text class="je">{{(nav==1?item.b1:(nav==2?item.b2:(nav==3?item.b3:(nav==4?item.b4:(nav==5?item.b5:(nav==6?item.b6:item.b7))))))}}</text>
|
||||
<view><image src="../../images/faifeito.png"></image></view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</view>
|
||||
<view class="nodata-box" hidden="{{nobonusHidden}}">
|
||||
<image src="{{bonusImg}}" class="bonus-image"/>
|
||||
<view>{{tipWords}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<loading hidden="{{loadingHidden}}">
|
||||
加载中...
|
||||
</loading>
|
||||
23
pages/mybonus/index.wxss
Normal file
23
pages/mybonus/index.wxss
Normal file
@@ -0,0 +1,23 @@
|
||||
page{
|
||||
background: #ccc;
|
||||
}
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.container .bonus-image {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
.nodata-box{display: flex;flex-direction: column;align-items: center;justify-content: center;}
|
||||
.mybonus-box{width:100%; overflow:hidden;padding:0.8em; box-sizing: border-box;}
|
||||
.mybonus-item{width:100%;display: flex;flex-direction: row; box-sizing: border-box; padding:0; margin-bottom:0.8em; background-color:#fff; border-radius:0.5em; box-sizing:border-box;overflow:hidden;}
|
||||
.mybonus-item.mybonus-title{background: linear-gradient(to bottom,#f2f2f2,#dbd8d8);}
|
||||
.mybonus-item text{display: flex; padding:0 0.5em; height:3em; line-height: 3em; box-sizing: border-box; overflow: hidden; color: #939393;/*border: 1px solid #f1f1f1;border-left:0; border-top:0;*/ text-align: center;align-items: center;justify-content: center;}
|
||||
.mybonus-item text.time{width:10em}
|
||||
.mybonus-item text.je{flex-grow: 1; border-right:0;}
|
||||
.mybonus-item view{width:1.2em;}
|
||||
.mybonus-item view image{margin-top:0.8em; width:1.2em; height:1.2em; }
|
||||
Reference in New Issue
Block a user