From 90dcbbc06eb2dce7d6fd6a7923f149f1f35c9361 Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Thu, 18 Apr 2024 23:45:57 +0800
Subject: [PATCH] first

---
 src/i18n/kor.json                        |    4 
 src/i18n/en.json                         |    4 
 src/components/contract-header/index.vue |    8 
 src/components/list-quotation/index.vue  |   14 
 src/i18n/spa.json                        |    4 
 src/i18n/jp.json                         |    4 
 src/page/perpetualContract/index.vue     | 1249 ++++++++++++++++++++++++++++++------------------------
 src/components/trade-head/index.vue      |    9 
 src/i18n/de.json                         |    4 
 src/i18n/vie.json                        |    4 
 src/i18n/zh.json                         |    2 
 src/i18n/cht.json                        |    4 
 src/i18n/it.json                         |    4 
 src/i18n/th.json                         |    4 
 src/i18n/id.json                         |    4 
 src/i18n/ara.json                        |    4 
 src/i18n/fra.json                        |    4 
 17 files changed, 748 insertions(+), 582 deletions(-)

diff --git a/src/components/contract-header/index.vue b/src/components/contract-header/index.vue
index 826a3d4..a02afb5 100644
--- a/src/components/contract-header/index.vue
+++ b/src/components/contract-header/index.vue
@@ -86,7 +86,13 @@
           @click="onRoute(item)"
         >
           <div>
-            <div class="textColor">{{ item.name }}</div>
+            <div class="textColor">
+              {{
+                item.name
+                  ? item.symbol.toUpperCase() + "/" + item.name.split("/")[1]
+                  : "--"
+              }}
+            </div>
             <div class="text-grey mt-10">
               {{ selectIndex == 1 ? $t("永续") : $t("交割") }}
             </div>
diff --git a/src/components/list-quotation/index.vue b/src/components/list-quotation/index.vue
index 004c60a..e810fac 100644
--- a/src/components/list-quotation/index.vue
+++ b/src/components/list-quotation/index.vue
@@ -73,10 +73,8 @@
                       {{ (item.symbol && item.symbol.toUpperCase()) || "--" }}
                     </span>
                     <span class="font-24" style="position: relative; top: 1px">
-                      {{
-                        (item.name &&
-                          item.name.replace(item.symbol.toUpperCase(), "")) ||
-                        "--"
+                      /{{
+                        (item.name && item.name.split("/")[1]) || "--"
                       }}</span
                     >
                   </span>
@@ -138,12 +136,8 @@
                       (item.symbol && item.symbol.toUpperCase()) || "--"
                     }}</span>
                     <span class="font-24" style="position: relative; top: 1px">
-                      {{
-                        (item.name &&
-                          item.name.replace(item.symbol.toUpperCase(), "")) ||
-                        "--"
-                      }}</span
-                    >
+                      /{{ (item.name && item.name.split("/")[1]) || "--" }}
+                    </span>
                   </span>
                   <span class="font-24 textNew1">{{
                     $t("成交量") + " " + (item.amount * 1).toFixed(2)
diff --git a/src/components/trade-head/index.vue b/src/components/trade-head/index.vue
index 059a6fb..e2e9fab 100644
--- a/src/components/trade-head/index.vue
+++ b/src/components/trade-head/index.vue
@@ -97,7 +97,14 @@
           @click="onRoute(item)"
         >
           <div>
-            <div class="font-700 textColor">{{ item.name || "--" }}</div>
+            <!-- {{ JSON.stringify(item) }} -->
+            <div class="font-700 textColor">
+              {{
+                item.name
+                  ? item.symbol.toUpperCase() + "/" + item.name.split("/")[1]
+                  : "--"
+              }}
+            </div>
             <div v-if="!kineType" class="text-grey mt-10">{{ title }}</div>
           </div>
           <div class="text-right">
diff --git a/src/i18n/ara.json b/src/i18n/ara.json
index 37c2302..c17a524 100644
--- a/src/i18n/ara.json
+++ b/src/i18n/ara.json
@@ -1936,5 +1936,7 @@
   "下载APP": "تحميل التطبيق",
   "邀请好友一起赚钱": "دعوة الأصدقاء لكسب المال معا",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "من فضلك لا تكشف عن كلمة السر الخاصة بك ، والرسائل القصيرة ، جوجل رمز التحقق إلى أي شخص ، بما في ذلك تبادل الموظفين .",
-  "设置": "ضبط"
+  "设置": "ضبط",
+  "直播": "بث مباشر",
+  "比赛": "مسابقات"
 }
\ No newline at end of file
diff --git a/src/i18n/cht.json b/src/i18n/cht.json
index feeef25..02219cf 100644
--- a/src/i18n/cht.json
+++ b/src/i18n/cht.json
@@ -1940,5 +1940,7 @@
   "下载APP": "下載APP",
   "邀请好友一起赚钱": "邀請好友一起賺錢",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "請不要向任何人透露密碼、簡訊和穀歌驗證碼,包括交易所工作人員。",
-  "设置": "設定"
+  "设置": "設定",
+  "直播": "直播",
+  "比赛": "比賽"
 }
\ No newline at end of file
diff --git a/src/i18n/de.json b/src/i18n/de.json
index 7980dc3..6e115b5 100644
--- a/src/i18n/de.json
+++ b/src/i18n/de.json
@@ -1937,5 +1937,7 @@
   "下载APP": "APP herunterladen",
   "邀请好友一起赚钱": "Freunde einladen, gemeinsam Geld zu verdienen",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "Bitte geben Sie Passwörter, Textnachrichten und Google-Verifizierungscodes niemandem weiter, einschließlich Tauschpersonal.",
-  "设置": "einrichten"
+  "设置": "einrichten",
+  "直播": "Direktsaat",
+  "比赛": "Wettbewerb"
 }
\ No newline at end of file
diff --git a/src/i18n/en.json b/src/i18n/en.json
index b68ccdc..971ab99 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -1949,5 +1949,7 @@
   "下载APP": "Download APP",
   "邀请好友一起赚钱": "Inviting friends to make money together",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "Please do not disclose passwords, text messages, and Google verification codes to anyone, including exchange staff.",
-  "设置": "set up"
+  "设置": "set up",
+  "直播": "direct seeding",
+  "比赛": "competition"
 }
\ No newline at end of file
diff --git a/src/i18n/fra.json b/src/i18n/fra.json
index a2024be..4da8456 100644
--- a/src/i18n/fra.json
+++ b/src/i18n/fra.json
@@ -2054,5 +2054,7 @@
   "下载APP": "Télécharger l'app",
   "邀请好友一起赚钱": "Inviter des amis à gagner de l'argent ensemble",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "S'il vous plaît ne pas divulguer les mots de passe, les SMS et les codes de vérification Google à quiconque, y compris le personnel d'échange.",
-  "设置": "Paramètres"
+  "设置": "Paramètres",
+  "直播": "En direct",
+  "比赛": "Compétition"
 }
