Kaynağa Gözat

比赛详情页面修改

begmoon 1 yıl önce
ebeveyn
işleme
3d2760732d

BIN
pages/.DS_Store


+ 7 - 3
pages/list/list.js

@@ -11,9 +11,9 @@ Page({
     total:0,
     order1:1,
     order2: 1,
-    order_by:'',
+    order_by:'total_income__desc',
     list:[],
-    date:''
+    date:'',
   },
 
   /**
@@ -36,11 +36,15 @@ Page({
     }
     
     const list = this.data.list;
+    const count = list.length;
+
     wx.showNavigationBarLoading();
     $api.getRankList(data).then(res=>{
           const players = res.data.data.players;
           for (let i = 0; i < players.length; i++) {
-            list.push(players[i])
+            let player = players[i]
+            player.rank = count+i+1
+            list.push(player)
           }
           this.setData({
             group: res.data.data.group,

+ 8 - 0
pages/list/list.wxml

@@ -19,10 +19,18 @@
 </view>
 <scroll-view scroll-y="true" class="list" bindscrolltolower='next'>
     <navigator hover-class="none" class="item" wx:for='{{list}}'  url="../today/today?id={{item.match_id}}&record_id={{item.id}}&user_id={{item.user_id}}">
+        <view wx:if="{{order_by == 'total_income__desc'}}">
         <image wx:if='{{item.group_rank==1}}' mode="widthFix" src="../../images/1.png"></image>
         <image wx:if='{{item.group_rank==2}}' mode="widthFix" src="../../images/2.png"></image>
         <image wx:if='{{item.group_rank==3}}' mode="widthFix" src="../../images/3.png"></image>
         <text style="width:36rpx;text-align:center;color:#CE994F;" wx:if='{{item.group_rank>3}}'>{{item.group_rank}}</text>
+        </view>
+        <view wx:else>
+          <image wx:if='{{item.rank==1}}' mode="widthFix" src="../../images/1.png"></image>
+          <image wx:if='{{item.rank==2}}' mode="widthFix" src="../../images/2.png"></image>
+          <image wx:if='{{item.rank==3}}' mode="widthFix" src="../../images/3.png"></image>
+          <text style="width:36rpx;text-align:center;color:#CE994F;" wx:if='{{item.rank>3}}'>{{item.rank}}</text>
+        </view>
         <text class="name">{{item.username}}</text>
         <text>{{item.today_fund}}w</text>
         <text  class="{{item.today_income[0]=='-'?'down':'up'}}">{{item.today_income}}</text>

+ 24 - 0
pages/matchdetail/matchdetail.js

@@ -11,6 +11,7 @@ Page({
    */
   data: {
     datas:{},
+    total_money:0,
     user_id:'',
     match_id:'',
     date:'',
@@ -94,8 +95,10 @@ Page({
       records       = res.data.data.records
       today_stock   = res.data.data.today_record.today_stock
       console.log(records,2323)
+      let tmoney = ((res.data.data.today_record.today_fund - res.data.data.today_record.init_fund)*10000).toFixed(0)
       this.setData({
         datas: res.data.data,
+        total_money:tmoney,
         date: stock_date[0] + '-' + stock_date[1],
         ec: {
           onInit: initChart
@@ -104,9 +107,26 @@ Page({
         //   onInit: initChart1
         // }
       })
+
     
       this.getDays()
       wx.hideNavigationBarLoading()
+      wx.setNavigationBarTitle({
+        title: res.data.data.userinfo.username,
+      })
+      if(this.data.total_money >= 0){
+        wx.setNavigationBarColor({
+          backgroundColor: '#D94B24',
+          frontColor: '#ffffff',
+        })
+      } else{
+        wx.setNavigationBarColor({
+          backgroundColor: '#07B20B',
+          frontColor: '#ffffff',
+        })
+      }
+      
+
     })
     .catch(err=>{
       wx.hideNavigationBarLoading()
@@ -114,6 +134,10 @@ Page({
     
   },
 
+  toThousandFilter(num) {
+    return (+num || 0).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ','))
+  },
+
   getDays(){
     $api.getCalendar({
       user_id:this.data.user_id,

+ 9 - 7
pages/matchdetail/matchdetail.wxml

@@ -1,6 +1,13 @@
 <!--pages/matchdetail/matchdetail.wxml-->
-<view class="title">
-    {{datas.match.name}}
+
+<view class="{{total_money[0]=='-' ?'head_loss':'head'}}">
+  <view class="head_title">{{datas.match.name}}</view>
+  <view class="head_bsyk">比赛盈亏</view>
+  <view class="head_money">{{total_money}}</view>
+  <view class="head_ratio" >
+    收益: <label>{{datas.today_record.total_income}}</label>
+    排名: <label>第{{datas.today_record.group_rank}}名</label>
+  </view>
 </view>
 <view class="style" style="margin: 0;">
   <view>
@@ -15,11 +22,6 @@
   <view>
     结束资产: {{datas.today_record.today_fund}}w
   </view>
-  <view class="match_ratio">
-    总收益<label class="{{datas.today_record.total_income[0]=='-' ?'down':'up'}}">{{datas.today_record.total_income}}</label>
-    胜率<label class="{{datas.today_record.total_income[0]=='-' ?'down':'up'}}">{{datas.today_record.win_rate}}</label>
-    排名<label class="{{datas.today_record.total_income[0]=='-' ?'down':'up'}}">{{datas.today_record.group_rank}}</label>
-  </view>
 </view>
 <view wx:if='{{datas.records.length>1}}'>
   <view class="title">收益曲线</view>

+ 44 - 0
pages/matchdetail/matchdetail.wxss

@@ -324,3 +324,47 @@ picker{
   color: #07B20B !important;
   margin-left: 5rpx;
 }
+
+.head{
+  background-color: #D94B24;
+  height: 360rpx;
+}
+
+.head_loss{
+  background-color: #07B20B;
+  height: 360rpx;
+}
+
+.head view{
+  color: #fff;
+  text-align: center;
+  /* font-size: 28rpx; */
+}
+
+.head_loss view{
+  color: #fff;
+  text-align: center;
+  /* font-size: 28rpx; */
+}
+
+
+
+.head_title{
+  font-size: 38rpx;
+  padding-top: 30rpx;
+}
+
+.head_bsyk{
+  font-size: 26rpx;
+  padding-top: 40rpx;
+}
+
+.head_money{
+  font-size: 58rpx;
+  padding-top: 5rpx;
+}
+
+.head_ratio{
+  font-size: 30rpx;
+  padding-top: 50rpx;
+}

+ 19 - 5
pages/rank/rank.js

@@ -10,7 +10,9 @@ Page({
     date:'',
     match:[],
     index:0,
-    match_id:''
+    match_id:'',
+    match_day:0,
+    matchData:{},
   },
 
   /**
@@ -28,30 +30,41 @@ Page({
       this.setData({
         match:res.data.data,
         index: 0,
-        match_id: res.data.data[0].id
+        match_id: res.data.data[0].id,
+        matchData:res.data.data[0],
       })
       this.getDate()
     })
     
+
   },
   getDate(){
     $api.getDate({ match_id: this.data.match_id }).then(res => {
+
       this.setData({
-        date: res.data.data
+        date: res.data.data,
       })
+
+
       this.getData()
     })
   },
   getData() {
     wx.showNavigationBarLoading()
+    
+    let day = this.data.matchData.valid_dates.indexOf(this.data.date)
+    this.setData({
+      match_day:day
+    })
+
     if (!this.data.match_id){
       return
     }
     $api.getRank({ stock_date: this.data.date, match_id: this.data.match_id}).then(res => {
         wx.hideNavigationBarLoading()
+        
         this.setData({
           datas:res.data.data,
-          
         })
     })
     .catch(err=>{
@@ -62,7 +75,8 @@ Page({
     let match=this.data.match;
     this.setData({
       index: e.detail.value,
-      match_id: match[e.detail.value].id
+      match_id: match[e.detail.value].id,
+      matchData:match[e.detail.value],
     })
     this.getDate()
   },

+ 5 - 3
pages/rank/rank.wxml

@@ -34,7 +34,9 @@
     <!-- {{datas.match.start_time}}至{{datas.match.end_time}} -->
     <picker mode="date" value="{{date}}"  bindchange="bindDateChange">
                 <view class="date-picker">
-                   {{date}}
+                   {{date}}<label wx:if="{{match_day >= 0}}">(开赛{{match_day}}天)</label>
+                   <label wx:else>(休)</label>
+
                    <image style="width:24rpx;" mode="widthFix" src="../../images/icon_down@2x.png"></image>
                 </view>
     </picker>
@@ -49,7 +51,7 @@
         {{item.name}} 
         <!-- <text>({{item.players_num}}人)</text> -->
         <navigator hover-class="none" url="../list/list?id={{item.id}}&stock_date={{date}}">
-          查看全部  <image mode="widthFix" src="../../images/right_icon.png"></image>
+          查看全部<image mode="widthFix" src="../../images/right_icon.png"></image>
         </navigator>
     </view> 
     <navigator hover-class="none" class="item" wx:for='{{item.players}}' 
@@ -63,7 +65,7 @@
         <text  class="{{player.total_income[0]=='-'?'down':'up'}}">{{player.total_income}}</text>
     </navigator>
     <view style="padding:10rpx 30rpx;position: relative;">
-      <text class="note">日盈利<text class="up">5%</text>以上{{item.win_count}}人,日亏损<text class="down">5%</text>以上{{item.loss_count}}人</text>
+      <text class="note">日盈利<text class="up">9%</text>以上{{item.win_count}}人,日亏损<text class="down">9%</text>以上{{item.loss_count}}人</text>
       <!-- <navigator hover-class="none" url="../comment/comment?id={{item.id}}" class="assess">顽主点评</navigator> -->
         <!-- <text class="note">点击选手,查看每日持股与交割单...</text> -->
     </view>

+ 1 - 1
pages/rank/rank.wxss

@@ -170,7 +170,7 @@ page{
   font-size: 36rpx;
   font-weight: 500;
   padding-left: 20rpx;
-  padding-right: 40rpx;
+  padding-right: 20rpx;
   margin-bottom: 20rpx;
 }
 .title text{

+ 3 - 2
pages/today/today.js

@@ -336,7 +336,7 @@ function initChart(canvas, width, height, dpr) {
       tooltip: {
         show: true,
         trigger: 'axis',
-        formatter: '{b0}: {c0}%'
+        formatter: '{b0}: {c0}%',
       },
       xAxis: {
         type: 'category',
@@ -350,11 +350,12 @@ function initChart(canvas, width, height, dpr) {
       },
       yAxis: {
         axisLine: {
-          show: true
+          show: true,
         },
         type: 'value',
         // name: '收益曲线',
         axisLabel: {
+          color: '#999999',
           formatter: function (value, index) {//隐藏 0
             let texts = [];
             texts.push(value + '%')

+ 12 - 1
pages/today/today.wxml

@@ -59,7 +59,14 @@
                  class="img" src="{{i}}"></image>
 </view>
 <view wx:if='{{datas.records.length>1}}'>
-  <view class="title">收益曲线</view>
+  <view class="quxian">
+    <label class="quxian_title">收益曲线</label>
+    <navigator class="match_info" url="../matchdetail/matchdetail?user_id={{user_id}}&match_id={{datas.match.id}}">详情
+      <image class="more" mode="widthFix" src="../../images/right_icon.png">
+      </image>
+    </navigator>
+  </view>
+  
 </view>
 
 <view class="content">
@@ -67,6 +74,7 @@
           <ec-canvas   ec="{{ ec }}">
           </ec-canvas>
     </view>
+    
 </view>
 
 <view class="content">
@@ -99,6 +107,9 @@
       </navigator>
     </view>
   </view>
+  <view class="calendar" >
+      点击具体日期可查看当日持仓
+  </view>
 </view>
 
 <view class="title">今日反思</view>

+ 31 - 0
pages/today/today.wxss

@@ -436,6 +436,37 @@ picker{
   color: #b1b1b1;
   font-size: 24rpx;
 }
+
+.quxian{
+  position: relative;
+  height: 50rpx;
+}
+
+.quxian_title{
+  font-weight: 500;
+  font-size: 30rpx;
+  padding-left: 20rpx;
+}
+
+.match_info{
+  font-size: 28rpx;
+  position: absolute;
+  right: 24rpx;
+  top: 10rpx;
+}
+
+.more{
+  width: 32rpx;
+  position: relative;
+  top: 5rpx;
+}
+
+.calendar{
+  font-size: 24rpx;
+  color: #999;
+  text-align: center;
+}
+
 @keyframes good
 {
     0% {