| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- const app = getApp();
- let self;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- list: [],
- page: 1,
- no_more: false,
- password: '',
- modalName: '',
- nowId: 0,
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- self = this;
- self.getList();
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- self.setData({list:[],page:1,no_more:false});
- self.getList();
- wx.stopPullDownRefresh();
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- self.getList();
- },
- toIndex() {
- wx.navigateTo({
- url: "/pages/teahouse/home/home"
- });
- },
- //列表
- getList() {
- var self = this;
- if (self.data.no_more) {
- return false;
- }
- app.post('teahouse/user/getBookList',{
- page:self.data.page,
- },function(res){
- if (res.length < 10) {
- self.setData({no_more:true});
- }
- let list = self.data.list;
- list = list.concat(res);
- let page = self.data.page;
- page++;
- self.setData({list:list,page:page});
- });
- },
- //密码
- showPassword(e) {
- wx.showLoading();
- app.post('teahouse/user/showPassword',{id:e.currentTarget.dataset.id},function(res){
- wx.hideLoading();
- self.setData({modalName:'DialogModal',password:res.password,nowId:e.currentTarget.dataset.id});
- });
- },
- hideModal() {
- self.setData({modalName:''});
- },
- refreshPassword(e) {
- wx.showLoading();
- app.post('teahouse/user/refreshPassword',{id:self.data.nowId},function(res){
- wx.hideLoading();
- self.setData({password:res.password});
- });
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- return {
- title: "晋爱人才",
- path: "/pages/home/home/home",
- };
- }
- })
|