78 lines
1.8 KiB
JavaScript
Raw Normal View History

2024-02-21 17:43:11 +08:00
let app = getApp()
Page({
2024-02-23 09:56:56 +08:00
data: {
currentTab: 0
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
onLoad(options) {
// 页面初始化 options为页面跳转所带来的参数
wx.setNavigationBarTitle({
title: options.name
})
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
onShow() {
this.getList()
},
getList(status) {
let that = this
let url = ''
if (that.data.currentTab == 0) {
url = '/suggestion/list'
} else if (that.data.currentTab == 1) {
url = '/suggestion/list?status=1'
} else if (that.data.currentTab == 2) {
url = '/suggestion/list?status=2'
} else if (that.data.currentTab == 3) {
url = '/suggestion/list?status=3'
}
app.AjaxRequest('GET', {
'content-type': 'application/json',
'Authorization': 'Bearer ' + app.Getopenid()
}, url, {}, function (res) {
if (res.code == 0) {
that.setData({
list: res.data
})
}
2024-02-21 17:43:11 +08:00
})
2024-02-23 09:56:56 +08:00
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
//滑动切换
swiperTab(e) {
var that = this
that.setData({
currentTab: e.detail.current
})
that.getList()
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
//点击切换
clickTab(e) {
var that = this
if (this.data.currentTab === e.target.dataset.current) {
return false
} else {
that.setData({
currentTab: e.target.dataset.current
})
}
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
scrollToLower() {
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
create() {
wx.navigateTo({
url: '/pages/complaint/newComplaint/newComplaint',
})
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
repairDetail(e) {
wx.navigateTo({
url: '/pages/complaint/complaintDetail/complaintDetail?id=' + e.currentTarget.dataset.id,
})
}
2024-02-21 17:43:11 +08:00
})