tanyanfei 2 年之前
父節點
當前提交
1d5cabc06d

+ 36 - 10
pages/follow/follow.js

@@ -18,7 +18,17 @@ Page({
     wx.showLoading({
       title: '正在加载',
     })
+    this.setData({
+      type:options.type,
+      id:options.id
+    })
     this.getFollow()
+    if(options.type == 2){
+      wx.setNavigationBarTitle({
+        title: '粉丝',
+      })
+    }
+    
   },
   next: function () {
     if (this.data.list.length < this.data.total) {
@@ -31,18 +41,34 @@ Page({
   },
   getFollow() {
     var list = this.data.list
-    $api.getMyFollow({
-      page: this.data.page, page_size: 20
-    }).then(res => {
-      wx.hideLoading()
-      res.data.data.list.forEach(item => {
-        list.push(item)
+    if(this.data.type == 1){
+      $api.getMyFollow({
+        page: this.data.page, page_size: 20,player_id:this.data.id
+      }).then(res => {
+        wx.hideLoading()
+        res.data.data.list.forEach(item => {
+          list.push(item)
+        })
+        this.setData({
+          list: list,
+          total: res.data.data.total
+        })
       })
-      this.setData({
-        list: list,
-        total: res.data.data.total
+    }else{
+      $api.getFans({
+        page: this.data.page, page_size: 20,player_id:this.data.id
+      }).then(res => {
+        wx.hideLoading()
+        res.data.data.list.forEach(item => {
+          list.push(item)
+        })
+        this.setData({
+          list: list,
+          total: res.data.data.total
+        })
       })
-    })
+    }
+    
   },
   /**
    * 生命周期函数--监听页面初次渲染完成

+ 1 - 1
pages/follow/follow.json

@@ -1,3 +1,3 @@
 {
-  "navigationBarTitleText": "我的关注"
+  "navigationBarTitleText": "关注"
 }

+ 23 - 2
pages/homepage/homepage.js

@@ -13,6 +13,9 @@ Page({
     mydata:{},
     date:'2021-11',
     days:[],
+    match:[],
+    index:0,
+    id:'',
     ec: {
       onInit: null
     },
@@ -26,7 +29,7 @@ Page({
    */
   onLoad: function (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
@@ -41,7 +44,16 @@ Page({
           title: '我的主页',
         })
     }
-    this.getData();
+    $api.getMatchList().then(res=>{
+      let l = res.data.data.length - 1;
+      this.setData({
+        match:res.data.data,
+        index: l,
+        id: res.data.data[l].id
+      })
+      this.getData();
+    })
+    
   },
   getDays(){
     // match_id   player_id  month: "2021-12"
@@ -68,6 +80,14 @@ Page({
       })
     })
   },
+  bindChange(e) {
+    let match=this.data.match;
+    this.setData({
+      index: e.detail.value,
+      id: match[e.detail.value].id
+    })
+    this.getData()
+  },
   getData(){
     wx.showNavigationBarLoading();
     var data = {}
@@ -105,6 +125,7 @@ Page({
     .catch(err=>{
       wx.hideNavigationBarLoading()
     })
+    
     //每日持股
     var parm={
       id: this.data.id, player_id: this.data.player_id?data.player_id:o

+ 13 - 4
pages/homepage/homepage.wxml

@@ -3,8 +3,9 @@
     <view class="name">
       {{datas.today_record.username}}
       <view class="fans">
-          <text>{{fans}}</text>粉丝12
-          <navigator url="../follow/follow" style="display: inline-block;"><text style="margin-left: 20rpx;">{{followers}}</text>关注</navigator>
+          
+          <navigator url="../follow/follow?id={{player_id}}&type=2" style="display: inline-block;"><text>{{fans}}</text>粉丝</navigator>
+          <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}}'>
@@ -30,7 +31,15 @@
   </view>
 </view>
 <view class="style" style="margin: 0;">
-    <view class="game">参赛  <picker>第49届顽主杯实盘大赛</picker></view>
+    <view class="game">参赛 
+      <picker  value="{{index}}"  range="{{match}}" range-key='name' bindchange="bindChange">
+      <view class="picker">
+        {{match[index].name}}
+        <image style="width:24rpx;" mode="widthFix" src="../../images/icon_down@2x.png"></image>
+      </view>
+    </picker>
+     <!-- <picker>第49届顽主杯实盘大赛</picker> -->
+    </view>
     <block wx:if="{{datas.today_record.group_rank}}">
     <view>
       <text>时间</text>{{datas.today_record.stock_date}}
@@ -132,5 +141,5 @@
   </view>
 </view>
 
-<view wx:if="type==1" class="content" style="margin-top: 100rpx;"><view bindtap="logout" class="logout">退出登录</view></view>
+<!-- <view wx:if="type==1" class="content" style="margin-top: 100rpx;"><view bindtap="logout" class="logout">退出登录</view></view> -->
 

+ 4 - 2
pages/stock/stock.wxml

@@ -1,8 +1,10 @@
 <!--pages/stock/stock.wxml-->
-<view class="search" wx:if='{{!id}}'>
+<view wx:if='{{!id}}' style="background: #fff;padding: 30rpx;">
+  <view class="search">
     <image mode="heightFix" src="../../images/ss1.png"></image>
     <input bindinput="inputChange" placeholder-style="color:#999;" placeholder=""></input>
     <text bindtap="search">搜索</text>
+  </view>
 </view>
 
 <view wx:if='{{id}}'>
@@ -72,7 +74,7 @@
       <button bindtap="sendmsg">提交</button>
   </view>
 </view>
-<scroll-view wx:else scroll-y='{{true}}' bindscrolltolower='next'>
+<scroll-view wx:else scroll-y='{{true}}' bindscrolltolower='next' style="background: #fff;padding:0 30rpx;">
     <navigator hover-class="none" class="list" url="../stock/stock?id={{item.id}}&&date={{stock_date}}&type={{type}}" wx:for='{{list}}'>{{item.stock_name}}
     <view class="num" wx:if='{{type==1}}'>持仓 <text>{{item.count}}</text> 人</view>
     <view class="num" wx:else>清仓 <text>{{item.count}}</text> 人</view>

+ 1 - 1
pages/stock/stock.wxss

@@ -123,7 +123,7 @@ image{
   font-weight: 500;
 }
 .stock_name{
-  line-height: 82rpx;
+  line-height: 100rpx;
   padding: 0 30rpx;
   font-size: 36rpx;
   font-weight: bold;

+ 2 - 3
pages/style/style.js

@@ -15,7 +15,7 @@ Page({
       zq: [],
       cw: [],
       df: [],
-      init_fund: '',
+      username: '',
       account_img: ''
     }
   },
@@ -41,7 +41,6 @@ Page({
         this.setData({
           form: form
         })
-      console.log(form)
     })
   },
   change(e){
@@ -67,7 +66,7 @@ Page({
   },
   bindinput(e){
     let form = this.data.form;
-    form.init_fund = e.detail.value;
+    form.username = e.detail.value;
     this.setData({
       form: form
     })

+ 19 - 11
pages/style/style.wxml

@@ -1,4 +1,22 @@
 <wxs src="../../utils/tool.wxs" module="tool"></wxs>
+<view class="item">
+  <label>入市时间</label>
+  <view class="tags">
+      <picker mode="date" fields='year' value="{{form.join_time}}"  bindchange="bindDateChange">
+          <view class="date-picker">
+              <text wx:if='{{!form.join_time}}'>请选择</text>
+              {{form.join_time==null?'':form.join_time}}
+              <image mode="widthFix" src="../../images/icon_down@2x.png"></image>
+          </view>
+      </picker>
+  </view>
+</view>
+<view class="item" wx:if="{{form.is_player==1}}"> 
+   <label>选手名称</label>
+   <view class="tags"> 
+      <input value="{{form.username}}" bindinput="bindinput" placeholder-style="color:#999;" placeholder="请填写"></input> 
+  </view>
+</view>
 <view class="title">请选择你的操作风格</view>
 <view wx:if='{{arr1.length>0}}'>
 <view class="item">
@@ -25,17 +43,7 @@
       <text wx:for='{{arr4}}' class="{{tool.indexOf(form.pz, item)>=0?'act':''}}" bindtap="change" data-id='{{item}}' data-item='pz'>{{item}}</text>
   </view>
 </view>
-<view class="item">
-  <label>入市时间</label>
-  <view class="tags">
-      <picker mode="date" fields='year' value="{{form.join_time}}"  bindchange="bindDateChange">
-          <view class="date-picker">
-              <text wx:if='{{!form.join_time}}'>请选择</text>{{form.join_time}}
-              <image mode="widthFix" src="../../images/icon_down@2x.png"></image>
-          </view>
-      </picker>
-  </view>
-</view>
+
 <!-- <view class="item" wx:if="{{form.is_player==1}}"> -->
   <!-- <label>参赛金额</label> -->
   <!-- <view class="tags"> -->

+ 1 - 1
pages/style/style.wxss

@@ -4,7 +4,7 @@ page{
 }
 .title{
   font-size: 32rpx;
-  margin-bottom: 10rpx;
+  margin: 10rpx 0;
 }
 .item{
   padding: 30rpx 0 0rpx;

+ 3 - 2
pages/today/today.wxml

@@ -3,9 +3,10 @@
     <image src="{{datas.today_record.avatar}}" ></image>
     <view class="name">
       {{datas.today_record.username}}
+
       <view class="fans">
-          <text>{{fans}}</text>粉丝
-          <text style="margin-left: 20rpx;">{{followers}}</text>关注
+          <navigator url="../follow/follow?id={{player_id}}&type=2" style="display: inline-block;"><text>{{fans}}</text>粉丝</navigator>
+          <navigator url="../follow/follow?id={{player_id}}&type=1" style="display: inline-block;"><text style="margin-left: 20rpx;">{{followers}}</text>关注</navigator>
       </view>
     </view>
     <navigator url="../homepage/homepage?id={{id}}&record_id={{record_id}}&player_id={{player_id}}">Ta的主页</navigator>

+ 1 - 1
pages/today/today.wxss

@@ -57,7 +57,7 @@ ec-canvas {
   font-weight: bold;
   margin-right: 10rpx;
 }
-.per_top navigator{
+.per_top>navigator{
   color: #fff;
   font-size: 28rpx;
   position: absolute;

+ 7 - 6
pages/user/user.wxml

@@ -10,7 +10,7 @@
         <navigator  url="../homepage/homepage?id={{todayinfo.match_id}}&record_id={{todayinfo.id}}&player_id={{todayinfo.player_id}}&type=1" class="mine">我的主页</navigator>
       </view>
       <view  wx:if='{{todayinfo.today_fund}}' class="today">
-      <navigator hover-class="none"  url="../change/change">
+      <navigator hover-class="none"  url="../today/today?id={{todayinfo.match_id}}&record_id={{todayinfo.id}}&player_id={{todayinfo.player_id}}">
       
       <view class="money">
         <text class="{{todayMoney[0]=='-' ?'down':'up'}}">{{todayMoney}}  </text>
@@ -19,7 +19,7 @@
       </view>
       <view class="date">
         <text>日期 <text>{{todayinfo.stock_date}}</text> </text>
-        <text>排名 <text>{{todayinfo.group_rank}}</text> </text>
+        <text>排名 <text>{{todayinfo.group_rank==null?'无':todayinfo.group_rank}}</text> </text>
       </view>
       <view class="date">
         <text>资产 <text>{{todayinfo.today_fund}}w</text> </text>
@@ -48,13 +48,14 @@
         <!-- <navigator hover-class="none" class="item" url="../style/style">
             我的风格  <image mode="widthFix" src="../../images/right_icon.png"></image>
         </navigator> -->
-        <navigator hover-class="none" style="border:none"  class="item" url="../aboutus/aboutus">
+        <navigator hover-class="none"  class="item" url="../aboutus/aboutus">
             关于我们  <image mode="widthFix" src="../../images/right_icon.png"></image>
         </navigator>
-      </view>  
-      <!-- <navigator hover-class="none"  class="item logout" bindtap="logout">
+        <navigator hover-class="none" style="border:none"   class="item" bindtap="logout">
             退出登录  <image mode="widthFix" src="../../images/right_icon.png"></image>
-        </navigator>  -->
+        </navigator> 
+      </view>  
+      
 
   
 </view>

+ 6 - 6
utils/api.js

@@ -42,11 +42,11 @@ function request(method, url, data) {
             }else{
               wx.hideNavigationBarLoading()
               wx.hideLoading()
-              // wx.showToast({
-              //   title: res.data.message,
-              //   icon:'none',
-              //   duration:3000
-              // })
+              wx.showToast({
+                title: res.data.message,
+                icon:'none',
+                duration:3000
+              })
             }
           },
           fail(err) {
@@ -150,7 +150,7 @@ const API = {
   addchoice: (data) => request(POST, `/api/wx/v3/user/choice`, data),
   deletechoice: (data) => request(DELETE, `/api/wx/v3/user/choice`, data),
   initfund: (data) => request(PUT, `/api/wx/player/fund`, data),
-  
+  getFans: (data) => request(GET, `/api/wx/v3/user/follower/list`, data),
   
 }; 
 module.exports = {