From 682182cf67a5aa9fed34335fea22d4673f30f10c Mon Sep 17 00:00:00 2001 From: Mr.Shi <1878285526@qq.com> Date: 星期一, 04 九月 2023 11:59:44 +0800 Subject: [PATCH] 小程序 --- minipro_standard/pages/mine/mine.vue | 73 +++++++++++++++++++++++++++++------- 1 files changed, 59 insertions(+), 14 deletions(-) diff --git a/minipro_standard/pages/mine/mine.vue b/minipro_standard/pages/mine/mine.vue index 18f9c4f..19d9808 100644 --- a/minipro_standard/pages/mine/mine.vue +++ b/minipro_standard/pages/mine/mine.vue @@ -2,11 +2,11 @@ <view> <div class="box"> <div class="box_info" :style="{background: 'url(' + img + ')'}"> - <image src="@/static/2@2x.png" mode="widthFix" /> + <image :src="userInfo.avatar ? userInfo.avatar : avatar" mode="widthFix" /> <div class="box_info_box"> - <text>寮犱笁</text> - <div class="box_info_box_x" @click="show = true"> - <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> @@ -22,20 +22,26 @@ </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="confirm"></u-picker> + <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: [ @@ -47,22 +53,61 @@ { name: '淇敼瀵嗙爜', url: '/pages/changePassword/changePassword', icon: require('@/static/mine_ic_xiugaimima@2x.png') }, ], img: require('@/static/mine_bg@2x.png'), + avatar: require('@/static/2@2x.png'), show: false, - columns: [ - ['涓浗', '缇庡浗', '鏃ユ湰'] - ] + columns: [] } }, onLoad() { uni.hideTabBar() }, methods: { - jump(url) { - uni.navigateTo({ url }) + // 閫�鍑虹櫥褰� + loginOut() { + wxLoginOut({ + companyUserId: this.userInfo.companyUser.id + }).then(res => { + if (res.code === 200) { + this.$store.commit('clearCache') + uni.reLaunch({ + url: '/pages/login/login' + }); + } + }) }, - confirm(val) { - console.log(val) - this.show = false + // 纭鍒囨崲缁勭粐 + 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 }) } } } -- Gitblit v1.9.3