Selaa lähdekoodia

跟单首页图表

lxf 1 päivä sitten
vanhempi
commit
1405a4a6ba

+ 12 - 3
src/view/copyTrade/marketview/find/components/userList.vue

@@ -45,7 +45,7 @@
             <div class="number">{{ item.profit > 0 ? '+' : '' }} {{ item.init_balance ? (item.profit * 100 / item.init_balance).toFixed(2) : item.profit ? '100.00' : '0.00' }}%</div>
           </div>
           <div class="char-box">
-            <chartView height="35px" :list="chartList" :id="market + item.id" />
+            <chartView v-if="chartLoaded" height="35px" :list="chartListAll[item.eid]" :id="market + item.id" />
           </div>
         </div>
         <div class="box2 flex">
@@ -86,7 +86,8 @@ export default {
   },
   data () {
     return {
-      chartList: ['12', '26', '12', '45'],
+      chartListAll: {},
+      chartLoaded: false
     }
   },
   computed: {
@@ -105,7 +106,15 @@ export default {
         time_start: time_end,
         time_end: time_start,
       }).then(res => {
-        console.log(res)
+        var list = (res.list || []).sort((a, b) => new Date(a.date.replace(/-/g, '/')).getTime() - new Date(b.date.replace(/-/g, '/')).getTime())
+        list.forEach(item => {
+          if (this.chartListAll[item.eid]) {
+            this.chartListAll[item.eid].push(item.profit)
+          } else {
+            this.chartListAll[item.eid] = [item.profit]
+          }
+        })
+        this.chartLoaded = true
       }).catch(() => {})
     }
   }

+ 25 - 3
src/view/copyTrade/marketview/tradingExperts/index.vue

@@ -100,7 +100,7 @@
                 <div class="number">{{ item.profit > 0 ? '+' : '' }} {{ item.init_balance ? (item.profit * 100 / item.init_balance).toFixed(2) : item.profit ? '100.00' : '0.00' }}%</div>
               </div>
               <div class="char-box">
-                <chartView height="35px" :smooth="false" :list="chartList" :id="'ul' + item" />
+                <chartView v-if="chartLoaded && chartLoaded<= pageNum" :list="chartListAll[item.eid]" height="35px" :smooth="false" :id="'ul' + item.eid" />
               </div>
             </div>
             <div class="box2 flex">
@@ -131,7 +131,7 @@
 </template>
 <script>
 import { mapGetters } from "vuex";
-import { getExpertList } from "@/api/copy";
+import { getExpertList, getExpertTradeListByDayGroup } from "@/api/copy";
 import chartView from "../components/chart.vue";
 export default {
   props: ['market'],
@@ -140,7 +140,8 @@ export default {
   },
   data () {
     return {
-      chartList: ['12', '26', '12', '45'],
+      chartListAll: {},
+      chartLoaded: null,
       loading: false,
       finished: false,
       refreshing: false,
@@ -201,6 +202,7 @@ export default {
         } else {
           this.list = this.list.concat(list);
         }
+        this.getExpertTradeListByDayGroup(list)
         this.loading = false;
         if (res.endRow == res.total) {
           this.finished = true;
@@ -225,6 +227,26 @@ export default {
         }
       })
       return html
+    },
+    getExpertTradeListByDayGroup(lists) {
+      var time_start = new Date().getTime()
+      var time_end = new Date()
+      time_end = time_end.setDate(time_end.getDate()-30);
+      getExpertTradeListByDayGroup({
+        eidList: JSON.stringify(lists.map(item => item.eid)),
+        time_start: time_end,
+        time_end: time_start,
+      }).then(res => {
+        var list = (res.list || []).sort((a, b) => new Date(a.date.replace(/-/g, '/')).getTime() - new Date(b.date.replace(/-/g, '/')).getTime())
+        list.forEach(item => {
+          if (this.chartListAll[item.eid]) {
+            this.chartListAll[item.eid].push(item.profit)
+          } else {
+            this.chartListAll[item.eid] = [item.profit]
+          }
+        })
+        this.chartLoaded = this.pageNum
+      }).catch(() => {})
     }
   }
 }

+ 1 - 1
src/view/copyTrade/myCopy/orderView/components/openList.vue

@@ -15,7 +15,7 @@
         <div class="price flex">
           <div>{{ $handleDigits(item.open_price, productDataObj[item.symbol] ? productDataObj[item.symbol].digits : 2) }}</div>
           &gt;
-          <div v-if="productDataObj[item.symbol]" :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ $handleDigits(item.cmd == 0 ? productDataObj[item.symbol].sell : productDataObj[item.symbol].buy, productDataObj[item.symbol].digits) }}</div>
+          <div v-if="productDataObj[item.symbol]" :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ $handleDigits((item.cmd == 0 ? productDataObj[item.symbol].sell : productDataObj[item.symbol].buy) || item.close_price, productDataObj[item.symbol].digits) }}</div>
         </div>
         <div class="time flex">
           <div>{{ item.open_time.replace(/-/g, '/') }}</div>

+ 1 - 1
src/view/copyTrade/tradeDetail/orderView/components/openList.vue

@@ -15,7 +15,7 @@
         <div class="price flex">
           <div>{{ $handleDigits(item.open_price, productDataObj[item.symbol] ? productDataObj[item.symbol].digits : 2) }}</div>
           &gt;
-          <div v-if="productDataObj[item.symbol]" :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ $handleDigits(item.cmd == 0 ? productDataObj[item.symbol].sell : productDataObj[item.symbol].buy, productDataObj[item.symbol].digits) }}</div>
+          <div v-if="productDataObj[item.symbol]" :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ $handleDigits((item.cmd == 0 ? productDataObj[item.symbol].sell : productDataObj[item.symbol].buy) || item.close_price, productDataObj[item.symbol].digits) }}</div>
         </div>
         <div class="time flex">
           <div>{{ item.open_time.replace(/-/g, '/') }}</div>