提交修改
CI / Server (Go) (push) Has been cancelled
CI / Web (Next.js) (push) Has been cancelled
CI / Mobile (React Native) (push) Has been cancelled
CI / Admin (React) (push) Has been cancelled
CI / Docker Build (push) Has been cancelled

This commit is contained in:
zeronline
2026-06-29 16:49:54 +08:00
parent 545329ac40
commit b01a5f91c3
43 changed files with 740 additions and 338 deletions
+6 -2
View File
@@ -1,7 +1,11 @@
const api = require('../../../services/api')
const app = getApp()
Page({
data: { friends: [], addPhone: '', loading: true },
onShow() { this.loadFriends() },
data: { friends: [], addPhone: '', loading: true, themeMode: 'light' },
onShow() {
this.setData({ themeMode: app.globalData.themeMode })
this.loadFriends()
},
async loadFriends() {
try { const f = await api.get('/api/social/friends'); this.setData({ friends: f || [] }) } catch(e) {}
this.setData({ loading: false })
+12 -10
View File
@@ -1,12 +1,14 @@
<view class="add-section">
<input class="input-field" value="{{addPhone}}" bindinput="onPhoneInput" placeholder="输入手机号添加" style="flex:1;margin-bottom:0" />
<button class="add-btn" bindtap="onAdd" disabled="{{!addPhone.trim()}}">添加</button>
</view>
<view data-theme="{{themeMode}}">
<view class="add-section">
<input class="input-field" value="{{addPhone}}" bindinput="onPhoneInput" placeholder="输入手机号添加" style="flex:1;margin-bottom:0" />
<button class="add-btn" bindtap="onAdd" disabled="{{!addPhone.trim()}}">添加</button>
</view>
<text class="section-title">好友列表 ({{friends.length}})</text>
<view wx:for="{{friends}}" wx:key="id" class="friend-item">
<view class="friend-avatar">{{item.nickname?.[0] || '?'}}</view>
<text class="friend-name">{{item.nickname || '用户'}}</text>
<button class="remove-btn" data-id="{{item.id}}" bindtap="onRemove">删除</button>
<text class="section-title">好友列表 ({{friends.length}})</text>
<view wx:for="{{friends}}" wx:key="id" class="friend-item">
<view class="friend-avatar">{{item.nickname?.[0] || '?'}}</view>
<text class="friend-name">{{item.nickname || '用户'}}</text>
<button class="remove-btn" data-id="{{item.id}}" bindtap="onRemove">删除</button>
</view>
<view class="empty" wx:if="{{!loading && friends.length===0}}"><text class="empty-text">还没有好友</text></view>
</view>
<view class="empty" wx:if="{{!loading && friends.length===0}}"><text class="empty-text">还没有好友</text></view>
+8 -8
View File
@@ -1,10 +1,10 @@
.add-section { display: flex; gap: 8px; padding: 12px 16px; align-items: center; }
.add-btn { padding: 10px 20px; background: #FF6B35; color: white; border: none; border-radius: 10px; font-size: 14px; }
.add-btn[disabled] { background: #E5E5EA; }
.section-title { font-size: 15px; color: #86868B; padding: 16px 16px 8px; display: block; }
.friend-item { display: flex; align-items: center; gap: 10px; background: white; margin: 4px 16px; padding: 12px 16px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.friend-avatar { width: 36px; height: 36px; border-radius: 18px; background: linear-gradient(135deg,#FF6B35,#FF4D6D); display: flex; align-items: center; justify-content: center; color: white; font-size: 14px; font-weight: 600; }
.friend-name { flex: 1; font-size: 15px; }
.remove-btn { background: none; border: none; color: #FF3B30; font-size: 13px; padding: 4px 8px; }
.add-btn { padding: 10px 20px; background: var(--color-primary); color: white; border: none; border-radius: 10px; font-size: 14px; }
.add-btn[disabled] { background: var(--color-border); }
.section-title { font-size: 15px; color: var(--color-text-secondary); padding: 16px 16px 8px; display: block; }
.friend-item { display: flex; align-items: center; gap: 10px; background: var(--color-card); margin: 4px 16px; padding: 12px 16px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.friend-avatar { width: 36px; height: 36px; border-radius: 18px; background: var(--color-primary-gradient); display: flex; align-items: center; justify-content: center; color: white; font-size: 14px; font-weight: 600; }
.friend-name { flex: 1; font-size: 15px; color: var(--color-text); }
.remove-btn { background: none; border: none; color: var(--color-error); font-size: 13px; padding: 4px 8px; }
.empty { text-align: center; padding: 40px; }
.empty-text { font-size: 15px; color: #86868B; }
.empty-text { font-size: 15px; color: var(--color-text-secondary); }