debug: 添加更详细的调试日志排查数据传递问题
This commit is contained in:
1 parent
bad21f1a58
commit
fb41aabca8
2 files changed
+32
-26
No files matched your search
@@ -202,28 +202,32 @@ export default {
|
||||
dateType: this.dateType
|
||||
})
|
||||
|
||||
console.log('API返回结果:', JSON.stringify(result))
|
||||
console.log('=== 测算页面 - API返回结果 ===')
|
||||
console.log('原始result:', result)
|
||||
console.log('result类型:', typeof result)
|
||||
console.log('result.data:', result.data)
|
||||
console.log('result.success:', result.success)
|
||||
console.log('result.data:', result.data)
|
||||
|
||||
let resultData = null
|
||||
if (result && result.success && result.data) {
|
||||
resultData = result.data
|
||||
} else if (result && result.data) {
|
||||
if (result && result.data) {
|
||||
resultData = result.data
|
||||
console.log('使用result.data:', resultData)
|
||||
} else {
|
||||
resultData = result
|
||||
console.log('使用result:', resultData)
|
||||
}
|
||||
|
||||
console.log('解析后的数据:', JSON.stringify(resultData))
|
||||
console.log('最终resultData:', resultData)
|
||||
console.log('resultData.name:', resultData.name)
|
||||
console.log('resultData.baZi:', resultData.baZi)
|
||||
|
||||
console.log('保存到globalData之前')
|
||||
getApp().globalData.baziResult = resultData
|
||||
console.log('保存到globalData之后')
|
||||
console.log('getApp().globalData.baziResult:', getApp().globalData.baziResult)
|
||||
|
||||
console.log('准备跳转到结果页面')
|
||||
uni.hideLoading()
|
||||
|
||||
uni.navigateTo({
|
||||
url: '/pages/bazi/result'
|
||||
})
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="debug-card" style="background: #ffeb3b; padding: 20rpx; margin-bottom: 20rpx; border-radius: 10rpx;">
|
||||
<text style="color: #333; font-size: 24rpx;">调试信息:</text>
|
||||
<text style="color: #333; font-size: 22rpx; display: block;">result.name: {{ result.name }}</text>
|
||||
<text style="color: #333; font-size: 22rpx; display: block;">result.baZi: {{ result.baZi }}</text>
|
||||
<text style="color: #333; font-size: 22rpx; display: block;">result.lunar: {{ result.lunar }}</text>
|
||||
<text style="color: #333; font-size: 22rpx; display: block;">result.shengXiao: {{ result.shengXiao }}</text>
|
||||
</view>
|
||||
|
||||
<view class="header-card">
|
||||
<view class="header-row">
|
||||
<view class="header-icon">
|
||||
@@ -218,21 +210,31 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
const app = getApp()
|
||||
console.log('===== 结果页面 onLoad =====')
|
||||
console.log('app:', app)
|
||||
const app = getApp()
|
||||
console.log('app对象:', app)
|
||||
console.log('app.globalData:', app.globalData)
|
||||
|
||||
if (app.globalData && app.globalData.baziResult) {
|
||||
this.result = app.globalData.baziResult
|
||||
console.log('结果数据已加载')
|
||||
console.log('this.result:', this.result)
|
||||
console.log('this.result.name:', this.result.name)
|
||||
console.log('this.result.baZi:', this.result.baZi)
|
||||
console.log('this.result.lunar:', this.result.lunar)
|
||||
console.log('this.result.shengXiao:', this.result.shengXiao)
|
||||
if (app.globalData) {
|
||||
console.log('app.globalData.baziResult:', app.globalData.baziResult)
|
||||
|
||||
if (app.globalData.baziResult) {
|
||||
this.result = app.globalData.baziResult
|
||||
console.log('结果数据已加载')
|
||||
console.log('this.result:', this.result)
|
||||
console.log('this.result.name:', this.result.name)
|
||||
console.log('this.result.baZi:', this.result.baZi)
|
||||
console.log('this.result.lunar:', this.result.lunar)
|
||||
console.log('this.result.shengXiao:', this.result.shengXiao)
|
||||
} else {
|
||||
console.log('app.globalData.baziResult 是 undefined 或 null')
|
||||
uni.showToast({
|
||||
title: '未获取到排盘数据',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.log('未获取到排盘数据')
|
||||
console.log('app.globalData 是 undefined')
|
||||
uni.showToast({
|
||||
title: '未获取到排盘数据',
|
||||
icon: 'none'
|
||||
|
||||
Reference in new issue
Block a user