| | |
| | | <template> |
| | | <view class="steps-card"> |
| | | <view class="steps-card" :class="{ landscape: isLandscapeLayout }"> |
| | | <view class="steps-row"> |
| | | <template v-for="(step, index) in stepsList" :key="index"> |
| | | <view class="step-item"> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed } from 'vue'; |
| | | import { computed, ref, onMounted, onUnmounted } from 'vue'; |
| | | import qrActiveIcon from '../static/appointment-scan/qr-active.png'; |
| | | import qrCompletedIcon from '../static/appointment-scan/qr-completed.png'; |
| | | import idcardInactiveIcon from '../static/appointment-scan/idcard-inactive.png'; |
| | |
| | | import printActiveIcon from '../static/appointment-scan/print-active.png'; |
| | | import stepArrowActiveImage from '../static/appointment-scan/step-arrow-active.png'; |
| | | import stepArrowInactiveImage from '../static/appointment-scan/step-arrow-inactive.png'; |
| | | |
| | | const isLandscapeLayout = ref(false); |
| | | const updateLayoutMode = () => { |
| | | try { |
| | | const windowInfo = uni.getWindowInfo ? uni.getWindowInfo() : uni.getSystemInfoSync(); |
| | | const viewportWidth = Number(windowInfo?.windowWidth || windowInfo?.screenWidth || 0); |
| | | const viewportHeight = Number(windowInfo?.windowHeight || windowInfo?.screenHeight || 0); |
| | | isLandscapeLayout.value = Boolean(viewportWidth && viewportHeight && viewportWidth > viewportHeight); |
| | | } catch (error) { |
| | | console.error('StepProgress 读取窗口尺寸失败:', error); |
| | | isLandscapeLayout.value = false; |
| | | } |
| | | }; |
| | | |
| | | let flowWindowResizeHandler = null; |
| | | const registerFlowWindowResize = () => { |
| | | if (flowWindowResizeHandler || !uni.onWindowResize) { |
| | | return; |
| | | } |
| | | flowWindowResizeHandler = () => { |
| | | updateLayoutMode(); |
| | | }; |
| | | uni.onWindowResize(flowWindowResizeHandler); |
| | | }; |
| | | const unregisterFlowWindowResize = () => { |
| | | if (!flowWindowResizeHandler || !uni.offWindowResize) { |
| | | flowWindowResizeHandler = null; |
| | | return; |
| | | } |
| | | uni.offWindowResize(flowWindowResizeHandler); |
| | | flowWindowResizeHandler = null; |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | updateLayoutMode(); |
| | | registerFlowWindowResize(); |
| | | }); |
| | | |
| | | onUnmounted(() => { |
| | | unregisterFlowWindowResize(); |
| | | }); |
| | | |
| | | const props = defineProps({ |
| | | currentStep: { |
| | |
| | | } |
| | | |
| | | .steps-row { |
| | | width: 100%; |
| | | width: 1008px; |
| | | height: 138px; |
| | | display: flex; |
| | | flex-direction: row; |
| | | align-items: flex-start; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | gap: 12px; |
| | | width: 120px; |
| | | } |
| | | |
| | |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | .step-icon { |
| | |
| | | font-family: Inter, sans-serif; |
| | | font-size: 23px; |
| | | text-align: center; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .completed-text { |
| | |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | margin-bottom: 56px; |
| | | } |
| | | |
| | | .arrow-img { |
| | | width: 92px; |
| | | height: 82px; |
| | | } |
| | | |
| | | /* 横屏模式 */ |
| | | .steps-card.landscape { |
| | | width: 1824px; |
| | | } |
| | | .steps-card.landscape .steps-row { |
| | | width: 1824px; |
| | | } |
| | | .steps-card.landscape .step-line { |
| | | flex: 1; /* 让连接线自动撑开 */ |
| | | align-items: center; |
| | | justify-content: center; |
| | | display: flex; |
| | | } |
| | | .steps-card.landscape .step-item { |
| | | flex: none; |
| | | width: 150px; |
| | | } |
| | | </style> |