upload project
This commit is contained in:
commit
06961cae04
422 changed files with 110626 additions and 0 deletions
357
subpackages/social/friend-requests/friend-requests.js
Normal file
357
subpackages/social/friend-requests/friend-requests.js
Normal file
|
|
@ -0,0 +1,357 @@
|
|||
// 好友请求管理页面
|
||||
const app = getApp();
|
||||
const friendAPI = require('../../../utils/friend-api.js');
|
||||
const notificationManager = require('../../../utils/notification-manager.js');
|
||||
const wsManager = require('../../../utils/websocket-manager-v2.js');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
// 请求列表
|
||||
friendRequests: [],
|
||||
pendingRequests: [],
|
||||
processedRequests: [],
|
||||
loading: true,
|
||||
refreshing: false,
|
||||
|
||||
// 统计
|
||||
pendingCount: 0,
|
||||
processedCount: 0,
|
||||
|
||||
// 系统信息
|
||||
statusBarHeight: 0,
|
||||
navBarHeight: 0,
|
||||
|
||||
// 标签页
|
||||
activeTab: 'pending', // pending, processed
|
||||
tabs: [
|
||||
{ key: 'pending', label: '好友申请', count: 0 },
|
||||
{ key: 'processed', label: '我的申请', count: 0 }
|
||||
]
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
|
||||
this.initSystemInfo();
|
||||
this.loadFriendRequests();
|
||||
|
||||
// 🔥 初始化WebSocket监听
|
||||
this.initWebSocketListener();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 刷新数据
|
||||
this.loadFriendRequests();
|
||||
// 选中好友tab
|
||||
try {
|
||||
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
|
||||
this.getTabBar().setData({ selected: 1 });
|
||||
}
|
||||
} catch (_) {}
|
||||
},
|
||||
|
||||
// 初始化系统信息
|
||||
initSystemInfo() {
|
||||
const systemInfo = wx.getSystemInfoSync();
|
||||
const menuButton = wx.getMenuButtonBoundingClientRect();
|
||||
|
||||
this.setData({
|
||||
statusBarHeight: systemInfo.statusBarHeight,
|
||||
navBarHeight: menuButton.bottom + 10
|
||||
});
|
||||
},
|
||||
|
||||
// 返回上一页
|
||||
goBack() {
|
||||
wx.navigateBack();
|
||||
},
|
||||
|
||||
// 加载好友请求
|
||||
async loadFriendRequests() {
|
||||
try {
|
||||
this.setData({ loading: true });
|
||||
|
||||
const response = await friendAPI.getFriendRequests();
|
||||
|
||||
// 从API响应中提取数据数组
|
||||
const requests = response.data || [];
|
||||
|
||||
// 分类请求
|
||||
let pendingRequests = requests.filter(req => req.status === 0);
|
||||
// pendingRequests = Array(20).fill(pendingRequests).flat();
|
||||
// console.log('pendingRequests-------',pendingRequests);
|
||||
|
||||
|
||||
const processedRequests = requests.filter(req => req.status !== 0);
|
||||
|
||||
// 更新标签页计数
|
||||
const updatedTabs = this.data.tabs.map(tab => ({
|
||||
...tab,
|
||||
count: tab.key === 'pending' ? pendingRequests.length : processedRequests.length
|
||||
}));
|
||||
|
||||
this.setData({
|
||||
friendRequests: requests,
|
||||
pendingRequests: pendingRequests,
|
||||
processedRequests: processedRequests,
|
||||
pendingCount: pendingRequests.length,
|
||||
processedCount: processedRequests.length,
|
||||
tabs: updatedTabs,
|
||||
loading: false,
|
||||
refreshing: false
|
||||
});
|
||||
|
||||
// 同步自定义TabBar好友角标
|
||||
try {
|
||||
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
|
||||
this.getTabBar().setFriendsBadge(pendingRequests.length || 0);
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
// 同步通知管理器未读计数
|
||||
try { notificationManager.setFriendsUnreadCount(pendingRequests.length || 0); } catch (_) {}
|
||||
|
||||
} catch (error) {
|
||||
console.error('加载好友请求失败:', error);
|
||||
this.setData({
|
||||
loading: false,
|
||||
refreshing: false
|
||||
});
|
||||
|
||||
wx.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onRefresh() {
|
||||
this.setData({ refreshing: true });
|
||||
this.loadFriendRequests();
|
||||
// 刷新后也通知好友页面更新数量
|
||||
setTimeout(() => {
|
||||
this.notifyFriendsPageRefresh();
|
||||
}, 500); // 延迟一点确保数据加载完成
|
||||
},
|
||||
|
||||
// 切换标签页
|
||||
switchTab(e) {
|
||||
const tab = e.currentTarget.dataset.tab;
|
||||
this.setData({
|
||||
activeTab: tab
|
||||
}); },
|
||||
|
||||
// 获取当前标签页的请求列表
|
||||
getCurrentRequests() {
|
||||
const { friendRequests, activeTab } = this.data;
|
||||
|
||||
if (activeTab === 'pending') {
|
||||
return friendRequests.filter(req => req.status === 0);
|
||||
} else {
|
||||
return friendRequests.filter(req => req.status !== 0);
|
||||
}
|
||||
},
|
||||
|
||||
// 处理好友请求
|
||||
async handleRequest(e) {
|
||||
const { requestId, accept } = e.currentTarget.dataset;
|
||||
const actionText = accept === 'true' ? '接受' : '拒绝';
|
||||
|
||||
try {
|
||||
wx.showLoading({ title: `${actionText}中...` });
|
||||
|
||||
await friendAPI.handleFriendRequest(requestId, accept === 'true');
|
||||
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: `已${actionText}`,
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 刷新列表
|
||||
this.loadFriendRequests();
|
||||
|
||||
// 通知好友页面刷新请求数量
|
||||
this.notifyFriendsPageRefresh();
|
||||
|
||||
// 同步自定义TabBar的好友红点:处理后尝试刷新数量
|
||||
try {
|
||||
const resp = await friendAPI.getFriendRequestCount();
|
||||
const count = (resp && (resp.code === 0 || resp.code === 200)) ? (resp.data?.count || 0) : 0;
|
||||
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
|
||||
this.getTabBar().setFriendsBadge(count);
|
||||
}
|
||||
try { notificationManager.setFriendsUnreadCount(count); } catch (_) {}
|
||||
} catch (_) {}
|
||||
|
||||
} catch (error) {
|
||||
wx.hideLoading();
|
||||
console.error('处理好友请求失败:', error);
|
||||
wx.showToast({
|
||||
title: error.message || `${actionText}失败`,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 通知好友页面刷新
|
||||
notifyFriendsPageRefresh() {
|
||||
try {
|
||||
// 通过全局事件通知好友页面刷新
|
||||
const app = getApp();
|
||||
if (app.globalData) {
|
||||
app.globalData.needRefreshFriendRequests = true;
|
||||
}
|
||||
|
||||
// 也可以通过页面栈找到好友页面并直接调用刷新方法
|
||||
const pages = getCurrentPages();
|
||||
const friendsPage = pages.find(page => page.route === 'pages/social/friends/friends');
|
||||
if (friendsPage) {
|
||||
// 刷新好友请求数量
|
||||
if (friendsPage.loadFriendRequestsCount) {
|
||||
friendsPage.loadFriendRequestsCount();
|
||||
}
|
||||
// 刷新好友列表(因为可能新增了好友)
|
||||
if (friendsPage.loadFriends) {
|
||||
friendsPage.loadFriends();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ 通知好友页面失败:', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 🔥 初始化WebSocket监听器
|
||||
initWebSocketListener() {
|
||||
try {
|
||||
if (this._wsInited) return;
|
||||
this._wsInited = true;
|
||||
|
||||
console.log('🔌 [好友请求页] 初始化WebSocket监听器');
|
||||
|
||||
// 绑定处理函数到 this
|
||||
this.handleNotificationMessage = this.handleNotificationMessage.bind(this);
|
||||
|
||||
// 监听通知消息
|
||||
wsManager.on('notification', this.handleNotificationMessage);
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ [好友请求页] 初始化WebSocket监听器失败:', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 处理通知消息
|
||||
handleNotificationMessage(msg) {
|
||||
try {
|
||||
console.log('🔔 [好友请求页] 收到通知消息:', msg);
|
||||
const data = msg?.data || msg;
|
||||
|
||||
// 判断是否为好友通知
|
||||
if (data?.type === 'friend_notification') {
|
||||
this.handleFriendNotification(data);
|
||||
} else if (data?.type === 'friend_request_notification') {
|
||||
this.handleFriendRequestNotification(data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ [好友请求页] 处理通知消息失败:', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 处理好友通知
|
||||
handleFriendNotification(data) {
|
||||
try {
|
||||
console.log('🆕 [好友请求页] 处理好友通知:', data);
|
||||
|
||||
const subType = data?.subType;
|
||||
|
||||
// 对于任何好友通知,都刷新列表
|
||||
if (subType === 'request' || subType === 'accepted' || subType === 'rejected' || subType === 'count_update') {
|
||||
// 延迟一点刷新,确保后端数据已更新
|
||||
setTimeout(() => {
|
||||
this.loadFriendRequests();
|
||||
}, 300);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ [好友请求页] 处理好友通知失败:', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 处理连接时的待处理好友请求通知
|
||||
handleFriendRequestNotification(data) {
|
||||
try {
|
||||
console.log('📋 [好友请求页] 处理待处理好友请求通知:', data);
|
||||
const pendingCount = data?.pendingCount || 0;
|
||||
|
||||
// 如果有待处理请求,刷新列表
|
||||
if (pendingCount > 0) {
|
||||
setTimeout(() => {
|
||||
this.loadFriendRequests();
|
||||
}, 300);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ [好友请求页] 处理待处理好友请求通知失败:', error);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
// 格式化时间
|
||||
formatTime(timeStr) {
|
||||
const time = new Date(timeStr);
|
||||
const now = new Date();
|
||||
const diff = now - time;
|
||||
|
||||
const minute = 60 * 1000;
|
||||
const hour = 60 * minute;
|
||||
const day = 24 * hour;
|
||||
const week = 7 * day;
|
||||
|
||||
if (diff < minute) {
|
||||
return '刚刚';
|
||||
} else if (diff < hour) {
|
||||
return `${Math.floor(diff / minute)}分钟前`;
|
||||
} else if (diff < day) {
|
||||
return `${Math.floor(diff / hour)}小时前`;
|
||||
} else if (diff < week) {
|
||||
return `${Math.floor(diff / day)}天前`;
|
||||
} else {
|
||||
return time.toLocaleDateString();
|
||||
}
|
||||
},
|
||||
|
||||
// 获取状态文本
|
||||
getStatusText(status) {
|
||||
switch (status) {
|
||||
case 0: return '待处理';
|
||||
case 1: return '已接受';
|
||||
case 2: return '已拒绝';
|
||||
default: return '未知';
|
||||
}
|
||||
},
|
||||
|
||||
// 获取状态样式类
|
||||
getStatusClass(status) {
|
||||
switch (status) {
|
||||
case 0: return 'pending';
|
||||
case 1: return 'accepted';
|
||||
case 2: return 'rejected';
|
||||
default: return 'unknown';
|
||||
}
|
||||
},
|
||||
|
||||
// 页面卸载
|
||||
onUnload() {
|
||||
// 移除 WebSocket 监听器
|
||||
try {
|
||||
if (this.handleNotificationMessage) {
|
||||
wsManager.off('notification', this.handleNotificationMessage);
|
||||
console.log('✅ [好友请求页] 已移除 WebSocket 监听器');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ [好友请求页] 移除 WebSocket 监听器失败:', error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
6
subpackages/social/friend-requests/friend-requests.json
Normal file
6
subpackages/social/friend-requests/friend-requests.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"navigationStyle": "default",
|
||||
"navigationBarTitleText": "好友请求",
|
||||
"navigationBarBackgroundColor": "#000000",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
167
subpackages/social/friend-requests/friend-requests.wxml
Normal file
167
subpackages/social/friend-requests/friend-requests.wxml
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
<!-- 好友请求管理页面 -->
|
||||
<view class="requests-container">
|
||||
|
||||
<!-- 标签页 -->
|
||||
<view class="tabs-container">
|
||||
<view class="tab-item {{activeTab === item.key ? 'active' : ' '}}"
|
||||
wx:for="{{tabs}}"
|
||||
wx:key="key"
|
||||
bindtap="switchTab"
|
||||
data-tab="{{item.key}}">
|
||||
<text class="tab-text">{{item.label}}</text>
|
||||
<view class="tab-badge" wx:if="{{item.key !== 'processed' && item.count > 0}}">
|
||||
<text class="badge-text">{{item.count > 99 ? '99+' : item.count}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<scroll-view class="content-container"
|
||||
scroll-y="true"
|
||||
refresher-enabled="true"
|
||||
refresher-triggered="{{refreshing}}"
|
||||
bindrefresherrefresh="onRefresh">
|
||||
|
||||
<!-- 加载中 -->
|
||||
<view class="loading-container" wx:if="{{loading}}">
|
||||
<view class="loading-spinner"></view>
|
||||
<text class="loading-text">加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-container" wx:if="{{!loading && (activeTab === 'pending' ? pendingRequests.length === 0 : processedRequests.length === 0)}}">
|
||||
<view class="empty-icon">
|
||||
<text class="icon-text">{{activeTab === 'pending' ? '📭' : '📋'}}</text>
|
||||
</view>
|
||||
<text class="empty-title">{{activeTab === 'pending' ? '暂无待处理请求' : '暂无已处理记录'}}</text>
|
||||
<text class="empty-desc">{{activeTab === 'pending' ? '当有人向您发送好友请求时,会在这里显示' : '您处理过的好友请求会在这里显示'}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 请求列表 -->
|
||||
<view class="requests-list" wx:if="{{!loading && (activeTab === 'pending' ? pendingRequests.length > 0 : processedRequests.length > 0)}}">
|
||||
<view class="request-item"
|
||||
wx:for="{{activeTab === 'pending' ? pendingRequests : processedRequests}}"
|
||||
wx:key="requestId">
|
||||
|
||||
<!-- 用户信息 -->
|
||||
<view class="user-section">
|
||||
<!-- 头像 -->
|
||||
<view class="avatar-out">
|
||||
<image wx:if="{{item.senderAvatar || item.avatar}}"
|
||||
src="{{item.senderAvatar || item.avatar}}"
|
||||
class="avatar-image"
|
||||
mode="aspectFill" />
|
||||
<view wx:else class="avatar-placeholder">
|
||||
<text class="avatar-text">{{item.senderNickname || item.nickname || '?'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 用户信息 -->
|
||||
<view class="user-info">
|
||||
<view class="user-name">
|
||||
<text class="nickname">{{item.senderNickname || item.nickname || '用户'}}</text>
|
||||
<view class="status-badge {{utils.getStatusClass(item.status)}}" wx:if="{{activeTab === 'processed'}}">
|
||||
<text class="status-text">{{utils.getStatusText(item.status)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="request-message" wx:if="{{item.message}}">
|
||||
<text class="message-text">{{item.message}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 右侧区域(日期+按钮) -->
|
||||
<view class="right-section">
|
||||
<!-- 日期 -->
|
||||
<view class="time-info">
|
||||
<text class="time-text">{{utils.formatTime(item.createdAt)}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="action-section" wx:if="{{item.status === 0}}">
|
||||
<view class="action-buttons">
|
||||
<image class="action-icon"
|
||||
src="../../../images/right-icon.svg"
|
||||
mode="aspectFit"
|
||||
bindtap="handleRequest"
|
||||
data-request-id="{{item.requestId}}"
|
||||
data-accept="true"/>
|
||||
<image class="action-icon"
|
||||
src="../../../images/error-icon.svg"
|
||||
mode="aspectFit"
|
||||
bindtap="handleRequest"
|
||||
data-request-id="{{item.requestId}}"
|
||||
data-accept="false"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部安全区域 -->
|
||||
<view class="safe-area-bottom"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<wxs module="utils">
|
||||
var getCurrentRequests = function(friendRequests, activeTab) {
|
||||
if (!friendRequests || !friendRequests.length) return [];
|
||||
|
||||
if (activeTab === 'pending') {
|
||||
return friendRequests.filter(function(req) {
|
||||
return req.status === 0;
|
||||
});
|
||||
} else {
|
||||
return friendRequests.filter(function(req) {
|
||||
return req.status !== 0;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var formatTime = function(timeStr) {
|
||||
if (!timeStr) return '';
|
||||
|
||||
var time = getDate(timeStr);
|
||||
var now = getDate();
|
||||
var diff = now.getTime() - time.getTime();
|
||||
|
||||
var minute = 60 * 1000;
|
||||
var hour = 60 * minute;
|
||||
var day = 24 * hour;
|
||||
var week = 7 * day;
|
||||
|
||||
if (diff < minute) {
|
||||
return '刚刚';
|
||||
} else if (diff < hour) {
|
||||
return Math.floor(diff / minute) + '分钟前';
|
||||
} else if (diff < day) {
|
||||
return Math.floor(diff / hour) + '小时前';
|
||||
} else if (diff < week) {
|
||||
return Math.floor(diff / day) + '天前';
|
||||
} else {
|
||||
return time.toLocaleDateString();
|
||||
}
|
||||
};
|
||||
|
||||
var getStatusText = function(status) {
|
||||
if (status === 0) return '待处理';
|
||||
if (status === 1) return '已接受';
|
||||
if (status === 2) return '已拒绝';
|
||||
return '未知';
|
||||
};
|
||||
|
||||
var getStatusClass = function(status) {
|
||||
if (status === 0) return 'pending';
|
||||
if (status === 1) return 'accepted';
|
||||
if (status === 2) return 'rejected';
|
||||
return 'unknown';
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getCurrentRequests: getCurrentRequests,
|
||||
formatTime: formatTime,
|
||||
getStatusText: getStatusText,
|
||||
getStatusClass: getStatusClass
|
||||
};
|
||||
</wxs>
|
||||
376
subpackages/social/friend-requests/friend-requests.wxss
Normal file
376
subpackages/social/friend-requests/friend-requests.wxss
Normal file
|
|
@ -0,0 +1,376 @@
|
|||
/* 好友请求管理页面样式 */
|
||||
|
||||
.requests-container {
|
||||
height: 100vh;
|
||||
background-color:black;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 标签页 */
|
||||
.tabs-container {
|
||||
background: #A7ADB7;
|
||||
display: flex;
|
||||
box-sizing:border-box;
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
margin-top: 20rpx;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 32rpx 0;
|
||||
position: relative;
|
||||
gap: 16rpx;
|
||||
color: white;
|
||||
border-radius: 40rpx;
|
||||
box-shadow: 10rpx 2rpx 8rpx 0 rgba(0,0,0,0.15),-5rpx 2rpx 8rpx 0 rgba(0,0,0,0.15);
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
background-color: #1E1E1E;
|
||||
border-radius: 40rpx;
|
||||
box-shadow: 10rpx 2rpx 8rpx 0 rgba(0,0,0,0.15);
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tab-item.active .tab-text {
|
||||
color: white;
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.tab-badge {
|
||||
background: #ff4757;
|
||||
border-radius: 20rpx;
|
||||
padding: 4rpx 12rpx;
|
||||
min-width: 32rpx;
|
||||
height: 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.badge-text {
|
||||
font-size: 20rpx;
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 内容区域 */
|
||||
.content-container {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: 120rpx;
|
||||
box-sizing: border-box;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* 加载中 */
|
||||
.loading-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 120rpx 0;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border: 4rpx solid #f3f3f3;
|
||||
border-top: 4rpx solid #667eea;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 空状态 */
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 120rpx 0 0 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-icon {
|
||||
font-size: 120rpx;
|
||||
margin-bottom: 32rpx;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.empty-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.empty-desc {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 请求列表 */
|
||||
.requests-list {
|
||||
box-sizing:border-box;
|
||||
overflow: hidden;
|
||||
width: 700rpx;
|
||||
margin-left: 25rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.request-item {
|
||||
border-radius: 24rpx;
|
||||
padding: 24rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
border: 1px solid rgb(131, 12, 243);
|
||||
min-height: 140rpx;
|
||||
margin: 20rpx 0;
|
||||
}
|
||||
|
||||
/* 用户信息区域 */
|
||||
.user-section {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 16rpx;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
.avatar-out{
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.avatar-image {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 24rpx;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.avatar-placeholder {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #e0e0e0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.avatar-text {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
/* 右侧区域(日期+按钮) */
|
||||
.right-section {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
align-self: stretch;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.nickname {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.status-badge.pending {
|
||||
background: #fff3e0;
|
||||
color: #ff9800;
|
||||
}
|
||||
|
||||
.status-badge.accepted {
|
||||
background: #e8f5e8;
|
||||
color: #4caf50;
|
||||
}
|
||||
|
||||
.status-badge.rejected {
|
||||
background: #ffebee;
|
||||
color: #f44336;
|
||||
}
|
||||
|
||||
.status-text {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.user-id {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-bottom: 16rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.request-message {
|
||||
max-width: 100%;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.message-text {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #B3B3B3;
|
||||
line-height: 1.4;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.time-info {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.time-text {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.handle-time {
|
||||
font-size: 22rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
/* 操作按钮区域 */
|
||||
.action-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.action-icon{
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
background:#F2F2F7;
|
||||
border-radius: 50%;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
/* 底部安全区域 */
|
||||
.safe-area-bottom {
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
/* ================== 暗色主题覆盖(社交-好友请求) ================== */
|
||||
.requests-container .tab-item.active {
|
||||
border-bottom-color: #1E1E1E;
|
||||
}
|
||||
|
||||
.requests-container .content-container {
|
||||
color: #f0f0f0;
|
||||
}
|
||||
|
||||
.requests-container .request-item {
|
||||
background: rgba(255, 255, 255, 0.38);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.38);
|
||||
}
|
||||
|
||||
/* 基础文字层级 */
|
||||
.requests-container .nickname,
|
||||
.requests-container .empty-title {
|
||||
color: #f5f5f5;
|
||||
}
|
||||
|
||||
.requests-container .empty-desc,
|
||||
.requests-container .user-id,
|
||||
.requests-container .time-text,
|
||||
.requests-container .handle-time {
|
||||
color: #b0b0b0;
|
||||
}
|
||||
|
||||
/* 状态色保留,仅底色微调对比 */
|
||||
.requests-container .status-badge.pending {
|
||||
background:#4a3720;
|
||||
color:#ffb347;
|
||||
}
|
||||
|
||||
.requests-container .status-badge.accepted {
|
||||
background:#1f3321;
|
||||
color:#57c765;
|
||||
}
|
||||
|
||||
.requests-container .status-badge.rejected {
|
||||
background:#3a1e20;
|
||||
color:#ff6b6b;
|
||||
}
|
||||
|
||||
/* 空 / 加载 / 提示 */
|
||||
.requests-container .loading-text,
|
||||
.requests-container .badge-text {
|
||||
color:#b0b0b0;
|
||||
}
|
||||
|
||||
.requests-container .empty-desc {
|
||||
color:#9e9e9e;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue