tanyanfei il y a 3 ans
Parent
commit
89194fbadc

+ 17 - 14
pages/index/index.wxml

@@ -18,15 +18,15 @@
       <scroll-view  scroll-y='{{true}}' bindscrolltolower='next'>
           <view  class="item1" wx:for='{{followList}}'>
             <navigator  url="../today/today?id={{item.match_id}}&record_id={{item.id}}&player_id={{item.player_id}}">
-              <view class="name">{{item.username}}  <text>选手</text> 
-              <view>TOP <text>{{item.match_group}}</text></view></view> 
+              <view class="name">{{item.username}}  <text>{{item.badge}}</text> 
+              <view>TOP <text>{{item.group_rank}}</text></view></view> 
               <view class="info">
                 日期: <view>{{item.stock_date}}(收益 
-                <text  class="{{item.today_income<0 ?'down':'up'}}">{{item.today_income}}%</text>)</view>
+                <text  class="{{item.today_income[0]=='-' ?'down':'up'}}">{{item.today_income}}</text>)</view>
               </view>
               <view class="info">
                 资产:  <view><label>{{item.today_fund}}w</label> (收益 
-                <text  class="{{item.total_income<0 ?'down':'up'}}">{{item.total_income}}%</text>)</view>
+                <text  class="{{item.total_income[0]=='-' ?'down':'up'}}">{{item.total_income}}</text>)</view>
               </view>
               <view class="info">
                 持仓: <view>
@@ -64,7 +64,7 @@
                         <view class="gp-name">{{item.stock_name}}</view>
                         <view class="num">持仓 <text>{{item.count}}</text> 人</view>
                     </navigator>
-                    <navigator class="more">查看更多 <image mode="widthFix" src="../../images/right_icon.png"></image></navigator>
+                    <navigator url="../stock/stock"  class="more">查看更多 <image mode="widthFix" src="../../images/right_icon.png"></image></navigator>
               </view>
               <view class="hot">
                     <view class="tab2">热门清仓</view>
@@ -89,17 +89,19 @@
                 <image wx:if='{{index==2}}' mode="widthFix" src="../../images/3.png"></image>
                 <text class="rank" wx:if='{{index>2}}'>{{index+1}}</text>
                 <view class="name">
-                  {{item.username}}  <text>选手</text>
-                  <view>胜率 <text>{{item.win_rate}}%</text></view>
+                  {{item.username}}  <text>{{item.badge}}</text>
+                  <view>胜率 
+                    <text class="{{item.win_rate[0]=='-' ?'down':'up'}}">{{item.win_rate}}</text>
+                  </view>
                 </view>
                 <view class="info">风格:
                 <label class="tag" wx:for='{{item.style}}' wx:for-item='i'>{{i}}</label></view>
                 <view class="info">
                     资产:  
-                    <view><label>{{item.total_income}}w</label> (总收益 <text class='up'> +8% </text> 
+                    <view><label>{{item.init_fund}}w</label> (总收益 <text class='up'> {{item.total_income}} </text> 
                       <text style="color:#F5F5F5;">  |  </text>
                       <text style="font-weight:500;color:#666;">最大回撤</text>
-                      <text class='down'> {{badest_income}}% </text>)
+                      <text class="{{item.badest_income[0]=='-' ?'down':'up'}}"> {{item.badest_income}} </text>)
                   </view>
                 </view>
              </navigator>
@@ -115,18 +117,19 @@
                 <image wx:if='{{index==2}}' mode="widthFix" src="../../images/3.png"></image>
                 <text class="rank" wx:if='{{index>2}}'>{{index+1}}</text>
                 <view class="name">
-                  {{item.username}}  <text>选手</text>
-                  <view>最大回撤  <text>{{item.badest_income}}%</text></view>
+                  {{item.username}}  <text>{{item.badge}}</text>
+                  <view>最大回撤  
+                  <text class="{{item.badest_income[0]=='-' ?'down':'up'}}">{{item.badest_income}}</text></view>
                 </view>
                 <view class="info">风格:
                 <label class="tag" wx:for='{{item.style}}' wx:for-item='i'>{{i}}</label></view>
                 <view class="info">
                     资产:  
