lilei пре 4 година
родитељ
комит
02ceaf5b81
1 измењених фајлова са 15 додато и 3 уклоњено
  1. 15 3
      pages/userCenter/index.vue

+ 15 - 3
pages/userCenter/index.vue

@@ -3,10 +3,10 @@
 		<!-- 头部 -->
 		<view class="user-head">
 			<view class="user-photo">
-				<u-image width="90rpx" shape="circle" height="90rpx" :src="src"></u-image>
+				<u-image width="90rpx" shape="circle" height="90rpx" :src="userInfo&&userInfo.avatarUrl"></u-image>
 			</view>
 			<view class="user-info">
-				李磊
+				{{userInfo&&userInfo.nickName}}
 			</view>
 		</view>
 		<!-- 列表 -->
@@ -29,9 +29,21 @@
 	export default {
 		data() {
 			return {
-				src: 'https://cdn.uviewui.com/uview/example/fade.jpg'
+				userInfo: {
+					avatarUrl:'',
+					nickName:''
+				}
 			};
 		},
+		onLoad() {
+			let _this = this
+			uni.getUserInfo({
+				success(e) {
+					console.log(e)
+					_this.userInfo = e.userInfo
+				}
+			})
+		},
 		methods:{
 			// 打开对应的页面
 			toPage(index){