From fcb00a66b4053550b473a29d7299c7a4737eea75 Mon Sep 17 00:00:00 2001
From: lxf <1371462558@qq.com>
Date: Wed, 16 Jul 2025 14:41:04 +0800
Subject: [PATCH] 翻译
---
src/page/perpetualContract/perpetualHistory.vue | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/src/page/perpetualContract/perpetualHistory.vue b/src/page/perpetualContract/perpetualHistory.vue
index ac02bb4..d98927d 100644
--- a/src/page/perpetualContract/perpetualHistory.vue
+++ b/src/page/perpetualContract/perpetualHistory.vue
@@ -86,6 +86,12 @@
</div>
</van-list>
</template>
+
+ <div v-if="type === 'position'">
+ <PerpetualPositionList
+ :list-data="orderHold"
+ ></PerpetualPositionList>
+ </div>
</van-tab>
</van-tabs>
</div>
@@ -96,6 +102,7 @@
import assetsHead from "@/components/assets-head";
import PerpetualEntrustList from "@/components/perpetual-entrust-list/index.vue";
import PerpetualHistoryPosition from "@/components/perpetual-history-position/index.vue";
+import PerpetualPositionList from "@/components/perpetual-position-list/index.vue";
import { _orderListCur, _orderListHold } from "@/API/trade.api";
import { _getCoins } from "@/API/home.api";
import { List, Tab, Tabs, DropdownMenu, DropdownItem } from "vant";
@@ -103,6 +110,7 @@
data() {
return {
type: "orders",
+ orderHold: [], // 永续持有仓位
dataList: {
orders: [],
hisorders: [],
@@ -118,15 +126,32 @@
title: this.$t("历史委托"),
type: "hisorders",
},
+ {
+ title: this.$t("当前持仓"),
+ type: "position",
+ },
],
loading: false,
finished: false,
page: 1,
+ pollTimer: null,
};
},
mounted() {
this.getCoins();
// this.symbol = this.$route.query.symbol;
+ },
+ watch: {
+ type(newVal) {
+ if (newVal === "position") {
+ this.startPolling();
+ } else {
+ this.stopPolling();
+ }
+ },
+ },
+ beforeDestroy() {
+ this.stopPolling();
},
methods: {
getCoins() {
@@ -148,7 +173,25 @@
onClickLeft() {
this.$router.go(-1);
},
+ startPolling() {
+ if (this.pollTimer) return;
+ this.pollTimer = setInterval(() => {
+ this.fetchList(); // 你的轮询方法
+ }, 1500); // 3秒轮询一次,可根据需要调整
+ },
+ stopPolling() {
+ if (this.pollTimer) {
+ clearInterval(this.pollTimer);
+ this.pollTimer = null;
+ }
+ },
async fetchList(symbol) {
+ if (this.type === "position") {
+ _orderListHold().then((data) => {
+ this.orderHold = data;
+ });
+ return;
+ }
const _api = this.type === "orders" ? _orderListCur : _orderListHold;
const type = this.type;
symbol = "";
@@ -181,6 +224,7 @@
components: {
PerpetualEntrustList,
PerpetualHistoryPosition,
+ PerpetualPositionList,
assetsHead,
[DropdownMenu.name]: DropdownMenu,
[DropdownItem.name]: DropdownItem,
--
Gitblit v1.9.3