From 1626d13ec8b1a63676e63cf95c5004c4118da3b3 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 26 十月 2025 14:59:48 +0800
Subject: [PATCH] feat:移除app 中我的栏目中不要的功能
---
app/pages/mine/index.vue | 222 ++++++++++++++++++------------------------------------
1 files changed, 75 insertions(+), 147 deletions(-)
diff --git a/app/pages/mine/index.vue b/app/pages/mine/index.vue
index 48b20a6..e6ccd74 100644
--- a/app/pages/mine/index.vue
+++ b/app/pages/mine/index.vue
@@ -14,7 +14,7 @@
</view>
<view v-if="name" @click="handleToInfo" class="user-info">
<view class="u_title">
- 鐢ㄦ埛鍚嶏細{{ name }}
+ {{ name }}
</view>
</view>
</view>
@@ -26,34 +26,19 @@
</view>
<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>
- <text class="text">浜ゆ祦缇�</text>
- </view>
- <view class="action-item" @click="handleBuilding">
- <view class="iconfont icon-service text-blue icon"></view>
- <text class="text">鍦ㄧ嚎瀹㈡湇</text>
- </view>
- <view class="action-item" @click="handleBuilding">
- <view class="iconfont icon-community text-mauve icon"></view>
- <text class="text">鍙嶉绀惧尯</text>
- </view>
- <view class="action-item" @click="handleBuilding">
- <view class="iconfont icon-dianzan text-green icon"></view>
- <text class="text">鐐硅禐鎴戜滑</text>
- </view>
- </view>
-
<!-- 鐢ㄦ埛淇℃伅灞曠ず -->
<view class="user-info-section">
<view class="info-item">
- <view class="info-label">鐢ㄦ埛鍚嶏細</view>
+ <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">{{ deptName || '鏈缃�' }}</view>
</view>
<view class="info-item">
<view class="info-label">缁戝畾杞﹁締锛�</view>
@@ -63,51 +48,22 @@
<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">
+ <!-- 缁戝畾/瑙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="handleUserAgreement">
+
+ <!-- 閫�鍑虹櫥褰� -->
+ <view class="list-cell list-cell-arrow" @click="handleLogout">
<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">
- <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>
@@ -119,12 +75,14 @@
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.nickName,
phonenumber: '',
+ deptName: '', // 鎵�灞炲垎鍏徃
boundVehicle: '', // 缁戝畾鐨勮溅杈嗕俊鎭�
boundVehicleId: null, // 缁戝畾鐨勮溅杈咺D
version: getApp().globalData.config.appInfo.version
@@ -135,10 +93,14 @@
return this.$store.state.user.avatar
},
windowHeight() {
- return uni.getSystemInfoSync().windowHeight - 50
+ return getSystemInfo().windowHeight - 50
}
},
onLoad() {
+ this.getUserInfo()
+ },
+ onShow() {
+ // 姣忔鏄剧ず椤甸潰鏃跺埛鏂扮敤鎴蜂俊鎭�
this.getUserInfo()
},
methods: {
@@ -149,12 +111,14 @@
// 鑾峰彇鐢ㄦ埛鍩烘湰淇℃伅
getUserProfile().then(response => {
const user = response.data
- this.name = user.userName
+ 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 = '鏈缃�'
})
// 鑾峰彇鐢ㄦ埛缁戝畾鐨勮溅杈嗕俊鎭�
@@ -175,40 +139,9 @@
}
},
- // 璺宠浆鍒扮粦瀹氳溅杈嗛〉闈�
- goToBindVehicle() {
+ // 澶勭悊杞﹁締缁戝畾鎿嶄綔
+ handleVehicleBinding() {
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() {
@@ -227,29 +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')
- },
- 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')
- },
- handleBuilding() {
- this.$modal.showToast('妯″潡寤鸿涓瓇')
}
}
}
@@ -333,25 +248,6 @@
* {
-ms-overflow-style: none; /* IE 10+ */
}
-
- .mine-actions {
- margin: 15px 15px;
- padding: 20px 0px;
- border-radius: 8px;
- background-color: white;
-
- .action-item {
- .icon {
- font-size: 28px;
- }
-
- .text {
- display: block;
- font-size: 13px;
- margin: 8px 0px;
- }
- }
- }
// 鐢ㄦ埛淇℃伅灞曠ず鍖哄煙
.user-info-section {
@@ -383,26 +279,58 @@
flex: 1;
}
}
+ }
+
+ // 鑿滃崟鍒楄〃鏍峰紡
+ .menu-list {
+ background-color: white;
+ border-radius: 8px;
+ margin: 15rpx;
+ overflow: hidden;
- .vehicle-actions {
- padding: 30rpx 0 10rpx 0;
- text-align: center;
+ .list-cell {
+ padding: 30rpx;
+ border-bottom: 1rpx solid #f0f0f0;
+ cursor: pointer;
+ transition: background-color 0.2s;
- .bind-btn, .unbind-btn {
- width: 80%;
- height: 80rpx;
- border-radius: 10rpx;
- font-size: 32rpx;
+ &:last-child {
+ border-bottom: none;
}
- .bind-btn {
- background-color: #007AFF;
- color: white;
+ &:active {
+ background-color: #f5f5f5;
}
- .unbind-btn {
- background-color: #ff4d4f;
- color: white;
+ .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;
}
}
}
--
Gitblit v1.9.1