upload project
This commit is contained in:
commit
06961cae04
422 changed files with 110626 additions and 0 deletions
402
subpackages/social/friend-detail/friend-detail.js
Normal file
402
subpackages/social/friend-detail/friend-detail.js
Normal file
|
|
@ -0,0 +1,402 @@
|
|||
// 好友详情页面
|
||||
const app = getApp();
|
||||
const friendAPI = require('../../../utils/friend-api.js');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
// 好友信息
|
||||
friendInfo: null,
|
||||
loading: true,
|
||||
|
||||
// 操作状态
|
||||
isDeleting: false,
|
||||
|
||||
// UI 预计算字段
|
||||
friendInitial: '?'
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
// 获取好友ID
|
||||
const customId = options.customId;
|
||||
if (customId) {
|
||||
this.loadFriendDetail(customId);
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '参数错误',
|
||||
icon: 'none'
|
||||
});
|
||||
setTimeout(() => {
|
||||
wx.navigateBack();
|
||||
}, 1500);
|
||||
}
|
||||
},
|
||||
|
||||
// 加载好友详情
|
||||
async loadFriendDetail(customId) {
|
||||
try {
|
||||
this.setData({ loading: true });
|
||||
|
||||
const response = await friendAPI.getFriendDetail(customId);
|
||||
if (response && (response.code === 0 || response.code === 200 || response.code === '0' || response.code === '200')) {
|
||||
const friendInfo = response.data;
|
||||
const initial = this._computeInitial(friendInfo);
|
||||
|
||||
// 计算年龄(根据生日)
|
||||
const calculatedAge = this.calculateAge(friendInfo?.birthday);
|
||||
|
||||
// 将家乡数组转换为字符串
|
||||
let hometownText = '';
|
||||
if (friendInfo?.hometown) {
|
||||
if (Array.isArray(friendInfo.hometown)) {
|
||||
hometownText = friendInfo.hometown.filter(item => item).join(' ');
|
||||
} else if (typeof friendInfo.hometown === 'string') {
|
||||
hometownText = friendInfo.hometown;
|
||||
}
|
||||
}else if(friendInfo.locationInfo){
|
||||
hometownText = friendInfo.locationInfo.district + friendInfo.locationInfo.city
|
||||
}
|
||||
|
||||
this.setData({
|
||||
friendInfo: friendInfo,
|
||||
loading: false,
|
||||
friendInitial: initial,
|
||||
calculatedAge: calculatedAge,
|
||||
hometownText: hometownText
|
||||
});
|
||||
} else {
|
||||
throw new Error(response?.message || '获取好友详情失败');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ 加载好友详情失败:', error);
|
||||
this.setData({ loading: false });
|
||||
|
||||
wx.showToast({
|
||||
title: error.message || '加载失败',
|
||||
icon: 'none'
|
||||
});
|
||||
|
||||
// 延迟返回上一页
|
||||
setTimeout(() => {
|
||||
wx.navigateBack();
|
||||
}, 1500);
|
||||
}
|
||||
},
|
||||
|
||||
// 根据生日计算年龄
|
||||
calculateAge(birthday) {
|
||||
if (!birthday) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 处理 YYYY-MM-DD 格式的日期
|
||||
let birthDate;
|
||||
if (typeof birthday === 'string' && birthday.includes('-')) {
|
||||
const dateParts = birthday.split('-');
|
||||
if (dateParts.length === 3) {
|
||||
birthDate = new Date(parseInt(dateParts[0]), parseInt(dateParts[1]) - 1, parseInt(dateParts[2]));
|
||||
} else {
|
||||
birthDate = new Date(birthday);
|
||||
}
|
||||
} else {
|
||||
birthDate = new Date(birthday);
|
||||
}
|
||||
|
||||
if (isNaN(birthDate.getTime())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const today = new Date();
|
||||
let age = today.getFullYear() - birthDate.getFullYear();
|
||||
const monthDiff = today.getMonth() - birthDate.getMonth();
|
||||
|
||||
// 如果还没过生日,年龄减1
|
||||
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
|
||||
age--;
|
||||
}
|
||||
|
||||
// 年龄应该大于等于0
|
||||
return age >= 0 ? age : null;
|
||||
} catch (error) {
|
||||
console.error('计算年龄失败:', error, birthday);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
// 发送消息
|
||||
sendMessage() {
|
||||
const { friendInfo } = this.data;
|
||||
if (!friendInfo) return;
|
||||
|
||||
wx.navigateTo({
|
||||
url: `/pages/message/chat/chat?targetId=${friendInfo.customId}&name=${encodeURIComponent(friendInfo.nickname)}&chatType=0`
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
previewImage(e) {
|
||||
try {
|
||||
// 获取当前点击的图片索引和动态索引
|
||||
const avatar = e.currentTarget.dataset.avatar;
|
||||
// 🔥 设置标志,防止预览关闭后触发页面刷新
|
||||
this._skipNextOnShowReload = true;
|
||||
const imageUrls=[avatar];
|
||||
// 调用微信小程序的图片预览API
|
||||
wx.previewImage({
|
||||
current: avatar,
|
||||
urls: imageUrls,
|
||||
success: () => {
|
||||
// 预览打开成功,标志已设置,关闭时会触发 onShow
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('图片预览失败:', err);
|
||||
// 预览失败,清除标志
|
||||
this._skipNextOnShowReload = false;
|
||||
wx.showToast({
|
||||
title: '预览图片失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('图片预览过程中出错:', error);
|
||||
// 出错时清除标志
|
||||
this._skipNextOnShowReload = false;
|
||||
wx.showToast({
|
||||
title: '预览图片失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 视频通话
|
||||
videoCall() {
|
||||
const { friendInfo } = this.data;
|
||||
if (!friendInfo) return;
|
||||
|
||||
wx.showToast({
|
||||
title: '视频通话功能开发中',
|
||||
icon: 'none'
|
||||
});
|
||||
},
|
||||
|
||||
// 设置备注
|
||||
setRemark() {
|
||||
const { friendInfo } = this.data;
|
||||
if (!friendInfo) {
|
||||
wx.showToast({
|
||||
title: '好友信息不存在',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('🔍 准备跳转到备注页面,好友信息:', friendInfo);
|
||||
|
||||
const nickname = friendInfo.nickname || friendInfo.remark || '好友';
|
||||
const customId = friendInfo.customId || '';
|
||||
const friendId = friendInfo.id || friendInfo.friendId || customId;
|
||||
const remark = friendInfo.remark || '';
|
||||
|
||||
wx.navigateTo({
|
||||
url: `/subpackages/social-remark/friend-remark?friendId=${encodeURIComponent(friendId)}&customId=${encodeURIComponent(customId)}&remark=${encodeURIComponent(remark)}&nickname=${encodeURIComponent(nickname)}`,
|
||||
success: () => {
|
||||
console.log('✅ 跳转成功');
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('❌ 跳转失败:', err);
|
||||
wx.showToast({
|
||||
title: '跳转失败: ' + (err.errMsg || '未知错误'),
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 删除好友
|
||||
deleteFriend() {
|
||||
const { friendInfo } = this.data;
|
||||
if (!friendInfo) return;
|
||||
|
||||
wx.showModal({
|
||||
title: '删除好友',
|
||||
content: `确定要删除好友"${friendInfo.nickname}"吗?删除后将同时清理聊天记录。`,
|
||||
confirmText: '删除',
|
||||
confirmColor: '#ff4757',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
this.setData({ isDeleting: true });
|
||||
wx.showLoading({ title: '正在删除...' });
|
||||
|
||||
// 后端删除好友关系
|
||||
await friendAPI.deleteFriend(friendInfo.customId);
|
||||
|
||||
// 🔥 删除对应的会话记录
|
||||
try {
|
||||
const nimConversationManager = require('../../../utils/nim-conversation-manager.js');
|
||||
const app = getApp();
|
||||
|
||||
// 获取当前用户的 NIM accountId
|
||||
const userInfo = app.globalData.userInfo;
|
||||
const myAccountId = userInfo?.neteaseIMAccid || userInfo?.user?.neteaseIMAccid;
|
||||
|
||||
console.log('删除会话 - 用户信息:', {
|
||||
myAccountId,
|
||||
friendId: friendInfo.customId
|
||||
});
|
||||
|
||||
if (myAccountId && friendInfo.customId) {
|
||||
const conversationId = `${myAccountId}|1|${friendInfo.customId}`;
|
||||
console.log('🗑️ 准备删除会话:', conversationId);
|
||||
|
||||
await nimConversationManager.deleteConversation(conversationId);
|
||||
console.log('✅ 已删除好友会话:', conversationId);
|
||||
} else {
|
||||
console.warn('⚠️ 缺少必要信息,无法删除会话', {
|
||||
hasMyAccountId: !!myAccountId,
|
||||
hasFriendId: !!friendInfo.customId
|
||||
});
|
||||
}
|
||||
} catch (convError) {
|
||||
console.error('⚠️ 删除会话失败(不影响主流程):', convError);
|
||||
}
|
||||
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: '已删除好友',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 延迟返回并刷新好友列表
|
||||
setTimeout(() => {
|
||||
// 通知好友页面刷新
|
||||
const pages = getCurrentPages();
|
||||
const friendsPage = pages.find(page => page.route === 'pages/social/friends/friends');
|
||||
if (friendsPage && friendsPage.loadFriends) {
|
||||
friendsPage.loadFriends();
|
||||
}
|
||||
|
||||
wx.navigateBack();
|
||||
}, 1000);
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ 删除好友失败:', error);
|
||||
wx.hideLoading();
|
||||
this.setData({ isDeleting: false });
|
||||
|
||||
wx.showToast({
|
||||
title: error.message || '删除失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 查看位置
|
||||
viewLocation() {
|
||||
const { friendInfo } = this.data;
|
||||
if (!friendInfo || !friendInfo.locationInfo) {
|
||||
wx.showToast({
|
||||
title: '暂无位置信息',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const { locationInfo } = friendInfo;
|
||||
wx.openLocation({
|
||||
latitude: locationInfo.latitude,
|
||||
longitude: locationInfo.longitude,
|
||||
name: friendInfo.nickname,
|
||||
address: locationInfo.address || '未知位置'
|
||||
});
|
||||
},
|
||||
|
||||
// ===== 置顶/免打扰开关 =====
|
||||
async onTogglePin(e) {
|
||||
wx.showToast({
|
||||
title: '请使用消息页面管理会话',
|
||||
icon: 'none'
|
||||
});
|
||||
},
|
||||
|
||||
async onToggleMute(e) {
|
||||
wx.showToast({
|
||||
title: '请使用消息页面管理会话',
|
||||
icon: 'none'
|
||||
});
|
||||
},
|
||||
|
||||
// 计算头像首字母
|
||||
_computeInitial(friendInfo) {
|
||||
try {
|
||||
const name = String(friendInfo?.remark || friendInfo?.nickname || '').trim();
|
||||
if (!name) return '?';
|
||||
return name.charAt(0);
|
||||
} catch (_) {
|
||||
return '?';
|
||||
}
|
||||
},
|
||||
|
||||
// 复制ID
|
||||
copyId() {
|
||||
const { friendInfo } = this.data;
|
||||
const id = friendInfo?.customId || (friendInfo?.id ? 'findme_' + friendInfo.id : '未设置');
|
||||
if (!id || id === '未设置') {
|
||||
wx.showToast({
|
||||
title: 'ID不存在',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
wx.setClipboardData({
|
||||
data: id,
|
||||
success: () => {
|
||||
wx.showToast({
|
||||
title: '复制成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
wx.showToast({
|
||||
title: '复制失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 查看二维码
|
||||
viewQRCode() {
|
||||
const { friendInfo } = this.data;
|
||||
if (!friendInfo || !friendInfo.customId) {
|
||||
wx.showToast({
|
||||
title: '好友信息不存在',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 传递好友的 customId 参数,用于生成好友的二维码
|
||||
wx.navigateTo({
|
||||
url: `/subpackages/qr/qr-code/qr-code?customId=${friendInfo.customId}`,
|
||||
success: (res) => {
|
||||
console.log('跳转二维码页面成功', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('跳转二维码页面失败', err);
|
||||
wx.showToast({
|
||||
title: '跳转失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
7
subpackages/social/friend-detail/friend-detail.json
Normal file
7
subpackages/social/friend-detail/friend-detail.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"navigationStyle": "default",
|
||||
"navigationBarTitleText": "好友详情",
|
||||
"navigationBarBackgroundColor": "#000000",
|
||||
"navigationBarTextStyle": "white",
|
||||
"backgroundColor": "#f5f5f5"
|
||||
}
|
||||
150
subpackages/social/friend-detail/friend-detail.wxml
Normal file
150
subpackages/social/friend-detail/friend-detail.wxml
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
<!-- 好友详情页面 -->
|
||||
<view class="friend-detail-container">
|
||||
|
||||
<!-- 加载中 -->
|
||||
<view class="loading-container" wx:if="{{loading}}">
|
||||
<view class="loading-spinner"></view>
|
||||
<text class="loading-text">加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 好友详情内容 -->
|
||||
<scroll-view class="detail-content" scroll-y="true" wx:if="{{!loading && friendInfo}}">
|
||||
|
||||
<!-- 基本信息卡片 -->
|
||||
<view class="info-card">
|
||||
<!-- 头像和基本信息 -->
|
||||
<view class="basic-info">
|
||||
<view class="profile-top flex-row">
|
||||
<view class="avatar-container">
|
||||
<image class="avatar-image" data-avatar="{{friendInfo.avatar}}" bindtap="previewImage" src="{{friendInfo.avatar || '/images/default-avatar.svg'}}" mode="aspectFill" />
|
||||
<view class="avatar-decoration" wx:if="{{friendInfo.isMember}}">👑</view>
|
||||
<view class="online-status online"></view>
|
||||
</view>
|
||||
<view class="profile-info flex-col">
|
||||
<view class="profile-name-row flex-row">
|
||||
<view class="profile-name">{{friendInfo.remark || friendInfo.nickname || 'FindMe用户'}}</view>
|
||||
<view class="vip-crown" wx:if="{{friendInfo.isMember}}">👑</view>
|
||||
</view>
|
||||
<view class="profile-id">
|
||||
<text class="id-label">ID: </text>
|
||||
<view class="id-value-wrapper" bindtap="copyId">
|
||||
<text class="id-value">{{friendInfo.customId}}</text>
|
||||
</view>
|
||||
<!-- 新增:去认证按钮 -->
|
||||
<view class="verify-btn" wx:if="{{!friendInfo.verified}}">
|
||||
<image class="verify-btn-p" bindtap="copyId" src="../../../images/btn.png" mode="widthFix" />
|
||||
<text class="verify-text">未认证</text>
|
||||
</view>
|
||||
<view class="verified-tag" wx:if="{{friendInfo.verified}}">
|
||||
<image class="verified-tag-p" bindtap="copyId" src="../../../images/tag.png" mode="widthFix" />
|
||||
<text class="verified-text">已认证</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部信息区:位置、二维码、编辑按钮、设置、简介、个人标签 -->
|
||||
<view class="profile-bottom">
|
||||
<!-- 操作按钮区 -->
|
||||
<view class="action-buttons">
|
||||
<view class="qr-code-btn" bindtap="viewQRCode">
|
||||
<image src="/images/qr-code.png" class="qr-code-icon"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 位置信息 -->
|
||||
<view class="profile-location" bindtap="viewLocation">
|
||||
<image src="/images/location.png" class="location-icon"/>
|
||||
<text class="location-text-qr">{{hometownText}}</text>
|
||||
<text class="location-arrow">›</text>
|
||||
</view>
|
||||
|
||||
<!-- 个人简介 -->
|
||||
<view class="profile-signature">
|
||||
<text class="signature-text">{{friendInfo.bio || '暂无简介'}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 个人标签区域 -->
|
||||
<view class="profile-tabs">
|
||||
<scroll-view scroll-x="true" class="tab-scroll" enable-flex="true">
|
||||
<view class="tab-item" wx:if="{{friendInfo.gender !== null && friendInfo.gender !== undefined && friendInfo.gender !== ''}}">
|
||||
<image wx:if="{{friendInfo.gender === 1 || friendInfo.gender === '1' || friendInfo.gender === 2 || friendInfo.gender === '2'}}" class="gender-icon" src="{{friendInfo.gender === 1 || friendInfo.gender === '1' ? '/images/self/male.svg' : '/images/self/fmale.svg'}}" mode="aspectFit" />
|
||||
<text wx:else>?</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{calculatedAge !== null && calculatedAge !== undefined || friendInfo.age}}">
|
||||
<text> {{calculatedAge !== null && calculatedAge !== undefined ? calculatedAge : ((friendInfo.age + "岁") || '')}}</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{friendInfo.mood && friendInfo.mood !== ''}}">
|
||||
<text> {{friendInfo.mood}}</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{friendInfo.mbtiType && friendInfo.mbtiType !== ''}}">
|
||||
<text> {{friendInfo.mbtiType}}</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{friendInfo.identity && friendInfo.identity !== ''}}">
|
||||
<text> {{friendInfo.identity}}</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{friendInfo.zodiacSign && friendInfo.zodiacSign !== ''}}">
|
||||
<text> {{friendInfo.zodiacSign}}</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{friendInfo.school && friendInfo.school !== ''}}">
|
||||
<text> {{friendInfo.school}}</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{friendInfo.occupation && friendInfo.occupation !== ''}}">
|
||||
<text> {{friendInfo.occupation}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 好友足迹(完全仿 profile.wxml 的 myfootprint 模块) -->
|
||||
<!-- <view class="myfootprint">
|
||||
<view class="footprint-title">{{friendInfo.remark || friendInfo.nickname}}的足迹</view>
|
||||
<image class="footprint-earth" src="/images/self/earth.png" mode="aspectFit"/>
|
||||
<view class="footprint-badge">
|
||||
<text>{{footprints && footprints.length ? footprints.length + '个足迹' : '暂无足迹'}}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 新增两个渐变圆角容器 -->
|
||||
<!-- <view class="footprint-gradient-row">
|
||||
<view class="footprint-gradient-box footprint-gradient-yellow"></view>
|
||||
<view class="footprint-gradient-box footprint-gradient-blue"></view>
|
||||
</view> -->
|
||||
|
||||
<!-- 操作按钮区 -->
|
||||
<view class="detail-action-buttons">
|
||||
<view class="detail-action-btn-wrapper" bindtap="sendMessage">
|
||||
<view class="detail-action-btn">
|
||||
<text>消息</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-action-btn-wrapper" bindtap="setRemark">
|
||||
<view class="detail-action-btn">
|
||||
<text>备注</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 详细信息 -->
|
||||
<view class="detail-sections">
|
||||
<!-- 危险操作 -->
|
||||
<view class="detail-section danger-section">
|
||||
<view class="danger-item" bindtap="deleteFriend">
|
||||
<text class="danger-text">删除好友</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部安全区域 -->
|
||||
<view class="safe-area-bottom"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
915
subpackages/social/friend-detail/friend-detail.wxss
Normal file
915
subpackages/social/friend-detail/friend-detail.wxss
Normal file
|
|
@ -0,0 +1,915 @@
|
|||
/* 足迹下方两个容器并排平分整行 */
|
||||
.footprint-gradient-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 32rpx;
|
||||
width: 100%;
|
||||
margin: 32rpx auto;
|
||||
}
|
||||
.footprint-gradient-row .footprint-gradient-box {
|
||||
width: 100%;
|
||||
height: 332rpx;
|
||||
border-radius: 40rpx;
|
||||
margin: 0;
|
||||
}
|
||||
/* 足迹下方两个渐变圆角容器样式 */
|
||||
.footprint-gradient-box {
|
||||
width: 100%;
|
||||
height: 332rpx;
|
||||
border-radius: 40rpx;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.footprint-gradient-yellow {
|
||||
background: linear-gradient(180deg, rgba(255, 255, 255, 0.31) 60%,#fff600 160%);
|
||||
}
|
||||
|
||||
.footprint-gradient-blue {
|
||||
background: linear-gradient(110deg, #139dff 10%, #3137ea 50%, #3bc493 100%);
|
||||
}
|
||||
/* 足迹模块样式(完全复制 profile.wxss) */
|
||||
.myfootprint{
|
||||
margin: 30rpx 0;
|
||||
padding: 20rpx;
|
||||
border-radius: 20rpx;
|
||||
background: linear-gradient(135deg, #34a853 0%, #7b4397 50%, #4285f4 100%);
|
||||
position: relative;
|
||||
height: 200rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* 左上角:足迹标题 */
|
||||
.footprint-title {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
left: 20rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* 中间:地球图标 */
|
||||
.footprint-earth {
|
||||
width: 560rpx;
|
||||
height: 120rpx;
|
||||
position: relative;
|
||||
top: 61%;
|
||||
left: 40%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* 右下角:足迹信息白色 pill */
|
||||
.footprint-badge {
|
||||
position: absolute;
|
||||
bottom: 20rpx;
|
||||
right: 20rpx;
|
||||
background: #fff;
|
||||
padding: 0 20rpx;
|
||||
border-radius: 10rpx;
|
||||
font-size: 24rpx;
|
||||
height:56rpx;
|
||||
line-height: 56rpx;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.footprint-badge text {
|
||||
font-size: 24rpx;
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
}
|
||||
/* 好友详情页面样式 */
|
||||
.friend-detail-container {
|
||||
min-height: 100vh;
|
||||
/* 渐变页面背景 - 从右下角往上,深变浅 */
|
||||
background: radial-gradient(ellipse at right bottom, #1c3954 0%, #1d3c7c 40%, #193170 70%, rgba(25, 49, 112, 0.8) 100%);
|
||||
}
|
||||
|
||||
/* 自定义导航栏已移除,使用系统导航栏 */
|
||||
.profile-info{
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
/* 加载状态 */
|
||||
.loading-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border: 3px solid #f3f3f3;
|
||||
border-top: 3px solid #007aff;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
margin-top: 12px;
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 详情内容 */
|
||||
.detail-content {
|
||||
height: 100vh; /* 系统导航下全屏滚动 */
|
||||
padding: 12px 14px 24px 14px;
|
||||
box-sizing: border-box;
|
||||
/* 与页面保持一致的渐变背景 - 从右下角往上,深变浅 */
|
||||
background: radial-gradient(ellipse at right bottom, #1c3954 0%, #1d3c7c 40%, #193170 70%, rgba(25, 49, 112, 0.8) 100%);
|
||||
}
|
||||
|
||||
/* 统一头像区域为 profile 页的布局与尺寸 */
|
||||
.profile-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.avatar-container {
|
||||
width: 186rpx;
|
||||
height: 186rpx;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
border-radius: 50%;
|
||||
border: 10rpx solid #193170;
|
||||
transition: all 0.3s ease;
|
||||
backdrop-filter: blur(20rpx);
|
||||
-webkit-backdrop-filter: blur(20rpx);
|
||||
margin-left: 46rpx;
|
||||
}
|
||||
|
||||
.avatar-container:active {
|
||||
transform: scale(0.95);
|
||||
box-shadow: 0 8rpx 32rpx rgba(102, 126, 234, 0.4);
|
||||
}
|
||||
|
||||
.avatar-image {
|
||||
width: 166rpx;
|
||||
height: 166rpx;
|
||||
object-fit: cover;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.avatar-decoration {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 15rpx;
|
||||
transform: translateX(-50%) rotate(-15deg);
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
font-size: 56rpx;
|
||||
line-height: 70rpx;
|
||||
text-align: center;
|
||||
z-index: 3;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-shadow: 0 0 10rpx rgba(255, 215, 0, 0.8);
|
||||
filter: drop-shadow(0 2rpx 4rpx rgba(0, 0, 0, 0.3));
|
||||
}
|
||||
|
||||
.online-status.online {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 5rpx;
|
||||
width: 32rpx;
|
||||
z-index: 2;
|
||||
height: 32rpx;
|
||||
background: #4CAF50;
|
||||
border: 3rpx solid #ffffff;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 0 4rpx rgba(76, 175, 80, 0.3);
|
||||
animation: pulse 2s infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% { box-shadow: 0 0 0 0 rgba(76,175,80,0.4); }
|
||||
70% { box-shadow: 0 0 0 10rpx rgba(76,175,80,0); }
|
||||
100% { box-shadow: 0 0 0 0 rgba(76,175,80,0); }
|
||||
}
|
||||
|
||||
/* 信息卡片 */
|
||||
.info-card {
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
.basic-info {
|
||||
display: flex;
|
||||
margin-bottom: 14px;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.avatar-section {
|
||||
position: relative;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
.friend-avatar {
|
||||
width: 74px;
|
||||
height: 74px;
|
||||
/* 改为圆形头像 */
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
|
||||
}
|
||||
|
||||
.avatar-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.avatar-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg,#dadfe4,#cfd5db);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.avatar-text {
|
||||
font-size: 32px;
|
||||
color: #999;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.member-badge {
|
||||
position: absolute;
|
||||
bottom: -4px;
|
||||
right: -4px;
|
||||
background: linear-gradient(45deg, #ff6b6b, #ffa500);
|
||||
border-radius: 8px;
|
||||
padding: 2px 6px;
|
||||
}
|
||||
|
||||
.member-text {
|
||||
font-size: 10px;
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.info-section {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.friend-name {
|
||||
font-size: 19px;
|
||||
font-weight: 600;
|
||||
color: #222;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.gender-icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.gender-text {
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.friend-id {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
margin-bottom: 4px; /* 与简介垂直间距更紧凑 */
|
||||
display: block; /* 独占一行,避免与简介挤在同一行 */
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.friend-bio {
|
||||
font-size: 13px;
|
||||
color: #555;
|
||||
line-height: 1.45;
|
||||
margin-bottom: 10px;
|
||||
display: block; /* 独占一行 */
|
||||
white-space: normal; /* 确保可换行 */
|
||||
}
|
||||
|
||||
.friendship-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.friendship-text {
|
||||
font-size: 13px;
|
||||
color: #007aff;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.friendship-days {
|
||||
font-size: 12px;
|
||||
color: #007aff;
|
||||
}
|
||||
|
||||
/* 操作按钮 */
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
flex: 1;
|
||||
height: 42px;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.action-btn.primary {
|
||||
background: linear-gradient(135deg,#4d7dff,#246bff);
|
||||
box-shadow: 0 4px 10px rgba(36,107,255,0.25);
|
||||
}
|
||||
|
||||
.action-btn.secondary {
|
||||
background: #f0f3f7;
|
||||
}
|
||||
|
||||
.btn-icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
/* font-size: 15px; */
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.action-btn.primary .btn-text {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.action-btn.secondary .btn-text {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 详细信息区域 */
|
||||
.detail-sections {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.detail-section {
|
||||
background-color: #fff;
|
||||
border-radius: 14px;
|
||||
overflow: hidden;
|
||||
border: 1px solid #f1f2f5;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
|
||||
}
|
||||
|
||||
.section-header {
|
||||
padding: 14px 16px 6px 16px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #222;
|
||||
letter-spacing: .5px;
|
||||
}
|
||||
|
||||
/* 信息项 */
|
||||
.info-items {
|
||||
padding: 0 16px 14px 16px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 0;
|
||||
border-bottom: 1px solid #f1f2f5;
|
||||
}
|
||||
|
||||
.info-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.item-label {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.item-value {
|
||||
font-size: 14px;
|
||||
color: #222;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* 位置信息 */
|
||||
.location-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 14px 16px 14px 16px;
|
||||
}
|
||||
|
||||
.location-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.location-icon {
|
||||
font-size: 16px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.location-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.location-address {
|
||||
font-size: 14px;
|
||||
color: #222;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.location-time {
|
||||
margin-left: 20px;
|
||||
font-size: 11px;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.location-arrow {
|
||||
font-size: 16px;
|
||||
color: #c7c7cc;
|
||||
}
|
||||
|
||||
/* 设置项 */
|
||||
.setting-items {
|
||||
padding: 0 16px 12px 16px;
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 14px 0;
|
||||
border-bottom: 1px solid #f1f2f5;
|
||||
}
|
||||
|
||||
.setting-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.setting-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.setting-icon {
|
||||
font-size: 16px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.setting-label {
|
||||
font-size: 14px;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
.setting-arrow {
|
||||
font-size: 16px;
|
||||
color: #c7c7cc;
|
||||
}
|
||||
|
||||
/* .setting-switch 已移除(消息免打扰/置顶聊天功能暂不提供) */
|
||||
|
||||
|
||||
.detail-section.danger-section {
|
||||
background-color: #5c8bff;
|
||||
border-radius: 44rpx;
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.danger-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
|
||||
.danger-text {
|
||||
font-size: 14px;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
letter-spacing: .5px;
|
||||
}
|
||||
|
||||
/* 底部安全区域 */
|
||||
.safe-area-bottom {
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.verified-tag-p {
|
||||
width: 32rpx;
|
||||
height: 40rpx;
|
||||
display: block;
|
||||
object-fit: contain;
|
||||
}
|
||||
.verify-btn-p {
|
||||
width: 32rpx;
|
||||
height: 40rpx;
|
||||
display: block;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
/* profile-name-row 样式(仿照 profile.wxml) */
|
||||
.profile-name-row {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.profile-name {
|
||||
font-size: 36rpx;
|
||||
white-space: normal;
|
||||
word-wrap: break-word;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.gender-badge {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
color: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.gender-badge .gender-icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.vip-crown {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
color: #ffd700;
|
||||
}
|
||||
|
||||
/* profile-id 样式(仿照 profile.wxml) */
|
||||
.profile-id {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.id-label {
|
||||
font-size: 28rpx;
|
||||
color: #f3f3f3;
|
||||
font-weight: 400;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.id-value-wrapper {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 10rpx 8rpx;
|
||||
margin-right: 12rpx;
|
||||
border-radius: 8rpx;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.id-value-wrapper:active {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.id-value {
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
font-weight: 400;
|
||||
font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
|
||||
}
|
||||
|
||||
.verify-btn {
|
||||
color: white;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
padding: 6rpx 20rpx;
|
||||
margin-left: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.verified-tag {
|
||||
color: #fa6294;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
padding: 6rpx 20rpx;
|
||||
border-radius: 24rpx;
|
||||
margin-left: 16rpx;
|
||||
border: 1rpx solid #50a853;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.verify-text,
|
||||
.verified-text {
|
||||
font-size: 24rpx;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/* profile-bottom 样式(仿照 profile.wxml) */
|
||||
.profile-bottom {
|
||||
background: linear-gradient(123deg, #8361FB 15.54%, #70AAFC 39.58%, #F0F8FB 62.43%, #F07BFF 90.28%);
|
||||
border-radius: 28rpx;
|
||||
gap: 32rpx;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
margin-top: -60rpx;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
width: fit-content;
|
||||
margin-left: auto;
|
||||
justify-content: flex-end;
|
||||
gap: 4rpx;
|
||||
padding-top: 20rpx;
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
|
||||
.qr-code-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.qr-code-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
background: linear-gradient(124deg, #FF6460 1.58%, #EC42C8 34.28%, #435CFF 54%, #00D5FF 84.05%);
|
||||
border-radius: 30rpx;
|
||||
padding: 0 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 20rpx;
|
||||
transition: all 0.2s ease;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.edit-icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.edit-text {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.setting-btn {
|
||||
padding: 0 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
transition: all 0.2s ease;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.setting-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.profile-location {
|
||||
background: rgba(43, 43, 43, 1);
|
||||
max-width: 80%;
|
||||
width: fit-content;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #36393e;
|
||||
border-radius: 24rpx;
|
||||
min-height: 48rpx;
|
||||
padding: 0 20rpx;
|
||||
margin-left: 32rpx;
|
||||
margin-top: -10rpx;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
.location-icon {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.location-text-qr {
|
||||
color: #ffffff;
|
||||
font-size: 24rpx;
|
||||
white-space: nowrap;
|
||||
margin-right: 20rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.location-arrow {
|
||||
font-size: 36rpx;
|
||||
color: #ffffff;
|
||||
margin-left: auto;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.profile-signature {
|
||||
height: 240rpx;
|
||||
max-height: 240rpx;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
padding: 24rpx;
|
||||
background: rgba(90, 90, 90, 0.548);
|
||||
border-radius: 24rpx;
|
||||
backdrop-filter: blur(20rpx);
|
||||
-webkit-backdrop-filter: blur(20rpx);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.2);
|
||||
box-shadow: 0 8rpx 12rpx rgba(0, 0, 0, 0.1), inset 0 0 20rpx rgba(255, 255, 255, 0.1);
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
margin: 22rpx 32rpx;
|
||||
}
|
||||
|
||||
.signature-text {
|
||||
font-size: 30rpx;
|
||||
color: #000000;
|
||||
margin: auto;
|
||||
font-weight: 400;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
white-space: pre-wrap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.profile-tabs {
|
||||
width: 100%;
|
||||
margin-bottom: 1rem;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
.tab-scroll {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
margin-top: .5rem;
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
height: 36rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: white;
|
||||
padding: 0 20rpx;
|
||||
border-radius: 20rpx;
|
||||
background: rgba(90, 90, 90, 0.548);
|
||||
transition: all 0.2s;
|
||||
margin-left: .3rem;
|
||||
margin-right: .3rem;
|
||||
}
|
||||
|
||||
/* 详细信息上方操作按钮 */
|
||||
.detail-action-buttons {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 32rpx 0;
|
||||
padding: 0 30rpx;
|
||||
gap: 30rpx;
|
||||
}
|
||||
|
||||
.detail-action-btn-wrapper {
|
||||
flex: 1;
|
||||
height: 64rpx;
|
||||
border-radius: 32rpx;
|
||||
padding: 2rpx;
|
||||
background: linear-gradient(180deg, #4e4e4e 0%, #404040 100%);
|
||||
}
|
||||
|
||||
.detail-action-btn {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 30rpx;
|
||||
background: linear-gradient(180deg, #000 0%, #232323 100%);
|
||||
}
|
||||
|
||||
.detail-action-btn text {
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/* ================== 暗色主题覆盖(社交-好友详情) ================== */
|
||||
/* 说明:仅在已将页面背景设为深色后,统一卡片/文字暗化;若未来引入全局切换可抽离为公共 .theme-dark */
|
||||
.friend-detail-container .detail-section {
|
||||
background-color: #1e1e1e;
|
||||
border: 1px solid #2a2a2a;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.6);
|
||||
}
|
||||
|
||||
/* 渐变背景已改成深色,如需更低明度可再调:#1a1a1a → #121212 */
|
||||
|
||||
/* 次级浅色按钮背景 */
|
||||
.friend-detail-container .action-btn.secondary {
|
||||
background: #2a2a2a;
|
||||
}
|
||||
.friend-detail-container .action-btn.secondary .btn-text { color: #e0e0e0; }
|
||||
|
||||
/* 信息分区的分隔线颜色调整 */
|
||||
.friend-detail-container .info-item,
|
||||
.friend-detail-container .setting-item {
|
||||
border-bottom: 1px solid #2a2a2a;
|
||||
}
|
||||
.friend-detail-container .info-item:last-child,
|
||||
.friend-detail-container .setting-item:last-child { border-bottom: none; }
|
||||
|
||||
/* 文字颜色层级:主文案 #f5f5f5;次级 #b0b0b0;弱化 #777 → #6b6b6b */
|
||||
.friend-detail-container .friend-name,
|
||||
.friend-detail-container .section-title,
|
||||
.friend-detail-container .item-value,
|
||||
.friend-detail-container .location-address,
|
||||
.friend-detail-container .setting-label,
|
||||
.friend-detail-container .danger-text { color: #ffffff; }
|
||||
|
||||
.friend-detail-container .friend-bio,
|
||||
.friend-detail-container .item-label,
|
||||
.friend-detail-container .friendship-text,
|
||||
.friend-detail-container .friendship-days,
|
||||
.friend-detail-container .friend-id,
|
||||
.friend-detail-container .location-time { color: #b0b0b0; }
|
||||
|
||||
|
||||
/* 危险区背景保持融合 */
|
||||
.friend-detail-container .detail-section.danger-section {
|
||||
background-color: #5c8bff;
|
||||
border-radius: 44rpx;
|
||||
height: 88rpx;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* 占位/淡色背景统一 */
|
||||
.friend-detail-container .avatar-placeholder { background: #fff; }
|
||||
|
||||
/* 提示、加载文字 */
|
||||
.friend-detail-container .loading-text { color: #888; }
|
||||
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;
|
||||
}
|
||||
176
subpackages/social/friend-selector/friend-selector.js
Normal file
176
subpackages/social/friend-selector/friend-selector.js
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
// 选择好友页面
|
||||
const app = getApp();
|
||||
const apiClient = require('../../../utils/api-client.js');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
// 好友列表
|
||||
friends: [],
|
||||
// 选中的好友列表(多选)
|
||||
selectedFriends: [],
|
||||
// 搜索关键词
|
||||
searchKeyword: '',
|
||||
// 加载状态
|
||||
loading: false,
|
||||
// 模式:partial_visible 或 exclude_friends
|
||||
mode: 'partial_visible'
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
// 获取传递的参数
|
||||
let selectedFriendsStr = options.selectedFriends || '[]';
|
||||
const mode = options.mode || 'partial_visible';
|
||||
|
||||
// 如果参数被编码了,需要解码
|
||||
try {
|
||||
selectedFriendsStr = decodeURIComponent(selectedFriendsStr);
|
||||
} catch (e) {
|
||||
// 如果解码失败,使用原始值
|
||||
console.log('参数未编码,使用原始值');
|
||||
}
|
||||
|
||||
try {
|
||||
const selectedFriends = JSON.parse(selectedFriendsStr);
|
||||
this.setData({
|
||||
selectedFriends: selectedFriends || [],
|
||||
mode: mode
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('解析选中的好友失败:', e);
|
||||
this.setData({
|
||||
selectedFriends: [],
|
||||
mode: mode
|
||||
});
|
||||
}
|
||||
|
||||
// 加载好友列表(在设置 selectedFriends 之后)
|
||||
this.loadFriends();
|
||||
},
|
||||
|
||||
// 加载好友列表
|
||||
loadFriends() {
|
||||
// TODO: 调用API加载好友列表
|
||||
this.setData({ loading: true });
|
||||
|
||||
// 示例数据
|
||||
setTimeout(() => {
|
||||
const friends = [
|
||||
{ id: 1, nickname: '张三', avatar: '/images/default-avatar.png', customId: 'user001' },
|
||||
{ id: 2, nickname: '李四', avatar: '/images/default-avatar.png', customId: 'user002' },
|
||||
{ id: 3, nickname: '王五', avatar: '/images/default-avatar.png', customId: 'user003' },
|
||||
{ id: 4, nickname: '赵六', avatar: '/images/default-avatar.png', customId: 'user004' },
|
||||
{ id: 5, nickname: '孙七', avatar: '/images/default-avatar.png', customId: 'user005' },
|
||||
{ id: 6, nickname: '周八', avatar: '/images/default-avatar.png', customId: 'user006' }
|
||||
];
|
||||
|
||||
// 为每个好友添加 isSelected 属性
|
||||
this.updateFriendsSelection(friends);
|
||||
|
||||
this.setData({
|
||||
friends: friends,
|
||||
loading: false
|
||||
});
|
||||
}, 500);
|
||||
},
|
||||
|
||||
// 更新好友的选中状态
|
||||
updateFriendsSelection(friends) {
|
||||
const { selectedFriends } = this.data;
|
||||
if (!friends || !selectedFriends) return;
|
||||
|
||||
friends.forEach(friend => {
|
||||
friend.isSelected = selectedFriends.some(selected => selected.id === friend.id);
|
||||
});
|
||||
},
|
||||
|
||||
// 选择好友(多选)
|
||||
selectFriend(e) {
|
||||
const friendId = e.currentTarget.dataset.friendId;
|
||||
const friend = this.data.friends.find(f => f.id === friendId);
|
||||
|
||||
if (!friend) return;
|
||||
|
||||
const selectedFriends = [...this.data.selectedFriends];
|
||||
const index = selectedFriends.findIndex(f => f.id === friendId);
|
||||
|
||||
if (index > -1) {
|
||||
// 取消选择
|
||||
selectedFriends.splice(index, 1);
|
||||
friend.isSelected = false;
|
||||
} else {
|
||||
// 选择
|
||||
selectedFriends.push(friend);
|
||||
friend.isSelected = true;
|
||||
}
|
||||
|
||||
this.setData({
|
||||
selectedFriends: selectedFriends,
|
||||
friends: this.data.friends
|
||||
});
|
||||
},
|
||||
|
||||
// 搜索输入
|
||||
onSearchInput(e) {
|
||||
this.setData({
|
||||
searchKeyword: e.detail.value
|
||||
});
|
||||
},
|
||||
|
||||
// 确认选择
|
||||
confirmSelection() {
|
||||
const { selectedFriends, mode } = this.data;
|
||||
|
||||
// 检查是否选择了好友
|
||||
if (!selectedFriends || selectedFriends.length === 0) {
|
||||
wx.showToast({
|
||||
title: '请选择好友',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 计算好友总数
|
||||
const friendsCount = selectedFriends.length;
|
||||
|
||||
// 生成显示文本:多个好友昵称,用逗号分隔
|
||||
const displayText = selectedFriends.map(friend => friend.nickname).join(',');
|
||||
|
||||
// 返回上一页并传递选中的好友
|
||||
const pages = getCurrentPages();
|
||||
const prevPage = pages[pages.length - 2];
|
||||
|
||||
if (prevPage) {
|
||||
if (mode === 'exclude_friends') {
|
||||
// 排除模式
|
||||
if (typeof prevPage.updateExcludeFriends === 'function') {
|
||||
prevPage.updateExcludeFriends(selectedFriends, friendsCount, displayText);
|
||||
}
|
||||
} else {
|
||||
// 部分可见模式
|
||||
if (typeof prevPage.updateSelectedFriends === 'function') {
|
||||
prevPage.updateSelectedFriends(selectedFriends, friendsCount, displayText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wx.navigateBack();
|
||||
},
|
||||
|
||||
// 获取过滤后的好友列表
|
||||
getFilteredFriends() {
|
||||
const { friends, searchKeyword } = this.data;
|
||||
if (!searchKeyword) {
|
||||
return friends;
|
||||
}
|
||||
return friends.filter(friend => {
|
||||
return friend.nickname.toLowerCase().includes(searchKeyword.toLowerCase());
|
||||
});
|
||||
},
|
||||
|
||||
// 返回
|
||||
navigateBack() {
|
||||
wx.navigateBack();
|
||||
}
|
||||
});
|
||||
|
||||
8
subpackages/social/friend-selector/friend-selector.json
Normal file
8
subpackages/social/friend-selector/friend-selector.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"navigationBarTitleText": "选择好友",
|
||||
"navigationBarBackgroundColor": "#000000",
|
||||
"navigationBarTextStyle": "white",
|
||||
"backgroundColor": "#000000",
|
||||
"disableScroll": false
|
||||
}
|
||||
|
||||
75
subpackages/social/friend-selector/friend-selector.wxml
Normal file
75
subpackages/social/friend-selector/friend-selector.wxml
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<view class="friend-selector-container">
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-container">
|
||||
<view class="search-box">
|
||||
<input
|
||||
class="search-input"
|
||||
type="text"
|
||||
placeholder="search"
|
||||
value="{{searchKeyword}}"
|
||||
bindinput="onSearchInput"
|
||||
/>
|
||||
<image class="search-icon" src="/images/Search.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 已选择好友显示容器 -->
|
||||
<view wx:if="{{selectedFriends.length > 0}}" class="selected-friends-container">
|
||||
|
||||
<scroll-view
|
||||
class="selected-avatars-scroll"
|
||||
scroll-x="{{true}}"
|
||||
enable-flex="{{true}}"
|
||||
show-scrollbar="{{false}}"
|
||||
>
|
||||
<view class="selected-content-row">
|
||||
<view class="selected-friends-info">
|
||||
<text class="selected-friends-text">已选择好友</text>
|
||||
<text class="selected-friends-count">{{selectedFriends.length}}</text>
|
||||
<text class="selected-friends-text">个好友</text>
|
||||
</view>
|
||||
<view class="selected-avatars-list">
|
||||
<block wx:for="{{selectedFriends}}" wx:key="id" wx:for-item="selectedFriend">
|
||||
<image
|
||||
class="selected-avatar"
|
||||
src="{{selectedFriend.avatar || '/images/default-avatar.png'}}"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 好友列表 -->
|
||||
<scroll-view class="content-scroll" scroll-y>
|
||||
<view class="friends-list">
|
||||
<block wx:for="{{friends}}" wx:key="id" wx:for-item="friend">
|
||||
<view
|
||||
class="friend-item {{friend.isSelected ? 'selected' : ''}}"
|
||||
bindtap="selectFriend"
|
||||
data-friend-id="{{friend.id}}"
|
||||
>
|
||||
<view class="friend-row">
|
||||
<view class="friend-checkbox">
|
||||
<view class="checkbox {{friend.isSelected ? 'checked' : ''}}">
|
||||
<image wx:if="{{friend.isSelected}}" src="/images/Selected.svg" mode="aspectFit" class="check-image"></image>
|
||||
<image wx:else src="/images/fram.svg" mode="aspectFit" class="uncheck-image"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="friend-main">
|
||||
<image class="friend-avatar" src="{{friend.avatar || '/images/default-avatar.png'}}" mode="aspectFill"></image>
|
||||
<text class="friend-name">{{friend.nickname}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 底部完成按钮 -->
|
||||
<view class="bottom-action">
|
||||
<button class="confirm-btn" bindtap="confirmSelection">完成</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
227
subpackages/social/friend-selector/friend-selector.wxss
Normal file
227
subpackages/social/friend-selector/friend-selector.wxss
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
/* 页面根容器 */
|
||||
page {
|
||||
background: linear-gradient(180deg, #0a0910 0%, #06151d 50%, #022027 100%);
|
||||
color: #ffffff;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
/* 主容器 */
|
||||
.friend-selector-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
background: linear-gradient(180deg, #0a0910 0%, #06151d 50%, #022027 100%);
|
||||
}
|
||||
|
||||
/* 搜索框容器 */
|
||||
.search-container {
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #202529;
|
||||
border-radius: 50rpx;
|
||||
padding: 20rpx 30rpx;
|
||||
border: 2rpx solid #d9d9d9;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.search-input::placeholder {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
/* 已选择好友显示容器 */
|
||||
.selected-friends-container {
|
||||
padding: 20rpx 30rpx;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/* 已选择头像滚动区域 */
|
||||
.selected-avatars-scroll {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.selected-content-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
padding: 0 10rpx;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.selected-friends-info {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
margin-right: 20rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.selected-friends-text {
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.selected-friends-count {
|
||||
font-size: 32rpx;
|
||||
background: linear-gradient(90deg, #e90abb, #fbcb09);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
font-weight: bold;
|
||||
margin: 0 5rpx;
|
||||
}
|
||||
|
||||
.selected-avatars-list {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.selected-avatar {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
border: 2rpx solid #435cff;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.selected-avatar:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
/* 内容滚动区域 */
|
||||
.content-scroll {
|
||||
flex: 1;
|
||||
overflow-y: scroll;
|
||||
padding-bottom: 180rpx;
|
||||
}
|
||||
|
||||
/* 好友列表 */
|
||||
.friends-list {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
/* 好友项 */
|
||||
.friend-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 30rpx;
|
||||
background-color: #20252910;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
|
||||
.friend-item.selected {
|
||||
background-color: #20252910;
|
||||
}
|
||||
|
||||
/* 好友行(checkbox 和 friend-main 在一行) */
|
||||
.friend-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 好友复选框 */
|
||||
.friend-checkbox {
|
||||
margin-right: 30rpx;
|
||||
margin-left: 20rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.checkbox.checked {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/* 选中图标样式 */
|
||||
.check-image {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.uncheck-image {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* 好友主要内容 */
|
||||
.friend-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.friend-avatar {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
background-color: #333333;
|
||||
}
|
||||
|
||||
.friend-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* 底部操作按钮 */
|
||||
.bottom-action {
|
||||
position: fixed;
|
||||
bottom: 40rpx;
|
||||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
padding: 10rpx;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
width: 200rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
background-image: linear-gradient(90deg, #ff6460, #ec42c8, #435cff, #00d3ff);
|
||||
color: #ffffff;
|
||||
border-radius: 50rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
border: none;
|
||||
letter-spacing: 4rpx;
|
||||
}
|
||||
|
||||
438
subpackages/social/search/search.js
Normal file
438
subpackages/social/search/search.js
Normal file
|
|
@ -0,0 +1,438 @@
|
|||
// 搜索用户页面
|
||||
const app = getApp();
|
||||
const friendAPI = require('../../../utils/friend-api.js');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
// 搜索相关
|
||||
searchKeyword: '',
|
||||
searchResults: [],
|
||||
loading: false,
|
||||
hasSearched: false,
|
||||
|
||||
// 搜索类型
|
||||
searchType: 'all', // all, nickname, custom_id, phone
|
||||
searchTypes: [
|
||||
{ value: 'all', label: '全部' },
|
||||
{ value: 'nickname', label: '昵称' },
|
||||
{ value: 'custom_id', label: 'ID' },
|
||||
{ value: 'phone', label: '手机号' }
|
||||
],
|
||||
|
||||
// 分页
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
hasMore: true,
|
||||
|
||||
// 系统信息
|
||||
statusBarHeight: 0,
|
||||
navBarHeight: 0,
|
||||
scanningUser: false,
|
||||
scanCache: {} // { customId: { timestamp, relationStatus } }
|
||||
},
|
||||
// 扫一扫二维码(识别 FINDME 格式并跳转)
|
||||
scanQRCode() {
|
||||
wx.scanCode({
|
||||
onlyFromCamera: false,
|
||||
success: async (res) => {
|
||||
const scanResult = res.result || '';
|
||||
|
||||
// 解析 FINDME 格式:FINDME:customId
|
||||
if (scanResult.startsWith('FINDME:')) {
|
||||
const customId = scanResult.replace('FINDME:', '').trim();
|
||||
|
||||
// 检查是否是好友关系
|
||||
this.checkFriendRelationFromScan(customId);
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '无法识别二维码内容',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
// 用户取消不提示错误
|
||||
if (err.errMsg && !err.errMsg.includes('cancel')) {
|
||||
wx.showToast({
|
||||
title: '扫码失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 检查好友关系(从扫码调用)
|
||||
async checkFriendRelationFromScan(customId) {
|
||||
if (this.data.scanningUser) return;
|
||||
this.setData({ scanningUser: true });
|
||||
wx.showLoading({ title: '加载中...', mask: true });
|
||||
|
||||
const friendDetailResponse = await friendAPI.getFriendDetail(customId).catch(() => null);
|
||||
wx.hideLoading();
|
||||
|
||||
const isFriend = friendDetailResponse?.code === 0 && friendDetailResponse?.data;
|
||||
this.setData({ scanningUser: false });
|
||||
this.navigateToUserDetail(customId, isFriend);
|
||||
},
|
||||
|
||||
// 跳转到用户详情页面
|
||||
navigateToUserDetail(customId, isFriend = false) {
|
||||
const url = isFriend
|
||||
? `/subpackages/social/friend-detail/friend-detail?customId=${customId}`
|
||||
: `/subpackages/social/user-preview/user-preview?customId=${customId}`;
|
||||
|
||||
wx.navigateTo({
|
||||
url: url,
|
||||
fail: (err) => {
|
||||
console.error('跳转失败:', err);
|
||||
wx.showToast({ title: '跳转失败,请重试', icon: 'none' });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
async fetchScannedUserBasicInfo(customId) {
|
||||
try {
|
||||
// 使用精确ID搜索
|
||||
const resp = await friendAPI.searchUsers(customId, 'custom_id', 1, 1);
|
||||
const users = resp?.data?.users || [];
|
||||
const user = users[0];
|
||||
wx.hideLoading();
|
||||
if (!user) {
|
||||
wx.showToast({ title: '用户不存在', icon: 'none' });
|
||||
this.setData({ scanningUser: false });
|
||||
return;
|
||||
}
|
||||
|
||||
// 非好友:跳转预览页面
|
||||
this.setData({ scanningUser: false });
|
||||
wx.navigateTo({
|
||||
url: `/subpackages/social/user-preview/user-preview?customId=${customId}`,
|
||||
fail: (err) => {
|
||||
console.warn('navigateTo user-preview 失败,尝试 redirectTo:', err);
|
||||
wx.redirectTo({ url: `/subpackages/social/user-preview/user-preview?customId=${customId}` });
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
wx.hideLoading();
|
||||
console.error('查询用户失败:', error);
|
||||
wx.showToast({ title: '查询失败', icon: 'none' });
|
||||
this.setData({ scanningUser: false });
|
||||
}
|
||||
},
|
||||
|
||||
handleGenericScan(raw) {
|
||||
wx.showModal({
|
||||
title: '二维码内容',
|
||||
content: raw.length > 200 ? raw.slice(0,200) + '...' : raw,
|
||||
showCancel: false
|
||||
});
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
|
||||
this.initSystemInfo();
|
||||
|
||||
// 如果有传入的搜索关键词,直接搜索
|
||||
if (options.keyword) {
|
||||
this.setData({
|
||||
searchKeyword: decodeURIComponent(options.keyword)
|
||||
});
|
||||
this.performSearch();
|
||||
}
|
||||
},
|
||||
|
||||
// 初始化系统信息
|
||||
initSystemInfo() {
|
||||
try {
|
||||
// 使用新的API替代已弃用的wx.getSystemInfoSync
|
||||
const windowInfo = wx.getWindowInfo();
|
||||
const menuButton = wx.getMenuButtonBoundingClientRect();
|
||||
|
||||
const statusBarHeight = windowInfo.statusBarHeight || 0;
|
||||
// 使用更紧凑的高度:状态栏
|
||||
const navBarHeight = statusBarHeight;
|
||||
|
||||
this.setData({
|
||||
statusBarHeight,
|
||||
navBarHeight
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('获取系统信息失败,使用兜底方案:', error);
|
||||
// 兜底方案
|
||||
try {
|
||||
const systemInfo = wx.getSystemInfoSync();
|
||||
const statusBarHeight = systemInfo.statusBarHeight || 0;
|
||||
const navBarHeight = statusBarHeight + 36;
|
||||
this.setData({
|
||||
statusBarHeight,
|
||||
navBarHeight
|
||||
});
|
||||
} catch (fallbackError) {
|
||||
console.error('兜底方案也失败了:', fallbackError);
|
||||
// 设置默认值
|
||||
this.setData({
|
||||
statusBarHeight: 20,
|
||||
navBarHeight: 56
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 返回上一页
|
||||
// 已移除自定义返回按钮,使用小程序自带返回
|
||||
|
||||
// 搜索输入
|
||||
onSearchInput(e) {
|
||||
this.setData({
|
||||
searchKeyword: e.detail.value
|
||||
});
|
||||
if(!(e.detail.value)){
|
||||
this.clearSearch()
|
||||
}
|
||||
},
|
||||
|
||||
// 搜索确认
|
||||
onSearchConfirm() {
|
||||
this.performSearch();
|
||||
},
|
||||
|
||||
// 清空搜索
|
||||
clearSearch() {
|
||||
this.setData({
|
||||
searchKeyword: '',
|
||||
searchResults: [],
|
||||
hasSearched: false,
|
||||
currentPage: 1,
|
||||
hasMore: true
|
||||
});
|
||||
},
|
||||
|
||||
// 切换搜索类型
|
||||
onSearchTypeChange(e) {
|
||||
const searchType = e.currentTarget.dataset.type;
|
||||
this.setData({
|
||||
searchType
|
||||
});
|
||||
|
||||
if (this.data.searchKeyword) {
|
||||
this.performSearch();
|
||||
}
|
||||
},
|
||||
|
||||
// 执行搜索
|
||||
async performSearch() {
|
||||
const keyword = this.data.searchKeyword.trim();
|
||||
if (!keyword) {
|
||||
wx.showToast({
|
||||
title: '请输入搜索关键词',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 基于搜索类型的输入校验
|
||||
const { searchType } = this.data;
|
||||
if (searchType === 'custom_id') {
|
||||
// ID: 1-20位纯数字
|
||||
if (!/^\d{1,20}$/.test(keyword)) {
|
||||
wx.showToast({
|
||||
title: 'ID需为1-20位纯数字',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else if (searchType === 'phone') {
|
||||
// 手机号:11位数字
|
||||
if (!/^\d{11}$/.test(keyword)) {
|
||||
wx.showToast({
|
||||
title: '手机号需为11位数字',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
loading: true,
|
||||
currentPage: 1,
|
||||
searchResults: [],
|
||||
hasMore: true
|
||||
});
|
||||
|
||||
try {
|
||||
const response = await friendAPI.searchUsers(
|
||||
keyword,
|
||||
this.data.searchType,
|
||||
1,
|
||||
this.data.pageSize
|
||||
);
|
||||
|
||||
// 根据正确的接口文档处理API响应结构
|
||||
const searchData = response.data || {};
|
||||
const users = searchData.users || [];
|
||||
const total = searchData.total || 0;
|
||||
|
||||
this.setData({
|
||||
searchResults: users,
|
||||
hasSearched: true,
|
||||
hasMore: users.length >= this.data.pageSize && this.data.currentPage * this.data.pageSize < total,
|
||||
loading: false
|
||||
});
|
||||
|
||||
if (users.length === 0) {
|
||||
wx.showToast({
|
||||
title: '未找到相关用户',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('搜索失败:', error);
|
||||
this.setData({
|
||||
loading: false,
|
||||
hasSearched: true
|
||||
});
|
||||
|
||||
wx.showToast({
|
||||
title: error.message || '搜索失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 加载更多
|
||||
async loadMore() {
|
||||
if (!this.data.hasMore || this.data.loading) return;
|
||||
|
||||
this.setData({ loading: true });
|
||||
|
||||
try {
|
||||
const response = await friendAPI.searchUsers(
|
||||
this.data.searchKeyword,
|
||||
this.data.searchType,
|
||||
this.data.currentPage + 1,
|
||||
this.data.pageSize
|
||||
);
|
||||
|
||||
const searchData = response.data || {};
|
||||
const newUsers = searchData.users || [];
|
||||
const total = searchData.total || 0;
|
||||
const newResults = [...this.data.searchResults, ...newUsers];
|
||||
|
||||
this.setData({
|
||||
searchResults: newResults,
|
||||
currentPage: this.data.currentPage + 1,
|
||||
hasMore: newResults.length < total,
|
||||
loading: false
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error('加载更多失败:', error);
|
||||
this.setData({ loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
// 添加好友
|
||||
async addFriend(e) {
|
||||
const { customId, nickname } = e.currentTarget.dataset;
|
||||
|
||||
try {
|
||||
// 显示输入框让用户输入验证消息
|
||||
const result = await this.showAddFriendDialog(nickname);
|
||||
if (!result.confirm) return;
|
||||
|
||||
wx.showLoading({ title: '发送中...' });
|
||||
|
||||
// 输入阶段已限制50字,这里仅做去空白
|
||||
const safeMessage = (result.message || '').trim();
|
||||
await friendAPI.addFriend(customId, safeMessage);
|
||||
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: '好友请求已发送',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 更新按钮状态
|
||||
const updatedResults = this.data.searchResults.map(user => {
|
||||
if (user.customId === customId) {
|
||||
return {
|
||||
...user,
|
||||
relationStatus: 'pending',
|
||||
actionText: '等待验证',
|
||||
canAddFriend: false
|
||||
};
|
||||
}
|
||||
return user;
|
||||
});
|
||||
|
||||
this.setData({
|
||||
searchResults: updatedResults
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
wx.hideLoading();
|
||||
console.error('添加好友失败:', error);
|
||||
wx.showToast({
|
||||
title: error.message || '添加好友失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 显示添加好友对话框
|
||||
showAddFriendDialog(nickname) {
|
||||
return new Promise((resolve) => {
|
||||
try {
|
||||
// 默认文案
|
||||
const selfNick = app.globalData?.userInfo?.user?.nickname || '';
|
||||
const base = `我是 ${selfNick}`;
|
||||
this._addDialogResolve = resolve; // 存到实例属性,避免放到 data
|
||||
this.setData({
|
||||
addDialogVisible: true,
|
||||
addDialogNickname: nickname || '',
|
||||
addDialogMessage: base
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('打开添加好友对话框失败', e);
|
||||
resolve({ confirm: false });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 对话框输入变更(已在组件层 maxlength=50 限制)
|
||||
onAddDialogInput(e) {
|
||||
const value = (e.detail.value || '').slice(0, 50);
|
||||
this.setData({ addDialogMessage: value });
|
||||
},
|
||||
|
||||
// 取消添加
|
||||
onAddDialogCancel() {
|
||||
try { this.setData({ addDialogVisible: false }); } catch (_) {}
|
||||
if (this._addDialogResolve) {
|
||||
this._addDialogResolve({ confirm: false });
|
||||
this._addDialogResolve = null;
|
||||
}
|
||||
},
|
||||
|
||||
// 确认添加
|
||||
onAddDialogConfirm() {
|
||||
const msg = (this.data.addDialogMessage || '').trim();
|
||||
try { this.setData({ addDialogVisible: false }); } catch (_) {}
|
||||
if (this._addDialogResolve) {
|
||||
this._addDialogResolve({ confirm: true, message: msg });
|
||||
this._addDialogResolve = null;
|
||||
}
|
||||
},
|
||||
|
||||
// 发送消息
|
||||
sendMessage(e) {
|
||||
const { customId, nickname } = e.currentTarget.dataset;
|
||||
wx.navigateTo({
|
||||
url: `/pages/message/chat/chat?targetId=${customId}&name=${encodeURIComponent(nickname)}&chatType=0`
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
6
subpackages/social/search/search.json
Normal file
6
subpackages/social/search/search.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"navigationStyle": "default",
|
||||
"navigationBarTitleText": "添加好友",
|
||||
"navigationBarBackgroundColor": "#000000",
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
149
subpackages/social/search/search.wxml
Normal file
149
subpackages/social/search/search.wxml
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
<!-- 搜索用户页面 -->
|
||||
<view class="search-container">
|
||||
|
||||
<!-- 搜索区域 -->
|
||||
<view class="search-section">
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-box {{searchResults && searchResults.length > 0 ? '' :'search-box-top'}}">
|
||||
<view class="search-input-wrapper" >
|
||||
<input class="search-input"
|
||||
placeholder-class="placeholder-style"
|
||||
placeholder="请输入ID/手机号搜索"
|
||||
value="{{searchKeyword}}"
|
||||
bindinput="onSearchInput"
|
||||
bindconfirm="onSearchConfirm"
|
||||
confirm-type="search"
|
||||
focus="true" />
|
||||
<view class="search-btn" bindtap="onSearchConfirm">
|
||||
<image class="search-btn-text" src="../../../images/map/Search.svg" mode=""/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索结果 -->
|
||||
<scroll-view class="results-container"
|
||||
scroll-y="true"
|
||||
bindscrolltolower="loadMore">
|
||||
|
||||
<!-- 加载中 -->
|
||||
<view class="loading-container" wx:if="{{loading && !hasSearched}}">
|
||||
<view class="loading-spinner"></view>
|
||||
<text class="loading-text">搜索中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 无结果 -->
|
||||
<view class="no-results" wx:if="{{hasSearched && searchResults.length === 0 && !loading}}">
|
||||
<view class="no-results-icon">😔</view>
|
||||
<text class="no-results-title">未找到相关用户</text>
|
||||
<text class="no-results-desc">试试其他关键词或搜索方式</text>
|
||||
</view>
|
||||
|
||||
<!-- 搜索结果列表 -->
|
||||
<view class="results-list" wx:if="{{searchResults.length > 0}}">
|
||||
<view class="result-item"
|
||||
wx:for="{{searchResults}}"
|
||||
wx:key="customId">
|
||||
|
||||
<!-- 用户信息 -->
|
||||
<view class="user-info" bindtap="viewUserDetail" data-custom-id="{{item.customId}}">
|
||||
<!-- 头像 -->
|
||||
<view class="user-avatar">
|
||||
<image wx:if="{{item.avatar}}"
|
||||
src="{{item.avatar}}"
|
||||
class="avatar-image"
|
||||
mode="aspectFill" />
|
||||
<view wx:else class="avatar-placeholder">
|
||||
<text class="avatar-text">{{item.nickname ? item.nickname.charAt(0) : '?'}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 会员标识 -->
|
||||
<view class="member-badge" wx:if="{{item.isMember}}">
|
||||
<text class="member-text">VIP</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 用户详情 -->
|
||||
<view class="user-details">
|
||||
<view class="user-name-row">
|
||||
<text class="user-nickname">{{item.nickname}}</text>
|
||||
<view class="gender-icon" wx:if="{{item.gender !== null && item.gender !== undefined && item.gender !== ''}}">
|
||||
<image wx:if="{{item.gender === 1 || item.gender === '1' || item.gender === 2 || item.gender === '2'}}" class="gender-icon-img" src="{{item.gender === 1 || item.gender === '1' ? '/images/self/male.svg' : '/images/self/fmale.svg'}}" mode="aspectFit" />
|
||||
<text wx:else>?</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="user-meta">
|
||||
<text class="user-id">ID: {{item.customId}}</text>
|
||||
<text class="match-type" wx:if="{{item.matchType}}">{{item.matchType === 'nickname' ? '昵称匹配' : item.matchType === 'custom_id' ? 'ID匹配' : '手机号匹配'}}</text>
|
||||
</view>
|
||||
|
||||
<text class="user-bio" wx:if="{{item.bio}}">{{item.bio}}</text>
|
||||
<text class="status-message" wx:if="{{item.statusMessage}}">{{item.statusMessage}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="action-buttons">
|
||||
<!-- 添加好友按钮 -->
|
||||
<view class="action-btn add-btn {{item.canAddFriend ? 'enabled' : 'disabled'}}"
|
||||
wx:if="{{item.relationStatus === 'can_add'}}"
|
||||
bindtap="addFriend"
|
||||
data-custom-id="{{item.customId}}"
|
||||
data-nickname="{{item.nickname}}">
|
||||
<text class="btn-text">{{item.actionText}}</text>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 等待验证 -->
|
||||
<view class="action-btn pending-btn" wx:if="{{item.relationStatus === 'pending'}}">
|
||||
<text class="btn-text">等待验证</text>
|
||||
</view>
|
||||
|
||||
<!-- 已是好友 -->
|
||||
<view class="action-btn friend-btn" wx:if="{{item.relationStatus === 'friend'}}">
|
||||
<text class="btn-text">已是好友</text>
|
||||
</view>
|
||||
|
||||
<!-- 发送消息按钮 -->
|
||||
<view class="action-btn message-btn"
|
||||
wx:if="{{item.relationStatus === 'friend'}}"
|
||||
bindtap="sendMessage"
|
||||
data-custom-id="{{item.customId}}"
|
||||
data-nickname="{{item.nickname}}">
|
||||
<text class="btn-text">发消息</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<view class="load-more" wx:if="{{hasMore && searchResults.length > 0}}">
|
||||
<view class="loading-spinner" wx:if="{{loading}}"></view>
|
||||
<text class="load-more-text">{{loading ? '加载中...' : '上拉加载更多'}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多 -->
|
||||
<view class="no-more" wx:if="{{!hasMore && searchResults.length > 0}}">
|
||||
<text class="no-more-text">没有更多用户了</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 添加好友验证消息对话框 -->
|
||||
<view wx:if="{{addDialogVisible}}" class="add-dialog-mask" catchtouchmove="true">
|
||||
<view class="add-dialog">
|
||||
<view class="add-dialog-title">添加 {{addDialogNickname}} 为好友</view>
|
||||
<textarea class="add-dialog-input"
|
||||
value="{{addDialogMessage}}"
|
||||
placeholder="请输入验证消息(最多50字)"
|
||||
maxlength="50"
|
||||
auto-height="true"
|
||||
bindinput="onAddDialogInput"/>
|
||||
<view class="add-dialog-actions">
|
||||
<button class="add-dialog-btn cancel" bindtap="onAddDialogCancel">取消</button>
|
||||
<button class="add-dialog-btn confirm" bindtap="onAddDialogConfirm">发送</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="add-dialog-safe" style="height: env(safe-area-inset-bottom);"></view>
|
||||
</view>
|
||||
620
subpackages/social/search/search.wxss
Normal file
620
subpackages/social/search/search.wxss
Normal file
|
|
@ -0,0 +1,620 @@
|
|||
/* 搜索用户页面样式 */
|
||||
|
||||
.search-container {
|
||||
height: 100vh;
|
||||
background-color: #000000;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-x: hidden;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 搜索区域 */
|
||||
.search-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.search-box-top{
|
||||
margin-top: 350rpx;
|
||||
}
|
||||
|
||||
.search-btn {
|
||||
height: 80rpx;
|
||||
padding: 0 28rpx;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: transform .15s, opacity .2s;
|
||||
max-width: 168rpx;
|
||||
}
|
||||
|
||||
.search-btn-text {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
|
||||
.btn-hover, .search-btn:active {
|
||||
opacity: .85;
|
||||
transform: scale(.96);
|
||||
}
|
||||
|
||||
.search-input-wrapper {
|
||||
/* flex: 1; */
|
||||
width: 654rpx;
|
||||
height: 74rpx;
|
||||
line-height: 74rpx;
|
||||
/* position: relative; */
|
||||
/* background: #f8f9fa; */
|
||||
border-radius: 35rpx;
|
||||
padding: 0 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
border: 1px solid #D9D9D9;
|
||||
/* position: relative; */
|
||||
|
||||
}
|
||||
|
||||
.search-icon-buttom{
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.search-icon-buttom:active{
|
||||
background-color: #353535;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.search-icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
color: #999;
|
||||
margin-right: 6rpx;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
font-size: 27rpx;
|
||||
}
|
||||
|
||||
.placeholder-style {
|
||||
color: #B3B3B3;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* 结果容器 */
|
||||
.results-container {
|
||||
flex: 1;
|
||||
padding: 0 32rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 加载中 */
|
||||
.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;
|
||||
}
|
||||
|
||||
/* 搜索提示 */
|
||||
.search-tips {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 120rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tips-icon {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.tips-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.tips-desc {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-bottom: 48rpx;
|
||||
}
|
||||
|
||||
.tips-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.tip-item {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* 无结果 */
|
||||
.no-results {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 120rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.no-results-icon {
|
||||
font-size: 120rpx;
|
||||
margin-bottom: 32rpx;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.no-results-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.no-results-desc {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* 结果列表 */
|
||||
.results-list {
|
||||
padding: 32rpx 0;
|
||||
}
|
||||
|
||||
.result-item {
|
||||
background: white;
|
||||
border-radius: 24rpx;
|
||||
padding: 32rpx;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
/* 避免内容撑宽导致容器超出屏幕 */
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 用户信息 */
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* background-color: red; */
|
||||
flex: 1;
|
||||
margin-right: 24rpx;
|
||||
/* 允许在弹性布局中缩小,避免长昵称/签名把容器撑宽 */
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
position: relative;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.avatar-image {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 48rpx;
|
||||
}
|
||||
|
||||
.avatar-placeholder {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 48rpx;
|
||||
background: #e0e0e0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
}
|
||||
|
||||
.avatar-text {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #666;
|
||||
white-space: nowrap;
|
||||
border: 1px red solid;
|
||||
}
|
||||
|
||||
.member-badge {
|
||||
position: absolute;
|
||||
bottom: -4rpx;
|
||||
right: -4rpx;
|
||||
background: linear-gradient(135deg, #ffd700, #ffb300);
|
||||
border-radius: 20rpx;
|
||||
padding: 4rpx 8rpx;
|
||||
}
|
||||
|
||||
.member-text {
|
||||
font-size: 20rpx;
|
||||
/* color: white; */
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.user-details {
|
||||
flex: 1;
|
||||
/* 防止内部文本造成横向溢出 */
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.user-name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8rpx;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.user-nickname {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-right: 16rpx;
|
||||
/* 长名称省略避免溢出 */
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
}
|
||||
|
||||
.gender-icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.gender-icon-img {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.user-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
/* gap: 4rpx; */
|
||||
gap: 16rpx;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.user-id {
|
||||
font-size: 24rpx;
|
||||
/* color: #999; */
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.match-type {
|
||||
font-size: 24rpx;
|
||||
color: #2196f3;
|
||||
background: #e3f2fd;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 12rpx;
|
||||
/* border: 1px solid red; */
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.user-bio {
|
||||
font-size: 26rpx;
|
||||
/* color: #666; */
|
||||
margin-bottom: 8rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
word-break: break-all;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.status-message {
|
||||
font-size: 24rpx;
|
||||
/* color: #999; */
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* 操作按钮 */
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
width: 80px;
|
||||
height: 40px;
|
||||
/* padding: 16rpx 32rpx; */
|
||||
line-height: 40px;
|
||||
border-radius: 12rpx;
|
||||
text-align: center;
|
||||
min-width: 120rpx;
|
||||
}
|
||||
|
||||
.add-btn.enabled {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
}
|
||||
|
||||
.add-btn.disabled {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
.pending-btn {
|
||||
background: #fff3e0;
|
||||
border: 2rpx solid #ff9800;
|
||||
}
|
||||
|
||||
.friend-btn {
|
||||
background: #e8f5e8;
|
||||
border: 2rpx solid #4caf50;
|
||||
}
|
||||
|
||||
.message-btn {
|
||||
background: #e3f2fd;
|
||||
border: 2rpx solid #2196f3;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.add-btn.enabled .btn-text {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.add-btn.disabled .btn-text {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.pending-btn .btn-text {
|
||||
color: #ff9800;
|
||||
}
|
||||
|
||||
.friend-btn .btn-text {
|
||||
color: #4caf50;
|
||||
}
|
||||
|
||||
.message-btn .btn-text {
|
||||
color: #2196f3;
|
||||
}
|
||||
|
||||
/* 加载更多 */
|
||||
.load-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 32rpx 0;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.load-more-text {
|
||||
font-size: 28rpx;
|
||||
/* color: #999; */
|
||||
}
|
||||
|
||||
.no-more {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 32rpx 0;
|
||||
}
|
||||
|
||||
.no-more-text {
|
||||
font-size: 28rpx;
|
||||
/* color: #ccc; */
|
||||
}
|
||||
|
||||
/* ================== 暗色主题覆盖(社交-用户搜索) ================== */
|
||||
.search-container .search-input-wrapper {
|
||||
background: black;
|
||||
border: 1px solid white;
|
||||
}
|
||||
|
||||
.search-container .search-input {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.search-container .search-icon {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.search-container .results-list .result-item {
|
||||
background: #1e1e1e;
|
||||
border: 1rpx solid #2a2a2a;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.search-container .user-nickname {
|
||||
color: #f5f5f5;
|
||||
}
|
||||
|
||||
.search-container .user-id,
|
||||
.search-container .user-bio,
|
||||
.search-container .status-message {
|
||||
color: #b0b0b0;
|
||||
}
|
||||
|
||||
.search-container .avatar-placeholder {
|
||||
background: #303030;
|
||||
}
|
||||
|
||||
.search-container .add-btn.disabled {
|
||||
background: #2a2a2a;
|
||||
}
|
||||
|
||||
.search-container .pending-btn {
|
||||
background: #4a3720;
|
||||
border-color: #ffb347;
|
||||
}
|
||||
|
||||
.search-container .friend-btn {
|
||||
background: #1f3321;
|
||||
border-color: #57c765;
|
||||
}
|
||||
|
||||
.search-container .message-btn {
|
||||
background: #1d3050;
|
||||
border-color: #246bff;
|
||||
}
|
||||
|
||||
.search-container .add-btn.enabled {
|
||||
background: linear-gradient(135deg, #4d7dff, #246bff);
|
||||
box-shadow: 0 4rpx 12rpx rgba(36, 107, 255, 0.35);
|
||||
}
|
||||
|
||||
.search-container .loading-text,
|
||||
.search-container .tips-desc,
|
||||
.search-container .tip-item,
|
||||
.search-container .no-results-desc {
|
||||
color: #9e9e9e;
|
||||
}
|
||||
|
||||
.search-container .tips-title,
|
||||
.search-container .no-results-title {
|
||||
color: #f5f5f5;
|
||||
}
|
||||
|
||||
.search-container .tips-icon,
|
||||
.search-container .no-results-icon {
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
.search-container .load-more-text {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.search-container .no-more-text {
|
||||
color: #555;
|
||||
}
|
||||
|
||||
/* ===== 添加好友对话框 ===== */
|
||||
.add-dialog-mask {
|
||||
position: fixed;
|
||||
left: 0; right: 0; top: 0; bottom: 0;
|
||||
background: rgba(0,0,0,0.55);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 9999;
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.add-dialog {
|
||||
width: 100%;
|
||||
max-width: 640rpx;
|
||||
background: #1e1e1e;
|
||||
border: 1rpx solid #2a2a2a;
|
||||
border-radius: 24rpx;
|
||||
padding: 32rpx;
|
||||
box-shadow: 0 10rpx 30rpx rgba(0,0,0,0.45);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.add-dialog-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
/* color: #f5f5f5; */
|
||||
margin-bottom: 16rpx;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.add-dialog-input {
|
||||
width: 100%;
|
||||
min-height: 140rpx;
|
||||
max-height: 360rpx;
|
||||
padding: 20rpx;
|
||||
background: #262626;
|
||||
/* color: #e0e0e0; */
|
||||
border-radius: 16rpx;
|
||||
border: 1rpx solid #2f2f2f;
|
||||
box-sizing: border-box;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.add-dialog-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 16rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.add-dialog-btn {
|
||||
min-width: 160rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 40rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.add-dialog-btn.cancel {
|
||||
background: #2a2a2a;
|
||||
/* color: #ccc; */
|
||||
}
|
||||
.add-dialog-btn.confirm {
|
||||
background: linear-gradient(135deg, #4d7dff, #246bff);
|
||||
/* color: #fff; */
|
||||
}
|
||||
214
subpackages/social/tag-friends/tag-friends.js
Normal file
214
subpackages/social/tag-friends/tag-friends.js
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
|
||||
// 标签好友页面
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
// 标签列表
|
||||
tags: [],
|
||||
// 选中的标签(单选,所以只有一个)
|
||||
selectedTag: null,
|
||||
// 搜索关键词
|
||||
searchKeyword: '',
|
||||
// 加载状态
|
||||
loading: false,
|
||||
// 模式:partial_visible 或 exclude_friends
|
||||
mode: 'partial_visible'
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
// 获取传递的参数
|
||||
let selectedTagsStr = options.selectedTags || '[]';
|
||||
const mode = options.mode || 'partial_visible';
|
||||
|
||||
// 如果参数被编码了,需要解码
|
||||
try {
|
||||
selectedTagsStr = decodeURIComponent(selectedTagsStr);
|
||||
} catch (e) {
|
||||
// 如果解码失败,使用原始值
|
||||
console.log('参数未编码,使用原始值');
|
||||
}
|
||||
|
||||
try {
|
||||
const selectedTags = JSON.parse(selectedTagsStr);
|
||||
// 单选,只取第一个
|
||||
this.setData({
|
||||
selectedTag: selectedTags && selectedTags.length > 0 ? selectedTags[0] : null,
|
||||
mode: mode
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('解析选中的标签失败:', e);
|
||||
this.setData({
|
||||
selectedTag: null,
|
||||
mode: mode
|
||||
});
|
||||
}
|
||||
|
||||
// 加载标签列表
|
||||
this.loadTags();
|
||||
},
|
||||
|
||||
// 加载标签列表
|
||||
loadTags() {
|
||||
// TODO: 调用API加载标签列表
|
||||
this.setData({ loading: true });
|
||||
|
||||
// 示例数据
|
||||
const tags = [
|
||||
{
|
||||
id: 1,
|
||||
name: '家人',
|
||||
friends: [
|
||||
{ id: 1, nickname: '爸爸', avatar: '' },
|
||||
{ id: 2, nickname: '妈妈', avatar: '' },
|
||||
{ id: 3, nickname: '哥哥', avatar: '' },
|
||||
{ id: 4, nickname: '姐姐', avatar: '' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '挚友',
|
||||
friends: [
|
||||
{ id: 5, nickname: '张三', avatar: '' },
|
||||
{ id: 6, nickname: '李四', avatar: '' },
|
||||
{ id: 7, nickname: '王五', avatar: '' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '同事',
|
||||
friends: [
|
||||
{ id: 8, nickname: '张海', avatar: '' },
|
||||
{ id: 9, nickname: '李三', avatar: '' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '骑手',
|
||||
friends: [
|
||||
{ id: 10, nickname: '骑手1', avatar: '' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: '游戏',
|
||||
friends: [
|
||||
{ id: 11, nickname: '游戏好友1', avatar: '' },
|
||||
{ id: 12, nickname: '游戏好友2', avatar: '' }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: '同学',
|
||||
friends: [
|
||||
{ id: 13, nickname: '同学1', avatar: '' },
|
||||
{ id: 14, nickname: '同学2', avatar: '' },
|
||||
{ id: 15, nickname: '同学3', avatar: '' }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
// 立即设置数据,不使用 setTimeout
|
||||
this.setData({
|
||||
tags: tags,
|
||||
loading: false
|
||||
});
|
||||
|
||||
console.log('标签列表已加载:', tags);
|
||||
},
|
||||
|
||||
// 选择标签(单选)
|
||||
selectTag(e) {
|
||||
const tagId = e.currentTarget.dataset.tagId;
|
||||
const tag = this.data.tags.find(t => t.id === tagId);
|
||||
|
||||
if (!tag) return;
|
||||
|
||||
// 单选:如果已选中则取消,否则选中
|
||||
if (this.data.selectedTag && this.data.selectedTag.id === tagId) {
|
||||
this.setData({
|
||||
selectedTag: null
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
selectedTag: tag
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 搜索输入
|
||||
onSearchInput(e) {
|
||||
this.setData({
|
||||
searchKeyword: e.detail.value
|
||||
});
|
||||
},
|
||||
|
||||
// 确认选择
|
||||
confirmSelection() {
|
||||
const { selectedTag, mode } = this.data;
|
||||
|
||||
// 检查是否选择了标签
|
||||
if (!selectedTag) {
|
||||
wx.showToast({
|
||||
title: '请选择标签',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 计算好友总数
|
||||
const friendsCount = selectedTag.friends ? selectedTag.friends.length : 0;
|
||||
const selectedTags = [selectedTag]; // 转换为数组格式
|
||||
|
||||
// 生成显示文本:标签名称 + 好友名字列表
|
||||
let displayText = '';
|
||||
if (selectedTag.friends && selectedTag.friends.length > 0) {
|
||||
const friendNames = selectedTag.friends.map(friend => friend.nickname).join(',');
|
||||
displayText = `${selectedTag.name}:${friendNames}`;
|
||||
} else {
|
||||
displayText = `${selectedTag.name}`;
|
||||
}
|
||||
|
||||
// 返回上一页并传递选中的标签
|
||||
const pages = getCurrentPages();
|
||||
const prevPage = pages[pages.length - 2];
|
||||
|
||||
if (prevPage) {
|
||||
if (mode === 'exclude_friends') {
|
||||
// 排除模式
|
||||
if (typeof prevPage.updateExcludeTags === 'function') {
|
||||
prevPage.updateExcludeTags(selectedTags, friendsCount, displayText);
|
||||
}
|
||||
} else {
|
||||
// 部分可见模式
|
||||
if (typeof prevPage.updateSelectedTags === 'function') {
|
||||
prevPage.updateSelectedTags(selectedTags, friendsCount, displayText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wx.navigateBack();
|
||||
},
|
||||
|
||||
// 获取过滤后的标签列表
|
||||
getFilteredTags() {
|
||||
const { tags, searchKeyword } = this.data;
|
||||
if (!searchKeyword) {
|
||||
return tags;
|
||||
}
|
||||
return tags.filter(tag => {
|
||||
return tag.name.toLowerCase().includes(searchKeyword.toLowerCase()) ||
|
||||
(tag.friends && tag.friends.some(friend =>
|
||||
friend.nickname.toLowerCase().includes(searchKeyword.toLowerCase())
|
||||
));
|
||||
});
|
||||
},
|
||||
|
||||
// 返回
|
||||
navigateBack() {
|
||||
wx.navigateBack();
|
||||
}
|
||||
});
|
||||
|
||||
8
subpackages/social/tag-friends/tag-friends.json
Normal file
8
subpackages/social/tag-friends/tag-friends.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"navigationBarTitleText": "选择标签",
|
||||
"navigationBarBackgroundColor": "#000000",
|
||||
"navigationBarTextStyle": "white",
|
||||
"backgroundColor": "#000000",
|
||||
"disableScroll": false
|
||||
}
|
||||
|
||||
60
subpackages/social/tag-friends/tag-friends.wxml
Normal file
60
subpackages/social/tag-friends/tag-friends.wxml
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<view class="tag-friends-container">
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-container">
|
||||
<view class="search-box">
|
||||
<input
|
||||
class="search-input"
|
||||
type="text"
|
||||
placeholder="search"
|
||||
value="{{searchKeyword}}"
|
||||
bindinput="onSearchInput"
|
||||
/>
|
||||
<image class="search-icon" src="/images/Search.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 标签列表 -->
|
||||
<scroll-view class="content-scroll" scroll-y enable-back-to-top="{{true}}">
|
||||
<view class="tags-list">
|
||||
<view wx:if="{{tags.length > 0}}">
|
||||
<block wx:for="{{tags}}" wx:key="id" wx:for-item="tag">
|
||||
<view
|
||||
class="tag-item {{selectedTag && selectedTag.id === tag.id ? 'selected' : ''}}"
|
||||
bindtap="selectTag"
|
||||
data-tag-id="{{tag.id}}"
|
||||
>
|
||||
<view class="tag-row">
|
||||
<view class="tag-checkbox">
|
||||
<view class="checkbox {{selectedTag && selectedTag.id === tag.id ? 'checked' : ''}}">
|
||||
<image wx:if="{{selectedTag && selectedTag.id === tag.id}}" src="/images/Selected.svg" mode="aspectFit" class="check-image"></image>
|
||||
<image wx:else src="/images/fram.svg" mode="aspectFit" class="uncheck-image"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tag-main">
|
||||
<text class="tag-name">{{tag.name}}</text>
|
||||
<text wx:if="{{tag.friends}}" class="tag-count">({{tag.friends.length}}人)</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 好友名字列表 -->
|
||||
<view wx:if="{{tag.friends && tag.friends.length > 0}}" class="friends-names">
|
||||
<text class="friends-names-text">
|
||||
<text wx:for="{{tag.friends}}" wx:key="id" wx:for-item="friend" wx:for-index="index">
|
||||
<text>{{friend.nickname}}</text><text wx:if="{{index < tag.friends.length - 1}}">,</text>
|
||||
</text>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view wx:else class="empty-tags">
|
||||
<text class="empty-text">暂无标签</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 底部完成按钮 -->
|
||||
<view class="bottom-action">
|
||||
<button class="confirm-btn" bindtap="confirmSelection">完成</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
179
subpackages/social/tag-friends/tag-friends.wxss
Normal file
179
subpackages/social/tag-friends/tag-friends.wxss
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
/* 页面根容器 */
|
||||
page {
|
||||
background: linear-gradient(180deg, #0a0910 0%, #06151d 50%, #022027 100%);
|
||||
color: #ffffff;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
/* 主容器 */
|
||||
.tag-friends-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
background: linear-gradient(180deg, #0a0910 0%, #06151d 50%, #022027 100%);
|
||||
}
|
||||
|
||||
/* 搜索框容器 */
|
||||
.search-container {
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #202529;
|
||||
border-radius: 50rpx;
|
||||
padding: 20rpx 30rpx;
|
||||
border: 2rpx solid #d9d9d9;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.search-input::placeholder {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
/* 内容滚动区域 */
|
||||
.content-scroll {
|
||||
flex: 1;
|
||||
overflow-y: scroll;
|
||||
padding-bottom: 180rpx;
|
||||
}
|
||||
|
||||
/* 标签列表 */
|
||||
.tags-list {
|
||||
padding: 20rpx 0;
|
||||
min-height: 200rpx;
|
||||
}
|
||||
|
||||
/* 空状态 */
|
||||
.empty-tags {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 100rpx 0;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #888888;
|
||||
}
|
||||
|
||||
/* 标签项 */
|
||||
.tag-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10rpx;
|
||||
background-color: #20252910;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
|
||||
|
||||
/* 标签行(checkbox 和 tag-main 在一行) */
|
||||
.tag-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 标签复选框 */
|
||||
.tag-checkbox {
|
||||
margin-right: 30rpx;
|
||||
margin-left: 20rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.checkbox.checked {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/* 选中图标样式 */
|
||||
.check-image {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.uncheck-image {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* 标签主要内容 */
|
||||
.tag-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.tag-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.tag-count {
|
||||
font-size: 24rpx;
|
||||
color: #888888;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
/* 好友名字列表 */
|
||||
.friends-names {
|
||||
margin-top: 15rpx;
|
||||
padding-left: 30rpx; /* 与 checkbox 对齐 */
|
||||
}
|
||||
|
||||
.friends-names-text {
|
||||
font-size: 24rpx;
|
||||
color: #888888;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 底部操作按钮 */
|
||||
.bottom-action {
|
||||
position: fixed;
|
||||
bottom: 80rpx;
|
||||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
padding: 10rpx;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
width: 200rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
background-image: linear-gradient(90deg, #ff6460, #ec42c8, #435cff, #00d3ff);
|
||||
color: #ffffff;
|
||||
border-radius: 50rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
border: none;
|
||||
letter-spacing: 4rpx;
|
||||
}
|
||||
|
||||
|
||||
310
subpackages/social/user-preview/user-preview.js
Normal file
310
subpackages/social/user-preview/user-preview.js
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
// 临时用户资料预览页(扫码非好友进入)
|
||||
const friendAPI = require('../../../utils/friend-api.js');
|
||||
const apiClient = require('../../../utils/api-client.js');
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
data:{
|
||||
customId:'',
|
||||
user:{},
|
||||
loading:true,
|
||||
error:'',
|
||||
relationStatus:'',
|
||||
showAddButton:false,
|
||||
privacyBlocked:false,
|
||||
blockedRelation:false,
|
||||
statusAdd:0 // 0 不是好友 1 已发送添加好友申请 2 已好友
|
||||
},
|
||||
onLoad(query){
|
||||
const customId = (query?.customId || '10703945')+"" ;
|
||||
if(!customId){
|
||||
this.setData({ error:'缺少用户ID', loading:false });
|
||||
return;
|
||||
}
|
||||
this.setData({ customId });
|
||||
this.loadUser(customId);
|
||||
},
|
||||
async loadUser(customId){
|
||||
this.setData({ loading:true, error:'' });
|
||||
try{
|
||||
// 使用新的接口 /user/info/{customId} 获取用户信息
|
||||
const response = await apiClient.getUserInfoByCustomId(customId);
|
||||
|
||||
if(!response || response.code !== 0 || !response.data){
|
||||
this.setData({ error:'用户不存在', loading:false });
|
||||
return;
|
||||
}
|
||||
|
||||
const user = response.data;
|
||||
console.log('✅ 获取用户信息成功:', user);
|
||||
|
||||
// 处理关系状态
|
||||
let relationStatus = user.relationStatus || 'can_add';
|
||||
if(!relationStatus){
|
||||
relationStatus = 'can_add'; // 未提供时默认可添加
|
||||
}
|
||||
|
||||
// 处理年龄:优先使用接口返回的 age,如果没有则根据 birthday 计算
|
||||
let calculatedAge = user.age;
|
||||
if(!calculatedAge && user.birthday){
|
||||
calculatedAge = this.calculateAge(user.birthday);
|
||||
}
|
||||
|
||||
// 处理家乡地址:将数组转换为字符串
|
||||
let hometownText = '';
|
||||
if (user.hometown) {
|
||||
if (Array.isArray(user.hometown)) {
|
||||
hometownText = user.hometown.filter(item => item).join(' ');
|
||||
} else if (typeof user.hometown === 'string') {
|
||||
hometownText = user.hometown;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断是否显示添加好友按钮和状态
|
||||
// 根据 relationStatus 判断:
|
||||
// - "self": 自己,不显示添加按钮
|
||||
// - "friend": 已是好友,statusAdd = 2
|
||||
// - "pending": 已发送申请,statusAdd = 1
|
||||
// - 其他: 可添加,statusAdd = 0
|
||||
let showAddButton = false;
|
||||
let statusAdd = 0;
|
||||
|
||||
if (relationStatus === 'self') {
|
||||
// 自己,不显示添加按钮
|
||||
showAddButton = false;
|
||||
statusAdd = 0;
|
||||
} else if (relationStatus === 'friend') {
|
||||
// 已是好友
|
||||
showAddButton = false;
|
||||
statusAdd = 2;
|
||||
} else if (relationStatus === 'pending' || relationStatus === 'requested') {
|
||||
// 已发送申请
|
||||
showAddButton = false;
|
||||
statusAdd = 1;
|
||||
} else {
|
||||
// 可以添加好友
|
||||
showAddButton = true;
|
||||
statusAdd = 0;
|
||||
}
|
||||
|
||||
console.log('👀 用户预览信息:', {
|
||||
relationStatus,
|
||||
showAddButton,
|
||||
statusAdd,
|
||||
calculatedAge,
|
||||
hometownText
|
||||
});
|
||||
|
||||
this.setData({
|
||||
user: user, // 使用完整的用户数据对象
|
||||
relationStatus,
|
||||
showAddButton,
|
||||
privacyBlocked: relationStatus === 'privacy_limited',
|
||||
blockedRelation: relationStatus === 'blocked',
|
||||
calculatedAge: calculatedAge,
|
||||
hometownText: hometownText,
|
||||
loading: false,
|
||||
statusAdd: statusAdd
|
||||
});
|
||||
}catch(e){
|
||||
console.error('❌ 加载用户失败:', e);
|
||||
let errorMessage = '加载失败';
|
||||
if(e.message){
|
||||
errorMessage = e.message;
|
||||
} else if(e.errMsg){
|
||||
errorMessage = e.errMsg;
|
||||
}
|
||||
this.setData({ error: errorMessage, loading:false });
|
||||
}
|
||||
},
|
||||
reload(){
|
||||
if(this.data.customId){ this.loadUser(this.data.customId); }
|
||||
},
|
||||
async addFriend(){
|
||||
if(!this.data.user.customId) return;
|
||||
try{
|
||||
const dialogRes = await this.showAddFriendDialog(this.data.user.nickname||this.data.user.customId);
|
||||
if(!dialogRes.confirm) return;
|
||||
wx.showLoading({ title:'发送中...' });
|
||||
const frienRes = await friendAPI.addFriend(this.data.user.customId, dialogRes.message);
|
||||
console.log('frienRes -------frienRes ',frienRes);
|
||||
wx.hideLoading();
|
||||
wx.showToast({ title:'请求已发送', icon:'success' });
|
||||
this.setData({ relationStatus:'pending', showAddButton:false,statusAdd:1 });
|
||||
}catch(e){
|
||||
wx.hideLoading();
|
||||
wx.showToast({ title:e.message||'发送失败', icon:'none' });
|
||||
}
|
||||
},
|
||||
goChat(){
|
||||
const { user } = this.data;
|
||||
if(!user.customId) return;
|
||||
wx.navigateTo({ url:`/pages/message/chat/chat?targetId=${user.customId}&name=${encodeURIComponent(user.nickname||'好友')}&chatType=0` });
|
||||
},
|
||||
|
||||
|
||||
previewImage(e) {
|
||||
try {
|
||||
// 获取当前点击的图片索引和动态索引
|
||||
const avatar = e.currentTarget.dataset.avatar;
|
||||
// 🔥 设置标志,防止预览关闭后触发页面刷新
|
||||
this._skipNextOnShowReload = true;
|
||||
const imageUrls=[avatar];
|
||||
// 调用微信小程序的图片预览API
|
||||
wx.previewImage({
|
||||
current: avatar,
|
||||
urls: imageUrls,
|
||||
success: () => {
|
||||
// 预览打开成功,标志已设置,关闭时会触发 onShow
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('图片预览失败:', err);
|
||||
// 预览失败,清除标志
|
||||
this._skipNextOnShowReload = false;
|
||||
wx.showToast({
|
||||
title: '预览图片失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('图片预览过程中出错:', error);
|
||||
// 出错时清除标志
|
||||
this._skipNextOnShowReload = false;
|
||||
wx.showToast({
|
||||
title: '预览图片失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 发送消息(与 goChat 功能相同)
|
||||
sendMessage() {
|
||||
const { user } = this.data;
|
||||
if (!user || !user.customId) {
|
||||
wx.showToast({
|
||||
title: '用户信息不存在',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
wx.navigateTo({
|
||||
url: `/pages/message/chat/chat?targetId=${user.customId}&name=${encodeURIComponent(user.nickname || user.customId || '好友')}&chatType=0`
|
||||
});
|
||||
},
|
||||
showAddFriendDialog(nickname){
|
||||
return new Promise(resolve=>{
|
||||
wx.showModal({
|
||||
title:`添加 ${nickname} 为好友`,
|
||||
editable:true,
|
||||
placeholderText:'请输入验证消息',
|
||||
content:`我是 ${app.globalData.userInfo?.user?.nickname||''}`,
|
||||
success:(res)=>{
|
||||
resolve({
|
||||
confirm:res.confirm,
|
||||
message:res.content || `我是 ${app.globalData.userInfo?.user?.nickname||''}`
|
||||
});
|
||||
},
|
||||
fail:()=>resolve({ confirm:false })
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 根据生日计算年龄
|
||||
calculateAge(birthday) {
|
||||
if (!birthday) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 处理 YYYY-MM-DD 格式的日期
|
||||
let birthDate;
|
||||
if (typeof birthday === 'string' && birthday.includes('-')) {
|
||||
const dateParts = birthday.split('-');
|
||||
if (dateParts.length === 3) {
|
||||
birthDate = new Date(parseInt(dateParts[0]), parseInt(dateParts[1]) - 1, parseInt(dateParts[2]));
|
||||
} else {
|
||||
birthDate = new Date(birthday);
|
||||
}
|
||||
} else {
|
||||
birthDate = new Date(birthday);
|
||||
}
|
||||
|
||||
if (isNaN(birthDate.getTime())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const today = new Date();
|
||||
let age = today.getFullYear() - birthDate.getFullYear();
|
||||
const monthDiff = today.getMonth() - birthDate.getMonth();
|
||||
|
||||
// 如果还没过生日,年龄减1
|
||||
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
|
||||
age--;
|
||||
}
|
||||
|
||||
// 年龄应该大于等于0
|
||||
return age >= 0 ? age : null;
|
||||
} catch (error) {
|
||||
console.error('计算年龄失败:', error, birthday);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
// 复制ID
|
||||
copyId() {
|
||||
const { user } = this.data;
|
||||
const id = user?.customId || (user?.id ? 'findme_' + user.id : '未设置');
|
||||
if (!id || id === '未设置') {
|
||||
wx.showToast({
|
||||
title: 'ID不存在',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
wx.setClipboardData({
|
||||
data: id,
|
||||
success: () => {
|
||||
wx.showToast({
|
||||
title: '复制成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
wx.showToast({
|
||||
title: '复制失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 跳转到二维码页面
|
||||
navigateToQRCode() {
|
||||
const { user } = this.data;
|
||||
if (!user || !user.customId) {
|
||||
wx.showToast({
|
||||
title: '用户信息不存在',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 传递陌生人的 customId 参数
|
||||
wx.navigateTo({
|
||||
url: `/subpackages/qr/qr-code/qr-code?customId=${user.customId}`,
|
||||
success: (res) => {
|
||||
console.log('跳转二维码页面成功', res);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('跳转二维码页面失败', err);
|
||||
wx.showToast({
|
||||
title: '跳转失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
7
subpackages/social/user-preview/user-preview.json
Normal file
7
subpackages/social/user-preview/user-preview.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"navigationBarTitleText": "陌生人",
|
||||
"navigationBarBackgroundColor": "#000000",
|
||||
"navigationBarTextStyle": "white",
|
||||
"backgroundColor": "#121212",
|
||||
"usingComponents": {}
|
||||
}
|
||||
157
subpackages/social/user-preview/user-preview.wxml
Normal file
157
subpackages/social/user-preview/user-preview.wxml
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
<view class="friend-detail-container">
|
||||
<view class="loading-container" wx:if="{{loading}}">
|
||||
<view class="loading-spinner"></view>
|
||||
<text class="loading-text">加载中...</text>
|
||||
</view>
|
||||
<view class="error-box" wx:elif="{{error}}">
|
||||
<text class="error-text">{{error}}</text>
|
||||
<button class="retry-btn" bindtap="reload">重试</button>
|
||||
</view>
|
||||
<scroll-view class="detail-content" scroll-y="true" wx:else>
|
||||
<view class="info-out">
|
||||
<view class="info-card">
|
||||
<view class="basic-info">
|
||||
<view class="profile-top">
|
||||
<view class="avatar-container">
|
||||
<image class="avatar-image" data-avatar="{{user.avatar}}" bindtap="previewImage" wx:if="{{user.avatar}}" src="{{user.avatar}}" mode="aspectFill" />
|
||||
<view wx:else class="avatar-placeholder">
|
||||
<text class="avatar-text">{{user.nickname ? user.nickname.charAt(0) : '?'}}</text>
|
||||
</view>
|
||||
<view class="online-status online"></view>
|
||||
</view>
|
||||
<view class="profile-info">
|
||||
<view class="profile-name-row">
|
||||
<view class="profile-name">{{user.nickname || user.customId || 'FindMe用户'}}</view>
|
||||
<view class="vip-crown" wx:if="{{user.isMember}}">👑</view>
|
||||
</view>
|
||||
<view class="profile-id">
|
||||
<view>
|
||||
<text class="id-label">ID: </text>
|
||||
<view class="id-value-wrapper" bindtap="copyId">
|
||||
<text class="id-value">{{user.customId}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tag" wx:if="{{user.verified}}">
|
||||
<image class="tagImg" src="/images/tag.png" mode=""/>
|
||||
<text class="tagText">已认证</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
<view class="info-out">
|
||||
<view class="profile-bottom">
|
||||
<view class="action-buttons">
|
||||
<!-- <view class="edit-btn" bindtap="goChat">
|
||||
<image src="/images/StartGroupChat.svg" class="edit-icon"/>
|
||||
<text class="edit-text">发消息</text>
|
||||
</view> -->
|
||||
<view class="qr-code-btn" bindtap="navigateToQRCode">
|
||||
<image src="/images/qr-code.png" class="qr-code-icon"/>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 位置信息 -->
|
||||
<view class="profile-location">
|
||||
<image src="/images/location.png" class="location-icon"/>
|
||||
<text class="location-text-qr">{{hometownText || '未设置'}}</text>
|
||||
<text class="location-arrow">›</text>
|
||||
</view>
|
||||
|
||||
<view class="profile-signature">
|
||||
<text class="signature-text">{{user.bio || '暂无简介'}}</text>
|
||||
</view>
|
||||
|
||||
<view class="profile-tabs">
|
||||
<scroll-view scroll-x="true" class="tab-scroll" enable-flex="true">
|
||||
<view class="tab-item" wx:if="{{user.gender !== null && user.gender !== undefined && user.gender !== ''}}">
|
||||
<image wx:if="{{user.gender === 1 || user.gender === '1' || user.gender === 2 || user.gender === '2'}}" class="gender-icon" src="{{user.gender === 1 || user.gender === '1' ? '/images/self/male.svg' : '/images/self/fmale.svg'}}" mode="aspectFit" />
|
||||
<text wx:else>?</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{(calculatedAge !== null && calculatedAge !== undefined) || (user.age !== null && user.age !== undefined)}}">
|
||||
<text>{{calculatedAge !== null && calculatedAge !== undefined ? (calculatedAge + '岁') : (user.age ? (user.age + '岁') : '')}}</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{user.mood && user.mood !== ''}}">
|
||||
<text>{{user.mood}}</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{user.mbtiType && user.mbtiType !== ''}}">
|
||||
<text>{{user.mbtiType}}</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{user.identity && user.identity !== ''}}">
|
||||
<text>{{user.identity}}</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{user.zodiacSign && user.zodiacSign !== ''}}">
|
||||
<text>{{user.zodiacSign}}</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{user.school && user.school !== ''}}">
|
||||
<text>{{user.school}}</text>
|
||||
</view>
|
||||
|
||||
<view class="tab-item" wx:if="{{user.occupation && user.occupation !== ''}}">
|
||||
<text>{{user.occupation}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="info-out">
|
||||
<view class="myfootprint">
|
||||
<view class="footprint-title">Dasha的足迹</view>
|
||||
<image class="footprint-earth" src="/images/self/earth.png" mode="aspectFit"/>
|
||||
<view class="footprint-badge"><text>暂无足迹</text></view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 新增两个渐变圆角容器 -->
|
||||
<!-- <view class="info-out">
|
||||
<view class="footprint-gradient-row">
|
||||
<view class="footprint-gradient-box footprint-gradient-yellow">
|
||||
<image class="video" src="/images/self/icon-video.png" mode=""/>
|
||||
</view>
|
||||
<view class="footprint-gradient-box footprint-gradient-blue">
|
||||
<image class="video" src="/images/self/icon-video.png" mode=""/>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 操作按钮区 -->
|
||||
<view class="info-out but-bom">
|
||||
<view class="detail-action-buttons">
|
||||
<view class="detail-action-btn-wrapper" bindtap="sendMessage">
|
||||
<view class="detail-action-btn">
|
||||
<text>消息</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-action-btn-wrapper" bindtap="addFriend" wx:if="{{statusAdd === 0}}">
|
||||
<view class="detail-action-btn">
|
||||
<text>加为好友</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-action-btn-wrapper gray" wx:if="{{statusAdd === 1}}">
|
||||
<view class="detail-action-btn">
|
||||
<text>已发送申请</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-action-btn-wrapper gray" wx:if="{{statusAdd === 2}}">
|
||||
<view class="detail-action-btn">
|
||||
<text>已是好友</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
|
||||
</view>
|
||||
500
subpackages/social/user-preview/user-preview.wxss
Normal file
500
subpackages/social/user-preview/user-preview.wxss
Normal file
|
|
@ -0,0 +1,500 @@
|
|||
.friend-detail-container {
|
||||
min-height: 100vh;
|
||||
background: radial-gradient(ellipse at right bottom, #1c3954 0%, #1d3c7c 40%, #193170 70%, rgba(25, 49, 112, 0.8) 100%);
|
||||
}
|
||||
|
||||
.detail-content {
|
||||
height: 100vh;
|
||||
padding: 24rpx 28rpx 48rpx 28rpx;
|
||||
padding-bottom: 120rpx;
|
||||
box-sizing: border-box;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.info-card {
|
||||
margin: 32rpx;
|
||||
}
|
||||
|
||||
.info-out {
|
||||
/* border: 1px solid red; */
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.profile-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.avatar-container {
|
||||
width: 186rpx;
|
||||
height: 186rpx;
|
||||
position: relative;
|
||||
background: #000;
|
||||
border-radius: 50%;
|
||||
border: 10rpx solid #394e83;
|
||||
transition: all 0.3s ease;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.avatar-image {
|
||||
width: 166rpx;
|
||||
height: 166rpx;
|
||||
object-fit: cover;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.avatar-placeholder {
|
||||
width: 166rpx;
|
||||
height: 166rpx;
|
||||
border-radius: 50%;
|
||||
background: #2a2a2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.avatar-text {
|
||||
font-size: 64rpx;
|
||||
color: #888;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.online-status.online {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 5rpx;
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
background: #4CAF50;
|
||||
border: 3rpx solid #ffffff;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.profile-info {
|
||||
flex: 1;
|
||||
padding-left: 24rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.profile-name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.profile-name {
|
||||
font-size: 36rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.gender-badge {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
color: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.gender-badge .gender-icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.vip-crown {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
color: #ffd700;
|
||||
}
|
||||
|
||||
.profile-id {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.id-label {
|
||||
font-size: 28rpx;
|
||||
color: #f3f3f3;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.id-value-wrapper {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 10rpx 8rpx;
|
||||
margin-right: 12rpx;
|
||||
border-radius: 8rpx;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.id-value-wrapper:active {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.id-value {
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
font-weight: 400;
|
||||
font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
|
||||
}
|
||||
|
||||
.profile-bio .bio-text {
|
||||
font-size: 28rpx;
|
||||
color: #b0b0b0;
|
||||
}
|
||||
|
||||
.profile-bottom {
|
||||
background: linear-gradient(123deg, #8361FB 15.54%, #70AAFC 39.58%, #F0F8FB 62.43%, #F07BFF 90.28%);
|
||||
border-radius: 28rpx;
|
||||
padding-top: 15rpx;
|
||||
gap: 16rpx;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
margin-top: -70rpx;
|
||||
padding-bottom: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
width: fit-content;
|
||||
margin-left: auto;
|
||||
justify-content: flex-end;
|
||||
gap: 4rpx;
|
||||
padding-top: 20rpx;
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.qr-code-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
transition: all 0.2s ease;
|
||||
margin-top: 10rpx;
|
||||
margin-right:20rpx;
|
||||
}
|
||||
|
||||
.qr-code-icon,
|
||||
.edit-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.edit-text {
|
||||
font-size: 24rpx;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.profile-location {
|
||||
background: rgba(43, 43, 43, 1);
|
||||
max-width: 80%;
|
||||
width: fit-content;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #36393e;
|
||||
border-radius: 24rpx;
|
||||
min-height: 48rpx;
|
||||
padding: 0 20rpx;
|
||||
margin-left: 32rpx;
|
||||
margin-top: 40rpx;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
.location-icon {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.location-arrow {
|
||||
font-size: 36rpx;
|
||||
color: #ffffff;
|
||||
margin-left: auto;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.location-text-qr {
|
||||
font-size: 30rpx;
|
||||
color: #e0e0e0;
|
||||
line-height: 1.4;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.profile-signature {
|
||||
min-height: 120rpx;
|
||||
max-height: 300rpx;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
padding: 16rpx 24rpx;
|
||||
background: rgba(90, 90, 90, 0.548);
|
||||
border-radius: 24rpx;
|
||||
backdrop-filter: blur(20rpx);
|
||||
-webkit-backdrop-filter: blur(20rpx);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.2);
|
||||
box-shadow: 0 8rpx 12rpx rgba(0, 0, 0, 0.1), inset 0 0 20rpx rgba(255, 255, 255, 0.1);
|
||||
margin: 0 32rpx;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.signature-text {
|
||||
font-size: 30rpx;
|
||||
color: #000000;
|
||||
margin: auto;
|
||||
font-weight: 400;
|
||||
width: 100%;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.profile-tabs {
|
||||
width: 100%;
|
||||
margin-bottom: 0;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
.tab-scroll {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
padding: 8rpx 0;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
|
||||
font-size: 24rpx;
|
||||
margin-top: 20rpx; /* slightly smaller text */
|
||||
line-height: 36rpx; /* controls the text vertical alignment */
|
||||
height: 36rpx; /* explicit height for the box */
|
||||
display: flex; /* ensures vertical centering */
|
||||
align-items: center; /* centers text in the box */
|
||||
color: white;
|
||||
padding: 6rpx 20rpx;
|
||||
border-radius: 20rpx;
|
||||
background: rgba(90, 90, 90, 0.548);
|
||||
transition: all 0.2s;
|
||||
margin-left: .3rem;
|
||||
margin-right: .3rem;
|
||||
}
|
||||
|
||||
.gender-icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.myfootprint {
|
||||
|
||||
margin: 30rpx 0;
|
||||
padding: 20rpx;
|
||||
border-radius: 20rpx;
|
||||
background: radial-gradient(circle at right, #0F918B 36%, #8827FF 50%, #0F918B 64%);
|
||||
position: relative;
|
||||
height: 236rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.footprint-title {
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
left: 20rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 400;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.footprint-earth {
|
||||
width: 560rpx;
|
||||
height: 120rpx;
|
||||
position: relative;
|
||||
top: 61%;
|
||||
left: 40%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.footprint-badge {
|
||||
position: absolute;
|
||||
bottom: 20rpx;
|
||||
right: 20rpx;
|
||||
background: #fff;
|
||||
padding: 0 20rpx;
|
||||
border-radius: 10rpx;
|
||||
font-size: 24rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
}
|
||||
|
||||
/* 足迹下方两个容器并排平分整行 */
|
||||
.footprint-gradient-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 32rpx;
|
||||
width: 100%;
|
||||
margin: 32rpx auto;
|
||||
}
|
||||
|
||||
.footprint-gradient-row .footprint-gradient-box {
|
||||
width: 100%;
|
||||
height: 332rpx;
|
||||
border-radius: 40rpx;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* 足迹下方两个渐变圆角容器样式 */
|
||||
.footprint-gradient-box {
|
||||
width: 100%;
|
||||
height: 332rpx;
|
||||
border-radius: 40rpx;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.footprint-gradient-yellow {
|
||||
background:radial-gradient( circle at center, #fff600 ,rgba(255, 255, 255, 0.1) );
|
||||
}
|
||||
|
||||
.footprint-gradient-blue {
|
||||
background: linear-gradient(130deg, #139dff 1%,#3137ea 40%,#3137ea 60%, #3137ea 80%, #3bc493 100%);
|
||||
}
|
||||
|
||||
|
||||
.detail-section.danger-section {
|
||||
background: linear-gradient(-15deg, #00D5FF 1.54%, #435CFF 39.58%, #EC42C8 62.43%, #FF6460 90.28%);
|
||||
border-radius: 44rpx;
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
|
||||
.but-bom {
|
||||
margin-top: 70rpx;
|
||||
}
|
||||
|
||||
/* 详细信息上方操作按钮 */
|
||||
.detail-action-buttons {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 32rpx 0;
|
||||
padding: 0 30rpx;
|
||||
gap: 30rpx;
|
||||
}
|
||||
|
||||
.detail-action-btn-wrapper {
|
||||
flex: 1;
|
||||
height: 64rpx;
|
||||
border-radius: 32rpx;
|
||||
padding: 2rpx;
|
||||
background: linear-gradient(180deg, #4e4e4e 0%, #404040 100%);
|
||||
}
|
||||
|
||||
.detail-action-btn-wrapper.gray {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.detail-action-btn {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 30rpx;
|
||||
background: linear-gradient(180deg, #000 0%, #232323 100%);
|
||||
}
|
||||
|
||||
.detail-action-btn text {
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.danger-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
|
||||
.danger-text {
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
|
||||
.tag {
|
||||
margin-left: 20rpx;
|
||||
width: 150rpx;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.tagImg {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
}
|
||||
|
||||
.tagText {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.video{
|
||||
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
}
|
||||
.title-home{
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
.title-return{
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
.title{
|
||||
width: 400rpx;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
height: 50rpx;
|
||||
/* border: 1px solid red; */
|
||||
margin-left: 40rpx;
|
||||
background-color: #36393E;
|
||||
border-radius: 14rpx;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.gray{
|
||||
background-color: #494949;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue