Initial commit

This commit is contained in:
admin
2025-12-09 14:31:16 +08:00
parent c34b63b8da
commit b8648c2861
82 changed files with 1896 additions and 46 deletions

View File

@@ -12,7 +12,11 @@ Page({
canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName'), // 如需尝试获取用户信息可改为false
selectedCategory: 'all',
showcases: [],
categoryStats: {}
categoryStats: {},
unreadCount: 0
},
onShow() {
this.fetchUnreadCount();
},
onLoad() {
if (wx.getUserProfile) {
@@ -30,6 +34,26 @@ Page({
this.setData({ selectedCategory: type });
this.fetchData(type);
},
fetchUnreadCount() {
// Only fetch if logged in
const app = getApp()
if (!app.globalData.token) return;
console.log('Fetching unread count...');
const { request } = require('../../utils/request')
request({ url: '/notifications/unread_count/' })
.then(res => {
if (res && typeof res.count === 'number') {
this.setData({ unreadCount: res.count })
}
})
.catch(err => console.error('Fetch unread count error:', err))
},
handleNotificationClick() {
wx.navigateTo({
url: '/pages/message/index'
})
},
fetchBanners() {
const { request } = require('../../utils/request')
request({ url: '/banners/?is_active=true' })