This commit is contained in:
lik
2026-09-03 13:29:39 +08:00
parent 16ba1f654a
commit e7b27888e3
17 changed files with 565 additions and 265 deletions
+4 -4
View File
@@ -25,7 +25,7 @@
},
"tabBar": {
"color": "#8a8a8a",
"selectedColor": "#1296db",
"selectedColor": "#1a8a63",
"backgroundColor": "#ffffff",
"borderStyle": "black",
"list": [
@@ -33,19 +33,19 @@
"pagePath": "pages/home/index",
"text": "首页",
"iconPath": "images/home.png",
"selectedIconPath": "images/home-blue.png"
"selectedIconPath": "images/home-green.png"
},
{
"pagePath": "pages/ai/index",
"text": "AI",
"iconPath": "images/chat.png",
"selectedIconPath": "images/chat-blue.png"
"selectedIconPath": "images/chat-green.png"
},
{
"pagePath": "pages/set/index",
"text": "设置",
"iconPath": "images/set.png",
"selectedIconPath": "images/set-blue.png"
"selectedIconPath": "images/set-green.png"
}
]
},
+21 -8
View File
@@ -12,13 +12,26 @@
}
.os-title {
position: relative;
font-size: 30rpx;
font-weight: 500;
font-weight: 600;
color: #1a1a1a;
margin-left: 8rpx;
margin-left: 20rpx;
letter-spacing: 1rpx;
}
.os-title::before {
content: '';
position: absolute;
left: -20rpx;
top: 50%;
transform: translateY(-50%);
width: 8rpx;
height: 28rpx;
border-radius: 4rpx;
background: linear-gradient(180deg, #2dd36f, #17c3a5);
}
.os-card {
background: linear-gradient(135deg, #ffffff 0%, #f3fbf8 100%);
border-radius: 24rpx;
@@ -63,11 +76,11 @@
}
.os-num.blue {
color: #409eff;
color: #17c3a5;
}
.os-num.orange {
color: #ff9f43;
color: #f5a623;
}
.os-label {
@@ -92,13 +105,13 @@
}
.os-item:nth-child(3) .os-fee {
color: #3d8fe0;
background: rgba(64, 158, 255, 0.12);
color: #14a08a;
background: rgba(23, 195, 165, 0.12);
}
.os-item:nth-child(5) .os-fee {
color: #e08a1e;
background: rgba(255, 159, 67, 0.14);
color: #d99a2b;
background: rgba(245, 166, 35, 0.14);
}
.os-divider {
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

+53
View File
@@ -8,6 +8,14 @@ const SEX_MAP = [
]
const BLOOD_TYPES = ['A', 'B', 'O', 'AB']
const STATUS_TEXT_MAP = {
pending: '待确认',
confirmed: '已确认',
in_progress: '进行中',
completed: '已完成',
cancelled: '已取消'
}
Page({
data: {
isEdit: false,
@@ -27,6 +35,7 @@ Page({
},
region: [],
regionLabel: '',
orderList: [],
sexLabels: SEX_MAP.map(item => item.label),
bloodTypes: BLOOD_TYPES
},
@@ -44,6 +53,50 @@ Page({
}
},
onShow() {
// 从订单页返回后刷新关联订单列表
if (this.data.isEdit && this.data.profileId) {
this.loadProfileOrders(this.data.profileId)
}
},
/**
* 加载与本档案关联的预约订单
*/
loadProfileOrders(profileId) {
API.escort.getAllRecords({ page: 1, pageSize: 50, healthProfileId: profileId })
.then(res => {
if (res.code !== 0) return
const pad = (n) => String(n).padStart(2, '0')
const orderList = (res.data.records || []).map(item => {
const d = item.schedule && item.schedule.date ? new Date(item.schedule.date) : null
return {
...item,
statusText: STATUS_TEXT_MAP[item.status] || item.status,
hospitalText: [item.hospital && item.hospital.name, item.hospital && item.hospital.department]
.filter(Boolean).join('·'),
schedule: {
...item.schedule,
dateText: d && !isNaN(d.getTime())
? `${d.getMonth() + 1}${d.getDate()}${pad(d.getHours())}:${pad(d.getMinutes())}`
: ''
}
}
})
this.setData({ orderList })
})
.catch(() => {})
},
/**
* 点击关联订单,进入订单详情
*/
onOrderTap(e) {
const id = e.currentTarget.dataset.id
if (!id) return
wx.navigateTo({ url: `/pages/order/orderDetail?id=${id}` })
},
/**
* 加载档案详情
*/
+127 -3
View File
@@ -21,11 +21,25 @@ page {
}
.section-title {
position: relative;
display: block;
font-size: 32rpx;
font-weight: 700;
font-size: 30rpx;
font-weight: 600;
color: #1a1a1a;
margin-left: 8rpx;
margin-left: 28rpx;
letter-spacing: 1rpx;
&::before {
content: '';
position: absolute;
left: -20rpx;
top: 50%;
transform: translateY(-50%);
width: 8rpx;
height: 28rpx;
border-radius: 4rpx;
background: linear-gradient(180deg, #2dd36f, #17c3a5);
}
}
.form-card {
@@ -68,6 +82,116 @@ page {
background-color: #f0f0f0;
}
/* 关联预约订单 */
.order-list {
margin-top: 16rpx;
display: flex;
flex-direction: column;
gap: 20rpx;
}
.order-card {
background-color: #ffffff;
border-radius: 24rpx;
padding: 28rpx 32rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
&:active {
opacity: 0.85;
}
}
.order-line1 {
display: flex;
align-items: center;
}
.order-patient {
font-size: 30rpx;
font-weight: 600;
color: #1a1a1a;
margin-right: 16rpx;
}
.order-service {
font-size: 26rpx;
font-weight: 500;
color: #1abc9c;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.status-tag {
font-size: 22rpx;
padding: 6rpx 20rpx;
border-radius: 30rpx;
font-weight: 500;
flex-shrink: 0;
}
.status-pending {
background: #fdf3e0;
color: #d99a2b;
}
.status-confirmed {
background: #e6f4ee;
color: #43a08a;
}
.status-in_progress {
background: #e6f4ee;
color: #43a08a;
}
.status-completed {
background: #efedf6;
color: #8a7bb5;
}
.status-cancelled {
background: #f5f5f5;
color: #b0b0b0;
}
.order-line2 {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 12rpx;
}
.order-hospital {
font-size: 26rpx;
color: #888888;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-right: 16rpx;
}
.order-time {
font-size: 26rpx;
color: #a0a3bd;
flex-shrink: 0;
}
.empty-order {
margin-top: 16rpx;
background-color: #ffffff;
border-radius: 24rpx;
padding: 48rpx 0;
text-align: center;
text {
font-size: 26rpx;
color: #b8b8c4;
}
}
/* 操作按钮 */
.btn-group {
display: flex;
+21
View File
@@ -81,6 +81,27 @@
</view>
</view>
<!-- 关联预约订单(仅编辑已有档案时显示) -->
<view wx:if="{{isEdit}}" class="section">
<text class="section-title">预约订单</text>
<view wx:if="{{orderList.length > 0}}" class="order-list">
<view class="order-card" wx:for="{{orderList}}" wx:key="_id" bindtap="onOrderTap" data-id="{{item._id}}">
<view class="order-line1">
<text class="order-patient">{{item.patient.name}}</text>
<text class="order-service">{{item.escort.serviceName}}</text>
<text class="status-tag status-{{item.status}}">{{item.statusText}}</text>
</view>
<view class="order-line2">
<text class="order-hospital">{{item.hospitalText}}</text>
<text class="order-time">{{item.schedule.dateText}}</text>
</view>
</view>
</view>
<view wx:else class="empty-order">
<text>暂无关联的预约订单</text>
</view>
</view>
<!-- 陪诊预约(仅编辑已有档案时显示) -->
<view wx:if="{{isEdit}}" class="btn btn-outline booking-btn" bindtap="onBooking">
<text>陪诊预约</text>
+39 -17
View File
@@ -4,18 +4,20 @@ const API = require('../../utils/api.js')
Page({
data: {
today: '',
greeting: '',
todayText: '',
pendingCount: 0,
completedCount: 0,
recentOrders: [],
// 快捷入口:前3个为快捷操作(橙色系),后4个为功能入口(绿色系)
// 快捷入口:type=quick 为快捷操作(橙色系),type=function 为功能入口(绿色系),分行显示
quickEntries: [
{ icon: 'add-circle', name: '增加预约', url: '/pages/order/orderEdit', color: '#ff8f4d' },
{ icon: 'file-add', name: '增加档案', url: '/pages/healthprofile/profileInfo', color: '#ff8f4d' },
{ icon: 'lightbulb-circle-filled', name: 'AI办公', url: '/pages/ai/index', isTab: true, color: '#ff8f4d' },
{ icon: 'bill', name: '预约订单', url: '/pages/order/index', color: '#1abc9c' },
{ icon: 'heart', name: '健康档案', url: '/pages/healthprofile/index', color: '#1abc9c' },
{ icon: 'user', name: '注册用户', url: '/pages/customer/index', color: '#1abc9c' },
{ icon: 'user-circle', name: '个人信息', url: '/pages/me/index', color: '#1abc9c' }
{ type: 'quick', icon: 'add-circle', name: '增加预约', url: '/pages/order/orderEdit', color: '#ff8f4d' },
{ type: 'quick', icon: 'file-add', name: '增加档案', url: '/pages/healthprofile/profileInfo', color: '#ff8f4d' },
{ type: 'quick', icon: 'lightbulb-circle-filled', name: 'AI办公', url: '/pages/ai/index', isTab: true, color: '#ff8f4d' },
{ type: 'function', icon: 'bill', name: '预约订单', url: '/pages/order/index', color: '#1abc9c' },
{ type: 'function', icon: 'heart', name: '健康档案', url: '/pages/healthprofile/index', color: '#1abc9c' },
{ type: 'function', icon: 'user', name: '注册用户', url: '/pages/customer/index', color: '#1abc9c' },
{ type: 'function', icon: 'user-circle', name: '个人信息', url: '/pages/me/index', color: '#1abc9c' }
],
online: true,
profile: {
@@ -23,7 +25,7 @@ Page({
level: '初级陪诊师',
avatar: ''
},
todayIncome: 168,
todayIncome: 0,
todayOrderCount: 0,
pendingOrder: {
count: 1,
@@ -63,7 +65,10 @@ Page({
this.loadUser()
const now = new Date();
const today = now.toISOString().substring(0, 10);
this.setData({ today });
const hour = now.getHours();
const greeting = hour < 6 ? '夜深了' : hour < 9 ? '早上好' : hour < 12 ? '上午好' : hour < 14 ? '中午好' : hour < 18 ? '下午好' : '晚上好';
const week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][now.getDay()];
this.setData({ today, greeting, todayText: `${now.getMonth() + 1}${now.getDate()}${week}` });
this.getRecentOrders();
this.getStats();
},
@@ -104,16 +109,33 @@ Page({
},
async getStats() {
const today = new Date().toISOString().substring(0, 10);
const [todayRes, pendingRes, completedRes] = await Promise.all([
API.escort.getAllRecords({ appointmentDate: today }),
API.escort.getAllRecords({ status: 'pending,confirmed' }),
const now = new Date();
const pad = (n) => String(n).padStart(2, '0');
// 本地日期(toISOString 是 UTC,早晨会差一天)
const todayStr = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
const isSameDay = (d, ref) =>
d.getFullYear() === ref.getFullYear() && d.getMonth() === ref.getMonth() && d.getDate() === ref.getDate();
const feeOf = (item) => Number(item.payment && item.payment.totalFee) || 0;
const [todayRes, completedRes] = await Promise.all([
API.escort.getAllRecords({ appointmentDate: todayStr }),
API.escort.getAllRecords({ status: 'completed' })
]);
// 今日收益:当日已完成订单的费用合计
let todayIncome = 0;
if (completedRes.code === 0) {
(completedRes.data.records || []).forEach(item => {
const d = item.schedule && item.schedule.date ? new Date(item.schedule.date) : null;
if (d && !isNaN(d.getTime()) && isSameDay(d, now)) {
todayIncome += feeOf(item);
}
});
}
this.setData({
todayOrderCount: todayRes.code === 0 ? (todayRes.data.records || []).length : 0,
pendingCount: pendingRes.code === 0 ? (pendingRes.data.records || []).length : 0,
completedCount: completedRes.code === 0 ? (completedRes.data.records || []).length : 0,
todayIncome,
todayOrderCount: todayRes.code === 0 ? (todayRes.data.records || []).length : 0
});
},
+18 -5
View File
@@ -15,6 +15,7 @@
<text class="level-text">{{profile.level}}</text>
</view>
</view>
<text class="greeting">{{greeting}}{{todayText}}</text>
</view>
</view>
<view class="online-switch" bindtap="toggleOnline">
@@ -33,6 +34,7 @@
<text class="stat-num">{{todayIncome}}</text>
</view>
</view>
<view class="stat-divider"></view>
<view class="stat stat-right">
<text class="stat-label">今日接单</text>
<view class="stat-value">
@@ -47,11 +49,21 @@
<view class="section">
<text class="section-title">快捷入口</text>
<view class="quick-grid card">
<view class="quick-item" wx:for="{{quickEntries}}" wx:key="name" bindtap="onEntryTap" data-index="{{index}}">
<view class="quick-icon" style="background-color: {{item.color}}1a;">
<t-icon name="{{item.icon}}" size="40rpx" color="{{item.color}}" />
<view class="quick-row">
<view class="quick-item" wx:for="{{quickEntries}}" wx:key="name" wx:if="{{item.type === 'quick'}}" bindtap="onEntryTap" data-index="{{index}}">
<view class="quick-icon" style="background-color: {{item.color}}1a;">
<t-icon name="{{item.icon}}" size="40rpx" color="{{item.color}}" />
</view>
<text class="quick-label">{{item.name}}</text>
</view>
</view>
<view class="quick-row">
<view class="quick-item" wx:for="{{quickEntries}}" wx:key="name" wx:if="{{item.type === 'function'}}" bindtap="onEntryTap" data-index="{{index}}">
<view class="quick-icon" style="background-color: {{item.color}}1a;">
<t-icon name="{{item.icon}}" size="40rpx" color="{{item.color}}" />
</view>
<text class="quick-label">{{item.name}}</text>
</view>
<text class="quick-label">{{item.name}}</text>
</view>
</view>
</view>
@@ -65,7 +77,7 @@
<text class="section-title">近7日订单</text>
<view class="view-all" bindtap="viewAllOrders">
<text>全部</text>
<text class="arrow">→</text>
<t-icon name="chevron-right" size="28rpx" color="#a0a3bd" />
</view>
</view>
@@ -86,6 +98,7 @@
</view>
<view class="empty-state" wx:else>
<t-icon name="inbox" size="72rpx" color="#d8dde8" />
<text class="empty-text">暂无近7日订单</text>
</view>
</view>
+53 -42
View File
@@ -1,7 +1,7 @@
/* pages/home/index.wxss */
page {
background: linear-gradient(180deg, #ffb97a 0%, #f5f6fa 420rpx);
background: #f5f6fa;
color: #1a1a2e;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
@@ -12,16 +12,15 @@ page {
padding: 24rpx 24rpx 64rpx;
}
/* === 头部信息卡(浅色玻璃 === */
/* === 头部信息卡(翡翠绿实底 === */
.header-card {
position: relative;
overflow: hidden;
background: rgba(255, 255, 255, 0.62);
border: 1rpx solid rgba(255, 255, 255, 0.85);
background: linear-gradient(135deg, #29b785 0%, #1a8a63 100%);
border-radius: 28rpx;
padding: 36rpx 32rpx;
color: #3d2f25;
box-shadow: 0 12rpx 32rpx rgba(242, 100, 80, 0.16);
color: #ffffff;
box-shadow: 0 12rpx 32rpx rgba(26, 138, 99, 0.25);
}
/* 装饰光斑,增加层次 */
@@ -30,7 +29,7 @@ page {
content: '';
position: absolute;
border-radius: 50%;
background: rgba(255, 138, 61, 0.1);
background: rgba(255, 255, 255, 0.07);
pointer-events: none;
}
@@ -46,7 +45,7 @@ page {
height: 160rpx;
bottom: -80rpx;
left: -40rpx;
background: rgba(242, 100, 80, 0.08);
background: rgba(255, 255, 255, 0.05);
}
.profile-row {
@@ -65,8 +64,8 @@ page {
width: 96rpx;
height: 96rpx;
border-radius: 50%;
background-color: rgba(255, 138, 61, 0.15);
border: 2rpx solid rgba(255, 255, 255, 0.9);
background-color: rgba(255, 255, 255, 0.2);
border: 2rpx solid rgba(255, 255, 255, 0.45);
display: flex;
align-items: center;
justify-content: center;
@@ -82,7 +81,7 @@ page {
.avatar-text {
font-size: 40rpx;
font-weight: 600;
color: #f2633f;
color: #ffffff;
}
.profile-info {
@@ -101,21 +100,28 @@ page {
.level-tag {
margin-left: 12rpx;
background-color: rgba(242, 100, 80, 0.12);
background-color: rgba(255, 255, 255, 0.2);
border-radius: 16rpx;
padding: 4rpx 14rpx;
}
.level-text {
font-size: 20rpx;
color: #e05a3a;
color: #ffffff;
}
.greeting {
display: block;
margin-top: 8rpx;
font-size: 22rpx;
color: rgba(255, 255, 255, 0.65);
}
.online-switch {
display: flex;
align-items: center;
background-color: rgba(255, 255, 255, 0.75);
border: 1rpx solid rgba(255, 255, 255, 0.9);
background-color: rgba(255, 255, 255, 0.16);
border: 1rpx solid rgba(255, 255, 255, 0.28);
border-radius: 28rpx;
padding: 6rpx 6rpx 6rpx 18rpx;
}
@@ -123,14 +129,14 @@ page {
.switch-text {
font-size: 24rpx;
margin-right: 10rpx;
color: #3d2f25;
color: #ffffff;
}
.switch-track {
width: 56rpx;
height: 32rpx;
border-radius: 16rpx;
background-color: rgba(61, 47, 37, 0.15);
background-color: rgba(255, 255, 255, 0.35);
position: relative;
transition: background-color 0.2s ease;
}
@@ -152,7 +158,7 @@ page {
.switch-track.on .switch-thumb {
left: 26rpx;
background-color: #ff8f4d;
background-color: #1a8a63;
}
.stats-row {
@@ -170,9 +176,14 @@ page {
align-items: flex-end;
}
.stat-divider {
width: 2rpx;
background: rgba(255, 255, 255, 0.25);
}
.stat-label {
font-size: 24rpx;
color: rgba(61, 47, 37, 0.65);
color: rgba(255, 255, 255, 0.75);
}
.stat-value {
@@ -191,7 +202,7 @@ page {
font-size: 44rpx;
font-weight: 700;
line-height: 1;
color: #f2633f;
color: #ffffff;
}
/* === 通用 Section === */
@@ -230,16 +241,10 @@ page {
.view-all {
display: flex;
align-items: center;
gap: 6rpx;
font-size: 24rpx;
color: #a0a3bd;
}
.view-all .arrow {
font-size: 28rpx;
color: #a0a3bd;
}
/* === 快捷功能入口 === */
.card {
background-color: #ffffff;
@@ -255,6 +260,11 @@ page {
flex-wrap: wrap;
}
.quick-row {
display: flex;
width: 100%;
}
.quick-item {
width: 25%;
display: flex;
@@ -272,7 +282,6 @@ page {
.quick-icon {
width: 88rpx;
height: 88rpx;
background-color: #e6f9f3;
border-radius: 26rpx;
display: flex;
align-items: center;
@@ -282,7 +291,7 @@ page {
}
.quick-label {
font-size: 24rpx;
font-size: 26rpx;
color: #3a3f4d;
}
@@ -338,23 +347,23 @@ page {
}
.status-pending {
background: #fff8e6;
color: #e6a23c;
background: #fdf3e0;
color: #d99a2b;
}
.status-confirmed {
background: #ecf5ff;
color: #409eff;
background: #e9f1f8;
color: #5c88a8;
}
.status-in_progress {
background: #f0f9eb;
color: #67c23a;
background: #e6f4ee;
color: #43a08a;
}
.status-completed {
background: #f4f0ff;
color: #7c5cfc;
background: #efedf6;
color: #8a7bb5;
}
.status-cancelled {
@@ -370,7 +379,7 @@ page {
}
.order-hospital {
font-size: 24rpx;
font-size: 26rpx;
color: #888888;
flex: 1;
overflow: hidden;
@@ -380,7 +389,7 @@ page {
}
.order-time {
font-size: 24rpx;
font-size: 26rpx;
color: #a0a3bd;
flex-shrink: 0;
}
@@ -390,13 +399,15 @@ page {
background: #ffffff;
border-radius: 24rpx;
border: 1rpx solid rgba(31, 61, 56, 0.06);
padding: 80rpx 0;
text-align: center;
padding: 64rpx 0;
display: flex;
flex-direction: column;
align-items: center;
box-shadow: 0 6rpx 20rpx rgba(31, 61, 56, 0.07);
}
.empty-text {
font-size: 28rpx;
margin-top: 16rpx;
font-size: 26rpx;
color: #c0c3d4;
font-weight: 400;
}
+13 -2
View File
@@ -133,8 +133,8 @@ Page({
paymentStatusText: PAYMENT_STATUS_MAP[payment.status] || payment.status || '未支付',
attendantSexText: attendant.sex === 'male' ? '男' : attendant.sex === 'female' ? '女' : '',
sexRequirementText: escort.sexRequirement === 'male' ? '要求男陪诊' : escort.sexRequirement === 'female' ? '要求女陪诊' : '不限',
// 操作按钮(待确认/已确认状态下可编辑订单信息)
showEditBtn: status === 'pending' || status === 'confirmed',
// 操作按钮(任何状态下可编辑订单信息)
showEditBtn: true,
showConfirmBtn: status === 'pending',
showCancelBtn: status === 'pending',
showStartBtn: status === 'confirmed',
@@ -153,6 +153,17 @@ Page({
wx.makePhoneCall({ phoneNumber: phone })
},
// 点击患者信息,进入健康档案详情
onProfileTap() {
if (!this.data.healthProfileId) {
wx.showToast({ title: '该订单未关联健康档案', icon: 'none' })
return
}
wx.navigateTo({
url: `/pages/healthprofile/profileInfo?id=${this.data.healthProfileId}`
})
},
// 编辑订单
onEdit() {
wx.navigateTo({
+1 -17
View File
@@ -24,20 +24,8 @@
use-cache="{{false}}"
dial="{{true}}"
bind:call="callPhone"
bindtap="onProfileTap"
/>
<view class="divider"></view>
<view class="info-row" wx:if="{{order.patient.weight}}">
<text class="info-label">体重</text>
<text class="info-value">{{order.patient.weight}}kg</text>
</view>
<view class="info-row" wx:if="{{order.patient.height}}">
<text class="info-label">身高</text>
<text class="info-value">{{order.patient.height}}cm</text>
</view>
<view class="info-row" wx:if="{{order.patient.idnumber}}">
<text class="info-label">身份证号</text>
<text class="info-value">{{order.patient.idnumber}}</text>
</view>
</view>
</view>
@@ -133,10 +121,6 @@
<text class="info-label">服务费用</text>
<text class="info-value fee-value">¥{{order.payment.totalFee || 0}}</text>
</view>
<view class="info-row" wx:if="{{order.payment.paidFee}}">
<text class="info-label">已支付</text>
<text class="info-value">¥{{order.payment.paidFee}}</text>
</view>
<view class="info-row">
<text class="info-label">支付状态</text>
<text class="info-value">{{paymentStatusText}}</text>
+30 -15
View File
@@ -89,17 +89,30 @@ page {
}
.section-title {
font-size: 32rpx;
font-weight: 700;
position: relative;
font-size: 30rpx;
font-weight: 600;
color: #1a1a1a;
margin-bottom: 16rpx;
margin-left: 8rpx;
margin-bottom: 24rpx;
margin-left: 20rpx;
letter-spacing: 1rpx;
}
.section-title::before {
content: '';
position: absolute;
left: -20rpx;
top: 50%;
transform: translateY(-50%);
width: 8rpx;
height: 28rpx;
border-radius: 4rpx;
background: linear-gradient(180deg, #2dd36f, #17c3a5);
}
.info-card {
background: #ffffff;
border-radius: 24rpx;
border-radius: 8rpx;
padding: 28rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
}
@@ -115,14 +128,14 @@ page {
}
.info-label {
font-size: 24rpx;
font-size: 28rpx;
color: #a0a3bd;
width: 140rpx;
flex-shrink: 0;
}
.info-value {
font-size: 26rpx;
font-size: 28rpx;
color: #3a3d5c;
flex: 1;
}
@@ -150,12 +163,12 @@ page {
}
.patient-age {
font-size: 24rpx;
font-size: 26rpx;
color: #a0a3bd;
}
.patient-phone {
font-size: 24rpx;
font-size: 26rpx;
color: #a0a3bd;
}
@@ -208,7 +221,7 @@ page {
}
.attendant-phone {
font-size: 24rpx;
font-size: 26rpx;
color: #a0a3bd;
}
@@ -222,7 +235,9 @@ page {
/* === 备注信息 === */
.note-block {
margin-bottom: 20rpx;
display: flex;
align-items: baseline;
margin-bottom: 16rpx;
}
.note-block:last-child {
@@ -230,18 +245,18 @@ page {
}
.note-label {
display: block;
font-size: 24rpx;
font-size: 26rpx;
color: #a0a3bd;
margin-bottom: 8rpx;
width: 140rpx;
flex-shrink: 0;
font-weight: 500;
}
.note-content {
display: block;
font-size: 26rpx;
color: #3a3d5c;
line-height: 1.6;
flex: 1;
}
/* === 底部操作 === */
+32 -35
View File
@@ -3,8 +3,9 @@ const API = require('../../utils/api.js')
Page({
data: {
isLoggedIn: false,
userInfo: null,
phoneNumber: '',
displayName: '',
avatar: '',
levelText: '初级陪诊员',
version: '1.0.0',
showLoginPopup: false,
loginForm: {
@@ -12,7 +13,7 @@ Page({
mobile: ''
},
menuList: [
{ icon: 'user', title: '个人资料', url: '' },
{ icon: 'user', title: '个人资料', url: '/pages/me/index' },
{ icon: 'notification', title: '消息通知', url: '' },
{ icon: 'lock-on', title: '账号安全', url: '' },
{ icon: 'help-circle', title: '帮助中心', url: '' },
@@ -38,28 +39,34 @@ Page({
},
onUserLogin(user) {
this.setData({
isLoggedIn: true,
userInfo: user,
phoneNumber: this.maskPhoneNumber(user.mobile || '')
})
this.applyUser(user)
},
checkLoginStatus() {
const app = getApp()
const user = app.globalData.user
if (user && user.security && user.security.token) {
this.setData({
isLoggedIn: true,
userInfo: user,
phoneNumber: this.maskPhoneNumber(user.mobile || '')
})
}
this.applyUser(app.globalData.user)
},
maskPhoneNumber(phone) {
if (!phone || phone.length < 7) return phone
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
/**
* 将用户对象映射为页面展示字段(真实信息)
*/
applyUser(user) {
if (!user || !user.security || !user.security.token) {
this.setData({
isLoggedIn: false,
displayName: '',
avatar: '',
levelText: '初级陪诊员'
})
return
}
const p = user.profile || {}
this.setData({
isLoggedIn: true,
displayName: p.name || '管理员',
avatar: p.avatar || '',
levelText: user.level || p.level || '初级陪诊员'
})
},
getAppVersion() {
@@ -112,14 +119,12 @@ Page({
if (data.code == 0) {
const app = getApp()
app.globalData.user = data.data.user
this.applyUser(app.globalData.user)
this.setData({
isLoggedIn: true,
userInfo: app.globalData.user,
phoneNumber: this.maskPhoneNumber(app.globalData.user.profile.mobile || ''),
showLoginPopup: false,
loginForm: { name: '', mobile: '' }
})
wx.showToast({ title: '登录成功', icon: 'success' })
} else {
wx.showToast({ title: '登录失败', icon: 'none' })
@@ -159,7 +164,7 @@ Page({
wx.showModal({
title: '退出登录',
content: '确定要退出登录吗?',
confirmColor: '#4c6ef5',
confirmColor: '#1a8a63',
success: (res) => {
if (res.confirm) {
wx.showLoading({ title: '退出中...' })
@@ -183,11 +188,7 @@ Page({
wx.removeStorageSync('admin_ai_session_id')
wx.removeStorageSync('admin_ai_chat_history')
this.setData({
isLoggedIn: false,
userInfo: null,
phoneNumber: ''
})
this.applyUser(null)
wx.showToast({ title: '已退出登录', icon: 'success' })
},
@@ -200,18 +201,14 @@ Page({
wx.showModal({
title: '清除缓存',
content: '确定要清除所有缓存数据吗?',
confirmColor: '#4c6ef5',
confirmColor: '#1a8a63',
success: (res) => {
if (res.confirm) {
wx.clearStorage({
success: () => {
const app = getApp()
app.globalData.user = null
this.setData({
isLoggedIn: false,
userInfo: null,
phoneNumber: ''
})
this.applyUser(null)
wx.showToast({ title: '缓存已清除', icon: 'success' })
}
})
+32 -21
View File
@@ -1,21 +1,23 @@
<view class="set-page">
<!-- 用户信息卡片 -->
<!-- 用户卡片 -->
<view class="user-card">
<view class="user-info" wx:if="{{isLoggedIn}}">
<view class="user-avatar">
<text class="avatar-text">{{userInfo.nickname ? userInfo.nickname[0] : '管'}}</text>
<image wx:if="{{avatar}}" class="avatar-img" src="{{avatar}}" mode="aspectFill" />
<text wx:else class="avatar-text">{{displayName[0]}}</text>
</view>
<view class="user-detail">
<text class="user-name">{{userInfo.nickname || '管理员'}}</text>
<text class="user-phone">{{phoneNumber}}</text>
</view>
<view class="logout-btn" bindtap="onLogout">
<text class="logout-text">退出</text>
<view class="name-row">
<text class="user-name">{{displayName}}</text>
<view class="level-tag">
<text class="level-text">{{levelText}}</text>
</view>
</view>
</view>
</view>
<view class="user-info login-area" wx:else>
<view class="user-avatar default-avatar">
<t-icon name="user" size="40rpx" color="#9ca3af" />
<t-icon name="user" size="40rpx" color="#8f9d97" />
</view>
<view class="user-detail">
<text class="login-title">未登录</text>
@@ -28,31 +30,40 @@
</view>
<!-- 菜单列表 -->
<view class="menu-section">
<view class="menu-list">
<view class="section">
<view class="menu-list card">
<view class="menu-item" wx:for="{{menuList}}" wx:key="index" data-index="{{index}}" bindtap="onMenuTap">
<view class="menu-left">
<t-icon name="{{item.icon}}" size="32rpx" color="#4c6ef5" />
<view class="menu-icon">
<t-icon name="{{item.icon}}" size="32rpx" color="#1a8a63" />
</view>
<text class="menu-title">{{item.title}}</text>
</view>
<view class="menu-right">
<t-icon name="chevron-right" size="28rpx" color="#9ca3af" />
</view>
<t-icon name="chevron-right" size="28rpx" color="#b7c6c0" />
</view>
</view>
</view>
<!-- 系统操作 -->
<view class="menu-section">
<view class="menu-list">
<view class="section">
<view class="menu-list card">
<view class="menu-item" bindtap="onClearCache">
<view class="menu-left">
<t-icon name="delete" size="32rpx" color="#ff6b6b" />
<view class="menu-icon danger-bg">
<t-icon name="delete" size="32rpx" color="#e05a4e" />
</view>
<text class="menu-title danger">清除缓存</text>
</view>
<view class="menu-right">
<t-icon name="chevron-right" size="28rpx" color="#9ca3af" />
<t-icon name="chevron-right" size="28rpx" color="#b7c6c0" />
</view>
<view class="menu-item" wx:if="{{isLoggedIn}}" bindtap="onLogout">
<view class="menu-left">
<view class="menu-icon danger-bg">
<t-icon name="logout" size="32rpx" color="#e05a4e" />
</view>
<text class="menu-title danger">退出登录</text>
</view>
<t-icon name="chevron-right" size="28rpx" color="#b7c6c0" />
</view>
</view>
</view>
@@ -78,7 +89,7 @@
</view>
<view class="popup-footer">
<view class="submit-btn" bindtap="onLoginSubmit">
<text class="submit-btn-text">登录</text>
<text class="submit-btn-text">登 录</text>
</view>
</view>
</view>
@@ -86,6 +97,6 @@
<!-- 版本信息 -->
<view class="version-info">
<text class="version-text">版本 {{version}}</text>
<text class="version-text">暖橙陪诊 · {{version}}</text>
</view>
</view>
+121 -96
View File
@@ -1,56 +1,104 @@
page {
background-color: #f5f6fa;
background: linear-gradient(180deg, #eaf6f1 0%, #f5f6fa 360rpx);
color: #1a1a2e;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.set-page {
padding: 24rpx;
padding: 24rpx 24rpx 64rpx;
min-height: 100vh;
box-sizing: border-box;
}
/* === 用户卡片(翡翠绿,呼应首页头部) === */
.user-card {
background-color: #ffffff;
border-radius: 24rpx;
border: 1rpx solid #e5e7eb;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
position: relative;
overflow: hidden;
margin-bottom: 24rpx;
background: linear-gradient(135deg, #29b785 0%, #1a8a63 100%);
border-radius: 28rpx;
box-shadow: 0 12rpx 32rpx rgba(26, 138, 99, 0.25);
margin-bottom: 32rpx;
}
.user-card::before,
.user-card::after {
content: '';
position: absolute;
border-radius: 50%;
background: rgba(255, 255, 255, 0.07);
pointer-events: none;
}
.user-card::before {
width: 240rpx;
height: 240rpx;
top: -110rpx;
right: -60rpx;
}
.user-card::after {
width: 140rpx;
height: 140rpx;
bottom: -70rpx;
left: -30rpx;
background: rgba(255, 255, 255, 0.05);
}
.user-info {
position: relative;
z-index: 1;
display: flex;
align-items: center;
padding: 40rpx 32rpx;
padding: 44rpx 32rpx;
gap: 24rpx;
}
.user-info.login-area {
align-items: center;
}
.user-avatar {
width: 100rpx;
height: 100rpx;
background: linear-gradient(135deg, #4c6ef5, #748ffc);
width: 104rpx;
height: 104rpx;
background-color: rgba(255, 255, 255, 0.2);
border: 2rpx solid rgba(255, 255, 255, 0.45);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
box-shadow: 0 4rpx 12rpx rgba(76, 110, 245, 0.25);
}
.user-avatar.default-avatar {
background: #f3f4f6;
box-shadow: none;
background-color: rgba(255, 255, 255, 0.16);
}
.avatar-text {
font-size: 36rpx;
font-size: 40rpx;
font-weight: 600;
color: #ffffff;
}
.avatar-img {
width: 100%;
height: 100%;
border-radius: 50%;
}
.name-row {
display: flex;
align-items: center;
}
.level-tag {
margin-left: 12rpx;
background-color: rgba(255, 255, 255, 0.2);
border-radius: 16rpx;
padding: 4rpx 14rpx;
flex-shrink: 0;
}
.level-text {
font-size: 20rpx;
color: #ffffff;
}
.user-detail {
flex: 1;
display: flex;
@@ -58,95 +106,61 @@ page {
gap: 8rpx;
}
.user-name {
font-size: 32rpx;
font-weight: 600;
color: #1a1a2e;
}
.user-phone {
font-size: 26rpx;
color: #9ca3af;
}
.user-name,
.login-title {
font-size: 32rpx;
font-weight: 600;
color: #1a1a2e;
font-size: 34rpx;
font-weight: 700;
color: #ffffff;
}
.login-desc {
font-size: 24rpx;
color: #9ca3af;
}
.logout-btn {
padding: 12rpx 28rpx;
background-color: rgba(255, 107, 107, 0.1);
border-radius: 28rpx;
display: flex;
align-items: center;
justify-content: center;
}
.logout-btn:active {
transform: scale(0.95);
opacity: 0.9;
}
.logout-text {
font-size: 24rpx;
color: #ff6b6b;
font-weight: 500;
color: rgba(255, 255, 255, 0.65);
}
.login-btn {
margin: 0;
padding: 16rpx 32rpx;
background: linear-gradient(135deg, #4c6ef5, #748ffc);
padding: 14rpx 32rpx;
background-color: #ffffff;
border-radius: 28rpx;
display: flex;
align-items: center;
justify-content: center;
line-height: 1;
border: none;
}
.login-btn::after {
border: none;
}
.login-btn:active {
transform: scale(0.95);
opacity: 0.9;
}
.login-btn-text {
font-size: 26rpx;
color: #ffffff;
font-weight: 500;
color: #1a8a63;
font-weight: 600;
}
.menu-section {
background-color: #ffffff;
border-radius: 24rpx;
border: 1rpx solid #e5e7eb;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
overflow: hidden;
/* === 菜单分组 === */
.section {
margin-bottom: 24rpx;
}
.card {
background-color: #ffffff;
border-radius: 24rpx;
border: 1rpx solid rgba(31, 61, 56, 0.06);
box-shadow: 0 6rpx 20rpx rgba(31, 61, 56, 0.07);
}
.menu-list {
padding: 0 32rpx;
padding: 8rpx 28rpx;
}
.menu-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx 0;
border-bottom: 1rpx solid #f3f4f6;
transition: background-color 0.2s ease;
padding: 28rpx 0;
border-bottom: 1rpx solid rgba(31, 61, 56, 0.06);
transition: opacity 0.2s ease;
}
.menu-item:last-child {
@@ -154,7 +168,7 @@ page {
}
.menu-item:active {
background-color: rgba(76, 110, 245, 0.05);
opacity: 0.6;
}
.menu-left {
@@ -163,21 +177,31 @@ page {
gap: 20rpx;
}
.menu-icon {
width: 64rpx;
height: 64rpx;
border-radius: 18rpx;
background-color: rgba(26, 138, 99, 0.08);
display: flex;
align-items: center;
justify-content: center;
}
.menu-icon.danger-bg {
background-color: rgba(224, 90, 78, 0.08);
}
.menu-title {
font-size: 28rpx;
color: #1a1a2e;
color: #1a1a1a;
font-weight: 500;
}
.menu-title.danger {
color: #ff6b6b;
}
.menu-right {
display: flex;
align-items: center;
color: #e05a4e;
}
/* === 版本信息 === */
.version-info {
display: flex;
align-items: center;
@@ -187,17 +211,17 @@ page {
.version-text {
font-size: 24rpx;
color: #9ca3af;
color: #9fb0a9;
}
/* 登录弹窗 */
/* === 登录弹窗 === */
.login-popup {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
background-color: rgba(0, 0, 0, 0.45);
display: flex;
align-items: center;
justify-content: center;
@@ -205,12 +229,12 @@ page {
}
.login-popup-content {
width: 80%;
width: 82%;
max-width: 600rpx;
background-color: #ffffff;
border-radius: 24rpx;
border-radius: 28rpx;
overflow: hidden;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.12);
box-shadow: 0 16rpx 48rpx rgba(31, 61, 56, 0.18);
}
.popup-header {
@@ -223,7 +247,7 @@ page {
.popup-title {
font-size: 32rpx;
font-weight: 600;
color: #1a1a2e;
color: #1a1a1a;
}
.popup-close {
@@ -262,17 +286,17 @@ page {
.form-input {
width: 100%;
height: 80rpx;
background-color: #f5f6fa;
background-color: #f7f9f8;
border-radius: 16rpx;
padding: 0 24rpx;
font-size: 28rpx;
color: #1a1a2e;
color: #1a1a1a;
box-sizing: border-box;
border: 1rpx solid #e5e7eb;
border: 1rpx solid #e5eae8;
}
.form-input:focus {
border-color: #4c6ef5;
border-color: #1a8a63;
}
.popup-footer {
@@ -282,12 +306,12 @@ page {
.submit-btn {
width: 100%;
height: 88rpx;
background: linear-gradient(135deg, #4c6ef5, #748ffc);
background: linear-gradient(135deg, #29b785, #1a8a63);
border-radius: 44rpx;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4rpx 16rpx rgba(76, 110, 245, 0.25);
box-shadow: 0 6rpx 18rpx rgba(26, 138, 99, 0.28);
transition: all 0.2s ease;
}
@@ -300,4 +324,5 @@ page {
font-size: 30rpx;
color: #ffffff;
font-weight: 600;
letter-spacing: 4rpx;
}