\ No newline at end of file
diff --git a/src/i18n/id.json b/src/i18n/id.json
index 234866b..be0039d 100644
--- a/src/i18n/id.json
+++ b/src/i18n/id.json
@@ -2135,5 +2135,7 @@
   "下载APP": "Unduh APLIKASI",
   "设置": "pengaturan",
   "邀请好友一起赚钱": "Undang teman untuk menghasilkan uang bersama",
-  "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "Tolong jangan ungkapkan sandi, pesan teks, dan kode verifikasi Google kepada siapa pun, termasuk staf bursa."
+  "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "Tolong jangan ungkapkan sandi, pesan teks, dan kode verifikasi Google kepada siapa pun, termasuk staf bursa.",
+  "直播": "Siaran langsung",
+  "比赛": "lomba"
 }
\ No newline at end of file
diff --git a/src/i18n/it.json b/src/i18n/it.json
index 94a1b5a..acc1545 100644
--- a/src/i18n/it.json
+++ b/src/i18n/it.json
@@ -2125,5 +2125,7 @@
   "下载APP": "Scarica APP",
   "邀请好友一起赚钱": "Invitare gli amici a fare soldi insieme",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "Si prega di non divulgare password, messaggi di testo e codici di verifica di Google a nessuno, incluso il personale di scambio.",
-  "设置": "istituito"
+  "设置": "istituito",
+  "直播": "semina diretta",
+  "比赛": "concorrenza"
 }
\ No newline at end of file
diff --git a/src/i18n/jp.json b/src/i18n/jp.json
index fe12f7f..ad07709 100644
--- a/src/i18n/jp.json
+++ b/src/i18n/jp.json
@@ -1954,5 +1954,7 @@
   "下载APP": "APPのダウンロード",
   "邀请好友一起赚钱": "友達を誘って一緒にお金を稼ぐ",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "取引所の従業員を含むパスワード、メール、グーグルの認証コードを誰にも明かさないでください。",
-  "设置": "設定#セッテイ#"
+  "设置": "設定#セッテイ#",
+  "直播": "生放送",
+  "比赛": "と同じものを見つける"
 }
\ No newline at end of file
diff --git a/src/i18n/kor.json b/src/i18n/kor.json
index 938f1a2..29db0da 100644
--- a/src/i18n/kor.json
+++ b/src/i18n/kor.json
@@ -1967,5 +1967,7 @@
   "下载APP": "APP 다운로드",
   "邀请好友一起赚钱": "친구를 초대하여 함께 돈을 벌다",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "거래소 직원을 포함하여 암호, 문자 메시지 및 구글 인증 코드를 누구에게도 공개하지 마십시오.",
-  "设置": "설치"
+  "设置": "설치",
+  "直播": "생방송",
+  "比赛": "경기"
 }
\ No newline at end of file
diff --git a/src/i18n/spa.json b/src/i18n/spa.json
index a4ac66b..bb9be5c 100644
--- a/src/i18n/spa.json
+++ b/src/i18n/spa.json
@@ -1941,5 +1941,7 @@
   "下载APP": "Descargar la aplicación",
   "邀请好友一起赚钱": "Invitar a amigos a ganar dinero juntos",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "Por favor, no revele contraseñas, mensajes de texto y códigos de verificación de Google a nadie, incluido el personal de la bolsa.",
-  "设置": "Configuración"
+  "设置": "Configuración",
+  "直播": "Transmisión en vivo",
+  "比赛": "Partido"
 }
\ No newline at end of file
diff --git a/src/i18n/th.json b/src/i18n/th.json
index a5a0d04..6909aa5 100644
--- a/src/i18n/th.json
+++ b/src/i18n/th.json
@@ -1949,5 +1949,7 @@
   "下载APP": "ดาวน์โหลด APP",
   "邀请好友一起赚钱": "ชวนเพื่อนมาทำเงินด้วยกัน",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "กรุณาอย่าเปิดเผยรหัสผ่าน SMS และ Google Captcha รวมถึงพนักงานแลกเปลี่ยน",
-  "设置": "การตั้งค่า"
+  "设置": "การตั้งค่า",
+  "直播": "ถ่ายทอดสด",
+  "比赛": "การแข่งขัน"
 }
\ No newline at end of file
diff --git a/src/i18n/vie.json b/src/i18n/vie.json
index 1e9837f..820231a 100644
--- a/src/i18n/vie.json
+++ b/src/i18n/vie.json
@@ -1951,5 +1951,7 @@
   "下载APP": "Tải app",
   "邀请好友一起赚钱": "Mời bạn bè cùng kiếm tiền",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "Vui lòng không tiết lộ mật khẩu, tin nhắn văn bản và mã xác minh Google cho bất kỳ ai, bao gồm cả nhân viên trao đổi.",
-  "设置": "Thiết lập"
+  "设置": "Thiết lập",
+  "直播": "Phát sóng trực tiếp",
+  "比赛": "Giải đấu"
 }
\ No newline at end of file
diff --git a/src/i18n/zh.json b/src/i18n/zh.json
index 2ad4e7c..aa24bd9 100644
--- a/src/i18n/zh.json
+++ b/src/i18n/zh.json
@@ -1933,6 +1933,8 @@
   "下载APP": "下载APP",
   "安全": "安全",
   "设置": "设置",
+  "直播": "直播",
+  "比赛": "比赛",
   "邀请好友一起赚钱": "邀请好友一起赚钱",
   "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。"
 }
\ No newline at end of file
diff --git a/src/page/perpetualContract/index.vue b/src/page/perpetualContract/index.vue
index 0230dc6..4b74e0a 100644
--- a/src/page/perpetualContract/index.vue
+++ b/src/page/perpetualContract/index.vue
@@ -1,524 +1,656 @@
 <template>
