// pages/channel/index/index.js // 引入 QCloud 小程序增强 SDK Date.prototype.format = function(format){ var o = { "M+" : this.getMonth()+1, //month "d+" : this.getDate(), //day "h+" : this.getHours(), //hour "m+" : this.getMinutes(), //minute "s+" : this.getSeconds(), //second "q+" : Math.floor((this.getMonth()+3)/3), //quarter "S" : this.getMilliseconds() //millisecond } if(/(y+)/.test(format)) { format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); } for(var k in o) { if(new RegExp("("+ k +")").test(format)) { format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length)); } } return format; } var qcloud = require('../../../vendor/qcloud-weapp-client-sdk/index'); // 引入配置 var config = require('../../../config'); // 显示繁忙提示 var showBusy = text => wx.showToast({ title: text, icon: 'loading', duration: 10000 }); // 显示成功提示 var showSuccess = text => { wx.hideToast(); wx.showToast({ title: text, icon: 'success' }); }; // 显示失败提示 var showModel = (title, content) => { wx.hideToast(); wx.showModal({ title, content: JSON.stringify(content), showCancel: false }); }; var showMsg = (title, content) => { wx.hideToast(); wx.showModal({ title, content: content, showCancel: false }); }; var busy=false; //获取应用实例 var app = getApp() Page({ data:{ userInfo: {}, loading:false, loading_more:false, loading_show:false, users_count:0, next_data:true, busy:false, posts:[] }, post_list:function(){ var self = this; if(self.data.busy){ return; } self.setData({ loading:true, posts:[], busy:true }); var url=config.service.apiUrl+'timeline'; qcloud.request({ // 要请求的地址 url: url, success(result) { if(result.data.success==true){ for (var i=0;i