syshxcx/pages/serve/serve.js
dong_bo0602 a1f9e23f6d 0607
2022-06-07 15:43:05 +08:00

163 lines
3.2 KiB
JavaScript

// pages/serve/serve.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
token: app.globalData.token,
showSettleType: false,
sourceUrl: app.baseUrls.sourceUrl,
settleType: '',
orgList: [],
page: {
page: 1,
rows:3,
// showArea: '6dcbb862-4b48-4dca-aee1-d78fd76adc05',
newsTypeId: 'b163953b-ed22-4041-a79f-73d5deedd025',
},
serveOrgList: [],
indicatorDots: true,
vertical: false,
autoplay: true,
interval: 3000,
duration: 500,
serviceUrl: app.baseUrls.serviceUrl,
baseImgUrl: app.baseUrls.baseImgUrl,
},
// 社会机构入驻
orgSettle: function (e) {
var type = e.currentTarget.dataset.type
wx.navigateTo({
url: './settle?type=' + type,
})
// this.setData({
// showSettleType: true,
// settleType: type
// })
},
// 关闭机构入驻
closeSettleType: function () {
this.setData({
showSettleType: false
})
},
// 前往入驻详情
doSettle: function (e) {
var type = e.currentTarget.dataset.type
var name = e.currentTarget.dataset.name
this.setData({
showSettleType: false
})
wx.navigateTo({
url: './settle?id=' + type + '&name=' + name,
})
},
// 更多机构
checkMoreOrg: function () {
wx.navigateTo({
url: './orgList',
})
},
// 获取社会服务机构列表
getServeOrg: function () {
var self = this
app.restAjax.get(app.restAjax.path(app.apis.getOrgList, [app.baseUrls.requestUrl]), self.data.page, {
headers: {
token: self.data.token
}
}, function (code, data) {
console.log(data)
self.setData({
serveOrgList: data.rows
})
}, function (code, data) {
console.log(data)
})
},
// 获取服务公告
getNotice: function () {
var self = this
app.restAjax.get(app.restAjax.path(app.apis.getNewsList, [app.baseUrls.requestUrl]), self.data.page, {
headers: {
token: self.data.token
}
}, function (code, data) {
self.setData({
noticeList: data.rows
})
}, function (code, data) {
console.log(data)
})
},
// 查看服务公告详情
checkNewsDetail: function (e) {
var id = e.currentTarget.dataset.id
wx.navigateTo({
url: '../news/newsDetail?newsId=' + id,
})
},
// 查看更多服务公告
checkMoreNews: function () {
wx.navigateTo({
url: './newsList',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getNotice()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getServeOrg()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})