Browse Source

collect-detail page

邹能昇 3 months ago
parent
commit
f77a308ea2
2 changed files with 24 additions and 7 deletions
  1. 19 0
      nova-tourism/components/my/index.js
  2. 5 7
      nova-tourism/components/my/index.wxml

+ 19 - 0
nova-tourism/components/my/index.js

@@ -1,4 +1,6 @@
 // nova-tourism/components/my/index.js
+let Parse = getApp().Parse;
+const company = getApp().globalData.company
 Component({
     /**
      * 组件的属性列表
@@ -16,6 +18,8 @@ Component({
         customHeight: 0,
         bottomNavHeight: 0,
         contentHeight: 0,
+
+        User1List:[],
     },
     lifetimes: {
         detached: function () {},
@@ -35,6 +39,7 @@ Component({
                 bottomNavHeight,
                 contentHeight
             });
+            this.getname()
         },
     },
 
@@ -48,5 +53,19 @@ Component({
                 url: `${url}`,
             });
         },
+        //获取头像名称
+        async getname(){
+            const currentUser = Parse.User.current();
+            let Userquery = new Parse.Query('_User');
+            Userquery.equalTo('company', company);
+            Userquery.equalTo('objectId', currentUser.id);
+            Userquery.notEqualTo('isDeleted', true)
+            let P2 = await Userquery.find();
+            let User1List = P2.map(item => item.toJSON());
+            this.setData({
+                User1List
+            })
+            console.log(this.data.User1List);
+        },
     }
 })

+ 5 - 7
nova-tourism/components/my/index.wxml

@@ -2,15 +2,13 @@
 <nav type="title" background-color="#ffffff" frontColor="#000000" title="望仙谷" />
 <view class="all" style="height: {{contentHeight}}rpx;">
     <view class="infobox">
-        <image src="https://file-cloud.fmode.cn//tmp/qE8I1dp1Z0O0ae3b6ab1226c9225aaa630c9529cba65.jpeg?imageView2/1/w/200/h/200"></image>
+        <image src="{{User1List[0].avatar}}"></image>
         <view class="info">
-            <view class="name">超级无敌暴龙</view>
-            <view class="uid">UID:123456789</view>
+            <view class="name">{{User1List[0].nickname}}</view>
+            <view class="uid">UID:{{User1List[0].objectId}}</view>
             <view class="labelbox">
-                <block wx:for="{{2}}">
-                    <view class="label">名宿主</view>
-                    <view class="label">达人</view>
-                </block>
+                    <view class="label" wx:if="{{User1List[0].type=='shop-admin'}}">民宿主</view>
+                    <view class="label"  wx:if="{{User1List[0].type=='user'}}">用户</view>
             </view>
         </view>
     </view>