shish 11 месяцев назад
Родитель
Сommit
fe7e2364f8
1 измененных файлов с 14 добавлено и 5 удалено
  1. 14 5
      mallApp/src/pages/home/recent.vue

+ 14 - 5
mallApp/src/pages/home/recent.vue

@@ -18,11 +18,11 @@
         <view class="profile-section">
           <view class="profile-header" @click="">
             <view class="avatar-container">
-              <image class="avatar" src="/static/images/default-avatar.png" mode="aspectFill" />
+              <image class="avatar" :src="user.smallAvatar" mode="aspectFill" />
             </view>
             <view class="user-info">
-              <text class="username">刘小明</text>
-              <text class="user-id">ID 31548</text>
+              <text class="username">{{ user.name }}</text>
+              <text class="user-id">ID {{ user.id }}</text>
             </view>
             <view class="arrow-container">
               <text class="arrow-icon">〉</text>
@@ -169,7 +169,7 @@ import { getList } from "@/api/hd";
 import { share } from "@/mixins";
 import AppAvatarModule from "@/components/module/app-avatar";
 import { mapGetters } from 'vuex'
-import { clearLogin } from "@/api/user";
+import { clearLogin,currentInfo } from "@/api/user";
 import { list } from "@/mixins";
 export default {
   name: "recent",
@@ -180,7 +180,8 @@ export default {
       //0没有登录 1有登录
       loginStyle :0,
       activePopupIndex: -1,
-      pageAction:{refresh:0}
+      pageAction:{refresh:0},
+      user:{name:'',smallAvatar:'',id:0}
     };
   },
   computed: {
@@ -276,8 +277,16 @@ export default {
       this.pageTo({ url:'/pages/home/mall?id='+item.id+'&account='+item.shopId})
     },
     init () {
+      this.getLoginInfo()
       this.getMyHdList()
     },
+    getLoginInfo(){
+      currentInfo().then(res=>{
+        if(res.code == 1){
+          this.user = res.data.info?res.data.info:[]
+        }
+      })
+    },
     getMyHdList(){
       return getList({page: this.list.page}).then(res=>{
         this.completes(res);