36 lines
647 B
JavaScript
36 lines
647 B
JavaScript
const { api } = require("../../utils/api")
|
|
|
|
// index.js
|
|
Page({
|
|
data: {
|
|
list:[]
|
|
},
|
|
onLoad(options) {
|
|
|
|
},
|
|
onShow(){
|
|
this.fetchList()
|
|
},
|
|
goInfo(e){
|
|
const id = e.currentTarget.dataset.id
|
|
wx.navigateTo({
|
|
url: '../index/info?id=' + id,
|
|
})
|
|
},
|
|
fetchList(){
|
|
const user = wx.getStorageSync('user')
|
|
const data = {userId: user.id,current:1,pageSize:20}
|
|
api('/plant/getList','POST',data,'json').then(res => {
|
|
if (res.code === 200){
|
|
const tmps = res.data.list
|
|
this.setData({list:tmps})
|
|
}
|
|
})
|
|
},
|
|
goAdd(){
|
|
wx.navigateTo({
|
|
url: '../add/index',
|
|
})
|
|
}
|
|
})
|