// pages/station/index.js const api = require('../../api/index.js'); const util = require('../../utils/util.js') Page({ /** * 页面的初始数据 */ data: { baseInfo:"", }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.getlist() }, getlist(){ let data ={ page:1, rows:1000 } api.request(`/api/v1/stations/HDES/superStations/${wx.getStorageSync('station').id}`, 'get',data) .then((res) => { console.log(res); for (let index = 0; index < res.data.list.length; index++) { res.data.list[index].createAt = util.timestamp(res.data.list[index].createAt) } this.setData({ baseInfo:res.data }) }) .catch((err) => { console.error('请求失败:', err); // 在这里处理请求失败的情况 }); }, ondetails(id){ console.log(id.currentTarget.dataset.id); wx.navigateTo({ url: `/pages/powerstation/index?id=${id.currentTarget.dataset.id}&source=xq`, // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始 }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })