qingcheng-xiaochengxu/pages/projectModule/userProject/userProject.js

115 lines
2.1 KiB
JavaScript
Raw Permalink Normal View History

2025-06-03 13:29:15 +00:00
import { baseUrl } from "../../../request"
2025-05-17 15:17:14 +00:00
// pages/projectModule/userProject/userProject.js
Page({
/**
* 页面的初始数据
*/
2025-05-30 00:06:55 +00:00
2025-05-17 15:17:14 +00:00
data: {
2025-06-03 13:29:15 +00:00
userProjectList: [],
2025-05-17 15:17:14 +00:00
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
2025-06-03 13:29:15 +00:00
this.getProgram();
},
// 结算记录
gotoSubSettlement(e) {
2025-05-17 15:17:14 +00:00
2025-06-03 13:29:15 +00:00
const projectId = e.currentTarget.dataset.id;
2025-06-05 14:27:57 +00:00
const url = e.currentTarget.dataset.url;
const name = e.currentTarget.dataset.name;
2025-06-03 13:29:15 +00:00
wx.navigateTo({
2025-06-05 14:27:57 +00:00
url: `/pages/projectModule/settlement/settlement?id=${projectId}&picurl=${url}&name=${name}`,
2025-06-03 13:29:15 +00:00
})
2025-05-17 15:17:14 +00:00
},
2025-06-03 13:29:15 +00:00
// 获取项目列表
getProgram() {
wx.request({
2025-06-03 23:34:05 +00:00
url: baseUrl + '/project/get/running',
2025-06-03 13:29:15 +00:00
method: 'POST',
header: {
Authorization: wx.getStorageSync('token')
},
success: res => {
2025-06-05 14:27:57 +00:00
console.log('项目列表---->',res.data);
2025-06-03 13:29:15 +00:00
if(res.data.code === 1) {
this.setData({
userProjectList: res.data.data
})
}
}
})
},
// 跳转项目明细
gotoProjectDetail(e){
// 获取data-id中的值
const projectId = e.currentTarget.dataset.id;
2025-05-21 12:24:34 +00:00
wx.navigateTo({
2025-06-03 23:34:05 +00:00
url: `/pages/projectModule/projectDetail/projectDetail?id=${projectId}&isPromo=0`,
2025-05-21 12:24:34 +00:00
})
},
2025-06-03 23:34:05 +00:00
// 子元素点击事件,阻止冒泡
stopEventPropagation(e) {
const projectId = e.currentTarget.dataset.id;
wx.navigateTo({
url: `/pages/projectModule/projectDetail/projectDetail?id=${projectId}&isPromo=1`,
})
},
2025-05-17 15:17:14 +00:00
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})