-    <div :key="symbol" class="pb-108 no_touch">
-        <!-- 头部区 -->
-        <ContractHeader  v-if="symbol === 'wld'" :symbol="'FTB'" :range="range" :selectIndex="selectIndex" :balance="userInfo.balance"
-            @tab="onTopTab" @update-coin="onUpdate">
-        </ContractHeader>
-		<ContractHeader  v-else-if="symbol === 'mln'" :symbol="'DKL'" :range="range" :selectIndex="selectIndex" :balance="userInfo.balance"
-		    @tab="onTopTab" @update-coin="onUpdate">
-		</ContractHeader>
-		<ContractHeader  v-else-if="symbol === 'qtum'" :symbol="'BQHN'" :range="range" :selectIndex="selectIndex" :balance="userInfo.balance"
-		    @tab="onTopTab" @update-coin="onUpdate">
-		</ContractHeader>
-		<ContractHeader  v-else-if="symbol === 'knc'" :symbol="'XCM'" :range="range" :selectIndex="selectIndex" :balance="userInfo.balance"
-		    @tab="onTopTab" @update-coin="onUpdate">
-		</ContractHeader>
-		<ContractHeader  v-else-if="symbol === 'vet'" :symbol="'ACG'" :range="range" :selectIndex="selectIndex" :balance="userInfo.balance"
-		    @tab="onTopTab" @update-coin="onUpdate">
-		</ContractHeader>
-		<ContractHeader  v-else :symbol="symbol" :range="range" :selectIndex="selectIndex" :balance="userInfo.balance"
-		    @tab="onTopTab" @update-coin="onUpdate">
-		</ContractHeader>
+  <div :key="symbol" class="pb-108 no_touch">
+    <!-- 头部区 -->
+    <ContractHeader
+      v-if="symbol === 'wld'"
+      :symbol="'FTB'"
+      :range="range"
+      :selectIndex="selectIndex"
+      :balance="userInfo.balance"
+      @tab="onTopTab"
+      @update-coin="onUpdate"
+    >
+    </ContractHeader>
+    <ContractHeader
+      v-else-if="symbol === 'mln'"
+      :symbol="'DKL'"
+      :range="range"
+      :selectIndex="selectIndex"
+      :balance="userInfo.balance"
+      @tab="onTopTab"
+      @update-coin="onUpdate"
+    >
+    </ContractHeader>
+    <ContractHeader
+      v-else-if="symbol === 'qtum'"
+      :symbol="'BQHN'"
+      :range="range"
+      :selectIndex="selectIndex"
+      :balance="userInfo.balance"
+      @tab="onTopTab"
+      @update-coin="onUpdate"
+    >
+    </ContractHeader>
+    <ContractHeader
+      v-else-if="symbol === 'knc'"
+      :symbol="'XCM'"
+      :range="range"
+      :selectIndex="selectIndex"
+      :balance="userInfo.balance"
+      @tab="onTopTab"
+      @update-coin="onUpdate"
+    >
+    </ContractHeader>
+    <ContractHeader
+      v-else-if="symbol === 'vet'"
+      :symbol="'ACG'"
+      :range="range"
+      :selectIndex="selectIndex"
+      :balance="userInfo.balance"
+      @tab="onTopTab"
+      @update-coin="onUpdate"
+    >
+    </ContractHeader>
+    <ContractHeader
+      v-else
+      :symbol="symbol"
+      :range="range"
+      :selectIndex="selectIndex"
+      :balance="userInfo.balance"
+      @tab="onTopTab"
+      @update-coin="onUpdate"
+    >
+    </ContractHeader>
 
-        <div :class="{ slide2: animated1 }" v-if="selectIndex === 1">
-            <div class="mainBackground" key="x">
-                <PerpetualOpen class="pl-30 pr-30" :key="keyIndex + 'a'" :selectIndex="selectIndex" :symbol="symbol"
-                    :green-data="bids" :red-data="asks" :price="price" :init-open="initOpen" :init-close="initClose"
-                    :init-futrue="initFutrue" @ordered="onOrdered" :currentType="currentType"
-                    @changeCurrentType="changeCurrentType" @changeValueBack="changeValueBack">
-                </PerpetualOpen>
-                <!-- <div class="line"></div> -->
-                <PerpetualOrder class="pl-30 pr-30" :key="keyIndex + 'b'" :symbol="symbol" :order-cur="orderCur"
-                    :order-hold="orderHold" :topIndex="selectIndex" :futrue-hold="futrueHold"
-                    :futrue-histroy="futrueHistroy" @tab="onTab" @recall="onRecall">
-                </PerpetualOrder>
-            </div>
-        </div>
-        <div :class="{ slide1: animated2 }" v-else>
-            <div class="mainBackground" key="y">
-                <PerpetualOpen class="pl-30 pr-30" :key="keyIndex + 'c'" :selectIndex="selectIndex" :symbol="symbol"
-                    :green-data="bids" :red-data="asks" :price="price" :init-open="initOpen" :init-close="initClose"
-                    :init-futrue="initFutrue" @ordered="onOrdered" @changeValueBack="changeValueBack">
-                </PerpetualOpen>
-                <div class="line"></div>
-                <!-- 委托/持仓-->
-                <PerpetualOrder class="pl-30 pr-30" :key="keyIndex + 'd'" :symbol="symbol" :order-cur="orderCur"
-                    :order-hold="orderHold" :price="price" :topIndex="selectIndex" :futrue-hold="futrueHold"
-                    :futrue-histroy="futrueHistroy" @tab="onTab" @recall="onRecall">
-                </PerpetualOrder>
-            </div>
-        </div>
-        <div class="fixed w-full shadow z-10 tabBackground1">
-            <div class="flex justify-between px-30 py-10">
-				<span class="font-24 textColor2"v-if="symbol === 'wld'">FTB/USDT&nbsp;{{ $t('k线图表') }}</span>
-				<span class="font-24 textColor2"v-else-if="symbol === 'mln'">DKL/USDT&nbsp;{{ $t('k线图表') }}</span>
-				<span class="font-24 textColor2"v-else-if="symbol === 'qtum'">BQHN/USDT&nbsp;{{ $t('k线图表') }}</span>
-				<span class="font-24 textColor2"v-else-if="symbol === 'knc'">XCM/USDT&nbsp;{{ $t('k线图表') }}</span>
-				<span class="font-24 textColor2"v-else-if="symbol === 'vet'">ACG/USDT&nbsp;{{ $t('k线图表') }}</span>
-                <span class="font-24 textColor2" v-else>{{ symbol.toUpperCase() }}/USDT&nbsp;{{ $t('k线图表') }}</span>
-                <van-icon class="textColor" @click.stop="showCharts = !showCharts"
-                    :name="showCharts ? 'arrow-down' : 'arrow-up'"></van-icon>
-            </div>
-            <k-line-charts :update-key="updateKey" :update-data="quote" :symbol="symbol" v-if="symbol && showCharts"
-                :showBottom="false" />
-        </div>
+    <div :class="{ slide2: animated1 }" v-if="selectIndex === 1">
+      <div class="mainBackground" key="x">
+        <PerpetualOpen
+          class="pl-30 pr-30"
+          :key="keyIndex + 'a'"
+          :selectIndex="selectIndex"
+          :symbol="symbol"
+          :green-data="bids"
+          :red-data="asks"
+          :price="price"
+          :init-open="initOpen"
+          :init-close="initClose"
+          :init-futrue="initFutrue"
+          @ordered="onOrdered"
+          :currentType="currentType"
+          @changeCurrentType="changeCurrentType"
+          @changeValueBack="changeValueBack"
+        >
+        </PerpetualOpen>
+        <!-- <div class="line"></div> -->
+        <PerpetualOrder
+          class="pl-30 pr-30"
+          :key="keyIndex + 'b'"
+          :symbol="symbol"
+          :order-cur="orderCur"
+          :order-hold="orderHold"
+          :topIndex="selectIndex"
+          :futrue-hold="futrueHold"
+          :futrue-histroy="futrueHistroy"
+          @tab="onTab"
+          @recall="onRecall"
+        >
+        </PerpetualOrder>
+      </div>
     </div>
