From 5c5cddb1c2ee0d19adddebaf3a3a10a6d93fd2ad Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 26 十月 2025 10:52:18 +0800
Subject: [PATCH] feat:优化微信小程序可以运行

---
 app/pages/mine/index.vue |  229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 221 insertions(+), 8 deletions(-)

diff --git a/app/pages/mine/index.vue b/app/pages/mine/index.vue
index 33c3a6e..48b20a6 100644
--- a/app/pages/mine/index.vue
+++ b/app/pages/mine/index.vue
@@ -1,5 +1,5 @@
 <template>
-  <view class="mine-container" :style="{height: `${windowHeight}px`}">
+  <view class="mine-container">
     <!--椤堕儴涓汉淇℃伅鏍�-->
     <view class="header-section">
       <view class="flex padding justify-between">
@@ -25,7 +25,7 @@
       </view>
     </view>
 
-    <view class="content-section">
+    <scroll-view class="content-section" scroll-y="true">
       <view class="mine-actions grid col-4 text-center">
         <view class="action-item" @click="handleJiaoLiuQun">
           <view class="iconfont icon-friendfill text-pink icon"></view>
@@ -45,11 +45,51 @@
         </view>
       </view>
 
+      <!-- 鐢ㄦ埛淇℃伅灞曠ず -->
+      <view class="user-info-section">
+        <view class="info-item">
+          <view class="info-label">鐢ㄦ埛鍚嶏細</view>
+          <view class="info-value">{{ name || '鏈櫥褰�' }}</view>
+        </view>
+        <view class="info-item">
+          <view class="info-label">鎵嬫満鍙风爜锛�</view>
+          <view class="info-value">{{ phonenumber || '鏈粦瀹�' }}</view>
+        </view>
+        <view class="info-item">
+          <view class="info-label">缁戝畾杞﹁締锛�</view>
+          <view class="info-value">{{ boundVehicle || '鏈粦瀹�' }}</view>
+        </view>
+        <view class="info-item">
+          <view class="info-label">App鐗堟湰鍙凤細</view>
+          <view class="info-value">{{ version || '1.0.0' }}</view>
+        </view>
+        
+        <!-- 缁戝畾/瑙g粦杞﹁締鎿嶄綔 -->
+        <view class="vehicle-actions" v-if="boundVehicle && boundVehicle !== '鏈粦瀹�'">
+          <button class="unbind-btn" @click="unbindVehicle">鍙栨秷缁戝畾杞﹁締</button>
+        </view>
+        <view class="vehicle-actions" v-else>
+          <button class="bind-btn" @click="goToBindVehicle">缁戝畾杞﹁締</button>
+        </view>
+      </view>
+
       <view class="menu-list">
         <view class="list-cell list-cell-arrow" @click="handleToEditInfo">
           <view class="menu-item-box">
             <view class="iconfont icon-user menu-icon"></view>
             <view>缂栬緫璧勬枡</view>
+          </view>
+        </view>
+        <view class="list-cell list-cell-arrow" @click="handleUserAgreement">
+          <view class="menu-item-box">
+            <view class="iconfont icon-text menu-icon"></view>
+            <view>鐢ㄦ埛鏈嶅姟鍗忚</view>
+          </view>
+        </view>
+        <view class="list-cell list-cell-arrow" @click="handlePrivacyPolicy">
+          <view class="menu-item-box">
+            <view class="iconfont icon-safe menu-icon"></view>
+            <view>闅愮鏀跨瓥</view>
           </view>
         </view>
         <view class="list-cell list-cell-arrow" @click="handleHelp">
@@ -71,18 +111,22 @@
           </view>
         </view>
       </view>
-
-    </view>
+    </scroll-view>
   </view>
 </template>
 
 <script>
   import storage from '@/utils/storage'
+  import { getUserProfile } from "@/api/system/user"
+  import { getUserBoundVehicle, unbindVehicleFromUser } from '@/api/vehicle'
   
   export default {
     data() {
       return {
-        name: this.$store.state.user.name,
+        name: this.$store.state.user.nickName,
+        phonenumber: '',
+        boundVehicle: '', // 缁戝畾鐨勮溅杈嗕俊鎭�
+        boundVehicleId: null, // 缁戝畾鐨勮溅杈咺D
         version: getApp().globalData.config.appInfo.version
       }
     },
@@ -94,7 +138,79 @@
         return uni.getSystemInfoSync().windowHeight - 50
       }
     },