-                    <view><label>{{item.total_income}}w</label> 
-                    (总收益 <text class='up'> +8% </text> 
+                    <view><label>{{item.init_fund}}w</label> 
+                    (总收益 <text class="{{item.total_income[0]=='-' ?'down':'up'}}">{{item.total_income}}</text> 
                       <text style="color:#F5F5F5;">  |  </text>
                       胜率
-                      <text class='down'> -8% </text>
+                      <text class="{{item.win_rate[0]=='-' ?'down':'up'}}">{{item.win_rate}}</text> 
                   </view>
                 </view>
             </navigator>

+ 1 - 1
pages/list/list.wxml

@@ -25,7 +25,7 @@
         <text style="width:36rpx;text-align:center;color:#CE994F;" wx:if='{{item.group_rank>3}}'>{{item.group_rank}}</text>
         <text class="name">{{item.username}}</text>
         <text>{{item.today_fund}}w</text>
-        <text  class="{{item.today_income<0?'down':'up'}}">{{item.today_income}}</text>
+        <text  class="{{item.today_income[0]=='-'?'down':'up'}}">{{item.today_income}}</text>
         <text  class="{{item.total_income[0]=='-'?'down':'up'}}">{{item.total_income}}</text>
         
     </navigator>

+ 8 - 1
pages/mymatch/mymatch.js

@@ -13,7 +13,14 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    
+    wx.getStorage({
+      key: 'userInfo',
+      success: res=> {
+        this.setData({
+          player_id: res.data.id
+        })
+      },
+    })
     $api.getMyMatch().then(res => {
       this.setData({
         list: res.data.data

+ 6 - 1
pages/rank/rank.js

@@ -35,7 +35,12 @@ Page({
       wx.hideNavigationBarLoading()
     })
   },
-
+  bindDateChange(e) {
+    this.setData({
+      date: e.detail.value
+    })
+    // this.getData()
+  },
 
 
 

+ 9 - 3
pages/rank/rank.wxml

@@ -1,7 +1,13 @@
 <view class="_top">
   <navigator url="../search/search"><image class="search" mode="heightFix" src="../../images/ss.png"></image></navigator>
-  {{date}}
-  <image  mode="heightFix"  src="../../images/icon_rise@2x.png"></image>
+  <!-- {{date}} -->
+  <picker mode="date" value="{{date}}"  bindchange="bindDateChange">
+                <view class="date-picker">
+                   {{date}}
+                   <image  mode="heightFix"  src="../../images/icon_rise@2x.png"></image>
+                </view>
+  </picker>
+  
 </view>
 
 <view class="game_info" wx:if='{{datas.match.name}}'>
@@ -16,7 +22,7 @@
 </view>
 <view class="list" wx:for="{{datas.groups}}" >
     <view class="title">
-        {{item.name}} <text>(5人)</text>
+        {{item.name}} <text>({{item.players_num}}人)</text>
         <navigator url="../list/list?id={{item.id}}">
           查看更多  <image mode="widthFix" src="../../images/right_icon.png"></image>
         </navigator>

+ 3 - 0
pages/rank/rank.wxss

@@ -135,4 +135,7 @@ page{
   position: absolute;
   right: 30rpx;
   top: 30rpx;
+}
+.date-picker{
+  color: #fff;
 }

+ 0 - 1
pages/record/record.js

@@ -13,7 +13,6 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    options.id = 29014
     $api.getRecord({ id: options.id}).then(res=>{
       this.setData({
         info:res.data.data

+ 30 - 6
pages/stock/stock.js

@@ -6,19 +6,43 @@ Page({
    * 页面的初始数据
    */
   data: {
-
+    name:'',
+    id:''
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    $api.getStock({ id: options.id}).then(res=>{
-      this.setData({
-        info:res.data.data
+    
+    if (options.id){
+      this.setData({id:options.id})
+      $api.getStock({ id: options.id}).then(res=>{
+            this.setData({
+              info:res.data.data
+            })
+            wx.setNavigationBarTitle({
+              title: res.data.data.name,
+            })
       })
-      wx.setNavigationBarTitle({
-        title: res.data.data.name,
+    }else{
+      this.getData()
+    }
+    
+  },
+  inputChange(e) {
+    this.setData({
+      name: e.detail.value
+    })
+    this.getData()
+  },
+  search() {
+    this.getData()
+  },
+  getData(){
+    $api.searchStock({ name: this.data.name}).then(res=>{
+      this.setData({
+        list:res.data.data
       })
     })
   },

+ 18 - 6
pages/stock/stock.wxml

@@ -1,11 +1,18 @@
 <!--pages/stock/stock.wxml-->
-<image mode="withFix" src="{{info.img}}"></image>
-<view class="desc">{{info.desc}}</view>
-<view class="player" wx:for='{{info.list}}'>
-    <view class="name">{{item.username}}  <text>选手</text> 
-    <view>TOP <text>{{item.match_group}}</text></view></view> 
+<view class="search" wx:if='{{!id}}'>
+    <image mode="heightFix" src="../../images/ss1.png"></image>
+    <input bindinput="inputChange" placeholder-style="color:#999;" placeholder=""></input>
+    <text bindtap="search">搜索</text>
+</view>
+
+<view wx:if='{{id}}'>
+  <image mode="withFix" src="{{info.img}}"></image>
+  <view class="desc">{{info.desc}}</view>
+  <view class="player" wx:for='{{info.list}}'>
+    <view class="name">{{item.username}}  <text>{{item.badge}}</text> 
+    <view>TOP <text>{{item.group_rank}}</text></view></view> 
     <view class="info">
-                资产:<view><label>{{item.today_fund}}w</label>(今日收益 <text  class="{{item.today_income<0 ?'down':'up'}}">{{item.today_income}}%</text><text style="color:#F5F5F5;">  |  </text>总收益<text  class="{{item.total_income<0 ?'down':'up'}}">{{item.total_income}}%</text>)</view>
+                资产:<view><label>{{item.today_fund}}w</label>(今日收益 <text  class="{{item.today_income[0]=='-' ?'down':'up'}}">{{item.today_income}}</text><text style="color:#F5F5F5;">  |  </text>总收益<text  class="{{item.total_income[0]=='-' ?'down':'up'}}">{{item.total_income}}</text>)</view>
     </view>
     <view class="info">
                 持仓: <view>
@@ -15,3 +22,8 @@
                 </view>
     </view>
   </view>
+</view>
+
+<view wx:else>
+    <navigator class="list" url="../stock/stock?id={{item.id}}" wx:for='{{list}}'>{{item.label}}</navigator>
+</view>

+ 30 - 0
pages/stock/stock.wxss

@@ -75,4 +75,34 @@ image{
   color: #CE994F;
   position: relative;
   top: -8rpx;
+}
+.search{
+  position: relative;
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 20rpx;
+}
+.search input{
+  width: 88%;
+  background: #F7F7F7;
+  height: 68rpx;
+  padding-left: 70rpx;
+  border-radius: 8rpx;
+  box-sizing: border-box;
+  font-size: 30rpx;
+}
+.search text{
+  font-size: 30rpx;
+  line-height: 68rpx;
+}
+.search image{
+  position: absolute;
+  height: 40rpx;
+  left: 20rpx;
+  top: 0;
+  bottom: 0;
+  margin: auto;
+}
+.list{
+  padding: 20rpx 0;
 }

+ 5 - 3
pages/today/today.wxml

@@ -1,12 +1,14 @@
 
 <view class="player">
-      <view class="name">{{datas.today_record.username}}  <text>选手</text>
+      <view class="name">{{datas.today_record.username}}  <text>{{datas.today_record.badge}}</text>
       <view style="width:140rpx;" wx:if='{{is_follow}}' data-action='cancel' bindtap="followPlayer">取消关注</view>
       <view wx:else  bindtap="followPlayer">+关注</view></view>  
       <view class="infos">
-          <view class="info">风格:<label class="tag">短线</label><label class="tag">重仓</label></view>
+          <view class="info">风格:
+          <label wx:for='{{datas.today_record.style}}' class="tag">{{item}}</label>
+          </view>
           <view class="info">
-                  排名: <view>{{datas.today_record.group_rank}}/54 
+                  排名: <view>{{datas.today_record.group_rank}}/{{datas.today_record.players_num}}
                   ({{datas.today_record.match_group_name}})</view>
           </view>
           <view class="info">

+ 2 - 0
utils/api.js

@@ -120,6 +120,8 @@ const API = {
   getCurrecord: (data) => request(GET, `/api/wx/player/currecord`, data),
   getArticle: (data) => request(GET, `/api/wx/article`, data),
   getStock: (data) => request(GET, `/api/wx/v2/stock`, data),
+  searchStock: (data) => request(GET, `/api/wx/stock/search`, data),
+  
 
 }; 
 module.exports = {