From 0a48616045ddce1562584543a0e89e5144051fde Mon Sep 17 00:00:00 2001 From: Codex Assistant <codex@example.com> Date: 星期日, 05 十月 2025 14:52:44 +0800 Subject: [PATCH] 报名审核 --- wx/pages/message/message.js | 52 ++++++++++++++++------------------------------------ 1 files changed, 16 insertions(+), 36 deletions(-) diff --git a/wx/pages/message/message.js b/wx/pages/message/message.js index 62900ba..e390706 100644 --- a/wx/pages/message/message.js +++ b/wx/pages/message/message.js @@ -21,8 +21,22 @@ // 鍔犺浇娑堟伅鍒楄〃 loadMessages() { - // 妫�鏌ョ敤鎴锋槸鍚﹀凡鐧诲綍 - const userInfo = app.globalData.userInfo + // 妫�鏌ョ敤鎴锋槸鍚﹀凡鐧诲綍锛屽鏋済lobalData涓病鏈夛紝灏濊瘯浠庢湰鍦板瓨鍌ㄦ仮澶� + let userInfo = app.globalData.userInfo + if (!userInfo || !userInfo.userId) { + console.log('globalData涓病鏈塽serInfo锛屽皾璇曚粠鏈湴瀛樺偍鎭㈠') + try { + const storedUserInfo = wx.getStorageSync('userInfo') + if (storedUserInfo && storedUserInfo.userId) { + console.log('浠庢湰鍦板瓨鍌ㄦ仮澶島serInfo鎴愬姛') + app.globalData.userInfo = storedUserInfo + userInfo = storedUserInfo + } + } catch (error) { + console.error('浠庢湰鍦板瓨鍌ㄦ仮澶島serInfo澶辫触:', error) + } + } + if (!userInfo || !userInfo.userId) { console.error('鐢ㄦ埛鏈櫥褰曟垨userId涓嶅瓨鍦�') wx.showToast({ @@ -73,38 +87,4 @@ }) }, - // 鏍煎紡鍖栨秷鎭椂闂� - formatMessageTime(timeStr) { - if (!timeStr) return '' - - try { - const date = new Date(timeStr) - const now = new Date() - const diff = now.getTime() - date.getTime() - - // 濡傛灉鏄粖澶� - if (diff < 24 * 60 * 60 * 1000) { - const hours = date.getHours().toString().padStart(2, '0') - const minutes = date.getMinutes().toString().padStart(2, '0') - return `${hours}:${minutes}` - } - - // 濡傛灉鏄槰澶� - if (diff < 48 * 60 * 60 * 1000) { - const hours = date.getHours().toString().padStart(2, '0') - const minutes = date.getMinutes().toString().padStart(2, '0') - return `鏄ㄥぉ ${hours}:${minutes}` - } - - // 鍏朵粬鏃ユ湡 - const month = (date.getMonth() + 1).toString().padStart(2, '0') - const day = date.getDate().toString().padStart(2, '0') - const hours = date.getHours().toString().padStart(2, '0') - const minutes = date.getMinutes().toString().padStart(2, '0') - return `${month}-${day} ${hours}:${minutes}` - } catch (error) { - console.error('鏃堕棿鏍煎紡鍖栧け璐�:', error) - return timeStr - } - } }) \ No newline at end of file -- Gitblit v1.8.0