cosmetology_list.js
2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
var e = getApp(),
a = e.globalData.setting,
os = a,
t = e.request;
Page({
/**
* 页面的初始数据
*/
data: {
iurl: a.imghost,
cosmetology_list: [], //美容师列表
is_cosmetology_read: 0,//是否有读过美容师接口,该属性用在没有美容师列表的排版
curpage: 1, //当前分页数
pageSize: 10, //页大小
total: 0,//总数量
ismore: 0, //是否加载完毕
},
onReachBottom: function () {
var th = this;
if (this.data.total <= th.data.pageSize) return;
if (this.data.ismore) return;
wx.showLoading({
title: '加载中...',
})
th.query_cology();
},
query_cology: function() {
var th = this;
var url = "http://localhost:8022/api/weshop/yy_fuwu_meirongshi";
wx.request({
url: url,
success: function(res) {
if (res.data.code == 0) {
th.setData({
cosmetology_list: res.data.data.pageData
})
}
}
})
// var th = this;
// var url = "http://localhost:8022/api/weshop/yy_fuwu_meirongshi";
// getApp().request.promiseGet(url, {
// data: {
// storeId: a.stoid,
// userId: d.user_id,
// page: th.data.curpage,
// pageSize: th.data.pageSize
// }
// }).then(res => {
// if (res.data.code == 0) {
// wx.hideLoading();
// th.data.curpage++;
// var arr1 = th.data.cosmetology_list;
// var arr2 = res.data.data.pageData;
// var arr3 = [...arr1, ...arr2];
// var ismore = 0;
// if (arr3.length == res.data.data.total) ismore = 1
// th.setData({
// cosmetology_list: arr3,
// total: res.data.data.total,
// ismore: ismore,
// is_service_read: 1,
// }), wx.stopPullDownRefresh(); //停止下拉刷新
// }
// })
},
//图片失败,默认图片
bind_bnerr1: function (e) {
var _errImg = e.target.dataset.errorimg;
var _Img = e.target.dataset.img;
if (_Img != undefined) {
var _errObj = {};
_errObj[_errImg] = "/miniapp/images/no_cate_def.png";
this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
// var th = this;
// var label = "技术好|长得帅|很可爱";
// var split = label.split("|");//标签通过分割符
// for (var i = 0; i < split.length; i++) {
// console.log("成功啦啦啦啦"+split[i]+i);
// }
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
var th = this;
th.query_cology();
},
})