Commit accb3867 by liimin

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

- 在 ToolBox 组件中替换自定义抽屉逻辑为 un-popup 组件,简化横竖屏样式处理
- 移除冗余的遮罩层、定位计算和拖拽逻辑,统一使用组件内置动画
- 在 FinishStep 组件中优化弹窗样式,调整间距、圆角和交互状态,提升视觉一致性
1 parent d76d287e
......@@ -545,35 +545,37 @@ defineExpose({ open, close });
.popup-content {
width: 100%;
max-width: 375px;
min-width: 325px;
/* Max width ensures it looks good on tablets/landscape, but allows it to shrink on small portrait phones */
max-width: 350px; /* Reduced from 375px to make the pop-up look more compact and refined */
background: #ffffff;
border-radius: 16px;
// border-radius: 20px;
overflow: hidden;
display: flex;
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 {
padding: 0 20px;
max-height: 500px;
flex: 1;
}
.popup-body {
/* Responsive padding: slightly less on very small screens */
// padding: 0 4px;
max-height: 55vh; /* Use viewport height to ensure it fits on small screens */
flex: 1;
}
.popup-footer {
display: flex;
flex-direction: row;
padding: 12px 20px;
// border-top: 1px solid #f0f0f0;
gap: 12px;
flex-shrink: 0;
align-items: center;
}
.popup-footer {
display: flex;
flex-direction: row;
padding: 16px 20px 20px;
gap: 16px;
flex-shrink: 0;
align-items: center;
}
.content{
width: 100%;
flex-direction: column;
}
}
.pop-tips {
width: 100%;
background: rgba(44, 102, 247, 0.1);
......@@ -601,77 +603,89 @@ defineExpose({ open, close });
}
.pop-tips-wrapper {
margin-top: 8px;
margin-top: 12px;
.pop-tips {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding: 10px 14px;
background: rgba(44, 102, 247, 0.08);
border-radius: 6px;
padding: 12px 16px;
background: rgba(44, 102, 247, 0.05);
border: 1px solid rgba(44, 102, 247, 0.1);
border-radius: 8px;
}
}
.pop-tips-wrapper .pop-tips-text {
color: #2c66f7;
font-size: 13px;
margin-left: 6px;
font-weight: 500;
margin-left: 8px;
}
.form {
display: flex;
padding-top: 15px;
padding-top: 16px;
flex-direction: column;
&-item {
width: 100%;
display: flex;
align-items: center;
box-sizing: border-box;
margin: 0 auto 12px;
margin: 0 auto 16px;
flex-direction: row;
.label {
position: relative;
flex-shrink: 0;
width: 80px;
width: 86px;
display: flex;
flex-direction: row;
align-items: center;
.required{
margin-right: 2px;
margin-right: 4px;
display: flex;
align-items: center;
}
}
.value {
flex: 1;
min-height: 40px;
min-height: 44px;
background: #ffffff;
margin-left: 12px;
margin-left: 8px;
box-sizing: border-box;
border-radius: 4px;
border-radius: 8px;
display: flex;
align-items: center;
transition: all 0.2s ease;
&.error {
// un-input 错误状态由组件自己控制
}
&.disabled {
background: #f4f4f4;
background: #f8f9fa;
}
.select {
width: 100%;
height: 40px;
height: 44px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 12px;
border: 1px solid #e8e8ea;
border-radius: 4px;
padding: 0 14px;
background: #f8f9fa;
border: 1px solid transparent;
border-radius: 8px;
box-sizing: border-box;
transition: all 0.2s ease;
&:active {
background: #f1f3f5;
}
.arrow {
flex-shrink: 0;
......@@ -700,55 +714,89 @@ defineExpose({ open, close });
display: flex;
flex-direction: column;
align-items: center;
margin-top: 16px;
.choose-item {
width: 100%;
height: 64px;
border: 1px solid #e8e8e8;
border-radius: 8px;
height: 68px;
background: #f8f9fa;
border: 1px solid transparent;
border-radius: 12px;
display: flex;
flex-direction: row;
align-items: 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 {
margin-right: 8px;
margin-right: 10px;
transition: transform 0.25s ease;
}
}
.success {
background: #14cc681a;
border-color: #14cc681a;
background: #f0fbf5;
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 {
background: #f247241a;
border-color: #f247241a;
background: #fff4f2;
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 {
color: #6c6c70;
color: #495057;
font-size: 15px;
font-weight: 500;
}
.required-text {
color: #ff0000;
color: #fa5252;
}
.select-text {
flex: 1;
font-size: 15px;
color: #333333;
color: #212529;
font-weight: 500;
}
.select-text-placeholder {
color: #c9c9c9;
color: #adb5bd;
font-weight: 400;
}
.choose-item-text {
font-size: 15px;
color: #333333;
font-size: 16px;
color: #495057;
font-weight: 500;
transition: all 0.2s ease;
}
</style>
<template>
<view class="tool-box" :style="toolBoxVars">
<!-- 遮罩层(仅在竖屏半抽屉形态且展开时显示) -->
<view v-if="!isLandscapeMode && show" class="mask" @click="hide"></view>
<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">
<un-popup :show="show" :mode="isLandscapeMode ? 'right' : 'bottom'" :round="isLandscapeMode ? 0 : 20" @close="hide">
<view class="list-wrapper" :class="isLandscapeMode ? 'landscape-wrapper' : 'portrait-wrapper'">
<view class="panel-head">
<!-- <text class="panel-title">{{ triggerText }}</text> -->
<view class="panel-close" @click="hide">
<text class="panel-close-text">×</text>
</view>
</view>
<scroll-view class="panel-body"
:style="scrollContainerStyle"
scroll-y="true"
@touchstart.stop
@touchmove.stop
@touchend.stop>
scroll-y="true">
<view class="section-title">快捷操作</view>
<view class="fixed-group">
<view class="action-grid">
......@@ -69,20 +57,8 @@
</view>
</scroll-view>
</view>
</view>
<!-- <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-popup>
<un-fab v-model:active="show"
:expandable="false"
inactive-icon="folder"
......@@ -359,40 +335,6 @@ const toolBoxVars = computed<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({
height: 100%;
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 {
width: 56px;
height: 56px;
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;
align-items: 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);
border: 1px solid rgba(255, 255, 255, 0.1);
border-right-width: 0;
flex-direction: column;
transition: transform 0.22s ease, box-shadow 0.22s ease;
......@@ -627,22 +527,8 @@ defineExpose({
margin-bottom: 0;
align-items: stretch;
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);
height: var(--fab-panel-height);
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;
height: 100%; /* 撑满侧边栏高度 */
}
.panel-head {
......@@ -725,14 +611,7 @@ defineExpose({
display: flex;
flex-direction: column;
margin-bottom: 12px;
}
.tool-panel-portrait .action-item {
width: 25%; /* 竖屏 4个一行 */
}
.tool-panel-landscape .action-item {
width: 33.33%; /* 横屏侧边栏 3个一行 */
width: 33.33%; /* 统一为 3个一行 */
}
.fab-item {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!