tanyanfei 3 年之前
父节点
当前提交
97aa034694
共有 3 个文件被更改,包括 14 次插入11 次删除
  1. 6 4
      pages/homepage/homepage.js
  2. 1 1
      pages/homepage/homepage.wxml
  3. 7 6
      pages/upload/upload.js

+ 6 - 4
pages/homepage/homepage.js

@@ -16,6 +16,7 @@ Page({
     match:[],
     index:0,
     id:'',
+    user_id:'',
     ec: {
       onInit: null
     },
@@ -28,10 +29,6 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    console.log(options)
-    
-    // options.id = 7, options.record_id = 29014
-    // options.id = 9, options.player_id = 3520
     id = options.id?options.id:null, record_id = options.record_id?options.record_id:null
     this.setData({
       type:options.type?options.type:'',
@@ -44,6 +41,11 @@ Page({
           title: '我的主页',
         })
     }
+    $api.getAuthinfo().then(res=>{
+      this.setData({
+        user_id:res.data.data.id
+      })
+    })
     $api.getMatchList().then(res=>{
       let l = res.data.data.length - 1;
       this.setData({

+ 1 - 1
pages/homepage/homepage.wxml

@@ -8,7 +8,7 @@
           <navigator url="../follow/follow?id={{player_id}}&type=1" style="display: inline-block;"><text style="margin-left: 20rpx;">{{followers}}</text>关注</navigator>
       </view>
     </view>
-    <block wx:if='{{type!=1}}'>
+    <block wx:if='{{user_id!=datas.today_record.user_id}}'>
     <view class="follow" style="width:140rpx;" wx:if='{{is_follow}}' data-action='cancel' bindtap="followPlayer">取消关注</view>
     <view class="follow" wx:else  bindtap="followPlayer">+ 关注</view>
     </block>

+ 7 - 6
pages/upload/upload.js

@@ -29,6 +29,12 @@ Page({
     if (!this.data.freshen) {
       return;
     }
+    $api.getAuthinfo().then(res=>{
+      this.setData({
+        role: res.data.data.role,
+        need_fill: res.data.data.need_fill,
+      })
+    })
     $api.getCurrecord().then(res=>{
       if (!res.data.data.id){return}
       let stock = res.data.data.today_stock
@@ -52,12 +58,7 @@ Page({
     this.setData({
       stock_date:y+'-'+m+'-'+d
     })
-    $api.getAuthinfo().then(res=>{
-      this.setData({
-        role: res.data.data.role,
-        need_fill: res.data.data.need_fill,
-      })
-    })
+    
   },
   /**添加持股 */
   add(){