tanyanfei 3 år sedan
förälder
incheckning
e8fb08999d

+ 3 - 7
pages/day/day.js

@@ -15,10 +15,6 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-    id = options.id
-    this.setData({
-      id: id
-    })
     wx.showNavigationBarLoading()
     /**获取token */
     wx.getStorage({
@@ -27,7 +23,7 @@ Page({
         this.setData({
           userInfo: res.data
         })
-        this.getData(options.id);
+        this.getData(options.id, options.player_id);
       },
       fail: error => {
         //跳转到登陆页面
@@ -37,10 +33,10 @@ Page({
       }
     })
   },
-  getData(id) {
+  getData(id, player_id) {
     wx.request({
       url: host + '/api/wx/player/match/record/list',
-      data: { id: id },
+      data: { id: id, player_id: player_id},
       header: {
         'Authorization': this.data.userInfo.token
       },

+ 5 - 2
pages/day/day.wxml

@@ -13,9 +13,12 @@
     <view class="item">
         <text class="tag blue">持仓</text>
         <view class="list">
-            <view wx:for='{{item.today_stock}}' wx:for-item='stock'>
-            {{stock.name}}  <text>{{stock.fund}}万</text></view>
+            
             <view wx:if='{{item.is_markt}}'>已开超市</view>
+            <block wx:else>
+                <view wx:for='{{item.today_stock}}' wx:for-item='stock'>
+              {{stock.name}}  <text wx:if='{{stock.fund}}'>{{stock.fund}}万</text></view>
+            </block>
         </view>
     </view>
 </navigator>

+ 10 - 6
pages/detail/detail.wxml

@@ -20,14 +20,18 @@
 <view class="part">
   <text class="tag blue">昨日持股</text>
   <view class="list">
-      <view wx:for='{{datas.yesterday_stock}}' wx:for-item='stock'>
-            {{stock.name}}  <text>{{stock.fund}}w</text>
-      </view>
+        <!-- <view wx:if='{{item.is_markt}}'>已开超市</view> -->
+        <!-- <block wx:else> -->
+            <view wx:for='{{datas.yesterday_stock}}' wx:for-item='stock' >
+            {{stock.name}}  <text wx:if='{{stock.fund}}'>{{stock.fund}}万</text></view>
+        <!-- </block>   -->
   </view>
   <text class="tag blue">今日持股</text>
   <view class="list">
-      <view wx:for='{{datas.today_stock}}' wx:for-item='stock'>
-            {{stock.name}}  <text>{{stock.fund}}w</text>
-      </view>
+      <!-- <view wx:if='{{item.is_markt}}'>已开超市</view> -->
+        <!-- <block wx:else> -->
+            <view wx:for='{{datas.today_stock}}' wx:for-item='stock' >
+            {{stock.name}}  <text wx:if='{{stock.fund}}'>{{stock.fund}}万</text></view>
+        <!-- </block> -->
   </view>
 </view>

+ 22 - 8
pages/gameDetail/gameDetail.js

@@ -2,7 +2,7 @@ import * as echarts from '../../ec-canvas/echarts';
 
 const app = getApp();
 var host = app.globalData.host;
-var id;
+var id, record_id;
 
 Page({
   onShareAppMessage: function (res) {
@@ -20,9 +20,10 @@ Page({
   },
 
   onLoad(options) {
-    id=options.id
+    id = options.id, record_id = options.record_id
     this.setData({
-      id:id
+      id:id,
+      record_id: record_id
     })
     wx.showNavigationBarLoading()
     /**获取token */
@@ -32,7 +33,7 @@ Page({
         this.setData({
           userInfo: res.data
         })
-        this.getData(options.id);
+        this.getData(id, record_id);
       },
       fail: error => {
         //跳转到登陆页面
@@ -42,10 +43,17 @@ Page({
       }
     })
   },
-  getData(id) {
+  getData(id, record_id) {
+    var data={}
+    if(id){
+      data.id=id
+    }
+    if (record_id) {
+      data.record_id = record_id
+    }
     wx.request({
       url: host + '/api/wx/player/match',
-      data: { id: id },
+      data: data,
       header: {
         'Authorization': this.data.userInfo.token
       },
@@ -68,14 +76,20 @@ Page({
 
 /**折线图 */
 function initChart(canvas, width, height, dpr) {
-
+  var data = {}
+  if (id) {
+    data.id = id
+  }
+  if (record_id) {
+    data.record_id = record_id
+  }
   wx.getStorage({
     key: 'userInfo',
     success: res => {
       var info = res.data
       wx.request({
         url: host + '/api/wx/player/match',
-        data:{id:id},
+        data: data,
         header: {
           'Authorization': info.token
         },

+ 2 - 2
pages/gameDetail/gameDetail.wxml

@@ -1,7 +1,7 @@
 <view class="part detail">
     <view><text>参赛名称</text>{{datas.match.name}}</view>
     <view><text>参赛日期</text>{{datas.match.start_time}} 至 {{datas.match.end_time}}</view>
-    <view><text>参赛名</text><open-data  type="userNickName"></open-data></view>
+    <view><text>参赛名</text>{{datas.today_record.username}}</view>
     <view><text>参赛组</text>{{datas.match.groups}}</view>
 </view>
 <view class="part info" wx:if='{{datas.today_record}}'>
@@ -16,5 +16,5 @@
       <ec-canvas id="mychart-dom-line" canvas-id="mychart-line" ec="{{ ec }}">
       </ec-canvas>
   </view>
-  <navigator url="../day/day?id={{id}}" class="per">每日持股</navigator>
+  <navigator url="../day/day?id={{id}}&player_id={{datas.today_record.player_id}}" class="per">每日持股</navigator>
 </view>

+ 4 - 2
pages/index/index.wxml

@@ -25,9 +25,11 @@
     <view class="item">
         <text class="tag blue">持仓</text>
         <view class="list">
-            <view wx:for='{{item.today_stock}}' wx:for-item='stock'>
+        <view wx:if='{{item.is_markt}}'>已开超市</view>
+        <block wx:else>
+            <view wx:for='{{item.today_stock}}' wx:for-item='stock' >
             {{stock.name}}  <text>{{stock.fund}}万</text></view>
-            <view wx:if='{{item.is_markt}}'>已开超市</view>
+        </block>
         </view>
     </view>
 </navigator>

+ 3 - 3
pages/rank/rank.wxml

@@ -10,8 +10,8 @@
           查看更多  <image mode="widthFix" src="../images/right_icon.png"></image>
         </navigator>
     </view> 
-    <view class="item" wx:for='{{item.players}}' 
-    wx:for-index='i' wx:for-item='player'>
+    <navigator class="item" wx:for='{{item.players}}' 
+    wx:for-index='i' wx:for-item='player'  url="../gameDetail/gameDetail?id={{item.match_id}}&record_id={{player.id}}">
         <image wx:if='{{i==0}}' mode="widthFix" src="../images/1.png"></image>
         <image wx:if='{{i==1}}' mode="widthFix" src="../images/2.png"></image>
         <image wx:if='{{i==2}}' mode="widthFix" src="../images/3.png"></image>
@@ -19,6 +19,6 @@
         <text>{{player.fund}}万</text>
         <text>{{player.today_fund}}万</text>
         <text  class="{{player.total_income[0]=='-'?'down':'up'}}">{{player.total_income}}</text>
-    </view>
+    </navigator>
 </view>