From 10354e63eb3298beb9ebcc029dd9f48d8936a272 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期五, 19 十二月 2025 23:15:05 +0800
Subject: [PATCH] feat:优化同步
---
app/pages/mine/index.vue | 279 ++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 210 insertions(+), 69 deletions(-)
diff --git a/app/pages/mine/index.vue b/app/pages/mine/index.vue
index 33c3a6e..e6ccd74 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">
@@ -14,7 +14,7 @@
</view>
<view v-if="name" @click="handleToInfo" class="user-info">
<view class="u_title">
- 鐢ㄦ埛鍚嶏細{{ name }}
+ {{ name }}
</view>
</view>
</view>
@@ -25,64 +25,66 @@
</view>
</view>
- <view class="content-section">
- <view class="mine-actions grid col-4 text-center">
- <view class="action-item" @click="handleJiaoLiuQun">
- <view class="iconfont icon-friendfill text-pink icon"></view>
- <text class="text">浜ゆ祦缇�</text>
+ <scroll-view class="content-section" scroll-y="true">
+ <!-- 鐢ㄦ埛淇℃伅灞曠ず -->
+ <view class="user-info-section">
+ <view class="info-item">
+ <view class="info-label">鏄电О锛�</view>
+ <view class="info-value">{{ name || '鏈櫥褰�' }}</view>
</view>
- <view class="action-item" @click="handleBuilding">
- <view class="iconfont icon-service text-blue icon"></view>
- <text class="text">鍦ㄧ嚎瀹㈡湇</text>
+ <view class="info-item">
+ <view class="info-label">鎵嬫満鍙风爜锛�</view>
+ <view class="info-value">{{ phonenumber || '鏈粦瀹�' }}</view>
</view>
- <view class="action-item" @click="handleBuilding">
- <view class="iconfont icon-community text-mauve icon"></view>
- <text class="text">鍙嶉绀惧尯</text>
+ <view class="info-item">
+ <view class="info-label">鎵�灞炲垎鍏徃锛�</view>
+ <view class="info-value">{{ deptName || '鏈缃�' }}</view>
</view>
- <view class="action-item" @click="handleBuilding">
- <view class="iconfont icon-dianzan text-green icon"></view>
- <text class="text">鐐硅禐鎴戜滑</text>
+ <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>
</view>
<view class="menu-list">
- <view class="list-cell list-cell-arrow" @click="handleToEditInfo">
+ <!-- 缁戝畾/瑙g粦杞﹁締 -->
+ <view class="list-cell list-cell-arrow" @click="handleVehicleBinding">
<view class="menu-item-box">
- <view class="iconfont icon-user menu-icon"></view>
- <view>缂栬緫璧勬枡</view>
+ <view class="iconfont icon-car menu-icon"></view>
+ <view>{{ boundVehicle && boundVehicle !== '鏈粦瀹�' ? '鏇存崲杞﹁締' : '缁戝畾杞﹁締' }}</view>
</view>
</view>
- <view class="list-cell list-cell-arrow" @click="handleHelp">
+
+ <!-- 閫�鍑虹櫥褰� -->
+ <view class="list-cell list-cell-arrow" @click="handleLogout">
<view class="menu-item-box">
- <view class="iconfont icon-help menu-icon"></view>
- <view>甯歌闂</view>
- </view>
- </view>
- <view class="list-cell list-cell-arrow" @click="handleAbout">
- <view class="menu-item-box">
- <view class="iconfont icon-aixin menu-icon"></view>
- <view>鍏充簬鎴戜滑</view>
- </view>
- </view>
- <view class="list-cell list-cell-arrow" @click="handleToSetting">
- <view class="menu-item-box">
- <view class="iconfont icon-setting menu-icon"></view>
- <view>搴旂敤璁剧疆</view>
+ <view class="iconfont icon-logout menu-icon text-red"></view>
+ <view class="text-red">閫�鍑虹櫥褰�</view>
</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'
+ import { getSystemInfo } from '@/utils/common'
export default {
data() {
return {
- name: this.$store.state.user.name,
+ name: this.$store.state.user.nickName,
+ phonenumber: '',
+ deptName: '', // 鎵�灞炲垎鍏徃
+ boundVehicle: '', // 缁戝畾鐨勮溅杈嗕俊鎭�
+ boundVehicleId: null, // 缁戝畾鐨勮溅杈咺D
version: getApp().globalData.config.appInfo.version
}
},
@@ -91,10 +93,57 @@
return this.$store.state.user.avatar
},
windowHeight() {
- return uni.getSystemInfoSync().windowHeight - 50
+ return getSystemInfo().windowHeight - 50
}
},
+ onLoad() {
+ this.getUserInfo()
+ },
+ onShow() {
+ // 姣忔鏄剧ず椤甸潰鏃跺埛鏂扮敤鎴蜂俊鎭�
+ this.getUserInfo()
+ },
methods: {
+ // 鑾峰彇鐢ㄦ埛淇℃伅
+ getUserInfo() {
+ const userId = this.$store.state.user.userId
+
+ // 鑾峰彇鐢ㄦ埛鍩烘湰淇℃伅
+ getUserProfile().then(response => {
+ const user = response.data
+ this.name = user.nickName || user.userName // 浼樺厛浣跨敤鏄电О
+ this.phonenumber = user.phonenumber
+ this.deptName = user.dept ? user.dept.deptName : '鏈缃�'
+ }).catch(() => {
+ // 鑾峰彇鐢ㄦ埛淇℃伅澶辫触鏃朵娇鐢ㄩ粯璁ゅ��
+ this.name = this.$store.state.user.nickName || '鏈櫥褰�'
+ this.phonenumber = '鏈粦瀹�'
+ this.deptName = '鏈缃�'
+ })
+
+ // 鑾峰彇鐢ㄦ埛缁戝畾鐨勮溅杈嗕俊鎭�
+ 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
+ })
+ }
+ },
+
+ // 澶勭悊杞﹁締缁戝畾鎿嶄綔
+ handleVehicleBinding() {
+ this.$tab.navigateTo('/pages/bind-vehicle')
+ },
+
handleToInfo() {
this.$tab.navigateTo('/pages/mine/info/index')
},
@@ -111,23 +160,11 @@
this.$tab.navigateTo('/pages/mine/avatar/index')
},
handleLogout() {
- this.$modal.confirm('纭畾娉ㄩ攢骞堕��鍑虹郴缁熷悧锛�').then(() => {
+ this.$modal.confirm('纭畾閫�鍑虹櫥褰曞悧锛�').then(() => {
this.$store.dispatch('LogOut').then(() => {
- this.$tab.reLaunch('/pages/index')
+ this.$tab.reLaunch('/pages/login')
})
})
- },
- handleHelp() {
- this.$tab.navigateTo('/pages/mine/help/index')
- },
- handleAbout() {
- this.$tab.navigateTo('/pages/mine/about/index')
- },
- handleJiaoLiuQun() {
- this.$modal.showToast('QQ缇わ細鈶�133713780(婊�)銆佲憽146013835(婊�)銆佲憿189091635')
- },
- handleBuilding() {
- this.$modal.showToast('妯″潡寤鸿涓瓇')
}
}
}
@@ -140,13 +177,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,27 +228,112 @@
}
.content-section {
+ flex: 1;
position: relative;
top: -50px;
-
- .mine-actions {
- margin: 15px 15px;
- padding: 20px 0px;
- border-radius: 8px;
+ // 闅愯棌婊氬姩鏉′絾淇濇寔婊氬姩鍔熻兘
+ ::-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+ */
+ }
+
+ // 鐢ㄦ埛淇℃伅灞曠ず鍖哄煙
+ .user-info-section {
background-color: white;
-
- .action-item {
- .icon {
- font-size: 28px;
+ 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;
}
-
- .text {
- display: block;
- font-size: 13px;
- margin: 8px 0px;
+
+ .info-label {
+ font-size: 28rpx;
+ color: #666;
+ width: 180rpx;
+ flex-shrink: 0;
+ }
+
+ .info-value {
+ font-size: 28rpx;
+ color: #333;
+ flex: 1;
+ }
+ }
+ }
+
+ // 鑿滃崟鍒楄〃鏍峰紡
+ .menu-list {
+ background-color: white;
+ border-radius: 8px;
+ margin: 15rpx;
+ overflow: hidden;
+
+ .list-cell {
+ padding: 30rpx;
+ border-bottom: 1rpx solid #f0f0f0;
+ cursor: pointer;
+ transition: background-color 0.2s;
+
+ &:last-child {
+ border-bottom: none;
+ }
+
+ &:active {
+ background-color: #f5f5f5;
+ }
+
+ .menu-item-box {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+
+ .menu-icon {
+ font-size: 36rpx;
+ margin-right: 20rpx;
+ }
+
+ view {
+ flex: 1;
+ font-size: 32rpx;
+ color: #333;
+ }
+
+ .text-red {
+ color: #ff4d4f;
+ }
+ }
+
+ &.list-cell-arrow .menu-item-box::after {
+ content: '';
+ width: 16rpx;
+ height: 16rpx;
+ border-top: 2rpx solid #999;
+ border-right: 2rpx solid #999;
+ transform: rotate(45deg);
+ margin-left: 20rpx;
}
}
}
}
}
-</style>
+</style>
\ No newline at end of file
--
Gitblit v1.9.1