wx.request({
url: that.data.couponData.requestUrl,
data: that.data.couponData.queryData,
header: {
'content-type': 'application/json'
},
success: function(res) {
var list = res.data.goodsList;
console.log(res.data);
for(var i in list) {
list[i].quanUsedNum = parseInt(list[i].quanTotalNum) - parseInt(list[i].quanRemainNum);
list[i].isImgRendered = false;
}
list[0].isImgRendered = list[1].isImgRendered = list[2].isImgRendered = list[3].isImgRendered = true;
that.setData({"couponData.totalPage":res.data.totalPage});
that.setData({"couponData.list":that.data.couponData.list.concat(list)});
that.setData({"couponData.loadmore":!that.data.couponData.loadmore});
that.setData({"couponData.queryData.pageNum":parseInt(that.data.couponData.queryData.pageNum) + 1});
if(that.data.couponData.queryData.pageNum > that.data.couponData.totalPage) {
that.setData({"couponData.isAction":false});
}
if(that.data.couponData.list.length < 1) {
that.setData({"couponData.nodata":true});
}
if(f) {
f();
}
}
});
wx.setClipboardData({
data: '【' + that.data.couponData.list[e.currentTarget.id].goodsTitle + '】复制这条信息,打开【手机淘宝】' + that.data.couponData.list[e.currentTarget.id].twoInOneKouling,
success: function(res) {
that.setData({"couponData.copyTip":true,"couponData.Kouling":that.data.couponData.list[e.currentTarget.id].twoInOneKouling})
}
});
<template name='navsearch'>
<view class='nav-search'>
<view class='nav-search__container space-between'>
<view class='nav-search__search' wx:if='{{isSearch}}'></view>
<input class='nav-search__input' placeholder='请输入关键词找券' name='queryStr' value="{{queryStr}}" bindfocus='toggleSearch' bindconfirm='doQuery' bindinput="syncQuery"/>
<view class='nav-search__delete' wx:if='{{!isSearch}}' bindtap='deleteAll'></view>
<view class='nav-search__btn center' wx:if='{{!isSearch}}' bindtap='doQuery'>搜索</view>
</view>
<view class='nav-filter' bindtap='toggleFilter'></view>
</view>
</template>
<!--在其他文件中使用模板-->
<import src="/template/template.wxml" />
<template is='navsearch' data="{{...couponData}}"></template>
var common = require('../../common/common.js');
...
common.f(); //调用
Page({
onShareAppMessage: function () {
return {
title: 'your title!',
path: '/xxxx/xxxx/xxxx', //分享之后回到这个页面
success: function(res) {
f(); //成功回调;
},
fail: function(res) {
f(); //失败回调;
}
}
}
})
//js文件
Page({
loadImg:function(e) {
//计算接下来加载哪几张
var index = Math.floor((e.detail.scrollTop - 8)/259.5);
var temp = this.data.couponData.list; //完整的列表
var min = Math.max(index * 2,0),max = Math.min(index * 2 + 8,temp.length);
for(var i = min; i < max; i ++) {
if(temp[i] && !temp[i].isImgRendered) {
temp[i].isImgRendered = true; //列表中的每一项有一个标记是否加载图片的的属性,默认false,随着页面滚动,一个个变成true。
}
}
this.setData({"couponData.list":temp});
temp = null;
},
})
//wxml文件中在scroll-view上绑定事件。
<scroll-view class="section" scroll-y="true" bindscroll='loadImg'></scroll-view>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有