+    <div :class="{ slide1: animated2 }" v-else>
+      <div class="mainBackground" key="y">
+        <PerpetualOpen
+          class="pl-30 pr-30"
+          :key="keyIndex + 'c'"
+          :selectIndex="selectIndex"
+          :symbol="symbol"
+          :green-data="bids"
+          :red-data="asks"
+          :price="price"
+          :init-open="initOpen"
+          :init-close="initClose"
+          :init-futrue="initFutrue"
+          @ordered="onOrdered"
+          @changeValueBack="changeValueBack"
+        >
+        </PerpetualOpen>
+        <div class="line"></div>
+        <!-- 委托/持仓-->
+        <PerpetualOrder
+          class="pl-30 pr-30"
+          :key="keyIndex + 'd'"
+          :symbol="symbol"
+          :order-cur="orderCur"
+          :order-hold="orderHold"
+          :price="price"
+          :topIndex="selectIndex"
+          :futrue-hold="futrueHold"
+          :futrue-histroy="futrueHistroy"
+          @tab="onTab"
+          @recall="onRecall"
+        >
+        </PerpetualOrder>
+      </div>
+    </div>
+    <div class="fixed w-full shadow z-10 tabBackground1">
+      <div class="flex justify-between px-30 py-10">
+        <span class="font-24 textColor2" v-if="symbol === 'wld'"
+          >FTB/USDT&nbsp;{{ $t("k线图表") }}</span
+        >
+        <span class="font-24 textColor2" v-else-if="symbol === 'mln'"
+          >DKL/USDT&nbsp;{{ $t("k线图表") }}</span
+        >
+        <span class="font-24 textColor2" v-else-if="symbol === 'qtum'">
+          BQHN/USDT&nbsp;{{ $t("k线图表") }}
+        </span>
+        <span class="font-24 textColor2" v-else-if="symbol === 'knc'"
+          >XCM/USDT&nbsp;{{ $t("k线图表") }}</span
+        >
+        <span class="font-24 textColor2" v-else-if="symbol === 'vet'"
+          >ACG/USDT&nbsp;{{ $t("k线图表") }}</span
+        >
+        <span class="font-24 textColor2" v-else
+          >{{ symbol.toUpperCase() }}/USDT&nbsp;{{ $t("k线图表") }}</span
+        >
+        <van-icon
+          class="textColor"
+          @click.stop="showCharts = !showCharts"
+          :name="showCharts ? 'arrow-down' : 'arrow-up'"
+        ></van-icon>
+      </div>
+      <k-line-charts
+        :update-key="updateKey"
+        :update-data="quote"
+        :symbol="symbol"
+        v-if="symbol && showCharts"
+        :showBottom="false"
+      />
+    </div>
+  </div>
 </template>
 
 <script>
-import ContractHeader from '@/components/contract-header/index.vue'
-import PerpetualOpen from '@/components/perpetual-open/index.vue'
-import PerpetualOrder from '@/components/perpetual-order/index.vue'
+import ContractHeader from "@/components/contract-header/index.vue";
+import PerpetualOpen from "@/components/perpetual-open/index.vue";
+import PerpetualOrder from "@/components/perpetual-order/index.vue";
 
