upload project

This commit is contained in:
unknown 2025-12-27 17:16:03 +08:00
commit 06961cae04
422 changed files with 110626 additions and 0 deletions

View 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>