hookehuyr

refactor(页面布局): 优化多个页面的导航栏和样式

移除重复的顶部导航栏代码,改用微信原生API设置标题
重构myCar页面布局,使用nut-row和nut-col实现响应式设计
调整样式间距和加载状态显示
...@@ -3,10 +3,28 @@ ...@@ -3,10 +3,28 @@
3 background-color: #f5f5f5; 3 background-color: #f5f5f5;
4 padding-bottom: 120px; 4 padding-bottom: 120px;
5 } 5 }
6 - 6 + .loading-container {
7 -.car-list { 7 + display: flex;
8 - padding: 20px; 8 + justify-content: center;
9 -} 9 + align-items: center;
10 +
11 + .loading-text {
12 + font-size: 28rpx;
13 + color: #999;
14 + }
15 + }
16 +
17 + .no-more-container {
18 + display: flex;
19 + justify-content: center;
20 + align-items: center;
21 + padding: 32rpx 0;
22 +
23 + text {
24 + font-size: 24rpx;
25 + color: #ccc;
26 + }
27 + }
10 28
11 /* 空状态样式 */ 29 /* 空状态样式 */
12 .empty-state { 30 .empty-state {
...@@ -78,10 +96,9 @@ ...@@ -78,10 +96,9 @@
78 /* 车辆图片 */ 96 /* 车辆图片 */
79 .car-image-container { 97 .car-image-container {
80 width: 100%; 98 width: 100%;
81 - height: 200px; 99 + height: 150px;
82 border-radius: 12px; 100 border-radius: 12px;
83 overflow: hidden; 101 overflow: hidden;
84 - margin-bottom: 20px;
85 } 102 }
86 103
87 .car-image { 104 .car-image {
...@@ -92,14 +109,14 @@ ...@@ -92,14 +109,14 @@
92 109
93 /* 车辆信息 */ 110 /* 车辆信息 */
94 .car-info { 111 .car-info {
95 - margin-bottom: 20px; 112 + padding-left: 12px;
96 } 113 }
97 114
98 .car-title { 115 .car-title {
99 font-size: 36px; 116 font-size: 36px;
100 font-weight: bold; 117 font-weight: bold;
101 color: #333; 118 color: #333;
102 - margin-bottom: 12px; 119 + margin-bottom: 0.5rem;
103 } 120 }
104 121
105 .car-details { 122 .car-details {
...@@ -204,7 +221,7 @@ ...@@ -204,7 +221,7 @@
204 } 221 }
205 222
206 .action-buttons { 223 .action-buttons {
207 - gap: 8px; 224 + gap: 15px;
208 } 225 }
209 226
210 .status-badge { 227 .status-badge {
...@@ -216,4 +233,4 @@ ...@@ -216,4 +233,4 @@
216 width: 14px; 233 width: 14px;
217 height: 14px; 234 height: 14px;
218 } 235 }
219 -}
...\ No newline at end of file ...\ No newline at end of file
236 +}
......
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-03 14:06:14 4 + * @LastEditTime: 2025-07-03 14:32:00
5 * @FilePath: /jgdl/src/pages/myCar/index.vue 5 * @FilePath: /jgdl/src/pages/myCar/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
11 <view class="flex-1"> 11 <view class="flex-1">
12 <!-- 滚动列表 --> 12 <!-- 滚动列表 -->
13 <scroll-view 13 <scroll-view
14 - class="car-list"
15 :style="scrollStyle" 14 :style="scrollStyle"
16 :scroll-y="true" 15 :scroll-y="true"
17 @scrolltolower="loadMore" 16 @scrolltolower="loadMore"
...@@ -27,51 +26,58 @@ ...@@ -27,51 +26,58 @@
27 </view> 26 </view>
28 27
29 <!-- 车辆卡片列表 --> 28 <!-- 车辆卡片列表 -->
30 - <view v-else class="space-y-4"> 29 + <view v-else class="space-y-4 ml-4 mr-4 mt-4">
31 <view v-for="car in carList" :key="car.id" class="car-card"> 30 <view v-for="car in carList" :key="car.id" class="car-card">
32 <!-- 状态标识 --> 31 <!-- 状态标识 -->
33 <view class="status-badges"> 32 <view class="status-badges">
34 <view v-if="car.isAuthenticated" class="status-badge verified"> 33 <view v-if="car.isAuthenticated" class="status-badge verified">
35 - <Check class="status-icon" />
36 <text>已认证</text> 34 <text>已认证</text>
37 </view> 35 </view>
38 <view v-if="car.isOffline" class="status-badge offline"> 36 <view v-if="car.isOffline" class="status-badge offline">
39 - <Close class="status-icon" />
40 <text>已下架</text> 37 <text>已下架</text>
41 </view> 38 </view>
42 </view> 39 </view>
43 40
44 - <!-- 车辆图片 --> 41 + <!-- 使用 nut-row 和 nut-col 布局 -->
45 - <view class="car-image-container"> 42 + <nut-row :gutter="10">
46 - <image :src="car.image" class="car-image" mode="aspectFill" /> 43 + <!-- 左侧:车辆图片 -->
47 - </view> 44 + <nut-col :span="8">
48 - 45 + <view class="car-image-container">
49 - <!-- 车辆信息 --> 46 + <image :src="car.image" class="car-image" mode="aspectFill" />
50 - <view class="car-info"> 47 + </view>
51 - <view class="car-title">{{ car.brand }} {{ car.model }}</view> 48 + </nut-col>
52 - <view class="car-details"> 49 +
53 - <text class="detail-item">{{ car.year }}</text> 50 + <!-- 右侧:车辆信息 -->
54 - <text class="detail-item">{{ car.condition }}</text> 51 + <nut-col :span="16">
55 - <text class="detail-item">{{ car.mileage }}公里</text> 52 + <view class="car-info">
56 - </view> 53 + <view class="car-title">{{ car.brand }} {{ car.model }}</view>
57 - <view class="car-description">{{ car.description }}</view> 54 + <view class="car-details">
58 - <view class="price-section"> 55 + <text class="detail-item">{{ car.year }}</text>
59 - <view class="current-price">¥{{ car.price }}</view> 56 + <text class="detail-item">{{ car.condition }}</text>
60 - <view class="market-price">市场价 ¥{{ car.marketPrice }}</view> 57 + <text class="detail-item">{{ car.mileage }}公里</text>
61 - </view> 58 + </view>
62 - </view> 59 + <view class="car-description">{{ car.description }}</view>
60 + <view class="price-section">
61 + <view class="current-price">¥{{ car.price }}</view>
62 + <view class="market-price">市场价 ¥{{ car.marketPrice }}</view>
63 + </view>
64 + </view>
65 + </nut-col>
66 + </nut-row>
63 67
64 <!-- 操作按钮 --> 68 <!-- 操作按钮 -->
65 - <view class="action-buttons"> 69 + <view class="action-buttons mt-4">
66 - <nut-button size="small" type="default" @click="editCar(car.id)">编辑</nut-button> 70 + <nut-button size="small" type="default" shape="square" @click="editCar(car.id)">编辑</nut-button>
67 <nut-button 71 <nut-button
68 size="small" 72 size="small"
73 + shape="square"
69 :type="car.isOffline ? 'success' : 'warning'" 74 :type="car.isOffline ? 'success' : 'warning'"
70 @click="toggleOffline(car)" 75 @click="toggleOffline(car)"
71 > 76 >
72 {{ car.isOffline ? '上架' : '下架' }} 77 {{ car.isOffline ? '上架' : '下架' }}
73 </nut-button> 78 </nut-button>
74 <nut-button 79 <nut-button
80 + shape="square"
75 v-if="!car.isAuthenticated" 81 v-if="!car.isAuthenticated"
76 size="small" 82 size="small"
77 type="primary" 83 type="primary"
...@@ -108,12 +114,9 @@ ...@@ -108,12 +114,9 @@
108 114
109 <script setup> 115 <script setup>
110 import { ref, computed, onMounted } from 'vue' 116 import { ref, computed, onMounted } from 'vue'
111 -import { Check, Close } from '@nutui/icons-vue-taro'
112 import Taro from '@tarojs/taro' 117 import Taro from '@tarojs/taro'
113 import './index.less' 118 import './index.less'
114 119
115 -// 添加样式定义
116 -
117 /** 120 /**
118 * 滚动样式 - 考虑header和TabBar的高度 121 * 滚动样式 - 考虑header和TabBar的高度
119 */ 122 */
......
1 <template> 1 <template>
2 <view class="sell-page"> 2 <view class="sell-page">
3 - <!-- 顶部导航 -->
4 - <nut-config-provider :theme-vars="themeVars">
5 - <nut-sticky top="0">
6 - <nut-navbar :title="isEditMode ? '编辑车源' : '发布车源'" left-show @on-click-back="goBack">
7 - <template #left-show>
8 - <RectLeft color="white" />
9 - </template>
10 - </nut-navbar>
11 - </nut-sticky>
12 - </nut-config-provider>
13 -
14 <!-- 表单内容 --> 3 <!-- 表单内容 -->
15 <view class="form-container"> 4 <view class="form-container">
16 <!-- 车辆照片上传 --> 5 <!-- 车辆照片上传 -->
...@@ -793,10 +782,10 @@ const loadCarData = async () => { ...@@ -793,10 +782,10 @@ const loadCarData = async () => {
793 782
794 try { 783 try {
795 Taro.showLoading({ title: '加载中...' }) 784 Taro.showLoading({ title: '加载中...' })
796 - 785 +
797 // TODO: 调用真实API获取车辆数据 786 // TODO: 调用真实API获取车辆数据
798 // const carData = await getCarById(carId.value) 787 // const carData = await getCarById(carId.value)
799 - 788 +
800 // 模拟API响应数据 789 // 模拟API响应数据
801 const mockCarData = { 790 const mockCarData = {
802 school: '上海理工大学', 791 school: '上海理工大学',
...@@ -821,7 +810,7 @@ const loadCarData = async () => { ...@@ -821,7 +810,7 @@ const loadCarData = async () => {
821 other: 'https://picsum.photos/300/200?random=4' 810 other: 'https://picsum.photos/300/200?random=4'
822 } 811 }
823 } 812 }
824 - 813 +
825 // 填充表单数据 814 // 填充表单数据
826 Object.assign(formData, { 815 Object.assign(formData, {
827 school: mockCarData.school, 816 school: mockCarData.school,
...@@ -840,10 +829,10 @@ const loadCarData = async () => { ...@@ -840,10 +829,10 @@ const loadCarData = async () => {
840 marketPrice: mockCarData.marketPrice, 829 marketPrice: mockCarData.marketPrice,
841 description: mockCarData.description 830 description: mockCarData.description
842 }) 831 })
843 - 832 +
844 // 填充图片数据 833 // 填充图片数据
845 Object.assign(uploadedImages, mockCarData.images) 834 Object.assign(uploadedImages, mockCarData.images)
846 - 835 +
847 Taro.hideLoading() 836 Taro.hideLoading()
848 } catch (error) { 837 } catch (error) {
849 console.error('加载车辆数据失败:', error) 838 console.error('加载车辆数据失败:', error)
...@@ -860,5 +849,9 @@ onMounted(() => { ...@@ -860,5 +849,9 @@ onMounted(() => {
860 if (isEditMode.value) { 849 if (isEditMode.value) {
861 loadCarData() 850 loadCarData()
862 } 851 }
852 + // 动态修改标题
853 + wx.setNavigationBarTitle({
854 + title: isEditMode.value ? '编辑车源' : '发布车源'
855 + });
863 }) 856 })
864 </script> 857 </script>
......
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-03 14:03:37 4 + * @LastEditTime: 2025-07-03 14:27:41
5 * @FilePath: /jgdl/src/pages/setAuthCar/index.vue 5 * @FilePath: /jgdl/src/pages/setAuthCar/index.vue
6 * @Description: 申请认证 6 * @Description: 申请认证
7 --> 7 -->
8 <template> 8 <template>
9 <view class="auth-car-page"> 9 <view class="auth-car-page">
10 - <!-- 顶部导航 -->
11 - <nut-config-provider :theme-vars="themeVars">
12 - <nut-sticky top="0">
13 - <nut-navbar :title="isEditMode ? '编辑认证' : '申请认证'" left-show @on-click-back="goBack">
14 - <template #left-show>
15 - <RectLeft color="white" />
16 - </template>
17 - </nut-navbar>
18 - </nut-sticky>
19 - </nut-config-provider>
20 -
21 <!-- 表单内容 --> 10 <!-- 表单内容 -->
22 <view class="form-container"> 11 <view class="form-container">
23 <!-- 车辆照片上传 --> 12 <!-- 车辆照片上传 -->
...@@ -488,6 +477,10 @@ onMounted(() => { ...@@ -488,6 +477,10 @@ onMounted(() => {
488 if (isEditMode.value) { 477 if (isEditMode.value) {
489 loadAuthData() 478 loadAuthData()
490 } 479 }
480 + // 动态修改标题
481 + wx.setNavigationBarTitle({
482 + title: isEditMode.value ? '编辑认证' : '发布认证'
483 + });
491 }) 484 })
492 </script> 485 </script>
493 486
......