From e6a02c8b09a796e436a501e9b87d19e25c34c9d1 Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期日, 07 四月 2024 15:53:37 +0800 Subject: [PATCH] # --- pages/user/user.vue | 133 +++++++++++++++++++++++++++++++++++++------ 1 files changed, 113 insertions(+), 20 deletions(-) diff --git a/pages/user/user.vue b/pages/user/user.vue index cb5bc04..bde3de5 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -3,8 +3,7 @@ <view class="user" @click="userDetail"> <!-- 澶村儚 --> <view class="user-avatar"> - <img src="" alt=""> - <!-- <image src="" mode="aspectFit"></image> --> + <image src="../../static/image/user__easyico.png" mode="aspectFit"></image> </view> <!-- 淇℃伅 --> <view class="user-info"> @@ -16,49 +15,114 @@ <uni-icons type="right"></uni-icons> </view> </view> + + <view class="taskbox"> + <view class="taskbox-title"> + <y-title title="寰呭鐞嗕换鍔�"></y-title> + </view> + <view class="taskbox-main"> + <view class="taskbox-body" v-for="(item,index) in Data" @click="goDetl(item)"> + <view class="taskbox-body-title">{{item.title}}</view> + <view class="taskbox-body-cell"> + <text class="taskbox-body-number">{{item.value}}</text> + <text class="taskbox-body-unit">涓�</text> + </view> + </view> + </view> + + </view> </view> </template> <script> + import user from '@/pages/api/user/user.js' export default{ data() { return { - username: '' + username: '', + Data: [ + { field: 'planPendingTaskCount', title: '瑙勫垝鐢宠鍗�', hide: false,value: ''}, + { field: 'priOnlinePendingTaskCount', title: '鏍镐环瀹℃壒', hide: false,value: '' }, + { field: 'priQuotePendingTaskCount', title: '鎶ヤ环瀹℃壒', hide: false,value: '' }, + { field: 'businessTripPendingTaskCount', title: '鍑哄樊瀹℃壒', hide: false,value: '' }, + { field: 'reimburseOnlinePendingTaskCount', title: '鎶ラ攢瀹℃壒', hide: false,value: '' }, + { field: 'planPriOnlinePendingTaskCount', title: '鍙帴鏀舵牳浠蜂换鍔�', hide: false,value: '' }, + ], + data2: [] } }, onShow() { this.getDetail() + this.getPersonData() }, methods: { + async getDetail() { + let res = await user.getDetail() + if (res.code === 200) { + this.username = res.data.username + console.log(res.data); + } else if (res.code === 403) { + this.backLogin(res) + } + }, userDetail() { uni.navigateTo({ url:'/pages/user/user_detail/userDetail' }) }, - getDetail() { - let that = this + backLogin(res) { + uni.showToast({title: res.msg, icon: "none", position: 'top'}) + setTimeout(() => { + uni.reLaunch({ + url: '../login/login' + }); + }, 1000); + }, + // 鑾峰彇浠诲姟淇℃伅 + getPersonData() { + let _this = this uni.request({ - url: that.baseUrl + '/user/detail/auth', + url: `${_this.baseUrl}/dashboard/personData/auth`, header: {'token' : uni.getStorageSync('token')}, - method: 'POST', success(res) { res = res.data if (res.code === 200) { - that.username = res.data.username - } else if (res.code === 403) { - uni.showToast({title: res.msg, icon: "none", position: 'top'}) - setTimeout(() => { - uni.reLaunch({ - url: '../../login/login' - }); - }, 1000); - } else { - uni.showToast({title: res.msg, icon: "none",position: 'top'}) + for (let k of _this.Data) { + k.value = res.data[k.field] + res.data[k.field] + } } - console.log(res.data); } }) }, + goDetl(item) { + if (item.value > 0) { + let url = '/pages/business' + switch(item.field) { + case 'planPendingTaskCount': + url = `${url}/plan/plan` + break; + case 'planPriOnlinePendingTaskCount': + url = `${url}/pricing/priOnline` + break; + case 'priQuotePendingTaskCount': + url = `${url}/pricing/priQuote` + break; + case 'businessTripPendingTaskCount': + url = `${url}/goBusiness/goBusiness` + break; + case 'reimburseOnlinePendingTaskCount': + url = `${url}/goBusiness/reimburseOnline` + break; + case 'priOnlinePendingTaskCount': + url = `${url}/pricing/priOnline` + break; + } + uni.navigateTo({ + url:url + }) + } + } } } </script> @@ -72,8 +136,9 @@ grid-template-columns: 1fr 4fr 1fr; } .user-avatar { - height: 200rpx; - width: 200rpx; + height: 100rpx; + width: 100rpx; + padding: 50rpx; /* background-color: aquamarine; */ display: flex; justify-content: center; @@ -105,4 +170,32 @@ align-items: center; justify-content: center; } + + .taskbox { + margin: 32rpx; + padding: 16rpx; + background-color: #fff; + border-radius: 20rpx; + } + .taskbox-main { + display: flex; + flex-wrap: wrap; + } + .taskbox-body-cell { + /* display: flex; */ + margin-left: 16rpx; + } + .taskbox-body-number { + font-size: 40rpx; + font-weight: bold; + } + .taskbox-body-unit { + margin-left: 8rpx; + /* vertical-align: text-bottom; */ + } + .taskbox-body { + margin: 16rpx; + width: 45%; + /* background-color: aquamarine; */ + } </style> \ No newline at end of file -- Gitblit v1.9.1