tanyanfei 7 months ago
parent
commit
7e1631e402

+ 3 - 0
app.json

@@ -1,5 +1,6 @@
 {
   "pages": [
+    
     "pages/index/index",
     "pages/rank/rank",
     "pages/upload/upload",
@@ -36,7 +37,9 @@
     "pages/winlost/winlost",
     "pages/article/article",
     "pages/matchdetail/matchdetail",
+    "pages/winloseRank/winloseRank",
     "pages/avg/avg"
+    
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 14 - 3
pages/avg/avg.js

@@ -10,7 +10,7 @@ Page({
    * 页面的初始数据
    */
   data: {
-    tab:['冠军组','千万组','百万组'],
+    tab:['全体选手','冠军组','千万组','百万组'],
     list:[],
     cur:0,
     match_name:'',
@@ -26,13 +26,16 @@ Page({
    */
   onLoad(options) {
     let nlist = JSON.parse(decodeURIComponent(options.list))
+    nlist.unshift(nlist[0])
+    // nlist[0].name='全体选手'
+    console.log(nlist)
     this.setData({
       cur:options.index,
       list:nlist,
       match_name:nlist[0].match_name,
     })
 
-    if(options.index == -1){
+    if(options.index == 0){
       this.loadAvg()
     } else{
       this.loadGroupAvg()
@@ -85,7 +88,6 @@ Page({
     var param = {
       match_id:group.match_id,
     }
-
     $api.getAvg(param).then(res => {
       if(res.data.code == 0){
         records = res.data.data.list
@@ -121,6 +123,15 @@ Page({
     this.setData({
       cur:e.target.dataset.id
     })
+    this.setData({
+      ec:null,
+      days:[]
+    })
+    if(e.target.dataset.id == 0){
+      this.loadAvg()
+    } else{
+      this.loadGroupAvg()
+    }
   },
 
   /**

+ 3 - 1
pages/avg/avg.wxml

@@ -4,7 +4,9 @@
 </view>
 
 <view wx:if="{{cur >= 0}}" class="tab">
-    <view wx:for='{{list}}' bindtap="tabChange" data-id='{{index}}' class="{{index==cur?'act':''}}">{{item.name}}</view>
+    <view wx:for='{{list}}' bindtap="tabChange" data-id='{{index}}' class="{{index==cur?'act':''}}">
+    {{index==0 ? '全体选手':item.name}}
+   </view>
 </view>
 
 <view class="content">

+ 1 - 1
pages/avg/avg.wxss

@@ -21,7 +21,7 @@
   
 }
 .tab view{
-  font-size: 32rpx;
+  font-size: 28rpx;
   color: #333;
   line-height: 80rpx;
   transition: all .1s linear;

+ 1 - 1
pages/baike/baike.wxss

@@ -37,7 +37,7 @@
   color: #333;
   line-height: 80rpx;
   transition: all .1s linear;
-  margin-right: 30rpx;
+  /* margin-right: 30rpx; */
   font-weight: 500;
 }
 .tab .act{

+ 38 - 2
pages/index/index.js

@@ -60,6 +60,7 @@ Page({
   },
   // 获取首页数据
   getIndexData:function(){
+    
     $api.getChampionlList({isbanner:1}).then(res=>{
       console.log(res)
       this.setData({
@@ -72,7 +73,42 @@ Page({
         winLost:res.data.data[0],
         match_day:day,
       })
-      
+      $api.getAvg({match_id:res.data.data[0].match_id}).then(res=>{
+        var week=['一','二','三','四','五','六','七','八','九','十','十一','十二','十三','十四','十五']
+        var days=res.data.data.list,weeks=[[]]
+        days=days.reverse()
+        week.forEach((item,index)=>{
+          weeks[index]={
+            name:'第'+item+'周',
+            data:[],
+            total:0
+          }
+        })
+        var i=0
+        days.forEach(item=>{
+          var w=new Date(item.stock_date).getDay() 
+          item.day=w
+          if(w==1){
+            i++
+          }
+          weeks[i].data.push(item)
+        })
+        weeks.forEach(item=>{
+          if(item.data.length>0){
+            var total=0
+            item.data.forEach(i=>{
+              var incom=Number(i.today_income.replace('%',''))
+              total+=incom
+              i.date=(new Date(i.stock_date).getMonth()+1)+'/'+(new Date(i.stock_date).getDate())
+            })
+            item.total=total.toFixed(2)
+          }
+        })
+        console.log(2333,days)
+        this.setData({
+          days:weeks.reverse()
+        })
+      })
       $api.getWinLose({match_id:res.data.data[0].match_id}).then(res1=>{
           this.setData({
             groups:res1.data.data
@@ -184,7 +220,7 @@ tapGroup(e){
 
 tapAvg(e){
   wx.navigateTo({
-    url: '../avg/avg?index=-1' + '&list=' + encodeURIComponent(JSON.stringify(this.data.groups.group_win_lose_list)),
+    url: '../avg/avg?index=0' + '&list=' + encodeURIComponent(JSON.stringify(this.data.groups.group_win_lose_list)),
   })
 },
   //预览

+ 42 - 14
pages/index/index.wxml

@@ -81,33 +81,61 @@
         <navigator hover-class="none" url="../detail/detail?id={{item.id}}" wx:for="{{notices}}">{{item.name}}</navigator>
   </view>
 </view>
-
-<view class="up-down-view">
-  <view class="up-title">
-        {{winLost.match_name}}<label wx:if="{{match_day >= 0}}">开赛第{{match_day}}天</label>
-        <navigator url="../winlost/winlost">历届<image class="more-image" mode="widthFix" src="../../images/right_icon.png"></image></navigator>
+<view class="up-down-view" style="padding: 0 25rpx;">
+  <view class="article-title" style="padding: 20rpx 0;"> 
+      <navigator url="">每天
+      <image class="more-image" mode="widthFix" src="../../images/right_icon.png"></image>
+      </navigator>
+      短线盈亏效应
   </view>
-  <scroll-view style="height: 200rpx;" scroll-x='{{true}}' wx:if='{{groups}}'>
-    <view class="group_list">
-      <view wx:for='{{groups.group_win_lose_list}}' class="g_list"  data-index='{{index}}' bind:tap="tapGroup">
+    <view class="group_list" wx:if='{{groups.today_win_lose_avg}}'>
+      <view class="g_list"  data-index='0'  bind:tap="tapGroup">
+        <image mode="widthFix" wx:if="{{groups.today_win_lose_avg[0]=='-'}}" src="../../images/indexlose@2x.png"></image>
+        <image mode="widthFix" wx:else src="../../images/indexwin@2x.png"></image>
+        <view>全体选手</view>
+        <text class="fund {{groups.today_win_lose_avg[0]=='-' ?'down':'up'}}">{{filters.toFix2(groups.total_fund)}}</text>
+        <text class="{{groups.today_win_lose_avg[0]=='-' ?'down':'up'}}">{{groups.today_win_lose_avg}}</text>
+      </view>
+      <view wx:for='{{groups.group_win_lose_list}}' class="g_list"  data-index='{{index+1}}' bind:tap="tapGroup">
         <image mode="widthFix" wx:if="{{item.today_income_avg[0]=='-'}}" src="../../images/indexlose@2x.png"></image>
         <image mode="widthFix" wx:else src="../../images/indexwin@2x.png"></image>
         <view>{{item.name}}</view>
         <text class="fund {{item.today_income_avg[0]=='-' ?'down':'up'}}">{{item.today_fund}}</text>
-        
         <text class="{{item.today_income_avg[0]=='-' ?'down':'up'}}">{{item.today_income_avg}}</text>
-       
       </view>
-      
     </view>
-  </scroll-view>
-  <view class="today">
+</view>
+<view class="up-down-view" style="padding: 25rpx;">
+  <view class="article-title" > 选手人均盈亏</view>
+  <view wx:if='{{days.length>0}}' class=" ">
+      <view wx:for='{{days}}' wx:if='{{item.data.length>0}}' class="yk">
+        <view class="week_name">{{item.name}}</view>
+        <view class="week_incom">
+          <view wx:for='{{item.data}}' wx:for-item='week' class="{{week.today_income=='0.0%' ?'none':''}} {{week.today_income[0]=='-' ?'down':'up'}}">
+            {{week.date}}
+            <text>{{week.today_income}}</text>
+        </view>
+        </view>
+        <view class="week_total">
+          周收益
+          <text class="{{item.total < 0 ?'down':'up'}}">{{item.total}}%</text>
+        </view>
+      </view>
+  </view>
+</view>
+
+<view class="up-down-view" style="padding: 0 25rpx;">
+  <view class="today" wx:if='{{0}}'>
     今日盈亏人数比 <text class="up" style="font-weight: 500;">{{groups.win_cnt}}</text> : <text class="down" style="font-weight: 500;">{{groups.lose_cnt}} </text>
     今日人均收益(算数平均)  
     <!-- <text class="{{groups.today_win_lose_avg[0]=='-' ?'down':'up'}}" style="font-weight: 500;">{{groups.today_win_lose_avg}}</text> -->
     <text class="{{groups.today_win_lose_avg[0]=='-' ?'down':'up'}}" style="font-weight: 500;text-decoration: underline;" bind:tap="tapAvg">{{groups.today_win_lose_avg}}</text>
   </view>
-
+  <view class="up-title">
+        {{winLost.match_name}}<label wx:if="{{match_day >= 0}}">开赛第{{match_day}}天</label>
+        <navigator url="../winlost/winlost">历届<image class="more-image" mode="widthFix" src="../../images/right_icon.png"></image></navigator>
+        <view style="color: #999;font-size: 24rpx;margin-top: 5px;">比赛日期:{{winLost.start_time}}至{{winLost.end_time}}</view>
+  </view>
   <view class="tab">
     <view wx:for='{{tabs1}}' bindtap="tabChange1" data-id='{{index}}' class="{{index==cur1?'act':''}}">{{item}}</view>
 </view>

+ 57 - 6
pages/index/index.wxss

@@ -30,16 +30,17 @@ page{
   margin: 0 auto 5rpx;
 }
 .banner-list{
-  height: 480rpx;
+  height: calc(100vw / 1.77 + 45px);
   background-color: #fff;
   margin-bottom: 20rpx;
 }
 .banner-list navigator{
-  height: 400rpx;
+  height: calc(100vw / 1.77);
   overflow: hidden;
 }
 .banner-list image{
   width: 100%;
+  height: 100% !important;
 }
 .banner-list .name{
   padding:0 20rpx;
@@ -237,7 +238,7 @@ image.number{
 }
 .tab{
   background: #fff;
-  margin-top: 16rpx;
+  /* margin-top: 16rpx; */
   padding:0 20rpx;
   display: flex;
   border-bottom: 1px solid #f2f2f2;
@@ -611,24 +612,28 @@ scroll-view{
 .group_list{
   display: flex;
   width: 100%;
+  flex-wrap: wrap;
+  justify-content: space-between;
 }
 .g_list{
   position: relative;
   text-align: center;
   padding: 10rpx 40rpx;
-  margin-right: 15rpx;
+  /* margin-right: 15rpx; */
+  width: 30%;
+  margin-bottom: 15px;
 }
 .g_list text{
   display: block;
   position: relative;
   z-index: 9;
-  font-size: 28rpx;
+  font-size: 26rpx;
   font-weight: 500;
 }
 .g_list view{
   position: relative;
   z-index: 9;
-  font-size: 32rpx;
+  font-size: 30rpx;
   font-weight: 500;
   margin-top: 10rpx;
 }
@@ -653,4 +658,50 @@ scroll-view{
   font-size: 30rpx;
   text-decoration: underline;
   display: inline;
+}
+
+.yk_list{
+  margin-top: 20rpx;
+}
+
+.yk{
+  display: flex;
+  justify-content: space-between;
+  font-size: 20rpx;
+}
+.week_name{
+  width: 15%;
+  padding: 10px 0;
+  font-size: 24rpx;
+}
+.week_total{
+  width: 15%;
+  text-align: center;
+  padding: 10rpx 0;
+}
+.week_incom{
+  width: 70%;
+  display: flex;
+}
+.week_incom>view{
+  padding: 10rpx 0;
+  width: 100rpx;
+  text-align: center;
+  /* border: 1px solid red; */
+}
+.week_incom text{
+  display: block;
+  color: #fff;
+}
+.week_incom .down{
+  background-color: #E90001;
+  color: #fff !important;
+}
+.week_incom .up{
+  background-color: #07B20B;
+  color: #fff !important;
+}
+.week_incom .none{
+  background-color: #d7d7d7;
+  /* color: #fff !important; */
 }

+ 5 - 3
pages/stock/stock.wxml

@@ -86,10 +86,12 @@
           <image wx:if="{{index<3}}" class="number" mode="widthFix" src="../../xiao/{{index+1}}.png"></image>
           <text wx:else class="number">{{index+1}}</text>
           <view class="stock-name">
-            {{item.stock_name}}
-            <text>持仓金额:{{filters.toFix2(item.total_fund)}}w</text>
+            {{item.stock_name}} <text class="cc">{{filters.toFix2(item.total_fund)}}w</text>
+            <text class="code">6000000 飞行汽车</text>
           </view>
-        <view class="num"> <text>{{item.count}}</text> 人持仓</view>
+        <view class="num"> <text>{{item.count}}</text> 人持仓 
+          <image class="more-image" mode="widthFix" src="../../images/right_icon.png"></image>
+        </view>
       
         </navigator>
         <block wx:if='{{total >= 20}}'>

+ 17 - 2
pages/stock/stock.wxss

@@ -171,18 +171,22 @@ image.number{
   justify-content: space-between;
 }
 .stock-name{
-  width: 70%;
+  width: 65%;
 }
-.stock-name text{
+.stock-name .code{
   display: block;
   font-size: 24rpx;
   color: #666;
+  padding-top: 5rpx;
 }
 .num{
   font-size: 28rpx;
   color: #666;
   text-align: right;
   float: right;
+  margin-top: 20rpx;
+  position: relative;
+  padding-right: 40rpx;
 }
 .num text{
   font-size: 30rpx;
@@ -197,6 +201,10 @@ image.number{
   background: #fff;
   position: relative;
 }
+.cc{
+  color: #E90001;
+  font-size: 24rpx;
+}
 .stock_name text{
   color: #999;
   font-weight: 400;
@@ -337,4 +345,11 @@ image.number{
   font-weight: 400;
   text-align: center;
   border-radius: 8rpx;
+}
+
+.more-image{
+  width: 32rpx;
+  position: absolute;
+  top:10rpx;
+  right: 0;
 }

+ 4 - 1
pages/today/today.js

@@ -411,8 +411,11 @@ function initChart1(canvas, width, height, dpr) {
     devicePixelRatio: dpr // new
   });
   canvas.setChart(chart);
+  console.log(today_stock)
   today_stock.forEach(item=>{
-    item.value = item.fund
+    if(item.fund != '0.0'){
+      item.value = item.fund
+    }
   })
   var radius = today_stock.length<9?'65%':'50%';
   var option = {

+ 7 - 1
pages/today/today.wxml

@@ -60,7 +60,13 @@
   </view>
 </view>
 
-<view class="title">持仓图<text class="des">(除持仓图外,欢迎选手上传买卖点神图)</text></view>
+<view class="title">持仓图<text class="des">(除持仓图外,欢迎选手上传买卖点神图)</text>
+  <navigator style="font-size: 24rpx;text-decoration: underline;color: #333;" url="../winloseRank/winloseRank?user_id={{user_id}}&match_id={{datas.match.id}}">
+  个股盈亏排名
+      <image class="more" mode="widthFix" src="../../images/right_icon.png">
+      </image>
+    </navigator>
+</view>
 
 <view class="imgs" wx:if='{{datas.today_record.today_stock_img.length>0}}'>
     <image wx:for='{{datas.today_record.today_stock_img}}' wx:for-item='i'  bindtap="preview" data-src='{{i}}' data-urls='{{datas.today_record.today_stock_img}}'

+ 80 - 0
pages/winloseRank/winloseRank.js

@@ -0,0 +1,80 @@
+// pages/winlost/winlost.js
+const app = getApp()
+const $api = require('../../utils/api.js').API;
+const $push = require('../../utils/api.js').PUSH;
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    var user_id=options.user_id,match_id=options.match_id
+    $api.getWinlossRank({user_id:user_id,rank_type:'win',match_id:match_id}).then(res=>{
+      this.setData({
+        win:res.data.data
+      })
+    })
+    $api.getWinlossRank({user_id:1888,rank_type:'loss',match_id:20}).then(res=>{
+      this.setData({
+        loss:res.data.data
+      })
+    })
+  },
+
+  
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 4 - 0
pages/winloseRank/winloseRank.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "个股盈亏排名"
+}

+ 47 - 0
pages/winloseRank/winloseRank.wxml

@@ -0,0 +1,47 @@
+<wxs module="filters" src="../../utils/toFixed.wxs" />
+
+<view class="up-down-view" >
+  <view class="up-title">
+       个股盈利榜单
+  </view>
+  <view class="up-down">
+    <view class="title_1">
+      <text style="width: 10%;">排名</text>
+      <text style="width: 25%;">名称</text>
+      <text style="width: 25%;">代码</text>
+      <text style="width: 30%;">日期</text>
+      <text style="width: 15%;text-align: right;">盈亏(w)</text>
+    </view>
+    <navigator wx:for="{{win}}" hover-class="none"  url="../today/today?id={{item.match_id}}&record_id={{item.id}}&user_id={{item.user_id}}">
+            <image wx:if="{{index<3}}" class="number" mode="widthFix" src="../../xiao/{{index+1}}.png"></image>
+            <text wx:else class="number">{{index+1}}</text>
+            <text style="width: 25%;">{{item.name}}</text>
+            <text style="width: 25%;color: #999;">{{item.code}}</text>
+            <text style="width: 30%;">{{item.stock_date}}</text>
+            <text style="text-align: right;" class="{{item.money>0 ? 'up':'down'}}">{{item.money}}w</text>
+    </navigator>
+  </view>
+</view>
+
+<view class="up-down-view" >
+  <view class="up-title">
+       个股亏损榜单
+  </view>
+  <view class="up-down">
+    <view class="title_1">
+      <text style="width: 10%;">排名</text>
+      <text style="width: 25%;">名称</text>
+      <text style="width: 25%;">代码</text>
+      <text style="width: 30%;">日期</text>
+      <text style="width: 15%;text-align: right;">盈亏(w)</text>
+    </view>
+    <navigator wx:for="{{loss}}" hover-class="none"  url="../today/today?id={{item.match_id}}&record_id={{item.id}}&user_id={{item.user_id}}">
+            <image wx:if="{{index<3}}" class="number" mode="widthFix" src="../../xiao/{{index+1}}.png"></image>
+            <text wx:else class="number">{{index+1}}</text>
+            <text style="width: 25%;">{{item.name}}</text>
+            <text style="width: 25%;color: #999;">{{item.code}}</text>
+            <text style="width: 30%;">{{item.stock_date}}</text>
+            <text style="text-align: right;" class="{{item.money>0 ? 'up':'down'}}">{{item.money}}w</text>
+    </navigator>
+  </view>
+</view>

+ 116 - 0
pages/winloseRank/winloseRank.wxss

@@ -0,0 +1,116 @@
+/* pages/winlost/winlost.wxss */
+.up-down-view{
+  background-color: #fff;
+  padding: 20rpx;
+}
+.content-list{
+  display: flex;
+  width: 300vw;
+}
+.number{
+  width: 50rpx;
+  display: inline-block;
+  text-align: center;
+  color: #CE994F;
+  font-size: 30rpx;
+  font-weight: 500;
+  margin-right: 10rpx;
+  margin-top: 3rpx;
+}
+image.number{
+  margin-top: 25rpx;
+}
+.avatar{
+  width: 90rpx;
+  height: 90rpx;
+  border-radius: 50%;
+  margin-right: 15rpx;
+  margin-left: 10rpx;
+}
+
+.end{
+  text-align: center;
+  color: #999;
+  line-height: 50rpx;
+  font-size: 28rpx;
+}
+
+.tab{
+  background: #fff;
+  margin-top: 16rpx;
+  padding:0 5rpx;
+  display: flex;
+  border-bottom: 1px solid #f2f2f2;
+  
+}
+.tab view{
+  font-size: 32rpx;
+  color: #333;
+  line-height: 80rpx;
+  transition: all .1s linear;
+  margin-right: 30rpx;
+}
+.tab .act{
+  color: #FF583D;
+  border-bottom: 2px solid #FF583D;
+  font-size: 32
+  rpx;
+}
+
+.up-title{
+  font-size: 32rpx;
+  /* padding: 5rpx; */
+  font-weight: 500;
+  margin-bottom: 10rpx;
+}
+
+.up-down{
+  width: 100%;
+  margin-right: 10rpx;
+}
+.up-down>navigator{
+  padding: 6rpx 0;
+  border-bottom: 1px solid #f2f2f2;
+  display: flex;
+  font-size: 30rpx;
+}
+.up-down .text{
+  width: 18%;
+  /* font-weight: 500; */
+  margin-left: 10rpx;
+}
+.up-down .down,.up-down .up{
+  width: 20%;
+}
+.up-down .usm{
+  width: 40%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  margin-left: 10rpx;
+}
+.title_1{
+  /* text-align: right; */
+  display: flex;
+  justify-content: space-between;
+  margin-top: 20rpx;
+}
+.title_1 text{
+  display: block;
+  /* width:19%; */
+  font-size: 24rpx;
+  color: #999;
+  text-align: left;
+  /* margin-left: -5rpx; */
+}
+
+.up-down navigator text{
+  line-height: 80rpx;
+  font-size: 26rpx;
+}
+.up-down>text{
+  color: rgb(128, 128, 128);
+  font-size: 30rpx;
+  margin-bottom: 10rpx;
+  display: block;
+}

+ 2 - 1
utils/api.js

@@ -215,7 +215,8 @@ const API = {
   imageOcr: (data) => request(POST, `/api/wx/v3/ai/ocr`, data),
   getAllDay: (data) => request(GET, `/api/wx/v3/match/group/winlose/allday`, data),
   getAvg: (data) => request(GET, `/api/wx/v3/match/group/winlose/avg/allday`, data),
-
+  getWinlossRank: (data) => request(GET, `/api/wx/v3/user/match/stock/winlossrank/list`, data),
+  
   initUser:() => initUser(),
 
 };