begmoon 2 lat temu
rodzic
commit
6811687545

+ 2 - 2
app.json

@@ -1,6 +1,5 @@
 {
   "pages": [
-    
     "pages/index/index",
     "pages/rank/rank",
     "pages/upload/upload",
@@ -26,7 +25,8 @@
     "pages/style/style",
     "pages/detail/detail",
     "pages/list/list",
-    "pages/comment/comment"
+    "pages/comment/comment",
+    "pages/matchdetail/matchdetail"
   ],
   "window": {
     "backgroundTextStyle": "light",

BIN
pages/.DS_Store


+ 1 - 1
pages/apply/apply.wxml

@@ -25,7 +25,7 @@
         </view>
         <view class="title title1">3、交作业</view>
         <view class="date">
-          7月5日收盘后开始交作业,默认为初始资金,随后每天下午3:00到3:30,在比赛系统自主提交,前排成绩将更新在比赛公众号。
+          {{info.post_start_time}}收盘后开始交作业,默认为初始资金,随后每天下午3:00到3:30,在比赛系统自主提交,前排成绩将更新在比赛公众号。
         </view>
         <view class="title title1">4、银证转账除权规则与账户验证</view>
         <view class="date">

+ 39 - 302
pages/homepage/homepage.js

@@ -2,7 +2,7 @@
 const app = getApp()
 import * as echarts from '../../ec-canvas/echarts';
 const $api = require('../../utils/api.js').API;
-var id, record_id, records = [], today_stock=[];
+
 Page({
 
   /**
@@ -10,189 +10,66 @@ Page({
    */
   data: {
     datas:{},
-    mydata:{},
-    date:'2021-11',
-    days:[],
-    match:[],
-    index:0,
-    id:'',
     user_id:'',
-    auth_user_id:'',
-    ec: {
-      onInit: null
-    },
-    ec1: {
-      onInit: null
-    }
+    matchlist:[],
+    fans:0,
+    followers:0,
+    is_follow:0,
+    age:0,
+    is_auth_user:1,
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    id = options.id?options.id:null, record_id = options.record_id?options.record_id:null
     this.setData({
-      type:options.type?options.type:'',
-      id: id,
-      record_id: record_id,
-      user_id: options.user_id ? options.user_id:'',
+      user_id: options.user_id,
+    })
+    wx.getStorage({
+      key: 'userInfo',
+      success: res => {
+        this.setData({
+          is_auth_user:res.data.id != this.data.user_id,
+        })
+      }
     })
+    
     if(options.type){
         wx.setNavigationBarTitle({
           title: '我的主页',
         })
     }
-    $api.getAuthinfo().then(res=>{
-      this.setData({
-        auth_user_id:res.data.data.id
-      })
-    })
-    let _this = this;
-    $api.getMatchList().then(res=>{
-      let l = res.data.data.length - 1;
-      this.setData({
-        match:res.data.data,
-        index: 4,
-        // id: res.data.data[l].id
-      })
-      this.getData();
-    })
-    
+
+    this.getUserData(options.user_id)
+    this.getUserMatch(options.user_id)
+
   },
-  getDays(){
-    $api.getCalendar({
-      user_id:this.data.user_id,
-      match_id:this.data.id,
-      month: this.data.date
-    }).then(res=>{
-      var days = [], w = new Date(this.data.date + '-01').getDay();
-      for (let i = 0; i < w; i++) {
-        days.push({
-          day: '',
-          income: ''
-        })
-      }
-      for (let i = 0; i < res.data.data.length; i++) {
-        days.push({
-          day: i+1,
-          income: res.data.data[i].today_income
-        })
-      }
+
+  getUserData(user_id){
+    var data      = {}
+    data.user_id  = user_id
+    var year      = new Date().getFullYear() 
+    $api.getUserInfo(data).then(res=>{
       this.setData({
-        days: days
+        datas:res.data.data,
+        age:year - res.data.data.join_time,
+        is_follow:res.data.data.is_follow,
       })
     })
   },
-  bindChange(e) {
-    let match=this.data.match;
-    let data=this.data.datas;
-    data.records=[]
-    this.setData({
-      index: e.detail.value,
-      id: match[e.detail.value].id,
-      datas:data
-    })
-    this.getData()
-  },
-  getData(){
-    wx.showNavigationBarLoading();
-    var data = {}
-    if (this.data.id) {
-      data.id = this.data.id
-    }
-    if (this.data.user_id) {
-      data.user_id = this.data.user_id
-    }
-    if (this.data.user_id) {
-      data.user_id = this.data.user_id
-    }
-    if (this.data.record_id) {
-      // data.record_id = this.data.record_id
-    }
-    $api.getPlayerMatch(data).then(res=>{
-      let stock_date=res.data.data.today_record.stock_date.split('-')
+
+  getUserMatch(user_id){
+    var data      = {}
+    data.user_id  = user_id
+
+    $api.getUserMatch(data).then(res=>{
       this.setData({
-        datas: res.data.data,
-        date: stock_date[0] + '-' + stock_date[1],
-        is_follow: res.data.data.is_follow,
-        // user_id: res.data.data.today_record.user_id,
-        followers:res.data.data.followers,
-        fans:res.data.data.fans,
-        ec: {
-          onInit: initChart
-        },
-        ec1: {
-          onInit: initChart1
-        }
+        matchlist:res.data.data.list,
       })
-      records = res.data.data.records
-      today_stock = res.data.data.today_record.today_stock
-      this.getDays()
-      wx.hideNavigationBarLoading()
-    })
-    .catch(err=>{
-      wx.hideNavigationBarLoading()
-    })
-    
-    //每日持股
-    var parm={
-      id: this.data.id, user_id: this.data.user_id?data.user_id:o,user_id: this.data.user_id?this.data.user_id:null
-    }
-    $api.getRecordList(parm).then(res=>{
-        this.setData({
-          stockList:res.data.data.list
-        })
-    })
-  },
-  bindDateChange(e){
-    this.setData({
-      date: e.detail.value
-    })
-    this.getDays()
-  },
-  prev(){
-    var date=this.data.date.split('-'),y=date[0],m=date[1];
-    if(m>1){
-      m--
-    }else{
-      m=12
-      y--
-    }
-    m=(m>9)?m:'0'+m
-    this.setData({
-      date: y+'-'+m
-    })
-    this.getDays()
-  },
-  logout() {
-    wx.removeStorage({
-      key: 'userInfo'
-    })
-    wx.switchTab({
-      url: '../user/user',
-    })
-  },
-  next() {
-    var date = this.data.date.split('-'), y = date[0], m = date[1];
-    if (m < 12) {
-      m++
-    } else {
-      m = 1
-      y++
-    }
-    m = (m > 9) ? m : '0' + m
-    this.setData({
-      date: y + '-' + m
-    })
-    this.getDays()
-  },
-  //预览
-  preview(e) {
-    wx.previewImage({
-      urls: e.target.dataset.urls,
-      current: e.target.dataset.src
     })
   },
+  
   followPlayer(e){
     let action = e.target.dataset.action;
     $api.follow({ follow_id: this.data.user_id, action:action}).then(res=>{
@@ -218,9 +95,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-    if(this.data.user_id){
-      this.getData();
-    }
+  
   },
 
   /**
@@ -259,141 +134,3 @@ Page({
   }
 })
 
-
-/**折线图 */
-function initChart(canvas, width, height, dpr) {
-    var xdata = [], ydata = [];
-    for (let i = 0; i < records.length; i++) {
-      let date = records[i].stock_date.split('-');
-      xdata.push(date[1] + '/' + date[2])
-      let y = records[i].total_income.replace('%', '')
-      ydata.push(Number(y))
-    }
-    xdata = xdata.reverse()
-    ydata = ydata.reverse()
-    const chart = echarts.init(canvas, null, {
-      width: width,
-      height: height,
-      devicePixelRatio: dpr // new
-    });
-    canvas.setChart(chart);
-    var option = {
-      legend: {
-        show: false
-      },
-      grid: {
-        x: 50,
-        y: 40,
-        x2: 10,
-        y2: 35
-      },
-      tooltip: {
-        show: true,
-        trigger: 'axis',
-        formatter: '{b0}: {c0}%'
-      },
-      xAxis: {
-        type: 'category',
-        data: xdata,
-        axisLabel: {
-          interval: 0,
-          rotate: 40,
-          color: '#999999',
-          interval: 2
-        }
-      },
-      yAxis: {
-        axisLine: {
-          show: true
-        },
-        type: 'value',
-        name: '收益曲线',
-        axisLabel: {
-          formatter: function (value, index) {//隐藏 0
-            let texts = [];
-            texts.push(value + '%')
-            return texts;
-          },
-          show: true
-        },
-      },
-      series: [{
-        name: 'A',
-        type: 'line',
-        smooth: true,
-        symbolSize: 8,
-        lineStyle: {
-          color: '#FF2D68'
-          // color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
-          //   offset: 0,
-          //   color: '#FF2D68'
-          // }, {
-          //   offset: 1,
-          //   color: '#4C4BFF'
-          // }]),
-        },
-        itemStyle: {
-          borderWidth: 5,
-          borderColor: '#FFAD52',
-          color: '#FFAD52'
-        },
-        data: ydata
-      }]
-    };
-
-    chart.setOption(option);
-    return chart;
-}
-
-
-
-
-function initChart1(canvas, width, height, dpr) {
-  const chart = echarts.init(canvas, null, {
-    width: width,
-    height: height,
-    devicePixelRatio: dpr // new
-  });
-  canvas.setChart(chart);
-  today_stock.forEach(item=>{
-    item.value = item.fund
-  })
-  var radius = today_stock.length<9?'65%':'50%';
-  var option = {
-    backgroundColor: "#ffffff",
-    legend: {
-      show: true,
-      orient: 'vertical',
-      right: '1%',
-      formatter: function (name){
-        var index = 0;
-        today_stock.forEach(function (value, i) {
-          if (value.name == name) {
-            index = i;
-          }
-        });
-        return name + "  " + today_stock[index].value;
-      }
-    },
-    series: [{
-      label: {
-        
-        normal: {
-          show: true,
-          fontSize: 12,
-          formatter: function (a) {
-            return Math.round(a.percent)+'%'
-          }
-        }
-      },
-      type: 'pie',
-      center: ['37%', '40%'],
-      radius: ['0%', radius],
-      data: today_stock
-      
-    }]
-  };
-
-  chart.setOption(option);
-  return chart;
-}

+ 32 - 115
pages/homepage/homepage.wxml

@@ -1,145 +1,62 @@
 <view class="per_top">
-    <image src="{{datas.today_record.avatar}}" ></image>
+    <image src="{{datas.avatar}}" ></image>
     <view class="name">
-      {{datas.today_record.username}}
+      {{datas.username}}
       <view class="fans">
           
-          <navigator url="../follow/follow?id={{user_id}}&type=2" style="display: inline-block;"><text>{{fans}}</text>粉丝</navigator>
-          <navigator url="../follow/follow?id={{user_id}}&type=1" style="display: inline-block;"><text style="margin-left: 20rpx;">{{followers}}</text>关注</navigator>
+          <navigator url="../follow/follow?id={{user_id}}&type=2" style="display: inline-block;"><text>{{datas.fans}}</text>粉丝</navigator>
+          <navigator url="../follow/follow?id={{user_id}}&type=1" style="display: inline-block;"><text style="margin-left: 20rpx;">{{datas.followers}}</text>关注</navigator>
       </view>
     </view>
-    <block wx:if='{{auth_user_id!=datas.today_record.user_id}}'>
+    <block wx:if='{{is_auth_user}}'>
       <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>
     <navigator class="follow" url="../style/style" wx:else>编辑</navigator>
 </view>
 <view class="style">
-  <view wx:if='{{datas.today_record.style.length>0}}' style="padding-bottom: 0;">
+  <view wx:if='{{datas.style.length>0}}' style="padding-bottom: 0;">
     <text>风格</text>
-    <view style="display: inline-block;width: 70%;vertical-align: top;"><label wx:for='{{datas.today_record.style}}' class="tag">{{item}}</label></view>
+    <view style="display: inline-block;width: 70%;vertical-align: top;"><label wx:for='{{datas.style}}' class="tag">{{item}}</label></view>
   </view>
   <view>
-    <text>股龄</text>{{datas.stock_age}}年
-  </view>
-  <!-- <view>
-    <text>城市</text>重庆
-  </view> -->
-  <view>
-    <text>我的自选</text>
-    <block wx:if="{{datas.stock_follow.length<=0}}">无</block>
-    <block wx:for="{{datas.stock_follow}}">{{item}} </block>
+    <text>股龄</text>{{age}}年
   </view>
 </view>
-<view class="style" style="margin: 0;">
-    <view class="game"><text style="color: #333;">参赛</text> 
-      <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}}
-    </view>
-    
-    <view>
-      <text>排名</text>{{datas.today_record.group_rank}}({{datas.today_record.match_group_name}})
-    </view>
-    <view>
-      <text>初始资产</text>{{datas.today_record.init_fund}}W
-    </view>
-    <view>
-      <text>结束资产</text>{{datas.today_record.today_fund}}W( 收益<label  class="{{datas.today_record.today_income[0]=='-' ?'down':'up'}}">{{datas.today_record.total_income}}</label>)
-    </view>
+
+<view class="match">
+  <view class="match_title">我的比赛</view>
+  <view class="match_list" wx:for="{{matchlist}}" wx:key="item">
+    <navigator hover-class="none" url='../matchdetail/matchdetail?user_id={{item.user_id}}&match_id={{item.match_id}}'>
     <view>
-      <text>胜率</text>{{datas.today_record.win_rate}}(最大回撤 <label class="{{datas.today_record.badest_income[0]=='-' ?'down':'up'}}"> {{datas.today_record.badest_income}} </label>)
-    </view>
-  </block>
-</view>
-<view class="content">
-    <!-- <view class="title">收益曲线</view> -->
-    <view class="container" wx:if='{{datas.records.length>0}}'>
-          <ec-canvas   ec="{{ ec }}">
-          </ec-canvas>
+      <label class="match_name">{{item.match_info.name}}</label>
+      <label class="match_group">{{item.match_group_info.name}}</label>
     </view>
-</view>
-<view class="content">
-  <view class="title">每月盈亏</view>
-  <view class="month">
-    <image bindtap="prev" mode="heightFix"  src="../../images/left.png"></image>
-    <picker mode="date" fields="month" value="{{date}}"  bindchange="bindDateChange">
-                <view class="date-picker">
-                   {{date}}
-                   <image  mode="heightFix"  src="../../images/icon_down@2x.png"></image>
-                </view>
-    </picker>
-    <image bindtap="next" mode="heightFix"  src="../../images/right.png"></image>
-  </view>
-  <view class="day">
-    <text>日</text><text>一</text><text>二</text>
-    <text>三</text><text>四</text><text>五</text><text>六</text>
-  </view>
-  <view class="days">
-    <view wx:for='{{days}}'>
-      <view wx:if='{{!item.income}}' style="color:#999;">
-        {{item.day}}
-        <text>{{item.income}}</text>
+    <view wx:if="{{item.match_info.match_status == 2}}">
+      <view class="match_date">
+        <label>比赛日期:{{item.match_info.start_time}} 至 {{item.match_info.end_time}} (未开始) </label>
       </view>
-      <view wx:else   class="{{item.income[0]=='-' ? 'down1':'up1'}}"> 
-        {{item.day}}
-        <text>{{item.income}}</text>
+
+      <view class="match_day">
+        <label>请在{{item.match_info.post_start_time}}收盘后提交作业</label>
       </view>
     </view>
-  </view>
-</view>
 
-<view class="days_stock">
-  <view class="title">每日持股
-  </view>
-  <view  class="stock" wx:for='{{stockList}}' wx:if="{{index<3}}">
-    <navigator hover-class="none" url='../today/today?id={{item.match_id}}&record_id={{item.id}}&user_id={{user_id}}'>
-      <view class="info">
-        <view class="date"> {{item.stock_date}}(今日收益 <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>
+    <view wx:else>
+      <view class="match_money">
+        <label>资产变化:{{item.today_record.init_fund}}w - {{item.today_record.today_fund}}w</label>
       </view>
-      
-      <view class="info">
-                  持仓:<label wx:if='{{item.is_markt}}'>开超市</label>
-                    <label wx:elif='{{item.today_stock.length>0}}'>
-                        <block wx:for="{{item.today_stock}}" wx:for-item='i'>{{i.name}}({{i.fund}}w) </block>
-                    </label>
-                    <view wx:else>空仓</view>
-      </view>
-      <view class="info" wx:if='{{item.experience}}'>
-        今日反思:{{item.experience}}
-      </view>
-      <view class="info" wx:if='{{item.wanzhu_comment}}'>
-        顽主点评:{{item.wanzhu_comment}}
+
+      <view class="match_ratio">
+        总收益<label class="{{item.today_record.today_income[0]=='-' ?'down':'up'}}">{{item.today_record.total_income}}</label>
+        胜率<label class="{{item.today_record.today_income[0]=='-' ?'down':'up'}}">{{item.today_record.win_rate}}</label>
+        排名<label class="{{item.today_record.today_income[0]=='-' ?'down':'up'}}">{{item.today_record.rank}}</label>
       </view>
-    </navigator>
-    <view class="imgs">
-          <image wx:for='{{item.today_stock_img}}' wx:for-item='i'  bindtap="preview" data-src='{{i}}' data-urls='{{item.today_stock_img}}'
-                 class="img" src="{{i}}"></image>
-    </view>
-    <view class="comment">
-        <image mode="widthFix" src="../../images/msg.png"></image>
-        <text>{{item.comments_count}}</text>
-        <image mode="widthFix" src="../../images/zan.png"></image>
-        <text>{{item.zans_count}}</text>
     </view>
-  </view>
-  <view class="look_all" wx:if="{{stockList.length>0}}">
-    <navigator hover-class="none" url="../day/day?id={{id}}&user_id={{user_id}}">
-          查看全部
-    </navigator>
+    
+  </navigator>
   </view>
 </view>
 
-<!-- <view wx:if="type==1" class="content" style="margin-top: 100rpx;"><view bindtap="logout" class="logout">退出登录</view></view> -->
+
 

+ 61 - 5
pages/homepage/homepage.wxss

@@ -1,6 +1,6 @@
 /* pages/today/today.wxss */
 page{
-  background: #F7F7F7;
+  background: #ffffff;
 }
 .page_top{
   background: #fff;
@@ -103,9 +103,8 @@ ec-canvas {
   border-left: 4px solid #D94B24;
   padding-left: 4rpx;
 }
-.game picker{
-  /* float: right; */
-}
+
+
 .infos{
   background: #FFF4F5;
   border-radius: 16rpx;
@@ -308,4 +307,61 @@ picker{
   color: #666;
   width: 85%;
   vertical-align: top;
-} */
+} */
+
+.match{
+  padding-left: 24rpx;
+}
+
+.match_title{
+  font-size: 28rpx;
+}
+
+.match_list{
+  justify-content: space-between;
+  border-bottom: 1px solid #F5F5F5;
+  padding: 24rpx 0;
+}
+
+.match_name{
+  font-size: 34rpx;
+}
+
+.match_group{
+  font-size: 26rpx;
+  position: absolute;
+  right: 24rpx;
+}
+
+.match_date{
+  font-size: 30rpx;
+  padding-top: 50rpx;
+  padding-top: 10rpx;
+}
+
+.match_day{
+  font-size: 30rpx;
+  color: #E90001;
+  padding-top: 10rpx;
+}
+
+.match_money{
+  font-size: 30rpx;
+  padding-top: 10rpx;
+}
+
+.match_ratio{
+  font-size: 30rpx;
+  padding-top: 10rpx;
+}
+
+.up{
+  font-size: 36rpx;
+  color: #E90001 !important;
+  margin-left: 5rpx;
+}
+.down{
+  font-size: 36rpx;
+  color: #07B20B !important;
+  margin-left: 5rpx;
+}

+ 2 - 2
pages/index/index.wxml

@@ -87,7 +87,7 @@
                         <view bindtap="tabChange1" data-id='0' class="{{hot==0?'act1':''}}">今日热门 <text></text></view>
                         <view bindtap="tabChange1" data-id='1' class="{{hot==1?'act1':''}}">我的自选 <text></text></view>
                     </view> -->
-                    <scroll-view style="padding:0;" scroll-y='{{true}}' style="height:calc(100vh - 377rpx);">
+                    <scroll-view style="padding:0;" scroll-y='{{true}}' style="height:calc(120vh - 377rpx);">
                         <view wx:if='{{hot==0}}'>
                           <navigator hover-class="none" url="../stock/stock?id={{item.id}}&date={{date}}" class="gp" wx:for='{{hotbuyList}}' wx:if='{{index<10}}'>
                               <image wx:if='{{index==0}}' mode="widthFix" src="../../images/1.png"></image>
@@ -96,7 +96,7 @@
                               <text class="rank" wx:if='{{index>2}}'>{{index+1}}</text>
                               <view class="gp-name">{{item.stock_name}}</view>
                               <view class="num"> <text>{{item.count}}</text> 人持仓</view>
-                             <view class="comment"><text>留言 {{item.comments_count}} 条</text>|<text>自选 {{item.choice_count}} 人</text></view>
+                             <view class="comment"><text>留言 {{item.comments_count}} 条</text></view>
                           </navigator>
                           <navigator hover-class="none" url="../stock/stock?date={{date}}&type=1"  class="more">查看更多 <image mode="widthFix" src="../../images/right_icon.png"></image></navigator>
                         </view>

+ 4 - 3
pages/index/index.wxss

@@ -154,7 +154,7 @@ scroll-view{
 }
 .hot{
   border-radius: 16rpx;
-  margin-top: 30rpx;
+  margin-top: 10rpx;
   /* box-shadow: 0px 0px 12px 0px rgba(218, 217, 217, 0.5); */
 }
 .hot_tab{
@@ -207,10 +207,11 @@ scroll-view{
 .gp{
   display: flex;
   justify-content: space-between;
-  padding: 24rpx 0;
+  padding: 10rpx 0;
   flex-wrap: wrap;
   border-bottom: 1px solid #F5F5F5;
 }
+
 .gp-name{
   font-weight: 500;
   font-size: 32rpx;
@@ -230,7 +231,7 @@ scroll-view{
 }
 .comment{
   width: 100%;
-  padding-top: 10rpx;
+  padding-top: 0rpx;
   padding-left: 60rpx;
 }
 .comment text{

+ 314 - 0
pages/matchdetail/matchdetail.js

@@ -0,0 +1,314 @@
+// pages/matchdetail/matchdetail.js
+const app = getApp()
+import * as echarts from '../../ec-canvas/echarts';
+const $api = require('../../utils/api.js').API;
+var records = [], today_stock=[];
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    datas:{},
+    user_id:'',
+    match_id:'',
+    date:'',
+    days:[],
+    ec: {
+      onInit: null
+    },
+    ec1: {
+      onInit: null
+    }
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    this.setData({
+      user_id:options.user_id,
+      match_id:options.match_id,
+    })
+    this.getMatchData()
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  },
+
+  getMatchData(){
+    wx.showNavigationBarLoading();
+    var data      = {}
+    data.user_id  = this.data.user_id
+    data.id       = this.data.match_id
+    $api.getPlayerMatch(data).then(res=>{
+      let stock_date=res.data.data.today_record.stock_date.split('-')
+      records       = res.data.data.records
+      today_stock   = res.data.data.today_record.today_stock
+      console.log(records,2323)
+      this.setData({
+        datas: res.data.data,
+        date: stock_date[0] + '-' + stock_date[1],
+        ec: {
+          onInit: initChart
+        },
+        // ec1: {
+        //   onInit: initChart1
+        // }
+      })
+    
+      this.getDays()
+      wx.hideNavigationBarLoading()
+    })
+    .catch(err=>{
+      wx.hideNavigationBarLoading()
+    })
+    
+  },
+
+  getDays(){
+    $api.getCalendar({
+      user_id:this.data.user_id,
+      match_id:this.data.match_id,
+      month: this.data.date
+    }).then(res=>{
+      var days = [], w = new Date(this.data.date + '-01').getDay();
+      for (let i = 0; i < w; i++) {
+        days.push({
+          day: '',
+          income: ''
+        })
+      }
+      for (let i = 0; i < res.data.data.length; i++) {
+        days.push({
+          day: i+1,
+          income: res.data.data[i].today_income
+        })
+      }
+      this.setData({
+        days: days
+      })
+    })
+  },
+
+  bindDateChange(e){
+    this.setData({
+      date: e.detail.value
+    })
+    this.getDays()
+  },
+  prev(){
+    var date=this.data.date.split('-'),y=date[0],m=date[1];
+    if(m>1){
+      m--
+    }else{
+      m=12
+      y--
+    }
+    m=(m>9)?m:'0'+m
+    this.setData({
+      date: y+'-'+m
+    })
+    this.getDays()
+  },
+
+  next() {
+    var date = this.data.date.split('-'), y = date[0], m = date[1];
+    if (m < 12) {
+      m++
+    } else {
+      m = 1
+      y++
+    }
+    m = (m > 9) ? m : '0' + m
+    this.setData({
+      date: y + '-' + m
+    })
+    this.getDays()
+  },
+
+})
+
+function initChart(canvas, width, height, dpr) {
+  var xdata = [], ydata = [];
+  for (let i = 0; i < records.length; i++) {
+    let date = records[i].stock_date.split('-');
+    xdata.push(date[1] + '/' + date[2])
+    let y = records[i].total_income.replace('%', '')
+    ydata.push(Number(y))
+  }
+  xdata = xdata.reverse()
+  ydata = ydata.reverse()
+  const chart = echarts.init(canvas, null, {
+    width: width,
+    height: height,
+    devicePixelRatio: dpr // new
+  });
+  canvas.setChart(chart);
+  var option = {
+    legend: {
+      show: false
+    },
+    grid: {
+      x: 50,
+      y: 40,
+      x2: 10,
+      y2: 35
+    },
+    tooltip: {
+      show: true,
+      trigger: 'axis',
+      formatter: '{b0}: {c0}%'
+    },
+    xAxis: {
+      type: 'category',
+      data: xdata,
+      axisLabel: {
+        interval: 0,
+        rotate: 40,
+        color: '#999999',
+        interval: 2
+      }
+    },
+    yAxis: {
+      axisLine: {
+        show: true
+      },
+      type: 'value',
+      name: '收益曲线',
+      axisLabel: {
+        formatter: function (value, index) {//隐藏 0
+          let texts = [];
+          texts.push(value + '%')
+          return texts;
+        },
+        show: true
+      },
+    },
+    series: [{
+      name: 'A',
+      type: 'line',
+      smooth: true,
+      symbolSize: 8,
+      lineStyle: {
+        color: '#FF2D68'
+        // color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
+        //   offset: 0,
+        //   color: '#FF2D68'
+        // }, {
+        //   offset: 1,
+        //   color: '#4C4BFF'
+        // }]),
+      },
+      itemStyle: {
+        borderWidth: 5,
+        borderColor: '#FFAD52',
+        color: '#FFAD52'
+      },
+      data: ydata
+    }]
+  };
+  chart.setOption(option);
+  return chart;
+}
+
+
+
+
+function initChart1(canvas, width, height, dpr) {
+const chart = echarts.init(canvas, null, {
+  width: width,
+  height: height,
+  devicePixelRatio: dpr // new
+});
+canvas.setChart(chart);
+today_stock.forEach(item=>{
+  item.value = item.fund
+})
+var radius = today_stock.length<9?'65%':'50%';
+var option = {
+  backgroundColor: "#ffffff",
+  legend: {
+    show: true,
+    orient: 'vertical',
+    right: '1%',
+    formatter: function (name){
+      var index = 0;
+      today_stock.forEach(function (value, i) {
+        if (value.name == name) {
+          index = i;
+        }
+      });
+      return name + "  " + today_stock[index].value;
+    }
+  },
+  series: [{
+    label: {
+      
+      normal: {
+        show: true,
+        fontSize: 12,
+        formatter: function (a) {
+          return Math.round(a.percent)+'%'
+        }
+      }
+    },
+    type: 'pie',
+    center: ['37%', '40%'],
+    radius: ['0%', radius],
+    data: today_stock
+    
+  }]
+};
+
+chart.setOption(option);
+return chart;
+}

+ 6 - 0
pages/matchdetail/matchdetail.json

@@ -0,0 +1,6 @@
+{
+  "navigationBarTitleText": "Ta的比赛",
+  "usingComponents": {
+    "ec-canvas": "../../ec-canvas/ec-canvas"
+  }
+}

+ 98 - 0
pages/matchdetail/matchdetail.wxml

@@ -0,0 +1,98 @@
+<!--pages/matchdetail/matchdetail.wxml-->
+<view class="style" style="margin: 0;">
+  <view class="title">
+    {{datas.match.name}}
+  </view>
+  <view>
+    比赛日期: {{datas.match.start_time}} 至 {{datas.match.end_time}}
+  </view>
+  <view>
+    我的分组: {{datas.match_group_info.name}}
+  </view>
+  <view>
+    初始资产: {{datas.today_record.init_fund}}w
+  </view>
+  <view>
+    结束资产: {{datas.today_record.today_fund}}w
+  </view>
+  <view class="match_ratio">
+    总收益<label class="{{datas.today_record.today_income[0]=='-' ?'down':'up'}}">{{datas.today_record.total_income}}</label>
+    胜率<label class="{{datas.today_record.today_income[0]=='-' ?'down':'up'}}">{{datas.today_record.win_rate}}</label>
+    排名<label class="{{datas.today_record.today_income[0]=='-' ?'down':'up'}}">{{datas.today_record.rank}}</label>
+  </view>
+</view>
+<view class="content">
+    <view class="container" wx:if='{{datas.records.length>0}}'>
+          <ec-canvas   ec="{{ ec }}">
+          </ec-canvas>
+    </view>
+</view>
+<view class="content">
+  <view class="title">每月盈亏</view>
+  <view class="month">
+    <image bindtap="prev" mode="heightFix"  src="../../images/left.png"></image>
+    <picker mode="date" fields="month" value="{{date}}"  bindchange="bindDateChange">
+                <view class="date-picker">
+                   {{date}}
+                   <image  mode="heightFix"  src="../../images/icon_down@2x.png"></image>
+                </view>
+    </picker>
+    <image bindtap="next" mode="heightFix"  src="../../images/right.png"></image>
+  </view>
+  <view class="day">
+    <text>日</text><text>一</text><text>二</text>
+    <text>三</text><text>四</text><text>五</text><text>六</text>
+  </view>
+  <view class="days">
+    <view wx:for='{{days}}'>
+      <view wx:if='{{!item.income}}' style="color:#999;">
+        {{item.day}}
+        <text>{{item.income}}</text>
+      </view>
+      <view wx:else   class="{{item.income[0]=='-' ? 'down1':'up1'}}"> 
+        {{item.day}}
+        <text>{{item.income}}</text>
+      </view>
+    </view>
+  </view>
+</view>
+
+<view class="days_stock">
+  <view class="title">每日持股
+  </view>
+  <view  class="stock" wx:for='{{datas.records}}'>
+    <navigator hover-class="none" url='../today/today?id={{item.match_id}}&record_id={{item.id}}&user_id={{user_id}}'>
+      <view class="info">
+        <view class="date"> {{item.stock_date}}(今日收益 <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>
+      </view>
+      
+      <view class="info">
+                  持仓:<label wx:if='{{item.is_markt}}'>开超市</label>
+                    <label wx:elif='{{item.today_stock.length>0}}'>
+                        <block wx:for="{{item.today_stock}}" wx:for-item='i'>{{i.name}}({{i.fund}}w) </block>
+                    </label>
+                    <view wx:else>空仓</view>
+      </view>
+      <view class="info" wx:if='{{item.experience}}'>
+        今日反思:{{item.experience}}
+      </view>
+      <view class="info" wx:if='{{item.wanzhu_comment}}'>
+        顽主点评:{{item.wanzhu_comment}}
+      </view>
+    </navigator>
+    <view class="imgs">
+          <image wx:for='{{item.today_stock_img}}' wx:for-item='i'  bindtap="preview" data-src='{{i}}' data-urls='{{item.today_stock_img}}'
+                 class="img" src="{{i}}"></image>
+    </view>
+    <view class="comment">
+        <image mode="widthFix" src="../../images/msg.png"></image>
+        <text>{{item.comments_count}}</text>
+        <image mode="widthFix" src="../../images/zan.png"></image>
+        <text>{{item.zans_count}}</text>
+    </view>
+  </view>
+
+</view>

+ 326 - 0
pages/matchdetail/matchdetail.wxss

@@ -0,0 +1,326 @@
+/* pages/matchdetail/matchdetail.wxss */
+/* pages/today/today.wxss */
+page{
+  background: #fff;
+}
+.page_top{
+  margin-bottom: 20rpx;
+  position: relative;
+}
+.container {
+  position: relative;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: space-between;
+  box-sizing: border-box; 
+  height: 50vh;
+  background: #fff;
+  z-index: 9;
+} 
+
+ec-canvas {
+  width: 100%;
+  height: 100%;
+  position: relative;
+  z-index: 99;
+}
+
+.per_top{
+  height: 138rpx;
+  position: relative;
+  padding:24rpx;
+  background: #D94B24;
+}
+.per_top>image{
+  width: 90rpx;
+  height: 90rpx;
+  position: absolute;
+  left: 24rpx;
+  top: 24rpx;
+  border-radius: 100%;
+}
+
+.name{
+  font-size:32rpx;
+  font-weight: 500;
+  margin-left: 110rpx;
+  color: #fff;
+}
+.fans{
+  color: rgba(255, 255, 255, 0.75);
+  font-size: 28rpx;
+  margin-top: 10rpx;
+}
+.fans text{
+  color: #FFF;
+  font-weight: bold;
+  margin-right: 10rpx;
+}
+.per_top .follow {
+  color: #fff;
+  font-size: 28rpx;
+  position: absolute;
+  right: 24rpx;
+  top: 32rpx;
+  border: 1px solid #fff;
+  border-radius: 8rpx;
+  padding: 5rpx 8rpx;
+}
+.style{
+  background: #fff;
+  padding: 30rpx;
+  margin-bottom: 20rpx;
+  font-size: 30rpx;
+  color: #333;
+}
+.style view{
+  padding: 6rpx 0;
+}
+.style text{
+  display: inline-block;
+  color: #999;
+  font-size: 30rpx;
+  width: 180rpx;
+}
+.style .tag{
+  font-size: 28rpx;
+  color: #CE994F;
+  border: 1px solid #CE994F;
+  border-radius: 8rpx;
+  margin-right: 8rpx;
+  font-weight: 400;
+  padding: 0 8rpx;
+  display: inline-block;
+  margin-bottom: 10rpx;
+}
+.game{
+  color: 32rpx;
+  font-weight: bold;
+  margin-bottom: 20rpx;
+}
+.date{
+  border-left: 4px solid #D94B24;
+  padding-left: 4rpx;
+}
+
+
+.infos{
+  background: #FFF4F5;
+  border-radius: 16rpx;
+  padding-top: 24rpx;
+ 
+}
+.bottom{
+  line-height: 92rpx;
+  padding: 0 24rpx;
+  border-radius: 0px 0px 8px 8px;
+  margin-top: 20rpx;
+  font-size: 28rpx;
+  background: linear-gradient(124deg, #FEEAEC 0%, #FFAEAF 100%);
+}
+.bottom text{
+  font-size: 36rpx;
+  margin-right: 30rpx;
+  font-weight: 500;
+}
+.legend{
+  position: absolute;
+  right: 30rpx;
+  top: 0;
+  z-index: 999999;
+}
+.legend view{
+  width: 230rpx;
+  line-height: 64rpx;
+  background: #F7F7F7;
+  border-radius: 8rpx;
+  text-align: center;
+  font-size: 28rpx;
+  margin-bottom: 10rpx;
+}
+
+.imgs,.content{
+  margin-bottom: 20rpx;
+  background: #fff;
+  padding: 15rpx;
+  position: relative;
+}
+.img{
+  display: inline-block;
+  width: 224rpx;
+  height: 224rpx;
+  border-radius: 8rpx;
+  margin-right: 8rpx;
+  margin-bottom: 8rpx;
+}
+.title{
+  font-weight: 500;
+  font-size: 32rpx;
+  margin-bottom: 24rpx;
+}
+.content{
+  font-size: 30rpx;
+  margin-bottom: 24rpx;
+  line-height: 48rpx;
+}
+.days_stock{
+  background: #fff;
+  padding: 30rpx;
+}
+
+.look_all{
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  background-color: #E90001;
+  height: 88rpx;
+  color: #fff;
+}
+
+.stock{
+  border-bottom: 1px solid #f5f5f5;
+  padding-bottom: 30rpx;
+  margin-bottom: 30rpx;
+}
+.stock .info{
+  padding: 10rpx 0;
+}
+.stock .imgs{
+  padding: 30rpx 0 0;
+  margin: 0;
+}
+.title navigator{
+  float: right;
+  color: #999;
+  font-size: 28rpx;
+}
+.title image{
+  width: 32rpx;
+  position: relative;
+  top: 7rpx;
+}
+
+.month{
+  text-align: right;
+  position: absolute;
+  right: 30rpx;
+  top: 30rpx;
+}
+.month>image{
+  height: 40rpx;
+  display: inline-block;
+  vertical-align: middle;
+}
+picker{
+  display: inline-block;
+  vertical-align: middle;
+  margin: 0 20rpx;
+}
+.date-picker{
+  font-size: 36rpx;
+  font-weight: 500;
+}
+.date-picker image{
+  height: 24rpx;
+}
+.day{
+  display: flex;
+  justify-content: space-between;
+  padding: 10rpx;
+  background: #f5f5f5;
+  margin: 20rpx 0;
+}
+.day text{
+  color: #999;
+  width: 14%;
+  text-align: center;
+}
+.days{
+  display: flex;
+  flex-wrap: wrap;
+  /* justify-content: space-between; */
+}
+.days view{
+  width: 14%;
+  text-align: center;
+  font-weight: 500;
+  height: 96rpx;
+  /* margin-bottom: 10rpx; */
+}
+.days text{
+  display: block;
+  color: #666;
+  font-size: 20rpx;
+  position: relative;
+  top: -5rpx;
+  font-weight: 400;
+}
+.days view view{
+  width: 100% !important;
+}
+.days view view text{
+   color: #fff;
+}
+.down1{
+  background: #07B20B;
+  color: #fff;
+  
+}
+.up1{
+  background: #E90001;
+  color: #fff;
+}
+.logout{
+  width: 100%;
+  line-height: 88rpx;
+  color: #666;
+  font-size: 32rpx;
+  text-align: center;
+  border: 1px solid rgba(224, 224, 224, 1);
+  border-radius: 8rpx;
+  background: #fff;
+}
+
+.comment{
+  padding:  24rpx 0;
+  border-bottom: 1px solid rgba(245, 245, 245, 1);
+}
+.comment image{
+  width: 32rpx;
+  margin-right: 10rpx;
+  position: relative;
+  top: 5rpx;
+}
+.comment text{
+  color: #999;
+  font-size: 28rpx;
+  margin-right: 40rpx;
+}
+
+.info{
+  font-size: 30rpx;
+  /* padding: 10rpx 24rpx;
+  display: flex; */
+}
+/* .info view{
+  color: #666;
+  width: 85%;
+  vertical-align: top;
+} */
+
+.match_ratio{
+  font-size: 30rpx;
+  padding-top: 10rpx;
+}
+
+.up{
+  font-size: 36rpx;
+  color: #E90001 !important;
+  margin-left: 5rpx;
+}
+.down{
+  font-size: 36rpx;
+  color: #07B20B !important;
+  margin-left: 5rpx;
+}

+ 4 - 6
pages/rank/rank.js

@@ -25,11 +25,10 @@ Page({
     // })
     
     $api.getMatchList().then(res=>{
-      let l = res.data.data.length - 1;
       this.setData({
         match:res.data.data,
-        index: l,
-        match_id: res.data.data[l].id
+        index: 0,
+        match_id: res.data.data[0].id
       })
       this.getDate()
     })
@@ -96,11 +95,10 @@ Page({
     
     if (!this.data.datas.groups){
       $api.getMatchList().then(res => {
-        let l = res.data.data.length - 1;
         this.setData({
           match: res.data.data,
-          index: l,
-          match_id: res.data.data[l].id
+          index: 0,
+          match_id: res.data.data[0].id
         })
         this.getDate()
       })

+ 1 - 1
pages/search/search.wxml

@@ -27,7 +27,7 @@
   </picker>
 </view>
 <scroll-view scroll-y='{{true}}' bindscrolltolower='next'>
-  <navigator hover-class="none" url="../today/today?id={{item.match_id}}&user_id={{item.id}}" class="player" wx:for='{{list}}'>
+  <navigator hover-class="none" url="../homepage/homepage?user_id={{item.user_id}}" class="player" wx:for='{{list}}'>
     <view class="name">{{item.username}}  <text>{{item.badge}}</text></view>
     <view class="info" wx:if='{{item.style.length>0}}'>风格:
                 <label class="tag" wx:for='{{item.style}}' wx:for-item='i'>{{i}}</label>

+ 3 - 3
pages/stock/stock.wxml

@@ -9,8 +9,8 @@
 
 <view wx:if='{{id}}'>
   <view class="stock_name">{{info.name}} <text wx:if='{{info.code}}'>{{info.code}}</text>
-  <view wx:if='{{!info.choiced}}' bindtap="choice">加入自选</view>
-  <view wx:else bindtap="delchoice">取消自选</view>
+  <!-- <view wx:if='{{!info.choiced}}' bindtap="choice">加入自选</view>
+  <view wx:else bindtap="delchoice">取消自选</view> -->
   </view>
   <image wx:if='{{info.img}}' mode="withFix" src="{{info.img}}"></image>
   <view wx:if='{{info.desc}}' class="desc">{{info.desc}}</view>
@@ -18,7 +18,7 @@
    <view bindtap="tab"   data-id='1' class="{{cur==1?'act':''}}">今日持仓 {{info.list.length}}<text></text></view>
       <view bindtap="tab" data-id='0' class="{{cur==0?'act':''}}">留言 {{comment_count}} <text></text></view>
      
-      <view bindtap="tab"   data-id='2' class="{{cur==2?'act':''}}">自选 {{myList.length}}<text></text></view>
+      <!-- <view bindtap="tab"   data-id='2' class="{{cur==2?'act':''}}">自选 {{myList.length}}<text></text></view> -->
   </view>
   <scroll-view bindtap="blur"  scroll-y='{{true}}' style="height:calc(100vh - 380rpx);background: #fff;padding: 30rpx;">
     <view class="content" wx:if='{{cur==0}}'>

+ 2 - 2
pages/user/user.wxml

@@ -34,11 +34,11 @@
 
 
       <view class="list" style="padding:0 30rpx;background:#fff;">
-        <navigator hover-class="none"  class="item" url="../choice/choice">
+        <!-- <navigator hover-class="none"  class="item" url="../choice/choice">
             我的自选
               <button class="contactus"></button>
               <image mode="widthFix" src="../../images/right_icon.png"></image>
-        </navigator>
+        </navigator> -->
         <navigator hover-class="none"  class="item" url="../message/message">
             咨询顽主
               <button class="contactus"></button>

+ 3 - 1
utils/api.js

@@ -18,6 +18,7 @@ function request(method, url, data) {
         if (res.data) {
           token = res.data.token
         }
+
         let header = {
           'content-type': 'application/json',
           'Authorization': token
@@ -155,7 +156,8 @@ const API = {
   initfund: (data) => request(PUT, `/api/wx/player/fund`, data),
   getFans: (data) => request(GET, `/api/wx/v3/user/follower/list`, data),
   getExperience: (data) => request(GET, `/api/wx/v3/experience/list`, data),
-  
+  getUserMatch: (data) => request(GET, `/api/wx/v3/user/match/list`, data),
+  getUserInfo: (data) => request(GET, `/api/wx/user/info`, data),
 }; 
 module.exports = {
   API: API