提交修改
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
const api = require('../../../services/api')
|
||||
const app = getApp()
|
||||
Page({
|
||||
data: { posts: [], page: 1, loading: true, showCreate: false, content: '' },
|
||||
onShow() { this.loadFeed() },
|
||||
data: { posts: [], page: 1, loading: true, showCreate: false, content: '', themeMode: 'light' },
|
||||
onShow() {
|
||||
this.setData({ themeMode: app.globalData.themeMode })
|
||||
this.loadFeed()
|
||||
},
|
||||
onPullDownRefresh() { this.setData({ page: 1 }); this.loadFeed().then(() => wx.stopPullDownRefresh()) },
|
||||
async loadFeed() {
|
||||
try {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<view data-theme="{{themeMode}}">
|
||||
<button class="create-post-btn" bindtap="openCreate">+ 分享动态</button>
|
||||
|
||||
<view wx:for="{{posts}}" wx:key="id" class="post-card" wx:for-item="p">
|
||||
@@ -24,6 +25,7 @@
|
||||
<view class="modal-actions">
|
||||
<button class="cancel-btn" bindtap="closeCreate">取消</button>
|
||||
<button class="submit-btn" disabled="{{!content.trim()}}" bindtap="submitPost">发布</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
.create-post-btn { display: block; margin: 12px 16px; background: white; border-radius: 12px; padding: 16px; color: #86868B; font-size: 15px; text-align: left; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
|
||||
.post-card { background: white; border-radius: 12px; margin: 8px 16px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
|
||||
.create-post-btn { display: block; margin: 12px 16px; background: var(--color-card); border-radius: 12px; padding: 16px; color: var(--color-text-secondary); font-size: 15px; text-align: left; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
|
||||
.post-card { background: var(--color-card); border-radius: 12px; margin: 8px 16px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
|
||||
.post-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
|
||||
.post-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; }
|
||||
.post-user { font-size: 14px; font-weight: 600; display: block; }
|
||||
.post-time { font-size: 12px; color: #86868B; }
|
||||
.post-content { font-size: 15px; line-height: 1.5; display: block; }
|
||||
.post-actions { display: flex; gap: 20px; padding-top: 8px; margin-top: 8px; border-top: 0.5px solid #F0F0F0; }
|
||||
.action-btn { font-size: 13px; color: #86868B; }
|
||||
.load-more { text-align: center; padding: 16px; color: #86868B; font-size: 14px; }
|
||||
.post-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; }
|
||||
.post-user { font-size: 14px; font-weight: 600; display: block; color: var(--color-text); }
|
||||
.post-time { font-size: 12px; color: var(--color-text-secondary); }
|
||||
.post-content { font-size: 15px; line-height: 1.5; display: block; color: var(--color-text); }
|
||||
.post-actions { display: flex; gap: 20px; padding-top: 8px; margin-top: 8px; border-top: 0.5px solid var(--color-divider); }
|
||||
.action-btn { font-size: 13px; color: var(--color-text-secondary); }
|
||||
.load-more { text-align: center; padding: 16px; color: var(--color-text-secondary); font-size: 14px; }
|
||||
.empty { text-align: center; padding: 60px 16px; font-size: 40px; }
|
||||
.empty-text { font-size: 15px; color: #86868B; display: block; margin-top: 8px; }
|
||||
.loading { text-align: center; padding: 40px; color: #86868B; }
|
||||
.empty-text { font-size: 15px; color: var(--color-text-secondary); display: block; margin-top: 8px; }
|
||||
.loading { text-align: center; padding: 40px; color: var(--color-text-secondary); }
|
||||
|
||||
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: flex-end; z-index: 100; }
|
||||
.modal-content { background: white; border-radius: 16px 16px 0 0; width: 100%; padding: 20px 16px; }
|
||||
.modal-title { font-size: 17px; font-weight: 600; text-align: center; display: block; margin-bottom: 12px; }
|
||||
.modal-textarea { width: 100%; border: 1px solid #E5E5EA; border-radius: 10px; padding: 12px; font-size: 15px; min-height: 120px; box-sizing: border-box; }
|
||||
.modal-content { background: var(--color-card); border-radius: 16px 16px 0 0; width: 100%; padding: 20px 16px; }
|
||||
.modal-title { font-size: 17px; font-weight: 600; text-align: center; display: block; margin-bottom: 12px; color: var(--color-text); }
|
||||
.modal-textarea { width: 100%; border: 1px solid var(--color-border); border-radius: 10px; padding: 12px; font-size: 15px; min-height: 120px; box-sizing: border-box; background: var(--color-input-bg); color: var(--color-text); }
|
||||
.modal-actions { display: flex; gap: 12px; margin-top: 12px; }
|
||||
.cancel-btn { flex: 1; padding: 12px; background: #f8f8fa; border: 1px solid #E5E5EA; border-radius: 10px; font-size: 15px; text-align: center; }
|
||||
.submit-btn { flex: 1; padding: 12px; background: linear-gradient(135deg,#FF6B35,#FF4D6D); color: white; border: none; border-radius: 10px; font-size: 15px; font-weight: 600; text-align: center; }
|
||||
.submit-btn[disabled] { opacity: 0.5; }
|
||||
.cancel-btn { flex: 1; padding: 12px; background: var(--color-input-bg); border: 1px solid var(--color-border); border-radius: 10px; font-size: 15px; text-align: center; color: var(--color-text); }
|
||||
.submit-btn { flex: 1; padding: 12px; background: var(--color-primary-gradient); color: white; border: none; border-radius: 10px; font-size: 15px; font-weight: 600; text-align: center; }
|
||||
.submit-btn[disabled] { opacity: 0.5; }
|
||||
@@ -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 })
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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); }
|
||||
Reference in New Issue
Block a user