chore: 抢单端UI回退前备份当前完整工作区
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { resolveAvatarUrl } = require('../../utils/avatar.js');
|
||||
const { resolveAvatarUrl, getDefaultAvatarUrl } = require('../../utils/avatar.js');
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
@@ -53,7 +53,8 @@ Component({
|
||||
|
||||
// 静音状态
|
||||
isMuted: false,
|
||||
|
||||
formattedTime: '',
|
||||
|
||||
// 自动隐藏计时器
|
||||
autoHideTimeout: null
|
||||
},
|
||||
@@ -123,7 +124,7 @@ Component({
|
||||
let avatar = resolveAvatarUrl(
|
||||
data.avatar || data.message?.senderData?.avatar,
|
||||
app
|
||||
);
|
||||
) || getDefaultAvatarUrl(app);
|
||||
|
||||
this.setData({
|
||||
show: true,
|
||||
@@ -131,6 +132,7 @@ Component({
|
||||
message: data.content || '[消息内容]',
|
||||
avatar: avatar,
|
||||
notificationData: data,
|
||||
formattedTime: this.formatTime(data.timestamp),
|
||||
progress: 100,
|
||||
swipingClass: '',
|
||||
swipeStyle: ''
|
||||
@@ -149,6 +151,7 @@ Component({
|
||||
this.clearTimers();
|
||||
this.setData({
|
||||
show: false,
|
||||
formattedTime: '',
|
||||
progress: 100,
|
||||
swipingClass: '',
|
||||
swipeStyle: ''
|
||||
@@ -265,6 +268,13 @@ Component({
|
||||
this.triggerEvent('close');
|
||||
this.hideNotification();
|
||||
},
|
||||
|
||||
onAvatarError() {
|
||||
const def = getDefaultAvatarUrl(getApp());
|
||||
if (def && this.data.avatar !== def) {
|
||||
this.setData({ avatar: def });
|
||||
}
|
||||
},
|
||||
|
||||
onMute(e) {
|
||||
e.stopPropagation();
|
||||
|
||||
@@ -15,14 +15,15 @@
|
||||
<!-- 通知内容 -->
|
||||
<view class="notification-content">
|
||||
<!-- 左侧头像 -->
|
||||
<image class="notification-avatar" src="{{avatar}}" mode="aspectFill"></image>
|
||||
<image class="notification-avatar" src="{{avatar}}" mode="aspectFill" binderror="onAvatarError"></image>
|
||||
|
||||
<!-- 中间内容区域 -->
|
||||
<view class="notification-body">
|
||||
<view class="notification-tag">新消息</view>
|
||||
<view class="notification-title">{{title}}</view>
|
||||
<view class="notification-message">{{message}}</view>
|
||||
<view class="notification-time" wx:if="{{showTime}}">
|
||||
{{formatTime(notificationData ? notificationData.timestamp : '')}}
|
||||
<view class="notification-time" wx:if="{{show && showTime && formattedTime}}">
|
||||
{{formattedTime}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
@@ -1,29 +1,40 @@
|
||||
.global-notification {
|
||||
position: fixed;
|
||||
left: 20rpx;
|
||||
right: 20rpx;
|
||||
top: 0rpx;
|
||||
left: 24rpx;
|
||||
right: 24rpx;
|
||||
top: calc(env(safe-area-inset-top) + 108rpx);
|
||||
z-index: 99999;
|
||||
opacity: 0;
|
||||
transform: translateY(-120%);
|
||||
transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
||||
transform: translateY(-160%);
|
||||
transition: all 0.42s cubic-bezier(0.34, 1.2, 0.64, 1);
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
border-radius: 24rpx;
|
||||
background: linear-gradient(135deg,
|
||||
rgba(41, 47, 61, 0.98) 0%,
|
||||
rgba(31, 36, 48, 0.98) 100%);
|
||||
backdrop-filter: blur(30rpx) saturate(180%);
|
||||
-webkit-backdrop-filter: blur(30rpx) saturate(180%);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.08);
|
||||
box-shadow:
|
||||
0 20rpx 60rpx rgba(0, 0, 0, 0.4),
|
||||
0 0 0 1rpx rgba(255, 255, 255, 0.03),
|
||||
inset 0 1rpx 0 rgba(255, 255, 255, 0.1);
|
||||
min-height: 140rpx;
|
||||
border-radius: 28rpx;
|
||||
background: linear-gradient(145deg,
|
||||
rgba(28, 32, 42, 0.97) 0%,
|
||||
rgba(22, 26, 36, 0.98) 100%);
|
||||
backdrop-filter: blur(40rpx) saturate(180%);
|
||||
-webkit-backdrop-filter: blur(40rpx) saturate(180%);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.1);
|
||||
box-shadow:
|
||||
0 24rpx 64rpx rgba(0, 0, 0, 0.45),
|
||||
0 0 0 1rpx rgba(255, 255, 255, 0.04),
|
||||
inset 0 1rpx 0 rgba(255, 255, 255, 0.12);
|
||||
min-height: 148rpx;
|
||||
touch-action: pan-y;
|
||||
}
|
||||
|
||||
.global-notification::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 24rpx;
|
||||
bottom: 24rpx;
|
||||
width: 6rpx;
|
||||
border-radius: 0 6rpx 6rpx 0;
|
||||
background: linear-gradient(180deg, #07c160 0%, #D4AF37 100%);
|
||||
}
|
||||
|
||||
.global-notification.show {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
@@ -58,8 +69,8 @@
|
||||
.notification-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 32rpx;
|
||||
min-height: 140rpx;
|
||||
padding: 28rpx 28rpx 28rpx 36rpx;
|
||||
min-height: 148rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@@ -84,6 +95,18 @@
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.notification-tag {
|
||||
display: inline-block;
|
||||
align-self: flex-start;
|
||||
font-size: 20rpx;
|
||||
color: #07c160;
|
||||
background: rgba(7, 193, 96, 0.15);
|
||||
padding: 4rpx 14rpx;
|
||||
border-radius: 20rpx;
|
||||
margin-bottom: 8rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.notification-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
|
||||
Reference in New Issue
Block a user