style(cycle-selection): 调整周期选择弹窗样式和布局
- 将周期说明移动到内容区域并添加样式 - 优化样式结构,减少嵌套层级 - 移除scoped限制使样式全局可用
Showing
1 changed file
with
77 additions
and
77 deletions
| ... | @@ -4,9 +4,9 @@ | ... | @@ -4,9 +4,9 @@ |
| 4 | <div class="cycle-popup"> | 4 | <div class="cycle-popup"> |
| 5 | <div class="popup-header"> | 5 | <div class="popup-header"> |
| 6 | <h3>选择周期</h3> | 6 | <h3>选择周期</h3> |
| 7 | - <p>{{ cycle_note }}</p> | ||
| 8 | </div> | 7 | </div> |
| 9 | <div class="popup-content"> | 8 | <div class="popup-content"> |
| 9 | + <p style="padding-top: 0.85rem; text-align: justify;">{{ cycle_note }}</p> | ||
| 10 | <van-radio-group v-model="selectedCycle"> | 10 | <van-radio-group v-model="selectedCycle"> |
| 11 | <div v-for="cycle in cycleList" :key="cycle.id" class="cycle-item"> | 11 | <div v-for="cycle in cycleList" :key="cycle.id" class="cycle-item"> |
| 12 | <van-radio :name="cycle.id"> | 12 | <van-radio :name="cycle.id"> |
| ... | @@ -67,11 +67,11 @@ const setPopupSize = () => { | ... | @@ -67,11 +67,11 @@ const setPopupSize = () => { |
| 67 | if (popupElement) { | 67 | if (popupElement) { |
| 68 | const screenWidth = window.innerWidth; | 68 | const screenWidth = window.innerWidth; |
| 69 | const screenHeight = window.innerHeight; | 69 | const screenHeight = window.innerHeight; |
| 70 | - | 70 | + |
| 71 | // 设置宽度为屏幕的85% | 71 | // 设置宽度为屏幕的85% |
| 72 | const popupWidth = screenWidth * 0.85; | 72 | const popupWidth = screenWidth * 0.85; |
| 73 | popupElement.style.width = `${popupWidth}px`; | 73 | popupElement.style.width = `${popupWidth}px`; |
| 74 | - | 74 | + |
| 75 | // 根据屏幕尺寸动态计算最大宽度 | 75 | // 根据屏幕尺寸动态计算最大宽度 |
| 76 | let maxWidth; | 76 | let maxWidth; |
| 77 | if (screenWidth <= 480) { | 77 | if (screenWidth <= 480) { |
| ... | @@ -84,13 +84,13 @@ const setPopupSize = () => { | ... | @@ -84,13 +84,13 @@ const setPopupSize = () => { |
| 84 | // 大屏设备 | 84 | // 大屏设备 |
| 85 | maxWidth = 500; | 85 | maxWidth = 500; |
| 86 | } | 86 | } |
| 87 | - | 87 | + |
| 88 | popupElement.style.maxWidth = `${maxWidth}px`; | 88 | popupElement.style.maxWidth = `${maxWidth}px`; |
| 89 | - | 89 | + |
| 90 | // 设置高度为屏幕的70% | 90 | // 设置高度为屏幕的70% |
| 91 | const popupHeight = screenHeight * 0.7; | 91 | const popupHeight = screenHeight * 0.7; |
| 92 | popupElement.style.height = `${popupHeight}px`; | 92 | popupElement.style.height = `${popupHeight}px`; |
| 93 | - | 93 | + |
| 94 | // 计算内容区域高度 | 94 | // 计算内容区域高度 |
| 95 | calculatePopupContentHeight(); | 95 | calculatePopupContentHeight(); |
| 96 | } | 96 | } |
| ... | @@ -150,12 +150,12 @@ const getCycleList = async (form_code) => { | ... | @@ -150,12 +150,12 @@ const getCycleList = async (form_code) => { |
| 150 | if (targetRoute) { | 150 | if (targetRoute) { |
| 151 | sessionStorage.removeItem('cycle_target_route'); | 151 | sessionStorage.removeItem('cycle_target_route'); |
| 152 | const route = JSON.parse(targetRoute); | 152 | const route = JSON.parse(targetRoute); |
| 153 | - | 153 | + |
| 154 | // 调试信息:检查不需要周期选择时的路由对象 | 154 | // 调试信息:检查不需要周期选择时的路由对象 |
| 155 | console.log('不需要周期选择时的路由对象:', route); | 155 | console.log('不需要周期选择时的路由对象:', route); |
| 156 | console.log('不需要周期选择时的查询参数:', route.query); | 156 | console.log('不需要周期选择时的查询参数:', route.query); |
| 157 | console.log('不需要周期选择时的code参数:', route.query.code); | 157 | console.log('不需要周期选择时的code参数:', route.query.code); |
| 158 | - | 158 | + |
| 159 | // 检查是否需要显示未完成表单弹框 | 159 | // 检查是否需要显示未完成表单弹框 |
| 160 | checkUnfinishedForm(route); | 160 | checkUnfinishedForm(route); |
| 161 | } else { | 161 | } else { |
| ... | @@ -182,12 +182,12 @@ const confirmCycleSelection = () => { | ... | @@ -182,12 +182,12 @@ const confirmCycleSelection = () => { |
| 182 | x_cycle: selectedCycle.value, | 182 | x_cycle: selectedCycle.value, |
| 183 | cycle_selected: '1' | 183 | cycle_selected: '1' |
| 184 | }; | 184 | }; |
| 185 | - | 185 | + |
| 186 | // 调试信息:检查route对象内容 | 186 | // 调试信息:检查route对象内容 |
| 187 | console.log('周期选择后的路由对象:', route); | 187 | console.log('周期选择后的路由对象:', route); |
| 188 | console.log('查询参数:', route.query); | 188 | console.log('查询参数:', route.query); |
| 189 | console.log('code参数:', route.query.code); | 189 | console.log('code参数:', route.query.code); |
| 190 | - | 190 | + |
| 191 | // 清除临时存储 | 191 | // 清除临时存储 |
| 192 | sessionStorage.removeItem('cycle_target_route'); | 192 | sessionStorage.removeItem('cycle_target_route'); |
| 193 | 193 | ||
| ... | @@ -245,7 +245,7 @@ onMounted(() => { | ... | @@ -245,7 +245,7 @@ onMounted(() => { |
| 245 | console.error('缺少表单代码参数'); | 245 | console.error('缺少表单代码参数'); |
| 246 | $router.replace('/'); | 246 | $router.replace('/'); |
| 247 | } | 247 | } |
| 248 | - | 248 | + |
| 249 | // 监听窗口尺寸变化 | 249 | // 监听窗口尺寸变化 |
| 250 | window.addEventListener('resize', handleResize); | 250 | window.addEventListener('resize', handleResize); |
| 251 | // 监听屏幕方向变化 | 251 | // 监听屏幕方向变化 |
| ... | @@ -259,7 +259,7 @@ onUnmounted(() => { | ... | @@ -259,7 +259,7 @@ onUnmounted(() => { |
| 259 | }); | 259 | }); |
| 260 | </script> | 260 | </script> |
| 261 | 261 | ||
| 262 | -<style lang="less" scoped> | 262 | +<style lang="less"> |
| 263 | .cycle-selection-page { | 263 | .cycle-selection-page { |
| 264 | width: 100vw; | 264 | width: 100vw; |
| 265 | height: 100vh; | 265 | height: 100vh; |
| ... | @@ -267,86 +267,86 @@ onUnmounted(() => { | ... | @@ -267,86 +267,86 @@ onUnmounted(() => { |
| 267 | display: flex; | 267 | display: flex; |
| 268 | align-items: center; | 268 | align-items: center; |
| 269 | justify-content: center; | 269 | justify-content: center; |
| 270 | -} | 270 | + .cycle-popup { |
| 271 | - | 271 | + width: 85vw; |
| 272 | -.cycle-popup { | 272 | + height: 70vh; |
| 273 | - width: 85vw; | 273 | + background: white; |
| 274 | - height: 70vh; | 274 | + border-radius: 12px; |
| 275 | - background: white; | 275 | + display: flex; |
| 276 | - border-radius: 12px; | 276 | + flex-direction: column; |
| 277 | - display: flex; | 277 | + overflow: hidden; |
| 278 | - flex-direction: column; | 278 | + position: relative; |
| 279 | - overflow: hidden; | 279 | + margin: 0 auto; |
| 280 | - position: relative; | 280 | + } |
| 281 | - margin: 0 auto; | ||
| 282 | -} | ||
| 283 | 281 | ||
| 284 | -.popup-header { | 282 | + .popup-header { |
| 285 | - padding: 20px; | 283 | + padding: 20px; |
| 286 | - text-align: center; | 284 | + text-align: center; |
| 287 | - border-bottom: 1px solid #eee; | 285 | + border-bottom: 1px solid #eee; |
| 288 | - flex-shrink: 0; | 286 | + flex-shrink: 0; |
| 289 | 287 | ||
| 290 | - h3 { | 288 | + h3 { |
| 291 | - margin: 0; | 289 | + margin: 0; |
| 292 | - font-size: 18px; | 290 | + font-size: 18px; |
| 293 | - font-weight: 600; | 291 | + font-weight: 600; |
| 294 | - color: #333; | 292 | + color: #333; |
| 293 | + } | ||
| 295 | } | 294 | } |
| 296 | -} | ||
| 297 | 295 | ||
| 298 | -.popup-content { | 296 | + .popup-content { |
| 299 | - flex: 1; | 297 | + flex: 1; |
| 300 | - overflow-y: auto; | 298 | + overflow-y: auto; |
| 301 | - padding: 0 20px; | 299 | + padding: 0 20px; |
| 302 | - min-height: 0; | 300 | + min-height: 0; |
| 303 | -} | 301 | + } |
| 304 | 302 | ||
| 305 | -.cycle-item { | 303 | + .cycle-item { |
| 306 | - padding: 15px 0; | 304 | + padding: 15px 0; |
| 307 | - border-bottom: 1px solid #f5f5f5; | 305 | + border-bottom: 1px solid #f5f5f5; |
| 308 | 306 | ||
| 309 | - &:last-child { | 307 | + &:last-child { |
| 310 | - border-bottom: none; | 308 | + border-bottom: none; |
| 309 | + } | ||
| 311 | } | 310 | } |
| 312 | -} | ||
| 313 | 311 | ||
| 314 | -.cycle-info { | 312 | + .cycle-info { |
| 315 | - margin-left: 10px; | 313 | + margin-left: 10px; |
| 316 | -} | 314 | + } |
| 317 | 315 | ||
| 318 | -.cycle-title { | 316 | + .cycle-title { |
| 319 | - font-size: 16px; | 317 | + font-size: 16px; |
| 320 | - font-weight: 500; | 318 | + font-weight: 500; |
| 321 | - color: #333; | 319 | + color: #333; |
| 322 | - margin-bottom: 8px; | 320 | + margin-bottom: 8px; |
| 323 | -} | 321 | + } |
| 324 | 322 | ||
| 325 | -.cycle-time { | 323 | + .cycle-time { |
| 326 | - font-size: 14px; | 324 | + font-size: 14px; |
| 327 | - color: #666; | 325 | + color: #666; |
| 328 | - line-height: 1.5; | 326 | + line-height: 1.5; |
| 329 | 327 | ||
| 330 | - div { | 328 | + div { |
| 331 | - margin-bottom: 4px; | 329 | + margin-bottom: 4px; |
| 332 | 330 | ||
| 333 | - &:last-child { | 331 | + &:last-child { |
| 334 | - margin-bottom: 0; | 332 | + margin-bottom: 0; |
| 333 | + } | ||
| 335 | } | 334 | } |
| 336 | } | 335 | } |
| 337 | -} | ||
| 338 | 336 | ||
| 339 | -.popup-footer { | 337 | + .popup-footer { |
| 340 | - padding: 20px; | 338 | + padding: 20px; |
| 341 | - border-top: 1px solid #eee; | 339 | + border-top: 1px solid #eee; |
| 342 | - flex-shrink: 0; | 340 | + flex-shrink: 0; |
| 343 | -} | 341 | + } |
| 344 | 342 | ||
| 345 | -.confirm-btn { | 343 | + .confirm-btn { |
| 346 | - width: 100%; | 344 | + width: 100%; |
| 347 | - height: 44px; | 345 | + height: 44px; |
| 348 | - border-radius: 8px; | 346 | + border-radius: 8px; |
| 349 | - font-size: 16px; | 347 | + font-size: 16px; |
| 350 | - font-weight: 500; | 348 | + font-weight: 500; |
| 349 | + } | ||
| 351 | } | 350 | } |
| 351 | + | ||
| 352 | </style> | 352 | </style> | ... | ... |
-
Please register or login to post a comment