feat: login rest

This commit is contained in:
Blizzard
2026-02-12 09:26:39 +08:00
parent e97fd30fa3
commit 5553e2711a
115 changed files with 4090 additions and 3499 deletions
+10 -2
View File
@@ -12,7 +12,8 @@ Page({
isLoading: false,
current: 1,
pageSize: 10,
hasMore: true
hasMore: true,
userInfo: null
},
onLoad() {
@@ -23,6 +24,13 @@ Page({
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({ selected: 2 });
}
// Update user info for header
const app = getApp();
const info = app.globalData.userInfo || wx.getStorageSync('userInfo');
if (info) {
this.setData({ userInfo: info });
}
},
// Called by create post page
@@ -67,7 +75,7 @@ Page({
return {
id: item.id,
user: publisher.nickName || publisher.name || '花友',
avatar: avatarObj.url || '/assets/default_avatar.png',
avatar: avatarObj.url,
content: item.content,
images: (item.imgList || []).map(img => img.url),
time: item.createdAtStr || '刚刚',
+3 -5
View File
@@ -3,10 +3,8 @@
<!-- Header with User Info -->
<view class="community-header">
<view class="user-info">
<view class="user-avatar">
<text>我</text>
</view>
<text class="user-name">我的花园</text>
<image class="header-avatar" src="{{userInfo.avatar && userInfo.avatar.url ? userInfo.avatar.url : userInfo.avatar}}" mode="aspectFill" />
<text class="user-name">{{userInfo.nickname || userInfo.name || '花友'}}</text>
</view>
</view>
@@ -31,7 +29,7 @@
<text class="post-text">{{item.content}}</text>
<!-- Image Grid -->
<view wx:if="{{item.images.length > 0}}" class="post-images-grid grid-{{item.images.length === 1 ? '1' : (item.images.length <= 4 ? '2' : '3')}}">
<view wx:if="{{item.images && item.images.length > 0}}" class="post-images-grid grid-{{item.images.length === 1 ? '1' : (item.images.length === 2 || item.images.length === 4 ? '2' : '3')}}">
<view wx:for="{{item.images}}" wx:for-item="img" wx:key="*this" class="post-image-item" catchtap="previewImage" data-url="{{img}}" data-urls="{{item.images}}">
<image
src="{{img}}"
+14 -15
View File
@@ -29,17 +29,12 @@ page {
gap: 20rpx;
}
.community-header .user-avatar {
.community-header .header-avatar {
width: 80rpx;
height: 80rpx;
background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
color: #558B2F;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 32rpx;
background: #f5f5f5;
object-fit: cover;
}
.community-header .user-name {
@@ -135,31 +130,35 @@ page {
/* Single Image */
.grid-1 {
display: flex;
width: 70%;
width: auto;
max-width: 70%;
}
.grid-1 .post-image-item {
width: 100%;
border-radius: 16rpx;
aspect-ratio: 16 / 9;
border-radius: 8rpx;
overflow: hidden;
}
.grid-1 .post-image-item t-image {
border-radius: 16rpx;
.grid-1 .post-image-item image {
border-radius: 8rpx;
}
/* 2-4 Images (2 columns) */
/* 2 or 4 Images (2 columns) */
.grid-2 {
grid-template-columns: repeat(2, 1fr);
width: 75%;
width: 500rpx; /* Constrain width for 2 columns to look like partial grid */
}
.grid-2 .post-image-item {
aspect-ratio: 1;
}
/* 5+ Images (3 columns) */
/* 3, 5+ Images (3 columns) */
.grid-3 {
grid-template-columns: repeat(3, 1fr);
width: auto; /* Full available width */
}
.grid-3 .post-image-item {