-import { _getBalance, _getDeepData, _initOpen, _initClose, _orderListCur, _orderListHold, _futrueOrderInit, _futrueOrderList } from '@/API/trade.api'
-import { _getHomeList } from '@/API/home.api'
-import { Popup, Swipe, SwipeItem } from 'vant';
-import { mapActions, mapGetters } from 'vuex'
-import { SET_COIN_LIST } from '@/store/const.store'
-import { WS_URL } from '@/config'
-import { getStorage } from '@/utils/utis'
-import KLineCharts from '@/components/kline-charts'
-var showLength = 7
+import {
+  _getBalance,
+  _getDeepData,
+  _initOpen,
+  _initClose,
+  _orderListCur,
+  _orderListHold,
+  _futrueOrderInit,
+  _futrueOrderList,
+} from "@/API/trade.api";
+import { _getHomeList } from "@/API/home.api";
+import { Popup, Swipe, SwipeItem } from "vant";
+import { mapActions, mapGetters } from "vuex";
+import { SET_COIN_LIST } from "@/store/const.store";
+import { WS_URL } from "@/config";
+import { getStorage } from "@/utils/utis";
+import KLineCharts from "@/components/kline-charts";
+var showLength = 7;
 export default {
-    name: "perpetualContract",
-    components: {
-        ContractHeader,
-        PerpetualOpen,
-        PerpetualOrder,
-        [Popup.name]: Popup,
-        [Swipe.name]: Swipe,
-        [SwipeItem.name]: SwipeItem,
-        KLineCharts
+  name: "perpetualContract",
+  components: {
+    ContractHeader,
+    PerpetualOpen,
+    PerpetualOrder,
+    [Popup.name]: Popup,
+    [Swipe.name]: Swipe,
+    [SwipeItem.name]: SwipeItem,
+    KLineCharts,
+  },
+  computed: {
+    ...mapGetters("user", ["userInfo"]),
+    ...mapGetters({
+      coinList: "home/coinList",
+    }),
+  },
+  watch: {
+    selectIndex(val) {
+      showLength = 7;
     },
-    computed: {
-        ...mapGetters('user', ['userInfo']),
-        ...mapGetters({
-            coinList: 'home/coinList',
-        }),
+  },
+  data() {
+    const initArr = [];
+    for (let i = 0; i < showLength; i++) {
+      initArr.push({
+        amount: "--",
+        price: "--",
+      });
+    }
+    return {
+      quote: {},
+      initTimer: null,
+      keyIndex: 0,
+      timeout: null,
+      timer: null, // 底部持仓等的公用定时器
+      timer1: null, // tab切换动画
+      timer2: null, // 交割合约底部持仓等的公用定时器
+      balance: 0,
+      symbol: "",
+      price: "",
+      range: "",
+      stop_price_profit: "",
+      stop_price_loss: "",
+      initOpen: {},
+      initClose: {},
+      asks: initArr, // 卖单
+      bids: initArr, // 买单
+      orderCur: [], // 当前委托
+      orderHold: [], // 持有仓位
+      futrueHold: [], // 交割持仓
+      futrueHistroy: [], // 交割历史
+      sockets: {
+        quotes: null, // 行情
+        deep: null, /// 深度
+      },
+      curTab: "", // 当前委托还是持有仓位
+      selectIndex: 1, // 当前tab
+      initFutrue: {}, /// 交割合约
+      show: false, // popup
+      animated1: false,
+      animated2: false,
+      currentType: "",
+      showCharts: false,
+      // curRequest: [], //
+    };
+  },
+  async created() {
+    if (!this.coinList.length) {
+      await this.SET_COIN_LIST();
+    }
+    _getBalance().then((data) => {
+      // 获取用户余额
+      this.$store.commit("user/SET_USERINFO", { balance: data.money });
+      // const { money } = data
+      // this.balance = money
+    });
+  },
+  methods: {
+    ...mapActions("home", [SET_COIN_LIST]),
+    onUpdate(symbol) {
+      // 更新
+      this.symbol = symbol;
+      this.closeSocket();
+      this.init(symbol);
     },
-    watch: {
-        selectIndex(val) {
-            showLength = 7
+    onRecall() {
+      // 撤单or 平仓 evt
+      this.clearTimer();
+      _orderListHold(this.symbol).then((data) => {
+        this.orderHold = data;
+      });
+      this[this.curTab](this.symbol);
+      _initOpen(this.symbol).then((data) => {
+        this.initOpen = data;
+      });
+    },
+    onTopTab(evt) {
+      // 当前tab 永续/交割
+      this.keyIndex += 1;
+      this.selectIndex = evt;
+      this.clearTimer();
+      if (this.selectIndex / 1 === 1) {
+        //this.curTab = 'fetchOrderListCur'
+        this.curTab = "fetchOrderListHold";
+        // this.animated1 = true
+        // this.timer = setTimeout(() => {
+        //     this.animated1 = false
+        //     clearTimeout(this.timer)
+        // }, 200)
+        this.animated2 = true;
+        this.timer1 = setTimeout(() => {
+          this.animated2 = false;
+          clearTimeout(this.timer1);
+        }, 200);
+      } else {
+        // this.animated2 = true
+        // this.timer = setTimeout(() => {
+        //     this.animated2 = false
+        //     clearTimeout(this.timer)
+        // }, 200)
+        this.animated1 = true;
+        this.timer1 = setTimeout(() => {
+          this.animated1 = false;
+          clearTimeout(this.timer1);
+        }, 200);
+      }
+      console.log(this.curTab);
+      this[this.curTab](this.symbol);
+    },
+    onOrdered(evt) {
+      // 下单过后的回调
+      this.clearTimer();
+      // this.clearTimeout()
+      this.initParam(this.symbol, evt); // 重新初始化
+      // TODO: 这里要做判断
+      if (this.selectIndex / 1 === 1) {
+        this[this.curTab](this.symbol); // 重新调取记录
+        console.log("this.curTab", this.curTab);
+      } else {
+        // 交割合约
+        this[this.curTab](this.symbol);
+        // this.show = true
+        console.log("curTab", evt, this.curTab);
+      }
+      //console.log('下单后更新数据')
+    },
+    onTab(evt) {
+      // 点击tab后的回调
+      console.log("evt", evt);
+      this.clearTimer();
+      // this.clearTimeout()
+      this.curTab = evt;
+      this[evt](this.symbol);
+    },
+    fetchQoutes(symbol) {
+      // 获取当前行情
+      _getHomeList(symbol).then((data) => {
+        // 获取行情
+        this.handleQoutes(data);
+        this.startQuoteSocket(); // socket
+      });
+    },
+    handleQoutes(data) {
+      if (data && data.length) {
+        const cur = data[0];
+        this.price = cur.close;
+        this.range = cur.change_ratio + "";
+        this.quote = cur;
+        this.updateKey++;
+      }
+    },
+    fetchDeepData(symbol) {
+      console.log("sd");
+      _getDeepData(symbol).then((data) => {
+        // 获取深度
+        console.log(data);
+        this.handleDeep(data);
+        this.startDeepSocket(); // socket
+      });
+    },
+    handleDeep(data) {
+      this.deepData = data;
+      const { asks, bids } = data;
+      this.asks = asks.sort((a, b) => a.price - b.price).slice(0, showLength);
+      this.bids = bids.sort((a, b) => a.price - b.price).slice(-showLength);
+    },
+    startQuoteSocket() {
+      // 行情socket
+      this.sockets.quotes = new WebSocket(`${WS_URL}/1/${this.symbol}`);
+      // socket.onopen =  () => {
+      //     console.log('open')
+      //     socket.send('hello')
+      // }
+      this.sockets.quotes.onmessage = (evt) => {
+        const { data } = evt;
+        const { code, data: _data } = JSON.parse(data);
+        if (code / 1 === 0) {
+          this.handleQoutes(_data);
         }
+      };
     },
-    data() {
-        const initArr = []
-        for (let i = 0; i < showLength; i++) {
-            initArr.push({
-                amount: '--',
-                price: '--'
-            })
+    startDeepSocket() {
+      this.sockets.deep = new WebSocket(`${WS_URL}/3/${this.symbol}`);
+      this.sockets.deep.onmessage = (evt) => {
+        const { data } = evt;
+        const { code, data: _data } = JSON.parse(data);
+        if (code / 1 === 0) {
+          this.handleDeep(_data);
         }
-        return {
-            quote: {},
-            initTimer: null,
-            keyIndex: 0,
-            timeout: null,
-            timer: null, // 底部持仓等的公用定时器
-            timer1: null, // tab切换动画
-            timer2: null, // 交割合约底部持仓等的公用定时器
-            balance: 0,
-            symbol: '',
-            price: '',
-            range: '',
-			stop_price_profit:'',
-			stop_price_loss:'',
-            initOpen: {},
-            initClose: {},
-            asks: initArr, // 卖单
-            bids: initArr, // 买单
-            orderCur: [], // 当前委托
-            orderHold: [], // 持有仓位
-            futrueHold: [], // 交割持仓
-            futrueHistroy: [], // 交割历史
-            sockets: {
-                quotes: null, // 行情
-                deep: null /// 深度
-            },
-            curTab: '', // 当前委托还是持有仓位
-            selectIndex: 1, // 当前tab
-            initFutrue: {}, /// 交割合约
-            show: false, // popup
-            animated1: false,
-            animated2: false,
-            currentType: '',
-            showCharts: false
-            // curRequest: [], //
-        }
+      };
     },
-    async created() {
-
-        if (!this.coinList.length) {
-            await this.SET_COIN_LIST()
-        }
-        _getBalance().then(data => { // 获取用户余额
-            this.$store.commit('user/SET_USERINFO', { balance: data.money })
-            // const { money } = data
-            // this.balance = money
-        })
+    initParam(symbol, type) {
+      // 初始化参数
+      if (type === "open" || type === "long" || type === "short" || !type) {
+        let initFunTimer = null;
+        let initFun = () => {
+          _initOpen(symbol)
+            .then((data) => {
+              this.initOpen = data;
+              clearTimeout(initFunTimer);
+              initFunTimer = null;
+            })
+            .catch((err) => {
+              initFunTimer = setTimeout(() => {
+                initFun();
+              }, 3000);
+            });
+        };
+        initFun();
+      }
+      if (type === "close" || !type) {
+        let initFunTimer = null;
+        let initFun = () => {
+          _initClose(symbol)
+            .then((data) => {
+              this.initClose = data;
+              console.log(this.initClose);
+              clearTimeout(initFunTimer);
+              initFunTimer = null;
+            })
+            .catch((err) => {
+              initFunTimer = setTimeout(() => {
+                initFun();
+              }, 3000);
+            });
+        };
+        initFunTimer = setTimeout(() => {
+          initFun();
+        }, 600);
+      }
+      if (type === "futrue" || !type) {
+        _futrueOrderInit(symbol).then((data) => {
+          this.initFutrue = data;
+        });
+      }
     },
-    methods: {
-        ...mapActions('home', [SET_COIN_LIST]),
-        onUpdate(symbol) { // 更新
-            this.symbol = symbol
-            this.closeSocket()
-            this.init(symbol)
-        },
-        onRecall() { // 撤单or 平仓 evt
-            this.clearTimer()
-            _orderListHold(this.symbol).then(data => {
-
-                this.orderHold = data
-            })
-            this[this.curTab](this.symbol)
-            _initOpen(this.symbol).then(data => {
-                this.initOpen = data
-            })
-        },
-        onTopTab(evt) { // 当前tab 永续/交割
-            this.keyIndex += 1
-            this.selectIndex = evt
-            this.clearTimer()
-            if (this.selectIndex / 1 === 1) {
-                //this.curTab = 'fetchOrderListCur'
-                this.curTab = 'fetchOrderListHold'
-                // this.animated1 = true
-                // this.timer = setTimeout(() => {
-                //     this.animated1 = false
-                //     clearTimeout(this.timer)
-                // }, 200)
-                this.animated2 = true
-                this.timer1 = setTimeout(() => {
-                    this.animated2 = false
-                    clearTimeout(this.timer1)
-                }, 200)
-            } else {
-                // this.animated2 = true
-                // this.timer = setTimeout(() => {
-                //     this.animated2 = false
-                //     clearTimeout(this.timer)
-                // }, 200)
-                this.animated1 = true
-                this.timer1 = setTimeout(() => {
-                    this.animated1 = false
-                    clearTimeout(this.timer1)
-                }, 200)
-            }
-            console.log(this.curTab)
-            this[this.curTab](this.symbol)
-        },
-        onOrdered(evt) { // 下单过后的回调
-            this.clearTimer()
-            // this.clearTimeout()
-            this.initParam(this.symbol, evt) // 重新初始化
-            // TODO: 这里要做判断
-            if (this.selectIndex / 1 === 1) {
-                this[this.curTab](this.symbol) // 重新调取记录
-                console.log('this.curTab', this.curTab)
-            } else { // 交割合约
-                this[this.curTab](this.symbol)
-                // this.show = true
-                console.log('curTab', evt, this.curTab)
-
-            }
-            //console.log('下单后更新数据')
-        },
-        onTab(evt) { // 点击tab后的回调
-            console.log('evt', evt)
-            this.clearTimer()
-            // this.clearTimeout()
-            this.curTab = evt
-            this[evt](this.symbol)
-        },
-        fetchQoutes(symbol) { // 获取当前行情
-            _getHomeList(symbol).then(data => { // 获取行情
-                this.handleQoutes(data)
-                this.startQuoteSocket() // socket
-            })
-        },
-        handleQoutes(data) {
-            if (data && data.length) {
-                const cur = data[0]
-                this.price = cur.close
-                this.range = cur.change_ratio + ''
-                this.quote = cur
-                this.updateKey++
-            }
-        },
-        fetchDeepData(symbol) {
-            console.log('sd')
-            _getDeepData(symbol).then(data => { // 获取深度
-                console.log(data)
-                this.handleDeep(data)
-                this.startDeepSocket() // socket
-            })
-        },
-        handleDeep(data) {
-            this.deepData = data
-            const { asks, bids } = data
-            this.asks = asks.sort((a, b) => a.price - b.price).slice(0, showLength)
-            this.bids = bids.sort((a, b) => a.price - b.price).slice(-showLength)
-        },
-        startQuoteSocket() { // 行情socket
-            this.sockets.quotes = new WebSocket(`${WS_URL}/1/${this.symbol}`)
-            // socket.onopen =  () => {
-            //     console.log('open')
-            //     socket.send('hello')
-            // }
-            this.sockets.quotes.onmessage = (evt) => {
-                const { data } = evt
-                const { code, data: _data } = JSON.parse(data)
-                if (code / 1 === 0) {
-                    this.handleQoutes(_data)
-                }
-            }
-        },
-        startDeepSocket() {
-            this.sockets.deep = new WebSocket(`${WS_URL}/3/${this.symbol}`)
-            this.sockets.deep.onmessage = (evt) => {
-                const { data } = evt
-                const { code, data: _data } = JSON.parse(data)
-                if (code / 1 === 0) {
-                    this.handleDeep(_data)
-                }
-            }
-        },
-        initParam(symbol, type) { // 初始化参数
-            if (type === 'open' || type === 'long' || type === 'short' || !type) {
-                let initFunTimer = null;
-                let initFun = () => {
-                    _initOpen(symbol).then(data => {
-                        this.initOpen = data
-                        clearTimeout(initFunTimer)
-                        initFunTimer = null
-                    }).catch(err => {
-                        initFunTimer = setTimeout(() => {
-                            initFun()
-                        }, 3000);
-                    })
-                }
-                initFun()
-            }
-            if (type === 'close' || !type) {
-                let initFunTimer = null;
-                let initFun = () => {
-                    _initClose(symbol).then(data => {
-                        this.initClose = data
-                        console.log(this.initClose)
-                        clearTimeout(initFunTimer)
-                        initFunTimer = null
-                    }).catch(err => {
-                        initFunTimer = setTimeout(() => {
-                            initFun()
-                        }, 3000);
-                    })
-                }
-                initFunTimer = setTimeout(() => {
-                    initFun()
-                }, 600);
-            }
-            if (type === 'futrue' || !type) {
-                _futrueOrderInit(symbol).then(data => {
-                    this.initFutrue = data
-                })
-            }
-        },
-        fetchOrderListCur(symbol) { // 当前委托
-            //console.log('当前委托')
-            if (this.userInfo.token) {
-                _orderListCur(symbol).then(data => {
-                    this.orderCur = data
-                })
-                this.clearTimer()
-                this.timer = setInterval(() => {
-                    _orderListCur(symbol).then(data => {
-                        // if (typeof this.timer === 'string') {
-                        //   this.timer = null
-                        //   return
-                        // }
-                        this.orderCur = data
-                    })
-                }, 1000)
-            } else {
-                this.orderCur = []
-            }
-        },
-        fetchOrderListHold(symbol) { // 当前持仓
-            if (this.userInfo.token) {
-                _orderListHold(symbol).then(data => {
-                    // this.orderHold = data
-                    this.orderHold = data.sort(this.sortData);
-                })
-                this.timer = setInterval(() => {
-                    _orderListHold(symbol).then(data => {
-                        // if (typeof this.timer === 'string') {
-                        //   this.timer = null
-                        //   return
-                        // }
-                        // this.orderHold = data
-                        this.orderHold = data.sort(this.sortData);
-                    })
-                }, 1000)
-            } else {
-                this.orderHold = []
-            }
-        },
-        fetchFutrueHoldList(symbol) { // 交割持仓
-            if (this.userInfo.token) {
-                let length = 0
-                _futrueOrderList(symbol).then(data => {
-                    // this.futrueHold = data
-                    this.futrueHold = data.sort(this.sortData);
-                    length = data.length
-                })
-                this.timer = setInterval(() => {
-                    _futrueOrderList(symbol).then(data => {
-                        // if (typeof this.timer === 'string') {
-                        //   this.timer = null
-                        //   return
-                        // }
-
-                        this.futrueHold = data.sort(this.sortData);
-                        if (length != data.length) {
-                            length = data.length
-                            _futrueOrderInit(symbol).then(dataList => {
-                                this.initFutrue = dataList
-                            })
-                        }
-                    })
-                }, 1000)
-            } else {
-                this.futrueHold = []
-            }
-        },
-        fetchFutrueHistory(symbol) { // 交割历史持仓
-            _futrueOrderList(symbol, 'hisorders').then(data => {
-                this.futrueHistroy = data
-                // this.clearTimeout()
-            })
-        },
-        init(symbol) { // 初始化页面
-            this.symbol = symbol.toLowerCase()
-            this.fetchQoutes(symbol)
-            this.fetchDeepData(symbol)
-            this.initParam(symbol) // 'open'
-            this.clearTimer()
-            //if (this.curTab === 'fetchOrderListCur') {
-            if (this.curTab === 'fetchOrderListHold') {
-                //this.fetchOrderListCur(symbol)
-                this.fetchOrderListHold(symbol)
-            } else {
-                this.fetchFutrueHoldList(symbol)
-            }
-        },
-        closeSocket() {
-            this.sockets.quotes && this.sockets.quotes.close()
-            this.sockets.deep && this.sockets.deep.close()
-            this.sockets.quotes = null
-            this.sockets.deep = null
-        },
-        // clearTimeout(noNeed) {
-        //     clearTimeout(this.timeout)
-        //     if (noNeed) { // 防止timout定时器因接口返回继续触发
-        //       this.timeout = ''
-        //       return
-        //     }
-        //     this.timeout = null
-        // },
-        clearTimer() {
-            clearInterval(this.timer)
-            // if (isNeed) {
-            //   this.timer = ''
+    fetchOrderListCur(symbol) {
+      // 当前委托
+      //console.log('当前委托')
+      if (this.userInfo.token) {
+        _orderListCur(symbol).then((data) => {
+          this.orderCur = data;
+        });
+        this.clearTimer();
+        this.timer = setInterval(() => {
+          _orderListCur(symbol).then((data) => {
+            // if (typeof this.timer === 'string') {
+            //   this.timer = null
             //   return
             // }
-            this.timer = null
-        },
-        changeCurrentType(type) {
-            this.currentType = type
-        },
-        changeValueBack(val) {
-            if (val == 0) {
-                showLength = 7
-            } else {
-                showLength = 13
-            }
-        },
-        sortData(a, b) {
-            return new Date(b.open_time).getTime() - new Date(a.open_time).getTime()
-        }
+            this.orderCur = data;
+          });
+        }, 1000);
+      } else {
+        this.orderCur = [];
+      }
     },
-    mounted() {
-        let symbol = this.$route.params.symbol
-        let catchSymbol = getStorage('symbol')
-        if (!symbol && catchSymbol) {
-            symbol = catchSymbol
-        }
-        if (this.selectIndex / 1 === 2) {
-            this.curTab = 'fetchFutrueHoldList'
-        } else {
-            this.curTab = 'fetchOrderListHold'
-        }
-        this.symbol = symbol
-        this.init(symbol)
+    fetchOrderListHold(symbol) {
+      // 当前持仓
+      if (this.userInfo.token) {
+        _orderListHold(symbol).then((data) => {
+          // this.orderHold = data
+          this.orderHold = data.sort(this.sortData);
+        });
+        this.timer = setInterval(() => {
+          _orderListHold(symbol).then((data) => {
+            // if (typeof this.timer === 'string') {
+            //   this.timer = null
+            //   return
+            // }
+            // this.orderHold = data
+            this.orderHold = data.sort(this.sortData);
+          });
+        }, 1000);
+      } else {
+        this.orderHold = [];
+      }
     },
-    activated() {
-        let symbol = this.$route.params.symbol
-        let catchSymbol = getStorage('symbol')
-        if (!symbol && catchSymbol) {
-            symbol = catchSymbol
-        }
-        if (this.selectIndex / 1 === 2) {
-            this.curTab = 'fetchFutrueHoldList'
-        } else {
-            this.curTab = 'fetchOrderListHold'
-        }
-        this.symbol = symbol
-        this.init(symbol)
-    },
-    // beforeRouteEnter(to, from, next) {
-    //     let { params: { symbol }, query: { selectIndex } } = to
-    //     // if(this.$route.query.selectIndex) {
-    //     //   this.selectIndex = this.$route.query.selectIndex
-    //     // }
-    //     let catchSymbol = getStorage('symbol')
-    //     if (!symbol && catchSymbol) {
-    //         symbol = catchSymbol
-    //     }
-    //     if (symbol) {
-    //         next(vm => {
-    //             if (selectIndex) {
-    //                 vm.selectIndex = selectIndex
-    //                 if (vm.selectIndex / 1 === 2) {
-    //                     vm.curTab = 'fetchFutrueHoldList'
-    //                 } else {
-    //                     //vm.curTab = 'fetchOrderListCur'
-    //                     vm.curTab = 'fetchOrderListHold'
-    //                 }
-    //             } else {
-    //                 //vm.curTab = 'fetchOrderListCur'
-    //                 vm.curTab = 'fetchOrderListHold'
-    //             }
-    //             vm.symbol = symbol
-    //             vm.init(symbol)
-    //         })
-    //     } else {
-    //         next()
-    //     }
-    // },
-    deactivated() {
-        this.closeSocket()
-        this.clearTimer()
-    },
-    activated() {
-        this.currentType = this.$route.query.currentType ? this.$route.query.currentType : 'long'
-    },
-    beforeDestroy() {
-        this.closeSocket()
-        // this.clearTimeout(true)
-        this.clearTimer()
-    }
-}
+    fetchFutrueHoldList(symbol) {
+      // 交割持仓
+      if (this.userInfo.token) {
+        let length = 0;
+        _futrueOrderList(symbol).then((data) => {
+          // this.futrueHold = data
+          this.futrueHold = data.sort(this.sortData);
+          length = data.length;
+        });
+        this.timer = setInterval(() => {
+          _futrueOrderList(symbol).then((data) => {
+            // if (typeof this.timer === 'string') {
+            //   this.timer = null
+            //   return
+            // }
 
+            this.futrueHold = data.sort(this.sortData);
+            if (length != data.length) {
+              length = data.length;
+              _futrueOrderInit(symbol).then((dataList) => {
+                this.initFutrue = dataList;
+              });
+            }
+          });
+        }, 1000);
+      } else {
+        this.futrueHold = [];
+      }
+    },
+    fetchFutrueHistory(symbol) {
+      // 交割历史持仓
+      _futrueOrderList(symbol, "hisorders").then((data) => {
+        this.futrueHistroy = data;
+        // this.clearTimeout()
+      });
+    },
+    init(symbol) {
+      // 初始化页面
+      this.symbol = symbol.toLowerCase();
+      this.fetchQoutes(symbol);
+      this.fetchDeepData(symbol);
+      this.initParam(symbol); // 'open'
+      this.clearTimer();
+      //if (this.curTab === 'fetchOrderListCur') {
+      if (this.curTab === "fetchOrderListHold") {
+        //this.fetchOrderListCur(symbol)
+        this.fetchOrderListHold(symbol);
+      } else {
+        this.fetchFutrueHoldList(symbol);
+      }
+    },
+    closeSocket() {
+      this.sockets.quotes && this.sockets.quotes.close();
+      this.sockets.deep && this.sockets.deep.close();
+      this.sockets.quotes = null;
+      this.sockets.deep = null;
+    },
+    // clearTimeout(noNeed) {
+    //     clearTimeout(this.timeout)
+    //     if (noNeed) { // 防止timout定时器因接口返回继续触发
+    //       this.timeout = ''
+    //       return
+    //     }
+    //     this.timeout = null
+    // },
+    clearTimer() {
+      clearInterval(this.timer);
+      // if (isNeed) {
+      //   this.timer = ''
+      //   return
+      // }
+      this.timer = null;
+    },
+    changeCurrentType(type) {
+      this.currentType = type;
+    },
+    changeValueBack(val) {
+      if (val == 0) {
+        showLength = 7;
+      } else {
+        showLength = 13;
+      }
+    },
+    sortData(a, b) {
+      return new Date(b.open_time).getTime() - new Date(a.open_time).getTime();
+    },
+  },
+  mounted() {
+    let symbol = this.$route.params.symbol;
+    let catchSymbol = getStorage("symbol");
+    if (!symbol && catchSymbol) {
+      symbol = catchSymbol;
+    }
+    if (this.selectIndex / 1 === 2) {
+      this.curTab = "fetchFutrueHoldList";
+    } else {
+      this.curTab = "fetchOrderListHold";
+    }
+    this.symbol = symbol;
+    this.init(symbol);
+  },
+  activated() {
+    let symbol = this.$route.params.symbol;
+    let catchSymbol = getStorage("symbol");
+    if (!symbol && catchSymbol) {
+      symbol = catchSymbol;
+    }
+    if (this.selectIndex / 1 === 2) {
+      this.curTab = "fetchFutrueHoldList";
+    } else {
+      this.curTab = "fetchOrderListHold";
+    }
+    this.symbol = symbol;
+    this.init(symbol);
+  },
+  // beforeRouteEnter(to, from, next) {
+  //     let { params: { symbol }, query: { selectIndex } } = to
+  //     // if(this.$route.query.selectIndex) {
+  //     //   this.selectIndex = this.$route.query.selectIndex
+  //     // }
+  //     let catchSymbol = getStorage('symbol')
+  //     if (!symbol && catchSymbol) {
+  //         symbol = catchSymbol
+  //     }
+  //     if (symbol) {
+  //         next(vm => {
+  //             if (selectIndex) {
+  //                 vm.selectIndex = selectIndex
+  //                 if (vm.selectIndex / 1 === 2) {
+  //                     vm.curTab = 'fetchFutrueHoldList'
+  //                 } else {
+  //                     //vm.curTab = 'fetchOrderListCur'
+  //                     vm.curTab = 'fetchOrderListHold'
+  //                 }
+  //             } else {
+  //                 //vm.curTab = 'fetchOrderListCur'
+  //                 vm.curTab = 'fetchOrderListHold'
+  //             }
+  //             vm.symbol = symbol
+  //             vm.init(symbol)
+  //         })
+  //     } else {
+  //         next()
+  //     }
+  // },
+  deactivated() {
+    this.closeSocket();
+    this.clearTimer();
+  },
+  activated() {
+    this.currentType = this.$route.query.currentType
+      ? this.$route.query.currentType
+      : "long";
+  },
+  beforeDestroy() {
+    this.closeSocket();
+    // this.clearTimeout(true)
+    this.clearTimer();
+  },
+};
 </script>
 
 <style lang="scss" scoped>
@@ -531,109 +663,110 @@
 //  transform: translateY(0)
 //}
 .no_touch {
-    -webkit-user-select: none;
-    user-select: none;
-    -ms-user-select: none;
-    -moz-user-select: none;
-    padding-bottom: 150px !important;
+  -webkit-user-select: none;
+  user-select: none;
+  -ms-user-select: none;
+  -moz-user-select: none;
+  padding-bottom: 150px !important;
 }
 
 .list-enter-active,
 .list-leave-active {
-    will-change: transform;
-    transition: all 250ms;
+  will-change: transform;
+  transition: all 250ms;
 }
 
 .list-enter {
-    opacity: 0;
-    transform: translate3d(-100%, 0, 0);
+  opacity: 0;
+  transform: translate3d(-100%, 0, 0);
 }
 
 .list-leave {
-    opacity: 0;
-    transform: translate3d(100%, 0, 0);
+  opacity: 0;
+  transform: translate3d(100%, 0, 0);
 }
 
 .rounded-view {
-    border-top-left-radius: 20px;
-    border-top-right-radius: 20px;
-    box-sizing: border-box;
+  border-top-left-radius: 20px;
+  border-top-right-radius: 20px;
+  box-sizing: border-box;
 }
 
 .my-swipe {
-    width: 100%;
+  width: 100%;
 }
 
-.my-swipe .van-swipe-item {}
+.my-swipe .van-swipe-item {
+}
 
 .line {
-    height: 13px;
+  height: 13px;
 
-    @include themify() {
-        background: themed("tab_background");
-    }
+  @include themify() {
+    background: themed("tab_background");
+  }
 }
 
 @keyframes animate1 {
-    0% {
-        opacity: 1;
-        transform: translate3d(100%, 0, 0);
-    }
+  0% {
+    opacity: 1;
+    transform: translate3d(100%, 0, 0);
+  }
 
-    //   40% {
-    //      opacity: 1;
-    //     transform: translate3d(50%, 0, 0);
-    //   }
-    100% {
-        opacity: 1;
-        transform: translate3d(0%, 0, 0);
-    }
+  //   40% {
+  //      opacity: 1;
+  //     transform: translate3d(50%, 0, 0);
+  //   }
+  100% {
+    opacity: 1;
+    transform: translate3d(0%, 0, 0);
+  }
 }
 
 @keyframes animate2 {
-    0% {
-        opacity: 1;
-        transform: translate3d(-100%, 0, 0);
-    }
+  0% {
+    opacity: 1;
+    transform: translate3d(-100%, 0, 0);
+  }
 
-    //   40% {
-    //      opacity: 1;
-    //     transform: translate3d(50%, 0, 0);
-    //   }
-    100% {
-        opacity: 1;
-        transform: translate3d(0%, 0, 0);
-    }
+  //   40% {
+  //      opacity: 1;
+  //     transform: translate3d(50%, 0, 0);
+  //   }
+  100% {
+    opacity: 1;
+    transform: translate3d(0%, 0, 0);
+  }
 }
 
 .slide1 {
-    animation: animate1 200ms linear;
+  animation: animate1 200ms linear;
 }
 
 .slide2 {
-    animation: animate2 200ms linear;
+  animation: animate2 200ms linear;
 }
 
 .line {
-    @include themify() {
-        background: themed("divi_line");
-    }
+  @include themify() {
+    background: themed("divi_line");
+  }
 }
 
 ::v-deep .contract-header {
-    @include themify() {
-        background: themed("main_background");
-    }
+  @include themify() {
+    background: themed("main_background");
+  }
 }
 
 .tabBackground1 {
-    @include themify() {
-        border: 1px solid themed("border_color1");
-    }
+  @include themify() {
+    border: 1px solid themed("border_color1");
+  }
 }
 
 .shadow {
-    bottom: 108px;
-    box-sizing: border-box;
+  bottom: 108px;
+  box-sizing: border-box;
 }
 </style>

--
Gitblit v1.9.3