diff --git a/pages/institutionalStructure/mixins/donation-mixin.js b/pages/institutionalStructure/mixins/donation-mixin.js index 8e2c982..44aedc6 100644 --- a/pages/institutionalStructure/mixins/donation-mixin.js +++ b/pages/institutionalStructure/mixins/donation-mixin.js @@ -45,33 +45,11 @@ export const donationMixin = { try { const response = await getInstitutionalDetail(this.formedId) console.log('项目详情API响应:', response) - if (response.code === 200) { - // 根据实际后端数据结构获取项目信息 - console.log('项目详情数据结构:', { - hasData: !!response.data, - hasRows: !!response.rows, - dataType: typeof response.data, - rowsType: typeof response.rows - }) - if (response.data) { this.projectInfo = response.data console.log('使用 response.data 作为项目信息') - } else if (response.rows) { - this.projectInfo = response.rows - console.log('使用 response.rows 作为项目信息') - } else { - this.projectInfo = {} - console.log('未找到项目信息,使用空对象') } - console.log('项目信息:', this.projectInfo) - } else { - console.error('获取项目信息失败:', response.msg) - uni.showToast({ - title: response.msg || '获取项目信息失败', - icon: 'none' - }) } } catch (error) { console.error('获取项目信息失败:', error) @@ -81,7 +59,6 @@ export const donationMixin = { }) } }, - /** * 获取捐款记录 * @param {string} keyword 搜索关键词 @@ -111,37 +88,7 @@ export const donationMixin = { if (response.code === 200) { // 根据实际后端数据结构获取数据数组 - let dataArray = [] - - console.log('解析数据结构:', { - hasData: !!response.data, - hasDataList: !!(response.data && response.data.list), - hasDataListRows: !!(response.data && response.data.list && response.data.list.rows), - dataIsArray: Array.isArray(response.data), - hasRows: !!response.rows, - rowsIsArray: Array.isArray(response.rows) - }) - - if (response.data && response.data.list && response.data.list.rows) { - // 标准结构:response.data.list.rows - dataArray = response.data.list.rows - console.log('使用标准结构: response.data.list.rows') - } else if (response.data && Array.isArray(response.data)) { - // 备用结构:response.data 直接是数组 - dataArray = response.data - console.log('使用备用结构: response.data') - } else if (response.rows && Array.isArray(response.rows)) { - // 备用结构:response.rows 是数组 - dataArray = response.rows - console.log('使用备用结构: response.rows') - } else { - console.error('无法找到数据数组,API响应结构:', response) - uni.showToast({ - title: '数据格式错误', - icon: 'none' - }) - return - } + let dataArray = response.data.list.rows // 转换数据格式 const newData = dataArray.map(item => ({ @@ -184,7 +131,6 @@ export const donationMixin = { * @param {string} val 搜索关键词 */ onSearch(val) { - console.log('搜索内容:', val) this.pageNum = 1 // 重置页码 this.loadDonationRecords(val) },