From ca73a173f008c8d7a9d700bad897ca24fe2d2203 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 16 十月 2023 09:29:57 +0800
Subject: [PATCH] 111

---
 minipro_standard/pages/mine/mine.vue |  103 +++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 82 insertions(+), 21 deletions(-)

diff --git a/minipro_standard/pages/mine/mine.vue b/minipro_standard/pages/mine/mine.vue
index 081c8eb..de9726e 100644
--- a/minipro_standard/pages/mine/mine.vue
+++ b/minipro_standard/pages/mine/mine.vue
@@ -1,18 +1,20 @@
 <template>
 <view>
 	<div class="box">
-		<div class="box_info" :style="{background: 'url(' + img + ')'}">
-			<image src="@/static/2@2x.png" mode="widthFix" />
+		 <!-- :style="{background: 'url(' + img + ')'}" -->
+		<div class="box_info">
+			<image :src="avatar" mode="widthFix" />
 			<div class="box_info_box">
-				<text>寮犱笁</text>
-				<div class="box_info_box_x">
-					<text>璞嗙背绉戞妧</text>
+				<text>{{userInfo.realname}}</text>
+				<div class="box_info_box_x" @click="switchOrganization">
+					<text>{{userInfo.curComDepartment ? userInfo.curComDepartment.name : ''}}</text>
 					<image src="@/static/mine_ic_change@2x.png" alt="" />
 				</div>
 			</div>
+			<image class="bg" src="@/static/mine_bg@2x.png" mode="widthFix"></image>
 		</div>
 		<div class="box_function">
-			<div class="box_function_item" v-for="(item, index) in MENU" :key="index">
+			<div class="box_function_item" v-for="(item, index) in MENU" :key="index" @click="jump(item.url)">
 				<div class="box_function_item_left">
 					<image :src="item.icon" alt="" />
 					<text>{{item.name}}</text>
@@ -22,43 +24,93 @@
 				</div>
 			</div>
 		</div>
-		<div class="box_out"><text>閫�鍑虹櫥褰�</text></div>
+		<div class="box_out" @click="loginOut"><text>閫�鍑虹櫥褰�</text></div>
 	</div>
+	<!-- 閮ㄩ棬閫夋嫨鍣� -->
+	<u-picker :show="show" :columns="columns" @confirm="onConfirm" @cancel="show = false"></u-picker>
 	<myTabbar :index="2" />
 </view>
 </template>
 
 <script>
+	import { changeCom, getDepartmentListByConditon } from '@/util/api/PersonalAPI'
 	import myTabbar from "@/components/myTabber.vue"
+	import { wxLoginOut } from '@/util/api'
+	import { mapState } from 'vuex'
 	export default {
 		components: {
 			myTabbar
 		},
+		computed: mapState([
+			'userInfo'
+		]),
 		data() {
 			return {
 				MENU: [
-					{ name: '涓汉淇℃伅', url: '/personal/personalInformation', icon: require('@/static/mine_ic_gerenxinxi@2x.png') },
+					{ name: '涓汉淇℃伅', url: '/pages/personal/personal', icon: require('@/static/mine_ic_gerenxinxi@2x.png') },
 					// { name: '绯荤粺閫氱煡', url: '', icon: require('@/assets/icon/mine_ic_xitonggonggao@2x.png') },
-					{ name: '鏇存柊鎵嬫満鍙�', url: '/personal/updatePhone', icon: require('@/static/mine_ic_shoujihao@2x.png') },
-					{ name: '鏇存柊閭鍙�', url: '/personal/updateMailbox', icon: require('@/static/mine_ic_youxianghao@2x.png') },
+					{ name: '鏇存柊鎵嬫満鍙�', url: '/pages/updatePhone/updatePhone', icon: require('@/static/mine_ic_shoujihao@2x.png') },
+					{ name: '鏇存柊閭鍙�', url: '/pages/updateMailbox/updateMailbox', icon: require('@/static/mine_ic_youxianghao@2x.png') },
 					{ name: '鎵爜缁戝畾璐﹀彿', url: '', icon: require('@/static/mine_ic_bangding@2x.png') },
-					{ name: '淇敼瀵嗙爜', url: '/personal/changePassword', icon: require('@/static/mine_ic_xiugaimima@2x.png') },
+					{ name: '淇敼瀵嗙爜', url: '/pages/changePassword/changePassword', icon: require('@/static/mine_ic_xiugaimima@2x.png') },
 				],
-				img: require('@/static/mine_bg@2x.png')
+				img: require('@/static/mine_bg@2x.png'),
+				avatar: require('@/static/2@2x.png'),
+				show: false,
+				columns: []
 			}
 		},
 		onLoad() {
 			uni.hideTabBar()
-			// uni.login({
-			// 	success: data => {
-			// 		this.wxLogin(data.code)
-			// 	},
-			// 	fail: err => {
-			// 		uni.$u.toast(err)
-			// 	}
-			// })
 		},
 		methods: {
+			// 閫�鍑虹櫥褰�
+			loginOut() {
+				wxLoginOut({
+					companyUserId: this.userInfo.companyUser.id
+				}).then(res => {
+					if (res.code === 200) {
+						this.$store.commit('clearCache')
+						uni.reLaunch({
+							url: '/pages/login/login'
+						});
+					}
+				})
+			},
+			// 纭鍒囨崲缁勭粐
+			onConfirm(e) {
+				changeCom(e.value[0].id).then(res => {
+					if (res.code === 200) {
+						this.show = false
+						uni.showToast({ title: '鏇存柊缁勭粐鎴愬姛', icon: 'success', duration: 2000 });
+						this.$store.dispatch('getUserInfos')
+					}
+				})
+			},
+			// 鑾峰彇缁勭粐
+			switchOrganization() {
+				getDepartmentListByConditon({
+					type: 0
+				}).then(res => {
+					if (res.code === 200) {
+						this.columns = []
+						let arr = []
+						res.data.forEach((item) => {
+							let obj = {
+								text: item.name, id: item.id
+							}
+							arr.push(obj)
+						})
+						this.columns.push(arr)
+						this.show = true
+					}
+				})
+			},
+			// 璺宠浆椤甸潰
+			jump(url) {
+				if (!url) return
+				uni.navigateTo({ url })
+			}
 		}
 	}
 </script>
@@ -76,9 +128,18 @@
 			align-items: center;
 			background-repeat: no-repeat;
 			background-size: cover;
+			position: relative;
 			image {
 				width: 88rpx;
 				height: 88rpx;
+			}
+			.bg {
+				width: 100%;
+				height: 168rpx;
+				position: absolute;
+				top: 0;
+				left: 0;
+				z-index: -1;
 			}
 			.box_info_box {
 				height: 88rpx;
@@ -142,7 +203,7 @@
 			width: 350rpx;
 			height: 88rpx;
 			background: #F7F7F7;
-			border-radius: 8rpx;
+			border-radius: 44rpx;
 			display: flex;
 			align-items: center;
 			justify-content: center;

--
Gitblit v1.9.3