66 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-02-21 17:43:11 +08:00
let app = getApp()
Page({
data: {
currentTab: 0,
IMG_NAME: app.IMG_NAME
},
onLoad(e) {
let that = this
let img = []
app.AjaxRequest('get', {
'content-type': 'application/json',
'Authorization': 'Bearer ' + app.Getopenid()
}, '/suggestion/list?id=' + e.id, {}, function (res) {
if (res.code == 0) {
res.data[0].images.forEach(item => {
img.push(app.IMG_NAME + item.name)
})
console.log(img)
that.setData({
repairList: res.data[0],
imgUrl: img
})
}
})
},
//滑动切换
swiperTab(e) {
var that = this
that.setData({
currentTab: e.detail.current
})
},
//点击切换
clickTab(e) {
var that = this
if (this.data.currentTab === e.target.dataset.current) {
return false
} else {
that.setData({
currentTab: e.target.dataset.current
})
}
},
previewImg(e) {
//获取当前图片的下标
var index = e.currentTarget.dataset.index
//所有图片
var imgs = this.data.imgUrl
wx.previewImage({
//当前显示图片
current: imgs[index],
//所有图片
urls: imgs
})
},
repairapply(e) {
wx.navigateTo({
url: '../evaluate/evaluate?id=' + e.currentTarget.dataset.id,
})
}
})