市北人才赋能平台 --小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
2.0 KiB

4 years ago
// pages/service/service.js
4 years ago
import { ServiceModel } from '../../models/service.js'
let serviceModel = new ServiceModel()
4 years ago
Page({
/**
* 页面的初始数据
*/
data: {
4 years ago
list:[],
page:1,
next:true
4 years ago
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
4 years ago
serviceModel.myService(this.data.page,res=>{
if(res.result.length > 0){
this.setData({
list:res.result
})
}else{
this.setData({
next:false
})
}
})
4 years ago
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
4 years ago
if(this.data.next){
var nextPage = this.data.page + 1
serviceModel.myService(nextPage,res=>{
if(res.result.length > 0){
this.setData({
list:this.data.list.concat(res.result),
page:nextPage
})
}else{
this.setData({
next:false
})
}
})
}
4 years ago
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
4 years ago
},
detail:function(e){
// console.log(e)
// return
wx.navigateTo({
url: '/pages/service/myService/myService?id=' + e.currentTarget.dataset.id
})
4 years ago
}
})