Commit accb3867 by liimin

refactor(components): 使用 un-popup 重构工具箱和完成步骤组件

- 在 ToolBox 组件中替换自定义抽屉逻辑为 un-popup 组件,简化横竖屏样式处理
- 移除冗余的遮罩层、定位计算和拖拽逻辑,统一使用组件内置动画
- 在 FinishStep 组件中优化弹窗样式,调整间距、圆角和交互状态,提升视觉一致性
1 parent d76d287e
...@@ -545,35 +545,37 @@ defineExpose({ open, close }); ...@@ -545,35 +545,37 @@ defineExpose({ open, close });
.popup-content { .popup-content {
width: 100%; width: 100%;
max-width: 375px; /* Max width ensures it looks good on tablets/landscape, but allows it to shrink on small portrait phones */
min-width: 325px; max-width: 350px; /* Reduced from 375px to make the pop-up look more compact and refined */
background: #ffffff; background: #ffffff;
border-radius: 16px; // border-radius: 20px;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
/* Box shadow for premium depth */
// box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1), 0 6px 16px rgba(0, 0, 0, 0.06);
}
.popup-body { .popup-body {
padding: 0 20px; /* Responsive padding: slightly less on very small screens */
max-height: 500px; // padding: 0 4px;
max-height: 55vh; /* Use viewport height to ensure it fits on small screens */
flex: 1; flex: 1;
} }
.popup-footer { .popup-footer {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
padding: 12px 20px; padding: 16px 20px 20px;
// border-top: 1px solid #f0f0f0; gap: 16px;
gap: 12px;
flex-shrink: 0; flex-shrink: 0;
align-items: center; align-items: center;
}
} }
.content{ .content{
width: 100%; width: 100%;
flex-direction: column; flex-direction: column;
} }
.pop-tips { .pop-tips {
width: 100%; width: 100%;
background: rgba(44, 102, 247, 0.1); background: rgba(44, 102, 247, 0.1);
...@@ -601,77 +603,89 @@ defineExpose({ open, close }); ...@@ -601,77 +603,89 @@ defineExpose({ open, close });
} }
.pop-tips-wrapper { .pop-tips-wrapper {
margin-top: 8px; margin-top: 12px;
.pop-tips { .pop-tips {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 10px 14px; padding: 12px 16px;
background: rgba(44, 102, 247, 0.08); background: rgba(44, 102, 247, 0.05);
border-radius: 6px; border: 1px solid rgba(44, 102, 247, 0.1);
border-radius: 8px;
} }
} }
.pop-tips-wrapper .pop-tips-text { .pop-tips-wrapper .pop-tips-text {
color: #2c66f7; color: #2c66f7;
font-size: 13px; font-size: 13px;
margin-left: 6px; font-weight: 500;
margin-left: 8px;
} }
.form { .form {
display: flex; display: flex;
padding-top: 15px; padding-top: 16px;
flex-direction: column; flex-direction: column;
&-item { &-item {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
box-sizing: border-box; box-sizing: border-box;
margin: 0 auto 12px; margin: 0 auto 16px;
flex-direction: row; flex-direction: row;
.label { .label {
position: relative; position: relative;
flex-shrink: 0; flex-shrink: 0;
width: 80px; width: 86px;
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
.required{ .required{
margin-right: 2px; margin-right: 4px;
display: flex;
align-items: center;
} }
} }
.value { .value {
flex: 1; flex: 1;
min-height: 40px; min-height: 44px;
background: #ffffff; background: #ffffff;
margin-left: 12px; margin-left: 8px;
box-sizing: border-box; box-sizing: border-box;
border-radius: 4px; border-radius: 8px;
display: flex; display: flex;
align-items: center; align-items: center;
transition: all 0.2s ease;
&.error { &.error {
// un-input 错误状态由组件自己控制 // un-input 错误状态由组件自己控制
} }
&.disabled { &.disabled {
background: #f4f4f4; background: #f8f9fa;
} }
.select { .select {
width: 100%; width: 100%;
height: 40px; height: 44px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 0 12px; padding: 0 14px;
border: 1px solid #e8e8ea; background: #f8f9fa;
border-radius: 4px; border: 1px solid transparent;
border-radius: 8px;
box-sizing: border-box; box-sizing: border-box;
transition: all 0.2s ease;
&:active {
background: #f1f3f5;
}
.arrow { .arrow {
flex-shrink: 0; flex-shrink: 0;
...@@ -700,55 +714,89 @@ defineExpose({ open, close }); ...@@ -700,55 +714,89 @@ defineExpose({ open, close });
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
margin-top: 16px;
.choose-item { .choose-item {
width: 100%; width: 100%;
height: 64px; height: 68px;
border: 1px solid #e8e8e8; background: #f8f9fa;
border-radius: 8px; border: 1px solid transparent;
border-radius: 12px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-top: 12px; margin-bottom: 12px;
transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
&:active {
transform: scale(0.98);
background: #f1f3f5;
}
.sprite-icon { .sprite-icon {
margin-right: 8px; margin-right: 10px;
transition: transform 0.25s ease;
} }
} }
.success { .success {
background: #14cc681a; background: #f0fbf5;
border-color: #14cc681a; border-color: rgba(20, 204, 104, 0.3);
box-shadow: 0 4px 12px rgba(20, 204, 104, 0.1);
.sprite-icon {
transform: scale(1.1);
}
.choose-item-text {
color: #14cc68;
font-weight: 600;
}
} }
.error { .error {
background: #f247241a; background: #fff4f2;
border-color: #f247241a; border-color: rgba(242, 71, 36, 0.3);
box-shadow: 0 4px 12px rgba(242, 71, 36, 0.1);
.sprite-icon {
transform: scale(1.1);
}
.choose-item-text {
color: #f24724;
font-weight: 600;
}
} }
} }
.form-label-text { .form-label-text {
color: #6c6c70; color: #495057;
font-size: 15px; font-size: 15px;
font-weight: 500;
} }
.required-text { .required-text {
color: #ff0000; color: #fa5252;
} }
.select-text { .select-text {
flex: 1; flex: 1;
font-size: 15px; font-size: 15px;
color: #333333; color: #212529;
font-weight: 500;
} }
.select-text-placeholder { .select-text-placeholder {
color: #c9c9c9; color: #adb5bd;
font-weight: 400;
} }
.choose-item-text { .choose-item-text {
font-size: 15px; font-size: 16px;
color: #333333; color: #495057;
font-weight: 500;
transition: all 0.2s ease;
} }
</style> </style>
<template> <template>
<view class="tool-box" :style="toolBoxVars"> <view class="tool-box" :style="toolBoxVars">
<!-- 遮罩层(仅在竖屏半抽屉形态且展开时显示) --> <un-popup :show="show" :mode="isLandscapeMode ? 'right' : 'bottom'" :round="isLandscapeMode ? 0 : 20" @close="hide">
<view v-if="!isLandscapeMode && show" class="mask" @click="hide"></view> <view class="list-wrapper" :class="isLandscapeMode ? 'landscape-wrapper' : 'portrait-wrapper'">
<view class="tool-panel"
:class="[show ? 'tool-panel-open' : 'tool-panel-close', isLandscapeMode ? 'tool-panel-landscape' : 'tool-panel-portrait']"
:style="panelPositionStyle"
@touchstart.stop
@touchmove.stop
@touchend.stop>
<view class="list-wrapper">
<view class="panel-head"> <view class="panel-head">
<!-- <text class="panel-title">{{ triggerText }}</text> -->
<view class="panel-close" @click="hide"> <view class="panel-close" @click="hide">
<text class="panel-close-text">×</text> <text class="panel-close-text">×</text>
</view> </view>
</view> </view>
<scroll-view class="panel-body" <scroll-view class="panel-body"
:style="scrollContainerStyle" :style="scrollContainerStyle"
scroll-y="true" scroll-y="true">
@touchstart.stop
@touchmove.stop
@touchend.stop>
<view class="section-title">快捷操作</view> <view class="section-title">快捷操作</view>
<view class="fixed-group"> <view class="fixed-group">
<view class="action-grid"> <view class="action-grid">
...@@ -69,20 +57,8 @@ ...@@ -69,20 +57,8 @@
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
</view> </un-popup>
<!-- <view class="trigger-holder"
:style="triggerPositionStyle">
<view class="custom-trigger"
:class="{ 'custom-trigger-active': triggerDragging }"
@click="handleFabClick"
@touchstart="handleTriggerTouchStart"
@touchmove="handleTriggerTouchMove"
@touchend="handleTriggerTouchEnd">
<un-icon name="folder" :size="24" color="#e2e8f0"></un-icon>
<text class="trigger-text">{{ triggerText }}</text>
</view>
</view> -->
<un-fab v-model:active="show" <un-fab v-model:active="show"
:expandable="false" :expandable="false"
inactive-icon="folder" inactive-icon="folder"
...@@ -359,40 +335,6 @@ const toolBoxVars = computed<UTSJSONObject>(() => { ...@@ -359,40 +335,6 @@ const toolBoxVars = computed<UTSJSONObject>(() => {
} as UTSJSONObject; } as UTSJSONObject;
}); });
const triggerPositionStyle = computed<UTSJSONObject>(() => {
if (!isLandscapeMode.value) {
// 竖屏下,展开时触发器通常保持不动或隐藏,这里为了简单起见,展开时隐藏触发器,依靠遮罩关闭
return {
top: `${currentOffsetTop.value}px`,
right: `0px`,
display: show.value ? 'none' : 'block'
} as UTSJSONObject;
}
const rightOffset = show.value ? panelWidth.value : 0;
return {
top: `${currentOffsetTop.value}px`,
right: `${rightOffset}px`
} as UTSJSONObject;
});
const panelPositionStyle = computed<UTSJSONObject>(() => {
if (!isLandscapeMode.value) {
// 竖屏:底部抽屉
return {
bottom: `0px`,
left: `0px`,
right: `0px`,
width: `100%`
} as UTSJSONObject;
}
// 横屏:侧边抽屉
const topInset = isPadLike.value ? 24 : 20;
return {
top: `${topInset}px`,
right: `0px`
} as UTSJSONObject;
});
// ============================================================================ // ============================================================================
// 方法 // 方法
// ============================================================================ // ============================================================================
...@@ -545,58 +487,16 @@ defineExpose({ ...@@ -545,58 +487,16 @@ defineExpose({
height: 100%; height: 100%;
pointer-events: none; pointer-events: none;
.mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.4);
z-index: 1000;
pointer-events: auto;
}
.tool-panel {
position: fixed;
z-index: 1001;
transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 220ms ease;
}
.tool-panel-open {
opacity: 1;
transform: translateX(0) translateY(0);
pointer-events: auto;
}
.tool-panel-landscape.tool-panel-close {
opacity: 0;
transform: translateX(calc(var(--panel-width) + 60px));
pointer-events: none;
}
.tool-panel-portrait.tool-panel-close {
opacity: 0;
transform: translateY(100%);
pointer-events: none;
}
.trigger-holder {
position: fixed;
pointer-events: auto;
z-index: 1002;
}
.custom-trigger { .custom-trigger {
width: 56px; width: 56px;
height: 56px; height: 56px;
background: linear-gradient(145deg, rgba(38, 45, 59, 0.95), rgba(52, 62, 82, 0.9)); background: linear-gradient(145deg, rgba(38, 45, 59, 0.95), rgba(52, 62, 82, 0.9));
border-radius: 50%;//16px 0 0 16px; border-radius: 50%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
box-shadow: -4px 8px 24px rgba(0, 0, 0, 0.25), inset 1px 1px 2px rgba(255, 255, 255, 0.15); box-shadow: -4px 8px 24px rgba(0, 0, 0, 0.25), inset 1px 1px 2px rgba(255, 255, 255, 0.15);
border: 1px solid rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.1);
border-right-width: 0;
flex-direction: column; flex-direction: column;
transition: transform 0.22s ease, box-shadow 0.22s ease; transition: transform 0.22s ease, box-shadow 0.22s ease;
...@@ -627,22 +527,8 @@ defineExpose({ ...@@ -627,22 +527,8 @@ defineExpose({
margin-bottom: 0; margin-bottom: 0;
align-items: stretch; align-items: stretch;
background: linear-gradient(145deg, rgba(30, 36, 48, 0.95), rgba(42, 50, 66, 0.92)); background: linear-gradient(145deg, rgba(30, 36, 48, 0.95), rgba(42, 50, 66, 0.92));
box-shadow: -8px 24px 48px rgba(0, 0, 0, 0.4), inset 1px 1px 2px rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.08);
}
.tool-panel-landscape .list-wrapper {
width: var(--panel-width); width: var(--panel-width);
height: var(--fab-panel-height); height: 100%; /* 撑满侧边栏高度 */
border-radius: 20px 0 0 20px;
border-right-width: 0;
}
.tool-panel-portrait .list-wrapper {
width: 100%;
height: auto;
border-radius: 20px 20px 0 0;
border-bottom-width: 0;
} }
.panel-head { .panel-head {
...@@ -725,14 +611,7 @@ defineExpose({ ...@@ -725,14 +611,7 @@ defineExpose({
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-bottom: 12px; margin-bottom: 12px;
} width: 33.33%; /* 统一为 3个一行 */
.tool-panel-portrait .action-item {
width: 25%; /* 竖屏 4个一行 */
}
.tool-panel-landscape .action-item {
width: 33.33%; /* 横屏侧边栏 3个一行 */
} }
.fab-item { .fab-item {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!