添加管理员逻辑
This commit is contained in:
@@ -195,9 +195,10 @@ Page({
|
||||
},
|
||||
|
||||
// 获取员工状态对应的图标
|
||||
getStaffStatusIcon(_status: string): string {
|
||||
// 统一使用trucks.png作为货运人员图标
|
||||
return '/images/trucks.png';
|
||||
getStaffStatusIcon(staff: any): string {
|
||||
// 根据员工角色返回不同的图标
|
||||
const userRole = staff?.role || 'employee';
|
||||
return userRole === 'ADMIN' ? '/images/crown.png' : '/images/truck.png';
|
||||
},
|
||||
|
||||
// 获取状态文本
|
||||
@@ -569,5 +570,17 @@ Page({
|
||||
const minute = date.getMinutes();
|
||||
return `${month}月${day}日 ${hour}:${minute < 10 ? '0' + minute : minute}`;
|
||||
}
|
||||
},
|
||||
|
||||
// 返回上一页
|
||||
goBack() {
|
||||
// 尝试使用navigateBack,如果失败则使用redirectTo返回首页
|
||||
wx.navigateBack({
|
||||
fail: () => {
|
||||
wx.redirectTo({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@@ -2,7 +2,12 @@
|
||||
<view class="admin-container">
|
||||
<!-- 顶部导航栏 -->
|
||||
<view class="top-nav">
|
||||
<text class="nav-title">配送管理系统</text>
|
||||
<view class="header-left">
|
||||
<view class="back-icon" bindtap="goBack">
|
||||
<text class="back-arrow">‹</text>
|
||||
</view>
|
||||
<text class="nav-title">配送管理系统</text>
|
||||
</view>
|
||||
<view class="user-info" wx:if="{{userInfo}}">
|
||||
<image class="user-avatar" src="/images/user-avatar.png" mode="aspectFill"></image>
|
||||
<text class="user-name">{{userInfo.name || '管理员'}}</text>
|
||||
|
@@ -20,11 +20,39 @@
|
||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 微信风格返回按钮 */
|
||||
.back-icon {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50%;
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.back-icon:active {
|
||||
background-color: rgba(255, 255, 255, 0.4);
|
||||
}
|
||||
|
||||
.back-arrow {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
Reference in New Issue
Block a user