From 52d463e03c1f074099ed8e8a6b7c3ddde52d2708 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Fri, 27 Oct 2023 14:50:28 +0800 Subject: [PATCH] fix:小程序初版 --- pages/actionChange/myInfor/index.vue | 45 +++++++++++++++++++++++++++++++-------------- 1 files changed, 31 insertions(+), 14 deletions(-) diff --git a/pages/actionChange/myInfor/index.vue b/pages/actionChange/myInfor/index.vue index b63dc6c..a186dec 100644 --- a/pages/actionChange/myInfor/index.vue +++ b/pages/actionChange/myInfor/index.vue @@ -2,11 +2,11 @@ <view class="mainContent"> <view class="headerAvatar"> <view class=""> - <u-avatar :text="firstFont" fontSize="40" randomBgColor size='100'></u-avatar> + <u-avatar :src="avatarUrl" fontSize="40" randomBgColor size='100'></u-avatar> </view> </view> <view class="inforBox"> - <u-cell-group> + <u-cell-group :custom-style='fontStyleobj'> <u-cell icon="server-man" title="������" :value="userInfor.userName"></u-cell> <u-cell icon="account-fill" title="������" :value="userInfor.account"></u-cell> <u-cell icon="integral-fill" title="������������" :value="unitName"></u-cell> @@ -19,38 +19,49 @@ </view> </template> <script> - import { - created - } from '../../../uni_modules/uview-ui/libs/mixin/mixin' + import store from '@/store/index.js' export default { data() { return { loading: false, userInfor: {}, - unitList: [] + avatarUrl: '', + unitList: [], + fontStyleobj: { + 'fontSize': '16px' + } } }, computed: { unitName() { let data = '' - if (this.unitList.length > 0) { - data = this.unitList.find(a => parseInt(a.unitId) === this.userInfor.unitId).unitName + if (Object.values(this.userInfor).length > 0 && this.unitList.length > 0) { + if (this.userInfor.unitId) { + data = this.unitList.find(a => parseInt(a.unitId) === this.userInfor.unitId).unitName + } } return data || '' }, - firstFont() { - return this.userInfor.userName[0] || '���' - } + // firstFont() { + // let data = '' + // if (Object.values(this.userInfor).length > 0) { + // data = this.userInfor.userName[0] + // } + // return data || '���' + // } }, created() { this.$http.httpGet('/allocation/unit').then(res => { this.unitList = res.data }) - this.userInfor = this.$storage.getJson('userInfo') - console.log('userInfor', this.userInfor.userName[0]) + this.userInfor = JSON.parse(uni.getStorageSync('userInfor') || '{}') + console.log('this.userInforGet', this.userInfor) + let baseUrl = this.$storage.get('baseUrl') + this.avatarUrl = `${baseUrl}/file/preview/${this.userInfor.file.fileId}` }, methods: { goOut() { + let openId = uni.getStorageSync('openId') uni.showModal({ title: '������', content: '������������������', @@ -60,10 +71,11 @@ userId: this.userInfor.userId }).then(res => { uni.clearStorageSync() + uni.setStorageSync('openId', openId) uni.reLaunch({ url: '/pages/login/login', }) - }).catch(uni.$u.toast('������������')) + }) } } }) @@ -88,4 +100,9 @@ .bunts { margin-top: 57.69rpx; } + + /deep/ .u-cell__title-text, + /deep/.u-cell__value { + font-size: 30.77rpx !important; + } </style> \ No newline at end of file -- Gitblit v1.8.0