chore: establish V1.1 recovery baseline

This commit is contained in:
2026-09-09 22:05:00 +08:00
commit b46b48eb33
947 changed files with 155471 additions and 0 deletions
@@ -0,0 +1,128 @@
/**
* 红娘工作台主页
*
* 展示待处理服务、工作台数据概览
*/
const api = require('../../utils/api');
Page({
data: {
operatorName: '',
pendingCount: 0,
inProgressCount: 0,
todayCount: 0,
completedCount: 0,
pendingServices: [],
loading: true,
currentDate: '',
},
onLoad() {
wx.setNavigationBarTitle({ title: '红娘工作台' });
// 获取操作员信息
const operatorName = wx.getStorageSync('operatorName') || '红娘';
this.setData({ operatorName });
// 设置当前日期
const now = new Date();
const dateStr = `${now.getFullYear()}年${now.getMonth() + 1}月${now.getDate()}日`;
this.setData({ currentDate: dateStr });
this.loadDashboard();
},
onShow() {
// 每次显示刷新数据
this.loadDashboard();
},
async loadDashboard() {
this.setData({ loading: true });
try {
const token = wx.getStorageSync('operatorToken');
if (!token) {
wx.redirectTo({ url: '/pages/matchmaker-login/matchmaker-login' });
return;
}
// 加载工作台数据
const [dashRes, pendingRes] = await Promise.all([
api.get('/operator/matchmaker/dashboard', {}, { Authorization: `Bearer ${token}` }),
api.get('/operator/matchmaker/pending', {}, { Authorization: `Bearer ${token}` }),
]);
if (dashRes.success) {
this.setData({
pendingCount: dashRes.data.pendingCount || 0,
inProgressCount: dashRes.data.inProgressCount || 0,
todayCount: dashRes.data.todayCount || 0,
completedCount: dashRes.data.completedCount || 0,
});
}
if (pendingRes.success) {
this.setData({
pendingServices: pendingRes.data || [],
});
}
} catch (err) {
console.error('加载工作台数据失败:', err);
} finally {
this.setData({ loading: false });
}
},
onViewService(e) {
const serviceId = e.currentTarget.dataset.id;
wx.navigateTo({ url: `/pages/matchmaker-service-detail/matchmaker-service-detail?id=${serviceId}` });
},
onClaimService(e) {
const serviceId = e.currentTarget.dataset.id;
wx.showLoading({ title: '接单中...' });
const token = wx.getStorageSync('operatorToken');
api.post(`/operator/matchmaker/services/${serviceId}/claim`, {}, {}, { Authorization: `Bearer ${token}` })
.then(res => {
wx.hideLoading();
if (res.success) {
wx.showToast({ title: '接单成功', icon: 'success' });
this.loadDashboard();
} else {
wx.showToast({ title: res.message || '接单失败', icon: 'none' });
}
})
.catch(err => {
wx.hideLoading();
wx.showToast({ title: '网络错误', icon: 'none' });
});
},
formatTime(timeStr) {
if (!timeStr) return '';
const date = new Date(timeStr);
const now = new Date();
const diff = now - date;
const days = Math.floor(diff / 86400000);
if (days === 0) return '今天';
if (days === 1) return '昨天';
if (days < 7) return days + '天前';
const m = date.getMonth() + 1;
const d = date.getDate();
return m + '月' + d + '日';
},
onLogout() {
wx.showModal({
title: '退出登录',
content: '确定要退出登录吗?',
success: (res) => {
if (res.confirm) {
wx.removeStorageSync('operatorToken');
wx.removeStorageSync('operatorName');
wx.reLaunch({ url: '/pages/matchmaker-login/matchmaker-login' });
}
},
});
},
});
@@ -0,0 +1,7 @@
{
"navigationBarTitleText": "红娘工作台",
"navigationBarBackgroundColor": "#E96B6B",
"navigationBarTextStyle": "white",
"backgroundColor": "#f0f2f5",
"usingComponents": {}
}
@@ -0,0 +1,85 @@
<!-- 红娘工作台 -->
<view class="page">
<!-- 欢迎区 -->
<view class="header">
<view class="header-top">
<view class="avatar">👩</view>
<view class="greeting-wrap">
<view class="greeting">您好,{{operatorName}}</view>
<view class="date">{{currentDate}}</view>
</view>
</view>
</view>
<view class="header-badge">公益红娘</view>
<!-- 数据概览 -->
<view class="stats-container">
<view class="stat-card" hover-class="stat-hover">
<view class="stat-icon pending">📋</view>
<view class="stat-value">{{pendingCount}}</view>
<view class="stat-label">待处理</view>
</view>
<view class="stat-card" hover-class="stat-hover">
<view class="stat-icon progress">⏳</view>
<view class="stat-value">{{inProgressCount}}</view>
<view class="stat-label">进行中</view>
</view>
<view class="stat-card" hover-class="stat-hover">
<view class="stat-icon completed">✅</view>
<view class="stat-value">{{completedCount}}</view>
<view class="stat-label">已完成</view>
</view>
<view class="stat-card" hover-class="stat-hover">
<view class="stat-icon today">📅</view>
<view class="stat-value">{{todayCount}}</view>
<view class="stat-label">今日</view>
</view>
</view>
<!-- 待处理列表 -->
<view class="section" wx:if="{{!loading}}">
<view class="section-header">
<view class="section-title-wrap">
<text class="section-dot"></text>
<text class="section-title">待处理服务</text>
</view>
<text class="section-count" wx:if="{{pendingCount > 0}}">共{{pendingCount}}件</text>
</view>
<view class="service-list" wx:if="{{pendingServices.length > 0}}">
<view
wx:for="{{pendingServices}}"
wx:key="serviceId"
class="service-card"
data-id="{{item.serviceId}}"
bindtap="onViewService"
>
<view class="service-left">
<view class="service-header">
<view class="service-tag">{{item.serviceType === 'recommend_partner' ? '推荐对象' : item.serviceType}}</view>
<view class="service-time">{{formatTime(item.createdAt)}}</view>
</view>
<view class="service-desc">{{item.description}}</view>
</view>
<button class="btn-claim" catchtap="onClaimService" data-id="{{item.serviceId}}" hover-class="btn-hover">接单</button>
</view>
</view>
<view class="empty-state" wx:else>
<view class="empty-illustration">📭</view>
<view class="empty-text">暂无待处理服务</view>
<view class="empty-hint">用户申请的服务将在这里展示</view>
</view>
</view>
<!-- 加载中 -->
<view class="loading-wrap" wx:if="{{loading}}">
<view class="loading-spinner"></view>
<text class="loading-text">加载中...</text>
</view>
<!-- 退出登录 -->
<view class="footer">
<button class="logout-btn" bindtap="onLogout">退出登录</button>
</view>
</view>
@@ -0,0 +1,266 @@
/* 页面容器 */
.page {
min-height: 100vh;
background: #f5f6fa;
}
/* 欢迎区 */
.header {
background: linear-gradient(135deg, #E96B6B 0%, #ff9a9a 100%);
padding: 48rpx 32rpx 60rpx;
color: #fff;
position: relative;
}
.header-top {
display: flex;
align-items: center;
gap: 24rpx;
}
.avatar {
width: 88rpx;
height: 88rpx;
background: rgba(255,255,255,0.25);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 44rpx;
}
.greeting {
font-size: 38rpx;
font-weight: 700;
margin-bottom: 6rpx;
}
.date {
font-size: 24rpx;
opacity: 0.85;
}
.header-badge {
margin: 12rpx 0 0 112rpx;
background: rgba(255,255,255,0.25);
padding: 6rpx 20rpx;
border-radius: 20rpx;
font-size: 22rpx;
color: #fff;
display: inline-block;
background: rgba(255,255,255,0.2);
padding: 8rpx 24rpx;
border-radius: 24rpx;
font-size: 22rpx;
}
/* 数据概览 - 2x2 网格 */
.stats-container {
display: flex;
flex-wrap: wrap;
padding: 0 24rpx;
margin-top: 24rpx;
position: relative;
z-index: 10;
}
.stat-card {
width: calc(50% - 16rpx);
margin: 0 8rpx 24rpx 8rpx;
background: #fff;
border-radius: 24rpx;
padding: 40rpx 20rpx;
text-align: center;
box-shadow: 0 8rpx 32rpx rgba(0,0,0,0.1);
box-sizing: border-box;
}
.stat-icon {
font-size: 48rpx;
margin-bottom: 16rpx;
}
.stat-value {
font-size: 56rpx;
font-weight: 700;
color: #1a1a1a;
line-height: 1.2;
margin-bottom: 8rpx;
}
.stat-label {
font-size: 26rpx;
color: #999;
}
/* 列表区块 */
.section {
margin: 0 24rpx 24rpx;
background: #fff;
border-radius: 24rpx;
padding: 32rpx;
box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
}
.section-title-wrap {
display: flex;
align-items: center;
gap: 12rpx;
}
.section-dot {
width: 6rpx;
height: 28rpx;
background: linear-gradient(180deg, #E96B6B 0%, #ff9a9a 100%);
border-radius: 3rpx;
}
.section-title {
font-size: 30rpx;
font-weight: 600;
color: #1a1a1a;
}
.section-count {
font-size: 22rpx;
color: #999;
background: #f5f5f5;
padding: 4rpx 14rpx;
border-radius: 12rpx;
}
/* 服务列表 */
.service-list {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.service-card {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx;
background: #fafafa;
border-radius: 16rpx;
border: 1rpx solid #f0f0f0;
}
.service-left {
flex: 1;
min-width: 0;
margin-right: 20rpx;
}
.service-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8rpx;
}
.service-tag {
font-size: 24rpx;
font-weight: 600;
color: #E96B6B;
background: rgba(233, 107, 107, 0.08);
padding: 4rpx 12rpx;
border-radius: 6rpx;
}
.service-time {
font-size: 20rpx;
color: #bbb;
}
.service-desc {
font-size: 26rpx;
color: #555;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.btn-claim {
background: linear-gradient(135deg, #E96B6B 0%, #ff8a80 100%);
color: #fff;
font-size: 24rpx;
font-weight: 600;
padding: 12rpx 32rpx;
border-radius: 24rpx;
border: none;
box-shadow: 0 4rpx 12rpx rgba(233, 107, 107, 0.25);
}
/* 空状态 */
.empty-state {
text-align: center;
padding: 80rpx 40rpx;
}
.empty-illustration {
font-size: 88rpx;
margin-bottom: 16rpx;
opacity: 0.5;
}
.empty-text {
font-size: 26rpx;
color: #999;
margin-bottom: 6rpx;
}
.empty-hint {
font-size: 22rpx;
color: #ccc;
}
/* 加载中 */
.loading-wrap {
display: flex;
flex-direction: column;
align-items: center;
padding: 120rpx 0;
gap: 20rpx;
}
.loading-spinner {
width: 44rpx;
height: 44rpx;
border: 4rpx solid #f0f0f0;
border-top-color: #E96B6B;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.loading-text {
font-size: 24rpx;
color: #999;
}
/* 底部退出 */
.footer {
padding: 40rpx 32rpx 20rpx;
}
.logout-btn {
width: 100%;
height: 84rpx;
line-height: 84rpx;
background: #fff;
color: #999;
font-size: 28rpx;
border-radius: 42rpx;
border: 2rpx solid #e8e8e8;
}