+    onLoad() {
+      this.getUserInfo()
+    },
     methods: {
+      // 鑾峰彇鐢ㄦ埛淇℃伅
+      getUserInfo() {
+        const userId = this.$store.state.user.userId
+        
+        // 鑾峰彇鐢ㄦ埛鍩烘湰淇℃伅
+        getUserProfile().then(response => {
+          const user = response.data
+          this.name = user.userName
+          this.phonenumber = user.phonenumber
+        }).catch(() => {
+          // 鑾峰彇鐢ㄦ埛淇℃伅澶辫触鏃朵娇鐢ㄩ粯璁ゅ��
+          this.name = this.$store.state.user.nickName || '鏈櫥褰�'
+          this.phonenumber = '鏈粦瀹�'
+        })
+        
+        // 鑾峰彇鐢ㄦ埛缁戝畾鐨勮溅杈嗕俊鎭�
+        if (userId) {
+          getUserBoundVehicle(userId).then(response => {
+            if (response.code === 200 && response.data) {
+              const vehicle = response.data
+              this.boundVehicle = vehicle.vehicleNumber || '鏈煡杞︾墝'
+              this.boundVehicleId = vehicle.vehicleId
+            } else {
+              this.boundVehicle = '鏈粦瀹�'
+              this.boundVehicleId = null
+            }
+          }).catch(() => {
+            this.boundVehicle = '鏈粦瀹�'
+            this.boundVehicleId = null
+          })
+        }
+      },
+      
+      // 璺宠浆鍒扮粦瀹氳溅杈嗛〉闈�
+      goToBindVehicle() {
+        this.$tab.navigateTo('/pages/bind-vehicle')
+      },
+      
+      // 鍙栨秷缁戝畾杞﹁締
+      unbindVehicle() {
+        const userId = this.$store.state.user.userId
+        const vehicleId = this.boundVehicleId
+        
+        if (!userId || !vehicleId) {
+          this.$modal.showToast('鏃犳硶鑾峰彇缁戝畾淇℃伅')
+          return
+        }
+        
+        this.$modal.confirm(`纭鍙栨秷缁戝畾杞﹁締 ${this.boundVehicle} 鍚楋紵`).then(() => {
+          // 璋冪敤API鍙栨秷缁戝畾杞﹁締
+          unbindVehicleFromUser(userId, vehicleId).then(response => {
+            if (response.code === 200) {
+              this.boundVehicle = '鏈粦瀹�'
+              this.boundVehicleId = null
+              this.$modal.showToast('鍙栨秷缁戝畾鎴愬姛')
+              // 鏇存柊鐢ㄦ埛淇℃伅
+              this.$store.dispatch('GetInfo')
+            } else {
+              this.$modal.showToast(response.msg || '鍙栨秷缁戝畾澶辫触')
+            }
+          }).catch(error => {
+            console.error('鍙栨秷缁戝畾澶辫触:', error)
+            this.$modal.showToast('鍙栨秷缁戝畾澶辫触锛岃閲嶈瘯')
+          })
+        }).catch(() => {
+          // 鐢ㄦ埛鍙栨秷鎿嶄綔
+        })
+      },
+      
       handleToInfo() {
         this.$tab.navigateTo('/pages/mine/info/index')
       },
@@ -123,6 +239,12 @@
       handleAbout() {
         this.$tab.navigateTo('/pages/mine/about/index')
       },
+      handleUserAgreement() {
+        this.$tab.navigateTo('/pages/mine/user-agreement/index')
+      },
+      handlePrivacyPolicy() {
+        this.$tab.navigateTo('/pages/mine/privacy-policy/index')
+      },
       handleJiaoLiuQun() {
         this.$modal.showToast('QQ缇わ細鈶�133713780(婊�)銆佲憽146013835(婊�)銆佲憿189091635')
       },
@@ -140,13 +262,32 @@
 
   .mine-container {
     width: 100%;
-    height: 100%;
-
+    height: 100vh;
+    display: flex;
+    flex-direction: column;
+    // 闅愯棌婊氬姩鏉′絾淇濇寔婊氬姩鍔熻兘
+    ::-webkit-scrollbar {
+      display: none;
+      width: 0 !important;
+      height: 0 !important;
+      background: transparent;
+    }
+    
+    // Firefox婊氬姩鏉¢殣钘�
+    * {
+      scrollbar-width: none; /* Firefox */
+    }
+    
+    // IE/Edge婊氬姩鏉¢殣钘�
+    * {
+      -ms-overflow-style: none; /* IE 10+ */
+    }
 
     .header-section {
       padding: 15px 15px 45px 15px;
       background-color: #3c96f3;
       color: white;
+      flex-shrink: 0; // 闃叉鏀剁缉
 
       .login-tip {
         font-size: 18px;
@@ -172,8 +313,26 @@
     }
 
     .content-section {
+      flex: 1;
       position: relative;
       top: -50px;
+      // 闅愯棌婊氬姩鏉′絾淇濇寔婊氬姩鍔熻兘
+      ::-webkit-scrollbar {
+        display: none;
+        width: 0 !important;
+        height: 0 !important;
+        background: transparent;
+      }
+      
+      // Firefox婊氬姩鏉¢殣钘�
+      * {
+        scrollbar-width: none; /* Firefox */
+      }
+      
+      // IE/Edge婊氬姩鏉¢殣钘�
+      * {
+        -ms-overflow-style: none; /* IE 10+ */
+      }
 
       .mine-actions {
         margin: 15px 15px;
@@ -193,6 +352,60 @@
           }
         }
       }
+      
+      // 鐢ㄦ埛淇℃伅灞曠ず鍖哄煙
+      .user-info-section {
+        background-color: white;
+        border-radius: 8px;
+        padding: 20rpx 30rpx;
+        margin: 15rpx;
+        box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
+        
+        .info-item {
+          display: flex;
+          padding: 15rpx 0;
+          border-bottom: 1rpx solid #f0f0f0;
+          
+          &:last-child {
+            border-bottom: none;
+          }
+          
+          .info-label {
+            font-size: 28rpx;
+            color: #666;
+            width: 180rpx;
+            flex-shrink: 0;
+          }
+          
+          .info-value {
+            font-size: 28rpx;
+            color: #333;
+            flex: 1;
+          }
+        }
+        
+        .vehicle-actions {
+          padding: 30rpx 0 10rpx 0;
+          text-align: center;
+          
+          .bind-btn, .unbind-btn {
+            width: 80%;
+            height: 80rpx;
+            border-radius: 10rpx;
+            font-size: 32rpx;
+          }
+          
+          .bind-btn {
+            background-color: #007AFF;
+            color: white;
+          }
+          
+          .unbind-btn {
+            background-color: #ff4d4f;
+            color: white;
+          }
+        }
+      }
     }
   }
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.1