From 3f3e2d5977787b0c6e09cd5cba7b41e5fb7d3fd0 Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Sun, 21 Apr 2024 15:59:28 +0800
Subject: [PATCH] first
---
src/i18n/kor.json | 5
src/components/list-quotation/index.vue | 17
src/i18n/spa.json | 5
src/components/perpetual-open/index.vue | 4
src/i18n/jp.json | 5
src/page/new-urrency/components/subscription-list-index.vue | 5
src/page/TtrendDetails/index.vue | 1553 +++++++++++---------
src/page/perpetualContract/index.vue | 66
src/components/trade-head/index.vue | 8
src/i18n/de.json | 5
src/page/assetsCenter/profile.vue | 7
src/page/perpetualContract/perpetualHistory.vue | 659 ++++----
src/page/quotes.vue | 18
src/page/register/identity.vue | 571 ++++---
src/request/http.js | 140
src/config/index.js | 2
src/request/httpAxios.js | 5
src/page/authentication/index.vue | 542 ++++--
src/page/new-urrency/index.vue | 6
src/page/new-urrency/components/subscription-list.vue | 13
src/i18n/en.json | 5
src/page/new-urrency/components/placing-list.vue | 13
src/page/assetsCenter/index.vue | 7
src/API/fund.api.js | 2
src/components/contract-header/index.vue | 8
src/store/modules/user.js | 174 +
src/components/trade-deep-data/index.vue | 30
src/page/trade/index.vue | 14
src/assets/image/kyc/kyc-demo.png | 0
src/router/router.js | 11
src/request/index.js | 6
src/utils/filter.js | 18
src/i18n/vie.json | 5
src/request/axios.js | 71
src/store/modules/home.store.js | 2
src/i18n/zh.json | 3
src/i18n/cht.json | 5
src/page/new-urrency/components/placing-list-index.vue | 6
src/main.js | 5
src/i18n/it.json | 5
src/i18n/th.json | 5
src/i18n/id.json | 5
src/page/tradeRecord/index.vue | 496 +++---
src/App.vue | 3
src/i18n/ara.json | 5
src/request/urlKyc.js | 9
src/i18n/fra.json | 5
47 files changed, 2,557 insertions(+), 1,997 deletions(-)
diff --git a/src/API/fund.api.js b/src/API/fund.api.js
index 256c318..0bfbf48 100644
--- a/src/API/fund.api.js
+++ b/src/API/fund.api.js
@@ -61,7 +61,7 @@
name: data.name, // 姓名
idimg_1: (data.frontFile.length && data.frontFile[0].resURL) || "",
idimg_2: (data.reverseFile.length && data.reverseFile[0].resURL) || "",
- idimg_3: (data.fileList.length && data.fileList[0].resURL) || "",
+ // idimg_3: (data.fileList.length && data.fileList[0].resURL) || "",
},
});
};
diff --git a/src/App.vue b/src/App.vue
index ac94f45..ce81d1e 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -74,6 +74,7 @@
mounted() {
window.document.documentElement.setAttribute("data-theme", this.theme);
changeTheme(this.theme);
+ this.GET_UERS_KYC();
},
components: {
// loading: Loading,
@@ -81,7 +82,7 @@
},
methods: {
...mapActions("home", [SET_KEFU]),
- ...mapActions("user", [SET_CONFIG]),
+ ...mapActions("user", [SET_CONFIG, "GET_UERS_KYC"]),
...mapMutations("language", ["setLanguage"]),
...mapMutations("home", [SET_CURRENCY]),
async init() {
diff --git a/src/assets/image/kyc/kyc-demo.png b/src/assets/image/kyc/kyc-demo.png
index 638cf8d..aa78188 100644
--- a/src/assets/image/kyc/kyc-demo.png
+++ b/src/assets/image/kyc/kyc-demo.png
Binary files differ
diff --git a/src/components/contract-header/index.vue b/src/components/contract-header/index.vue
index 8d144b7..c76e14e 100644
--- a/src/components/contract-header/index.vue
+++ b/src/components/contract-header/index.vue
@@ -14,7 +14,7 @@
@click="onSidebar"
/> -->
<div class="flex pl-21 textColor" @click="onSidebar">
- <div class="font-35">{{ symbol.toUpperCase() || "--" }}/USDT</div>
+ <div class="font-35">{{ symbol | _symbolName }}/USDT</div>
<div class="ml-15">{{ title }}</div>
</div>
<div
@@ -87,11 +87,7 @@
>
<div>
<div class="textColor">
- {{
- item.name
- ? item.symbol.toUpperCase() + "/" + item.name.split("/")[1]
- : "--"
- }}
+ {{ item.symbol | _symbolName(1) }}
</div>
<div class="text-grey mt-10">
{{ selectIndex == 1 ? $t("永续") : $t("交割") }}
diff --git a/src/components/list-quotation/index.vue b/src/components/list-quotation/index.vue
index e810fac..a6d1fc6 100644
--- a/src/components/list-quotation/index.vue
+++ b/src/components/list-quotation/index.vue
@@ -70,13 +70,12 @@
<p class="flex flex-col" style="margin-left: 5px">
<span class="flex items-end font-32 flex items-center" s>
<span class="textColor font-600 font-30">
- {{ (item.symbol && item.symbol.toUpperCase()) || "--" }}
+ {{ item.symbol | _symbolName }}
+ <!-- {{ (item.symbol && item.symbol.toUpperCase()) || "--" }} -->
</span>
<span class="font-24" style="position: relative; top: 1px">
- /{{
- (item.name && item.name.split("/")[1]) || "--"
- }}</span
- >
+ /{{ (item.name && item.name.split("/")[1]) || "--" }}
+ </span>
</span>
<span class="font-24 textNew1">{{
@@ -132,9 +131,10 @@
<div class="anniu"></div>
<p class="flex flex-col" style="margin-left: 5px">
<span class="flex items-end font-32 flex items-center">
- <span class="textColor font-600 font-30">{{
- (item.symbol && item.symbol.toUpperCase()) || "--"
- }}</span>
+ <span class="textColor font-600 font-30">
+ {{ item.symbol | _symbolName }}
+ <!-- {{ (item.symbol && item.symbol.toUpperCase()) || "--" }} -->
+ </span>
<span class="font-24" style="position: relative; top: 1px">
/{{ (item.name && item.name.split("/")[1]) || "--" }}
</span>
@@ -248,6 +248,7 @@
},
onItemClick(item) {
if (this.tabActive == 2) {
+ setStorage("tradeSymbol", item.symbol);
//现货
this.$router.push({
path: `/trade/${item.symbol}`,
diff --git a/src/components/perpetual-open/index.vue b/src/components/perpetual-open/index.vue
index 9e127cd..bba2761 100644
--- a/src/components/perpetual-open/index.vue
+++ b/src/components/perpetual-open/index.vue
@@ -63,7 +63,7 @@
</div>
<div class="text-right items-end justify-end">
<div class="">{{ $t("数量") }}</div>
- <div class="mt-4">({{ symbol.toUpperCase() || "--" }})</div>
+ <div class="mt-4">({{ symbol | _symbolName() }})</div>
</div>
</div>
<div
@@ -586,7 +586,7 @@
this.form.price = val;
}
this.form.para_id =
- this.initFutrue.para && this.initFutrue.para[this.paraIndex].para_id; // 不优雅,不可靠
+ this.initFutrue.para && this.initFutrue.para[this.paraIndex]?.para_id; // 不优雅,不可靠
// this.form.symbol = this.symbol.toLowerCase()
},
initOpen: {
diff --git a/src/components/trade-deep-data/index.vue b/src/components/trade-deep-data/index.vue
index 091255a..e9580e7 100644
--- a/src/components/trade-deep-data/index.vue
+++ b/src/components/trade-deep-data/index.vue
@@ -118,7 +118,13 @@
this.getHomeList();
},
watch: {
- symbol(val) {
+ symbol() {
+ const init = [];
+ for (let i = 0; i < DEEP_LENGTH; i++) {
+ init.push({ amount: "", price: "" });
+ }
+ this.greenData = init;
+ this.redData = init;
this.startDeepSocket();
this.getHomeList();
},
@@ -185,11 +191,17 @@
this.$emit("getList", dataObj);
});
},
+
startDeepSocket() {
// 开启socket链接
this.closeSocket();
- console.log("start deep");
+
this.socket = new WebSocket(`${WS_URL}/3/${this.symbol}`);
+
+ this.socket.onopen = () => {
+ console.log("WebSocket connection established");
+ };
+
this.socket.onmessage = (evt) => {
const { data } = evt;
const { code, data: _data } = JSON.parse(data);
@@ -197,9 +209,23 @@
this.handleDeep(_data);
}
};
+
+ this.socket.onerror = (error) => {
+ console.error("WebSocket error:", error);
+ setTimeout(this.startDeepSocket, 5000); // 5秒后尝试重新连接
+ };
+
+ this.socket.onclose = (event) => {
+ console.log("WebSocket connection closed:", event);
+ // 重新连接,可以根据需求添加重连的逻辑,这里只是简单的示例
+ };
},
handleDeep(data) {
// 格式化数据
+ // console.log(this.symbol, data.symbol);
+ if (this.symbol !== data.symbol) {
+ return;
+ }
this.deepData = data;
if (this.selectValue >= 1) {
this.deepData.asks.map((item) => {
diff --git a/src/components/trade-head/index.vue b/src/components/trade-head/index.vue
index a089cdf..ca42c49 100644
--- a/src/components/trade-head/index.vue
+++ b/src/components/trade-head/index.vue
@@ -24,7 +24,7 @@
/> -->
<div class="flex flex-col pl-21" @click="onSidebar">
<div class="font-35 textColor">
- {{ (symbol && symbol.toUpperCase()) || "--" }}/USDT
+ {{ symbol | _symbolName(1) }}
</div>
</div>
<div
@@ -99,11 +99,7 @@
<div>
<!-- {{ JSON.stringify(item) }} -->
<div class="font-700 textColor">
- {{
- item.name
- ? item.symbol.toUpperCase() + "/" + item.name.split("/")[1]
- : "--"
- }}
+ {{ item.symbol | _symbolName(1) }}
</div>
<div v-if="!kineType" class="text-grey mt-10">{{ title }}</div>
</div>
diff --git a/src/config/index.js b/src/config/index.js
index 1567b93..01183b8 100644
--- a/src/config/index.js
+++ b/src/config/index.js
@@ -21,7 +21,7 @@
base_url = "https://" + ENV_PRO + "/wap/";
base_url2 = "https://" + ENV_PRO + "/css/plugin/summernote/";
//ws_url = `wss://${ENV_PRO}/data/websocket`
- ws_url = `wss://bingx.zqbom.com/data/websocket`;
+ ws_url = "wss://" + ENV_PRO + "/data/websocket";
}
export const BASE_URL = base_url;
export const BASE_URL2 = base_url2;
diff --git a/src/i18n/ara.json b/src/i18n/ara.json
index ac3bb2d..2463e0a 100644
--- a/src/i18n/ara.json
+++ b/src/i18n/ara.json
@@ -1940,5 +1940,8 @@
"直播": "بث مباشر",
"比赛": "مسابقات",
"已上市": "المدرجة بالفعل",
- "是否认购": "إذا كان الاشتراك"
+ "是否认购": "إذا كان الاشتراك",
+ "请先实名认证!": "يرجى التحقق من الاسم الحقيقي أولا !",
+ "USDC充值": "usdc شحن",
+ "BNB充值": "بنك التسليف والادخار"
}
\ No newline at end of file
diff --git a/src/i18n/cht.json b/src/i18n/cht.json
index 7c47213..f6fca20 100644
--- a/src/i18n/cht.json
+++ b/src/i18n/cht.json
@@ -1944,5 +1944,8 @@
"直播": "直播",
"比赛": "比賽",
"已上市": "已上市",
- "是否认购": "是否認購"
+ "是否认购": "是否認購",
+ "请先实名认证!": "請先實名認證!",
+ "USDC充值": "USDC充值",
+ "BNB充值": "BNB充值"
}
\ No newline at end of file
diff --git a/src/i18n/de.json b/src/i18n/de.json
index e74b889..aff12e1 100644
--- a/src/i18n/de.json
+++ b/src/i18n/de.json
@@ -1941,5 +1941,8 @@
"直播": "Direktsaat",
"比赛": "Wettbewerb",
"已上市": "Aufgeführt",
- "是否认购": "Ob abonniert werden soll"
+ "是否认购": "Ob abonniert werden soll",
+ "请先实名认证!": "Bitte authentifizieren Sie zuerst Ihren echten Namen!",
+ "USDC充值": "USDC-Aufladung",
+ "BNB充值": "BNB-Aufladung"
}
\ No newline at end of file
diff --git a/src/i18n/en.json b/src/i18n/en.json
index c1d68d8..c5720be 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -1953,5 +1953,8 @@
"直播": "direct seeding",
"比赛": "competition",
"已上市": "Listed",
- "是否认购": "Whether to subscribe"
+ "是否认购": "Whether to subscribe",
+ "请先实名认证!": "Please authenticate your real name first!",
+ "USDC充值": "USDC recharge",
+ "BNB充值": "BNB recharge"
}
\ No newline at end of file
diff --git a/src/i18n/fra.json b/src/i18n/fra.json
index 65f56f8..0136eb3 100644
--- a/src/i18n/fra.json
+++ b/src/i18n/fra.json
@@ -2058,5 +2058,8 @@
"直播": "En direct",
"比赛": "Compétition",
"已上市": "Déjà listé",
- "是否认购": "S'abonner ou non"
+ "是否认购": "S'abonner ou non",
+ "请先实名认证!": "Veuillez d'abord certifier par nom réel!",
+ "USDC充值": "Recharge USDC",
+ "BNB充值": "BNB recharge"
}
\ No newline at end of file
diff --git a/src/i18n/id.json b/src/i18n/id.json
index f87e77c..12ce0aa 100644
--- a/src/i18n/id.json
+++ b/src/i18n/id.json
@@ -2139,5 +2139,8 @@
"直播": "Siaran langsung",
"比赛": "lomba",
"已上市": "Tersedia",
- "是否认购": "Apakah akan berlangganan atau tidak"
+ "是否认购": "Apakah akan berlangganan atau tidak",
+ "请先实名认证!": "Harap verifikasi nama asli Anda terlebih dahulu!",
+ "USDC充值": "Setoran USDC",
+ "BNB充值": "Isi ulang BNB"
}
\ No newline at end of file
diff --git a/src/i18n/it.json b/src/i18n/it.json
index 0556367..913761a 100644
--- a/src/i18n/it.json
+++ b/src/i18n/it.json
@@ -2129,5 +2129,8 @@
"直播": "semina diretta",
"比赛": "concorrenza",
"已上市": "Elencato",
- "是否认购": "Indica se sottoscrivere"
+ "是否认购": "Indica se sottoscrivere",
+ "请先实名认证!": "Si prega di autenticare il vostro vero nome prima!",
+ "USDC充值": "Ricarica USDC",
+ "BNB充值": "Ricarica BNB"
}
\ No newline at end of file
diff --git a/src/i18n/jp.json b/src/i18n/jp.json
index 8972289..85ebf75 100644
--- a/src/i18n/jp.json
+++ b/src/i18n/jp.json
@@ -1958,5 +1958,8 @@
"直播": "生放送",
"比赛": "と同じものを見つける",
"已上市": "発売済み",
- "是否认购": "購入するかどうか"
+ "是否认购": "購入するかどうか",
+ "请先实名认证!": "まず実名認証をお願いします!",
+ "USDC充值": "USDCチャージ",
+ "BNB充值": "BNBチャージ"
}
\ No newline at end of file
diff --git a/src/i18n/kor.json b/src/i18n/kor.json
index 35d4e0f..11d2211 100644
--- a/src/i18n/kor.json
+++ b/src/i18n/kor.json
@@ -1971,5 +1971,8 @@
"直播": "생방송",
"比赛": "경기",
"已上市": "출시됨",
- "是否认购": "인수 여부"
+ "是否认购": "인수 여부",
+ "请先实名认证!": "실명인증부터 해주세요!",
+ "USDC充值": "USDC 충전",
+ "BNB充值": "BNB 충전"
}
\ No newline at end of file
diff --git a/src/i18n/spa.json b/src/i18n/spa.json
index 48ab9b0..5c7f50f 100644
--- a/src/i18n/spa.json
+++ b/src/i18n/spa.json
@@ -1945,5 +1945,8 @@
"直播": "Transmisión en vivo",
"比赛": "Partido",
"已上市": "Cotizado",
- "是否认购": "Si suscribir o no"
+ "是否认购": "Si suscribir o no",
+ "请先实名认证!": "¡¡ por favor, autenticación de nombre real primero!",
+ "USDC充值": "Recarga de usdc",
+ "BNB充值": "Recarga BNB"
}
\ No newline at end of file
diff --git a/src/i18n/th.json b/src/i18n/th.json
index 69da10c..1f63f7e 100644
--- a/src/i18n/th.json
+++ b/src/i18n/th.json
@@ -1953,5 +1953,8 @@
"直播": "ถ่ายทอดสด",
"比赛": "การแข่งขัน",
"已上市": "จดทะเบียนแล้ว",
- "是否认购": "ไม่ว่าจะเป็นการสมัคร"
+ "是否认购": "ไม่ว่าจะเป็นการสมัคร",
+ "请先实名认证!": "โปรดรับรองชื่อจริงก่อน!",
+ "USDC充值": "การเติมเงิน USDC",
+ "BNB充值": "BNB เติมเงิน"
}
\ No newline at end of file
diff --git a/src/i18n/vie.json b/src/i18n/vie.json
index c19a9cb..d028c5d 100644
--- a/src/i18n/vie.json
+++ b/src/i18n/vie.json
@@ -1955,5 +1955,8 @@
"直播": "Phát sóng trực tiếp",
"比赛": "Giải đấu",
"已上市": "Danh sách",
- "是否认购": "Đăng ký hay không"
+ "是否认购": "Đăng ký hay không",
+ "请先实名认证!": "Xin hãy chứng thực tên thật trước!",
+ "USDC充值": "USDC nạp tiền",
+ "BNB充值": "BNB nạp tiền"
}
\ No newline at end of file
diff --git a/src/i18n/zh.json b/src/i18n/zh.json
index d49e8fd..5835215 100644
--- a/src/i18n/zh.json
+++ b/src/i18n/zh.json
@@ -1938,5 +1938,8 @@
"邀请好友一起赚钱": "邀请好友一起赚钱",
"已上市": "已上市",
"是否认购": "是否认购",
+ "USDC充值": "USDC充值",
+ "BNB充值": "BNB充值",
+ "请先实名认证!": "请先实名认证!",
"请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。": "请不要向任何人透露密码、短信和谷歌验证码,包括交易所工作人员。"
}
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index 3982e1c..c288905 100644
--- a/src/main.js
+++ b/src/main.js
@@ -4,8 +4,13 @@
import i18n from "./i18n";
import moment from "moment";
import router from "@/router/router";
+import * as filters from "@/utils/filter";
import "@/assets/remNew.js";
+// Vue.filter("_symbolName", symbolName);
+Object.keys(filters).forEach((key) => {
+ Vue.filter(key, filters[key]);
+});
Vue.config.productionTip = false;
Vue.prototype.TITLE = process.env.VUE_APP_TITLE;
Vue.prototype.$moment = moment;
diff --git a/src/page/TtrendDetails/index.vue b/src/page/TtrendDetails/index.vue
index 55879fd..33f570c 100644
--- a/src/page/TtrendDetails/index.vue
+++ b/src/page/TtrendDetails/index.vue
@@ -1,7 +1,7 @@
<template>
- <div class="trend-detail pb-90 mainBackground">
- <!-- 头部 -->
- <!-- <div class="w-full h-88 flex items-center justify-between px-32 box-border">
+ <div class="trend-detail pb-90 mainBackground">
+ <!-- 头部 -->
+ <!-- <div class="w-full h-88 flex items-center justify-between px-32 box-border">
<div class="flex items-center w-full" @click="onRoute('/quotes?active=3')">
<img src="@/assets/image/assets-center/convert.png" class="w-38 h-38" />
<p class="font-38 font-600 ml-10">{{quote.name}}</p>
@@ -13,138 +13,228 @@
@click="goHistory" />
</div>
</div> -->
- <trade-head @openRecord="openRecord" :backFunc="() => $router.push('/')" :symbol="symbol" :islevel="true"
- @update-coin="onUpdate" @data="quote = $event" :title="$t('永续')" @changeLine="onChangeLine" :isReturn="isReturn"
- :kineType="kineType" :tabIndex="tab" />
- <div class="flex justify-between px-32 pt-40" v-if="!kineType">
- <div class="w-368 h-80 mr-32 flex justify-center items-center rounded box-border tabBtn"
- :class="tab === '1' ? 'activeBtn' : ''" @click="onTab('1')">{{ $t('永续合约') }}</div>
- <div class="w-368 h-80 flex justify-center items-center rounded box-border tabBtn"
- :class="tab === '2' ? 'activeBtn' : ''" @click="onTab('2')">{{ $t('交割合约') }}</div>
+ <trade-head
+ @openRecord="openRecord"
+ :backFunc="() => $router.push('/')"
+ :symbol="symbol"
+ :islevel="true"
+ @update-coin="onUpdate"
+ @data="quote = $event"
+ :title="$t('永续')"
+ @changeLine="onChangeLine"
+ :isReturn="isReturn"
+ :kineType="kineType"
+ :tabIndex="tab"
+ />
+ <div class="flex justify-between px-32 pt-40" v-if="!kineType">
+ <div
+ class="w-368 h-80 mr-32 flex justify-center items-center rounded box-border tabBtn"
+ :class="tab === '1' ? 'activeBtn' : ''"
+ @click="onTab('1')"
+ >
+ {{ $t("永续合约") }}
+ </div>
+ <div
+ class="w-368 h-80 flex justify-center items-center rounded box-border tabBtn"
+ :class="tab === '2' ? 'activeBtn' : ''"
+ @click="onTab('2')"
+ >
+ {{ $t("交割合约") }}
+ </div>
+ </div>
+ <!-- 数据区 -->
+ <div :class="{ slide2: animated1, slide1: animated2 }">
+ <div>
+ <div class="flex flex-1 px-32 mt-40">
+ <div class="flex flex-col font-22">
+ <p
+ class="font-70 font-600"
+ :class="quote.change_ratio > 0 ? 'text-green' : 'text-red'"
+ >
+ {{ quote.close || "--" }}
+ </p>
+ <p class="font-22 mt-10 textColor">
+ ≈ {{ currency.currency_symbol
+ }}{{
+ quote.close
+ ? (quote.close * currency.rate).toFixed(
+ quote.close.toString().split(".")[1]
+ ? quote.close.toString().split(".")[1].length
+ : 2
+ )
+ : "--"
+ }}
+ <span :class="quote.change_ratio > 0 ? 'text-green' : 'text-red'"
+ >{{
+ quote.change_ratio || (quote.change_ratio === 0 ? 0 : "--")
+ }}%</span
+ >
+ </p>
+ <p class="text-grey mt-10">
+ {{ $t("标记价格") }} {{ quote.open || "--" }}
+ </p>
+ </div>
+ <div class="flex flex-wrap flex-1 justify-end font-22">
+ <div class="flex w-1/2 flex-col justify-between w-177">
+ <p class="text-grey">{{ $t("24h最高价") }}</p>
+ <p class="textColor">{{ quote.high || "--" }}</p>
+ </div>
+ <div class="flex w-1/2 flex-col justify-between w-177">
+ <p class="text-grey">
+ {{ $t("24h成交量") }}( {{ symbol | _symbolName() }})
+ </p>
+ <p class="textColor">
+ {{ fixDate(quote.amount * 1, $i18n) || "--" }}
+ </p>
+ </div>
+ <div class="flex w-1/2 flex-col justify-between w-177 mt-20">
+ <p class="text-grey">{{ $t("24h最低价") }}</p>
+ <p class="textColor">{{ quote.low || "--" }}</p>
+ </div>
+ <div class="flex w-1/2 flex-col justify-between w-177 mt-20">
+ <p class="text-grey">{{ $t("24h成交额(USDT)") }}</p>
+ <p class="textColor">
+ {{ (quote.volume * 1).toFixed(2) || "--" }}
+ </p>
+ </div>
+ </div>
</div>
- <!-- 数据区 -->
- <div :class="{ slide2: animated1, slide1: animated2 }">
- <div>
- <div class="flex flex-1 px-32 mt-40">
- <div class="flex flex-col font-22">
- <p class="font-70 font-600" :class="quote.change_ratio > 0 ? 'text-green' : 'text-red'">
- {{ quote.close || '--' }}</p>
- <p class="font-22 mt-10 textColor">≈ {{ currency.currency_symbol }}{{ quote.close ? (quote.close *
- currency.rate).toFixed(quote.close.toString().split('.')[1] ?
- quote.close.toString().split('.')[1].length : 2) : '--' }}
- <span :class="quote.change_ratio > 0 ? 'text-green' : 'text-red'">{{ quote.change_ratio
- || (quote.change_ratio === 0 ? 0 : '--') }}%</span>
- </p>
- <p class="text-grey mt-10">{{ $t('标记价格') }} {{ quote.open || '--' }}</p>
- </div>
- <div class="flex flex-wrap flex-1 justify-end font-22">
- <div class="flex w-1/2 flex-col justify-between w-177">
- <p class="text-grey">{{ $t('24h最高价') }}</p>
- <p class="textColor">{{ quote.high || '--' }}</p>
- </div>
- <div class="flex w-1/2 flex-col justify-between w-177">
- <p class="text-grey">{{ $t('24h成交量') }}({{ symbol && symbol.toUpperCase() || '--' }})</p>
- <p class="textColor">{{ fixDate(quote.amount * 1, $i18n) || '--' }}</p>
- </div>
- <div class="flex w-1/2 flex-col justify-between w-177 mt-20">
- <p class="text-grey">{{ $t('24h最低价') }}</p>
- <p class="textColor">{{ quote.low || '--' }}</p>
- </div>
- <div class="flex w-1/2 flex-col justify-between w-177 mt-20">
- <p class="text-grey">{{ $t('24h成交额(USDT)') }}</p>
- <p class="textColor">{{ (quote.volume * 1).toFixed(2) || '--' }}</p>
- </div>
- </div>
- </div>
+ </div>
+ <!-- k line-->
+ <div class="mt-35 h-482-px">
+ <kline-charts
+ :update-key="updateKey"
+ :update-data="quote"
+ :isChangeLine="isChangeLine"
+ :symbol="symbol"
+ v-if="symbol"
+ @updataLine="isChangeLine = false"
+ />
+ </div>
+ <div class="w-full h-20 greyBg"></div>
+ <!-- tab 区域-->
+ <div class="pb-180 tabContent">
+ <van-tabs v-model="active">
+ <van-tab :title="$t('委托订单')" name="1">
+ <div class="flex px-32 justify-between px-32">
+ <ul class="flex flex-col flex-1 mr-20">
+ <li class="font-28 text-grey mt-30 mb-15 w-full">
+ <p>{{ $t("买入") }}</p>
+ <p class="flex justify-between items-cener font-22">
+ <span style="margin-right: -10px"
+ >{{ $t("价格") }}(USDT)</span
+ >
+ <span>{{ $t("数量") }}({{ symbol | _symbolName(1) }})</span>
+ </p>
+ </li>
+ <li
+ v-for="(item, index) in bids"
+ :key="index"
+ class="flex justify-between font-26 py-15"
+ :style="{
+ background:
+ `linear-gradient(to left,${
+ theme == 'dark' ? '#121212' : '#ffffff'
+ } 0% ` +
+ (item.amount / bids[bids.length - 1].amount) * 100 +
+ '%,rgba(94,186,137,.1) ' +
+ (item.amount / bids[bids.length - 1].amount) * 100 +
+ '%,rgba(94,186,137,.1) 100%)',
+ }"
+ >
+ <span class="textColor">{{ item.price || "--" }}</span>
+ <span v-if="symbol == 'shib'" class="text-green">{{
+ fixDate(item.amount, $i18n) || "--"
+ }}</span>
+ <span v-else class="text-green">{{
+ item.amount || "--"
+ }}</span>
+ </li>
+ </ul>
+ <ul class="flex-1 flex flex-col ml-20">
+ <li class="font-28 text-grey mt-30 mb-15 w-full">
+ <p>{{ $t("卖出") }}</p>
+ <p class="flex justify-between items-center font-22">
+ <span class="-ml-5">{{ $t("价格") }}(USDT)</span>
+ <span>{{ $t("数量") }}({{ symbol | _symbolName() }})</span>
+ </p>
+ </li>
+ <li
+ v-for="(item, index) in asks"
+ :key="index"
+ class="flex justify-between font-26 py-15"
+ :style="{
+ background:
+ `linear-gradient(to left,${
+ theme == 'dark' ? '#121212' : '#ffffff'
+ } 0% ` +
+ (item.amount / asks[asks.length - 1].amount) * 100 +
+ '%,rgba(246,70,93,.1) ' +
+ (item.amount / asks[asks.length - 1].amount) * 100 +
+ '%,rgba(246,70,93,.1) 100%)',
+ }"
+ >
+ <span class="textColor">{{ item.price || "--" }}</span>
+ <span v-if="symbol == 'shib'" class="text-red">{{
+ fixDate(item.amount, $i18n) || "--"
+ }}</span>
+ <span v-else class="text-red">{{ item.amount || "--" }}</span>
+ </li>
+ </ul>
</div>
- <!-- k line-->
- <div class="mt-35 h-482-px">
- <kline-charts :update-key="updateKey" :update-data="quote" :isChangeLine="isChangeLine" :symbol="symbol"
- v-if="symbol" @updataLine="isChangeLine = false" />
+ </van-tab>
+ <van-tab :title="$t('最新交易')" name="2">
+ <ul class="px-32 font-28 text-grey">
+ <li class="flex justify-between mt-30">
+ <span class="flex-1">{{ $t("时间") }}</span>
+ <span class="flex-1">{{ $t("方向") }}</span>
+ <span class="flex-1">{{ $t("价格") }}(USDT)</span>
+ <span class="flex-1 flex justify-center"
+ >{{ $t("数量") }}({{ symbol.toUpperCase() }})</span
+ >
+ </li>
+ <li
+ v-for="(item, index) in deals"
+ :key="item.ts + item.price + item.amount || index"
+ class="flex justify-between mt-30"
+ >
+ <span class="flex-1">{{
+ item.current_time ? item.current_time : "--"
+ }}</span>
+ <span
+ :class="item.direction === 'buy' ? 'text-green' : 'text-red'"
+ class="flex-1"
+ >{{
+ item.direction === "buy" ? $t("买入") : $t("卖出")
+ }}</span
+ >
+ <span
+ :class="item.direction === 'buy' ? 'text-green' : 'text-red'"
+ class="flex-1 flex-justify-center"
+ >{{ item.price || "--" }}</span
+ >
+ <span class="flex-1 flex justify-center">{{
+ item.amount || "--"
+ }}</span>
+ </li>
+ </ul>
+ </van-tab>
+ <van-tab :title="$t('深度图')" name="3">
+ <div class="buy-sell-box">
+ <div class="buy-item">
+ <div class="bg-line"></div>
+ {{ $t("买盘") }}
+ </div>
+ <div class="sell-item">
+ <div class="bg-line"></div>
+ {{ $t("卖盘") }}
+ </div>
</div>
- <div class="w-full h-20 greyBg"></div>
- <!-- tab 区域-->
- <div class="pb-180 tabContent">
- <van-tabs v-model="active">
- <van-tab :title="$t('委托订单')" name="1">
- <div class="flex px-32 justify-between px-32">
- <ul class="flex flex-col flex-1 mr-20">
- <li class="font-28 text-grey mt-30 mb-15 w-full">
- <p>{{ $t('买入') }}</p>
- <p class="flex justify-between items-cener font-22">
- <span style="margin-right: -10px;">{{ $t('价格') }}(USDT)</span>
- <span>{{ $t('数量') }}({{ symbol.toUpperCase() }})</span>
- </p>
- </li>
- <li v-for="(item, index) in bids" :key="index" class="flex justify-between font-26 py-15"
- :style="{
- 'background': `linear-gradient(to left,${theme == 'dark' ? '#121212' : '#ffffff'} 0% ` +
- (item.amount / bids[bids.length - 1].amount) * 100 + '%,rgba(94,186,137,.1) ' +
- (item.amount / bids[bids.length - 1].amount) * 100 + '%,rgba(94,186,137,.1) 100%)'
- }">
- <span class="textColor">{{ item.price || '--' }}</span>
- <span v-if="symbol == 'shib'" class="text-green">{{ fixDate(item.amount, $i18n) ||
- '--' }}</span>
- <span v-else class="text-green">{{ item.amount || '--' }}</span>
- </li>
- </ul>
- <ul class="flex-1 flex flex-col ml-20">
- <li class="font-28 text-grey mt-30 mb-15 w-full">
- <p>{{ $t('卖出') }}</p>
- <p class="flex justify-between items-center font-22">
- <span class="-ml-5">{{ $t('价格') }}(USDT)</span>
- <span>{{ $t('数量') }}({{ symbol.toUpperCase() }})</span>
- </p>
- </li>
- <li v-for="(item, index) in asks" :key="index" class="flex justify-between font-26 py-15"
- :style="{
- 'background': `linear-gradient(to left,${theme == 'dark' ? '#121212' : '#ffffff'} 0% ` +
- (item.amount / asks[asks.length - 1].amount) * 100 + '%,rgba(246,70,93,.1) ' +
- (item.amount / asks[asks.length - 1].amount) * 100 + '%,rgba(246,70,93,.1) 100%)'
- }">
- <span class="textColor">{{ item.price || '--' }}</span>
- <span v-if="symbol == 'shib'" class="text-red">{{ fixDate(item.amount, $i18n) ||
- '--' }}</span>
- <span v-else class="text-red">{{ item.amount || '--' }}</span>
- </li>
- </ul>
- </div>
- </van-tab>
- <van-tab :title="$t('最新交易')" name="2">
- <ul class="px-32 font-28 text-grey">
- <li class="flex justify-between mt-30">
- <span class="flex-1">{{ $t('时间') }}</span>
- <span class="flex-1">{{ $t('方向') }}</span>
- <span class="flex-1">{{ $t('价格') }}(USDT)</span>
- <span class="flex-1 flex justify-center">{{ $t('数量') }}({{ symbol.toUpperCase() }})</span>
- </li>
- <li v-for="(item, index) in deals" :key="item.ts + item.price + item.amount || index"
- class="flex justify-between mt-30">
- <span class="flex-1">{{ item.current_time ? item.current_time : '--' }}</span>
- <span :class="item.direction === 'buy' ? 'text-green' : 'text-red'" class="flex-1">{{
- item.direction === 'buy' ? $t('买入') : $t('卖出') }}</span>
- <span :class="item.direction === 'buy' ? 'text-green' : 'text-red'"
- class="flex-1 flex-justify-center">{{ item.price || '--' }}</span>
- <span class="flex-1 flex justify-center">{{ item.amount || '--' }}</span>
- </li>
- </ul>
- </van-tab>
- <van-tab :title="$t('深度图')" name="3">
- <div class="buy-sell-box">
- <div class="buy-item">
- <div class="bg-line"></div>
- {{ $t('买盘') }}
- </div>
- <div class="sell-item">
- <div class="bg-line"></div>
- {{ $t('卖盘') }}
- </div>
- </div>
- <div class="deep-chart-box">
- <deep-chart :deepBuy="deepBuy" :deepSell="deepSell"></deep-chart>
- </div>
- </van-tab>
- <!-- <van-tab :title="$t('数据分析')" name="4">
+ <div class="deep-chart-box">
+ <deep-chart :deepBuy="deepBuy" :deepSell="deepSell"></deep-chart>
+ </div>
+ </van-tab>
+ <!-- <van-tab :title="$t('数据分析')" name="4">
<div class="capital-box">
<div class="capital-flows">
<span class="title">资金流向分析</span><van-icon name="warning-o" />
@@ -187,7 +277,7 @@
</div>
</div>
</van-tab> -->
- <!-- <van-tab :title="$t('币种简介')" name="3" class="border-t-color" v-if="this.$te(`${symbol}简介`)">
+ <!-- <van-tab :title="$t('币种简介')" name="3" class="border-t-color" v-if="this.$te(`${symbol}简介`)">
<div class="px-20 py-20 font-40 text-grey">
{{ $t('关于名称', { 'symbol': symbol.toUpperCase() }) }}
</div>
@@ -195,662 +285,715 @@
{{ $t(`${symbol}简介`, { 'symbol': symbol.toUpperCase() }) }}
</div>
</van-tab> -->
- </van-tabs>
- </div>
- <!-- 按钮区 -->
- <div class="flex pl-40 pt-11 pb-11 pr-32 text-white justify-between fixed bottom-108 w-full box-border h-90-px z-10 buttonSafe"
- v-if="!kineType" :class="theme == 'dark' ? 'bg-night1' : 'bg-grey'">
- <div class="flex flex-col mx-30 items-center" @click="onRoute('/exchangeRate')">
- <img src="@/assets/image/icon-rate.png" class="w-38 h-38" />
- <p class="font-25 text-grey mt-8 text-center">{{ $t('汇率') }}</p>
- </div>
- <div ref="toBuy" class="w-270 h-88 bg-green flex justify-center items-center rounded-lg"
- @click="onSubmit('buy')">
- {{ tab == 1 ? $t('开多') : $t('买多') }}
- </div>
- <div ref="toSell" class="w-270 h-88 bg-red flex justify-center items-center rounded-lg"
- @click="onSubmit('sell')">
- {{ tab == 1 ? $t('开空') : $t('买空') }}</div>
- </div>
+ </van-tabs>
+ </div>
+ <!-- 按钮区 -->
+ <div
+ class="flex pl-40 pt-11 pb-11 pr-32 text-white justify-between fixed bottom-108 w-full box-border h-90-px z-10 buttonSafe"
+ v-if="!kineType"
+ :class="theme == 'dark' ? 'bg-night1' : 'bg-grey'"
+ >
+ <div
+ class="flex flex-col mx-30 items-center"
+ @click="onRoute('/exchangeRate')"
+ >
+ <img src="@/assets/image/icon-rate.png" class="w-38 h-38" />
+ <p class="font-25 text-grey mt-8 text-center">{{ $t("汇率") }}</p>
</div>
- <van-popup v-model="show" class="rounded-2xl" :key="initFutrue.session_token">
- <popup-confirm-order :paras="initFutrue.para" :symbol="symbol" :direction="direction"
- :balance="initFutrue.amount" :price="quote.close" @close="onClose" @confirm="onOrderConfirm"
- v-if="popType === 'confirm'" />
- <popup-delivery showBtns :detailData="detailData" :key="detailData.order_no" @close="onClose"
- @continueToBuy="order()" @timeEnd="handleTimeEnd" :price="quote.close" v-else />
- </van-popup>
+ <div
+ ref="toBuy"
+ class="w-270 h-88 bg-green flex justify-center items-center rounded-lg"
+ @click="onSubmit('buy')"
+ >
+ {{ tab == 1 ? $t("开多") : $t("买多") }}
+ </div>
+ <div
+ ref="toSell"
+ class="w-270 h-88 bg-red flex justify-center items-center rounded-lg"
+ @click="onSubmit('sell')"
+ >
+ {{ tab == 1 ? $t("开空") : $t("买空") }}
+ </div>
+ </div>
</div>
+ <van-popup
+ v-model="show"
+ class="rounded-2xl"
+ :key="initFutrue.session_token"
+ >
+ <popup-confirm-order
+ :paras="initFutrue.para"
+ :symbol="symbol"
+ :direction="direction"
+ :balance="initFutrue.amount"
+ :price="quote.close"
+ @close="onClose"
+ @confirm="onOrderConfirm"
+ v-if="popType === 'confirm'"
+ />
+ <popup-delivery
+ showBtns
+ :detailData="detailData"
+ :key="detailData.order_no"
+ @close="onClose"
+ @continueToBuy="order()"
+ @timeEnd="handleTimeEnd"
+ :price="quote.close"
+ v-else
+ />
+ </van-popup>
+ </div>
</template>
<script>
-import { Tab, Tabs, Popup } from 'vant';
-import TradeHead from '@/components/trade-head/index.vue'
-import KlineCharts from '@/components/kline-charts'
-import deepChart from '@/components/deepChart'
-import pieChart from '@/components/pieChart'
-import inflowKline from '@/components/inflow-kline'
-import cylinderChart from '@/components/cylinderChart'
-import { _getHomeList, _collect, _deleteCollect } from '@/API/home.api'
-import { _getBalance, _futrueOrder, _futrueOrderInit, _futrueOrderDetail } from '@/API/trade.api'
-import { mapGetters } from 'vuex';
+import { Tab, Tabs, Popup } from "vant";
+import TradeHead from "@/components/trade-head/index.vue";
+import KlineCharts from "@/components/kline-charts";
+import deepChart from "@/components/deepChart";
+import pieChart from "@/components/pieChart";
+import inflowKline from "@/components/inflow-kline";
+import cylinderChart from "@/components/cylinderChart";
+import { _getHomeList, _collect, _deleteCollect } from "@/API/home.api";
+import {
+ _getBalance,
+ _futrueOrder,
+ _futrueOrderInit,
+ _futrueOrderDetail,
+} from "@/API/trade.api";
+import { mapGetters } from "vuex";
import { fixDate } from "@/utils/utis";
-import { WS_URL } from '@/config';
+import { WS_URL } from "@/config";
import PopupDelivery from "@/components/popup-delivery";
-import PopupConfirmOrder from '@/components/popup-confirm-order'
+import PopupConfirmOrder from "@/components/popup-confirm-order";
export default {
- name: 'TrendDetails',
- components: {
- [Tabs.name]: Tabs,
- [Tab.name]: Tab,
- [Popup.name]: Popup,
- KlineCharts,
- PopupDelivery,
- PopupConfirmOrder,
- TradeHead,
- deepChart,
- pieChart,
- inflowKline,
- cylinderChart
- },
- data() {
- const arr = []
- for (let i = 0; i < 17; i++) {
- arr.push({
- id: i
- })
- }
- return {
- show: false,
- direction: 'buy',
- initFutrue: {},
- detailData: {},
- price: '',
- popType: 'confirm', // confirm / counting
- fixDate,
- tab: '1', // 顶部标签
- symbol: '',
- quoteData: [],
- quote: {},
- active: 1,
- asks: arr, // 卖
- bids: arr, // 买
- deals: arr, // 交易
- sockets: {
- quote: null,
- deals: null,
- askBid: null
- },
- animated1: false,
- animated2: false,
- updateKey: 1,
- collected: '0', // 是否自选
- maxSell: 0, // 卖单最大
- maxBuy: 0, // 买单最大
- order_no: '',
- timer: null,
- isChangeLine: false,
- isReturn: true, //是否有返回
- kineType: '',
- // updateData: {}
- deepBuy: [],
- deepSell: [],
- fromPath: ''
- }
- },
- computed: {
- ...mapGetters({
- currency: 'home/currency',
- userInfo: 'user/userInfo',
- theme: 'home/theme'
- })
- },
- mounted() {
- //this.continueOrder()
- this.kineType = this.$route.query.kineType;
-
- },
- created() {
-
- },
- watch: {
- active(val) { // tab切换
- if (val / 1 === 1 || val / 1 === 3) {
- this.sockets.deals && this.sockets.deals.close()
- this.sockets.deals = null
- if (this.symbol) { // 刚进来可能是null
- this.startAskBidSocket()
- }
- } else {
- this.sockets.askBid && this.sockets.askBid.close()
- this.sockets.askBid = null
- this.startDealsSocket()
- }
- },
- symbol() {
- this.closeSocket()
- }
-
-
- },
- methods: {
- onChangeLine() {
- this.isChangeLine = true
- },
- continueOrder() {
- let direction = this.$route.query.direction
- if (direction) {
- this.symbol = this.$route.params.symbol
- this.tab = '2'
- console.log(this.tab)
- this.onSubmit(direction);
- }
- },
- order() {
- this.onSubmit(this.direction);
- },
- onTab(e) {
- this.tab = e
- // this.$router.go()
- if (e == 1) {
- this.animated1 = true
- this.timer = setTimeout(() => {
- this.animated1 = false
- clearTimeout(this.timer)
- }, 200)
- } else {
- this.animated2 = true
- this.timer = setTimeout(() => {
- this.animated2 = false
- clearTimeout(this.timer)
- }, 200)
- }
- },
-
- onCollect() { // 收藏,取消收藏
- let _api = _collect
- if (this.collected === '1') {
- _api = _deleteCollect
- }
- _api(this.symbol).then(() => {
- this.collected = this.collected === '1' ? '0' : '1'
- if (this.collected === '1') {
- this.$toast.success(this.$t('收藏成功'))
- } else {
- this.$toast.success(this.$t('取消收藏'))
- }
- })
- },
- goHistory() {
- const url = this.topIndex / 1 === 1 ? 'perpetualHistory' : 'deliveryContractHistory'
- this.$router.push({
- path: `/${url}?symbol=${this.symbol}`
- });
- },
- fetchData() {
- this.closeSocket()
- _getHomeList(this.symbol).then(data => {
- // console.log(data[0])
- this.quote = data[0]
- this.$nextTick(() => {
- if (!this.sockets.quote && this.symbol) {
- this.startQuoteScoket()
- }
-
- if ((this.tab === '1' || this.tab === '3') && !this.sockets.askBid && this.symbol) {
- this.startAskBidSocket()
- }
- })
- // this.startDealsSocket()
- })
- },
- startQuoteScoket() {
- this.sockets.quote = new WebSocket(`${WS_URL}/1/${this.symbol}`)
- this.sockets.quote.onmessage = (evt) => {
- const { data } = evt
- const { code, data: _data } = JSON.parse(data)
- if (code / 1 === 0) {
- this.quote = _data[0]
- let str = _data[0] ? _data[0].close.toString() : ''
- if (str.indexOf('.') != -1) {
- this.coinLength = str.split('.')[1].length
- }
- this.updateKey++
- }
- }
- },
- startAskBidSocket() { // 委托
- this.sockets.askBid = new WebSocket(`${WS_URL}/3/${this.symbol}`)
- this.sockets.askBid.onmessage = (evt) => {
- const { data } = evt
- const { code, data: _data } = JSON.parse(data)
- if (code / 1 === 0) {
- let { asks, bids } = _data
- this.deepBuy = bids
- this.deepSell = asks
- asks = asks.sort((prev, next) => prev.price - next.price)
- bids = bids.sort((prev, next) => prev.price - next.price)
- this.asks = asks.slice(0, 17)
- this.bids = bids.reverse().slice(0, 17)
- }
- }
- },
- startDealsSocket() { // 交易
- this.sockets.deals = new WebSocket(`${WS_URL}/2/${this.symbol}`)
- this.sockets.deals.onmessage = (evt) => {
- const { data } = evt
- const { code, data: _data } = JSON.parse(data)
- if (code / 1 === 0) {
- this.deals = _data.data.slice(0, 17)
- }
- }
- },
- onRoute(path) { // 跳转汇率页面
- this.$router.push(path)
- },
- onSubmit(direction) { // TODO: 返回
- if (this.tab === '2') {
- this.popType = 'confirm'
- this.direction = direction
- _futrueOrderInit(this.symbol).then(data => {
- this.initFutrue = data
- this.show = true
- })
- return
- } else {
- let currentType = direction == 'buy' ? 'long' : 'short'
- this.$router.push(`/perpetualContract/${this.symbol}?currentType=${currentType}`)
- }
- },
- onClose() {
- this.show = false
- },
- handleTimeEnd() {
- _futrueOrderDetail(this.order_no).then(data => {
- clearTimeout(this.timeout)
- this.detailData = data
- if (data.state !== 'created') {
- this.timeout = setTimeout(() => {
- this.handleTimeEnd()
- }, 1000)
- }
- })
- },
- onOrderConfirm(e) { // 确认订单
- _futrueOrder({ ...e, symbol: this.symbol, direction: this.direction, session_token: this.initFutrue.session_token }).then(data => {
- // console.log(data)
- this.order_no = data.order_no
- _getBalance().then(data => { // 刷新余额
- this.$store.commit('user/SET_USERINFO', { balance: data.money })
- })
- _futrueOrderDetail(data.order_no).then(data => {
- this.detailData = data
- this.popType = ''
- })
- }).catch(() => {
- setTimeout(() => {
- _futrueOrderInit(this.symbol).then(data => {
- this.order_no = ''
- this.initFutrue = data
- })
- }, 1000);
- })
- },
- closeSocket() {
- this.sockets.quote && this.sockets.quote.close()
- this.sockets.deals && this.sockets.deals.close()
- this.sockets.askBid && this.sockets.askBid.close()
- this.sockets.quote = null
- this.sockets.deals = null
- this.sockets.askBid = null
- },
- onUpdate(symbol) { // 更新
- this.closeSocket()
- this.symbol = symbol;
- this.fetchData()
- },
- openRecord() {
- if (this.fromPath == 'Trade') {
- this.$router.push('/tradeRecord/' + this.symbol)
- } else {
- this.$router.push('/perpetualHistory?symbol=' + this.symbol)
- }
- console.log(this.fromPath)
- }
- },
- activated() {
- // if (!this.sockets.quote && this.symbol) {
- // this.startQuoteScoket()
- // }
- // if (this.tab === '1' && !this.sockets.askBid && this.symbol) {
- // this.startAskBidSocket()
- // }
- if (!this.symbol) {
- this.symbol = this.$route.params.symbol
- this.fetchData()
- this.closeSocket()
- }
- if (this.tab === '2' && !this.sockets.deals && this.symbol) {
- this.startDealsSocket()
- }
- this.continueOrder()
- this.kineType = this.$route.query.kineType
- },
- deactivated() {
- this.closeSocket()
- },
- beforeDestroy() {
- this.sockets.quote && this.sockets.quote.close()
- this.sockets.deals && this.sockets.deals.close()
- this.sockets.askBid && this.sockets.askBid.close()
- this.sockets.quote = null
- this.sockets.deals = null
- this.sockets.askBid = null
- },
- beforeRouteEnter(to, from, next) {
- const { params: { symbol } } = to
- console.log(symbol)
- next(vm => {
- vm.fromPath = from.name
- vm.symbol = symbol
- vm.closeSocket()
- vm.fetchData()
- })
+ name: "TrendDetails",
+ components: {
+ [Tabs.name]: Tabs,
+ [Tab.name]: Tab,
+ [Popup.name]: Popup,
+ KlineCharts,
+ PopupDelivery,
+ PopupConfirmOrder,
+ TradeHead,
+ deepChart,
+ pieChart,
+ inflowKline,
+ cylinderChart,
+ },
+ data() {
+ const arr = [];
+ for (let i = 0; i < 17; i++) {
+ arr.push({
+ id: i,
+ });
}
-}
+ return {
+ show: false,
+ direction: "buy",
+ initFutrue: {},
+ detailData: {},
+ price: "",
+ popType: "confirm", // confirm / counting
+ fixDate,
+ tab: "1", // 顶部标签
+ symbol: "",
+ quoteData: [],
+ quote: {},
+ active: 1,
+ asks: arr, // 卖
+ bids: arr, // 买
+ deals: arr, // 交易
+ sockets: {
+ quote: null,
+ deals: null,
+ askBid: null,
+ },
+ animated1: false,
+ animated2: false,
+ updateKey: 1,
+ collected: "0", // 是否自选
+ maxSell: 0, // 卖单最大
+ maxBuy: 0, // 买单最大
+ order_no: "",
+ timer: null,
+ isChangeLine: false,
+ isReturn: true, //是否有返回
+ kineType: "",
+ // updateData: {}
+ deepBuy: [],
+ deepSell: [],
+ fromPath: "",
+ };
+ },
+ computed: {
+ ...mapGetters({
+ currency: "home/currency",
+ userInfo: "user/userInfo",
+ theme: "home/theme",
+ }),
+ },
+ mounted() {
+ //this.continueOrder()
+ this.kineType = this.$route.query.kineType;
+ },
+ created() {},
+ watch: {
+ active(val) {
+ // tab切换
+ if (val / 1 === 1 || val / 1 === 3) {
+ this.sockets.deals && this.sockets.deals.close();
+ this.sockets.deals = null;
+ if (this.symbol) {
+ // 刚进来可能是null
+ this.startAskBidSocket();
+ }
+ } else {
+ this.sockets.askBid && this.sockets.askBid.close();
+ this.sockets.askBid = null;
+ this.startDealsSocket();
+ }
+ },
+ symbol() {
+ this.closeSocket();
+ },
+ },
+ methods: {
+ onChangeLine() {
+ this.isChangeLine = true;
+ },
+ continueOrder() {
+ let direction = this.$route.query.direction;
+ if (direction) {
+ this.symbol = this.$route.params.symbol;
+ this.tab = "2";
+ console.log(this.tab);
+ this.onSubmit(direction);
+ }
+ },
+ order() {
+ this.onSubmit(this.direction);
+ },
+ onTab(e) {
+ this.tab = e;
+ // this.$router.go()
+ if (e == 1) {
+ this.animated1 = true;
+ this.timer = setTimeout(() => {
+ this.animated1 = false;
+ clearTimeout(this.timer);
+ }, 200);
+ } else {
+ this.animated2 = true;
+ this.timer = setTimeout(() => {
+ this.animated2 = false;
+ clearTimeout(this.timer);
+ }, 200);
+ }
+ },
+
+ onCollect() {
+ // 收藏,取消收藏
+ let _api = _collect;
+ if (this.collected === "1") {
+ _api = _deleteCollect;
+ }
+ _api(this.symbol).then(() => {
+ this.collected = this.collected === "1" ? "0" : "1";
+ if (this.collected === "1") {
+ this.$toast.success(this.$t("收藏成功"));
+ } else {
+ this.$toast.success(this.$t("取消收藏"));
+ }
+ });
+ },
+ goHistory() {
+ const url =
+ this.topIndex / 1 === 1
+ ? "perpetualHistory"
+ : "deliveryContractHistory";
+ this.$router.push({
+ path: `/${url}?symbol=${this.symbol}`,
+ });
+ },
+ fetchData() {
+ this.closeSocket();
+ _getHomeList(this.symbol).then((data) => {
+ // console.log(data[0])
+ this.quote = data[0];
+ this.$nextTick(() => {
+ if (!this.sockets.quote && this.symbol) {
+ this.startQuoteScoket();
+ }
+
+ if (
+ (this.tab === "1" || this.tab === "3") &&
+ !this.sockets.askBid &&
+ this.symbol
+ ) {
+ this.startAskBidSocket();
+ }
+ });
+ // this.startDealsSocket()
+ });
+ },
+ startQuoteScoket() {
+ this.sockets.quote = new WebSocket(`${WS_URL}/1/${this.symbol}`);
+ this.sockets.quote.onmessage = (evt) => {
+ const { data } = evt;
+ const { code, data: _data } = JSON.parse(data);
+ if (code / 1 === 0) {
+ this.quote = _data[0];
+ let str = _data[0] ? _data[0].close.toString() : "";
+ if (str.indexOf(".") != -1) {
+ this.coinLength = str.split(".")[1].length;
+ }
+ this.updateKey++;
+ }
+ };
+ },
+ startAskBidSocket() {
+ // 委托
+ this.sockets.askBid = new WebSocket(`${WS_URL}/3/${this.symbol}`);
+ this.sockets.askBid.onmessage = (evt) => {
+ const { data } = evt;
+ const { code, data: _data } = JSON.parse(data);
+ if (code / 1 === 0) {
+ let { asks, bids } = _data;
+ this.deepBuy = bids;
+ this.deepSell = asks;
+ asks = asks.sort((prev, next) => prev.price - next.price);
+ bids = bids.sort((prev, next) => prev.price - next.price);
+ this.asks = asks.slice(0, 17);
+ this.bids = bids.reverse().slice(0, 17);
+ }
+ };
+ },
+ startDealsSocket() {
+ // 交易
+ this.sockets.deals = new WebSocket(`${WS_URL}/2/${this.symbol}`);
+ this.sockets.deals.onmessage = (evt) => {
+ const { data } = evt;
+ const { code, data: _data } = JSON.parse(data);
+ if (code / 1 === 0) {
+ this.deals = _data.data.slice(0, 17);
+ }
+ };
+ },
+ onRoute(path) {
+ // 跳转汇率页面
+ this.$router.push(path);
+ },
+ onSubmit(direction) {
+ // TODO: 返回
+ if (this.tab === "2") {
+ this.popType = "confirm";
+ this.direction = direction;
+ _futrueOrderInit(this.symbol).then((data) => {
+ this.initFutrue = data;
+ this.show = true;
+ });
+ return;
+ } else {
+ let currentType = direction == "buy" ? "long" : "short";
+ this.$router.push(
+ `/perpetualContract/${this.symbol}?currentType=${currentType}`
+ );
+ }
+ },
+ onClose() {
+ this.show = false;
+ },
+ handleTimeEnd() {
+ _futrueOrderDetail(this.order_no).then((data) => {
+ clearTimeout(this.timeout);
+ this.detailData = data;
+ if (data.state !== "created") {
+ this.timeout = setTimeout(() => {
+ this.handleTimeEnd();
+ }, 1000);
+ }
+ });
+ },
+ onOrderConfirm(e) {
+ // 确认订单
+ _futrueOrder({
+ ...e,
+ symbol: this.symbol,
+ direction: this.direction,
+ session_token: this.initFutrue.session_token,
+ })
+ .then((data) => {
+ // console.log(data)
+ this.order_no = data.order_no;
+ _getBalance().then((data) => {
+ // 刷新余额
+ this.$store.commit("user/SET_USERINFO", { balance: data.money });
+ });
+ _futrueOrderDetail(data.order_no).then((data) => {
+ this.detailData = data;
+ this.popType = "";
+ });
+ })
+ .catch(() => {
+ setTimeout(() => {
+ _futrueOrderInit(this.symbol).then((data) => {
+ this.order_no = "";
+ this.initFutrue = data;
+ });
+ }, 1000);
+ });
+ },
+ closeSocket() {
+ this.sockets.quote && this.sockets.quote.close();
+ this.sockets.deals && this.sockets.deals.close();
+ this.sockets.askBid && this.sockets.askBid.close();
+ this.sockets.quote = null;
+ this.sockets.deals = null;
+ this.sockets.askBid = null;
+ },
+ onUpdate(symbol) {
+ // 更新
+ this.closeSocket();
+ this.symbol = symbol;
+ this.fetchData();
+ },
+ openRecord() {
+ if (this.fromPath == "Trade") {
+ this.$router.push("/tradeRecord/" + this.symbol);
+ } else {
+ this.$router.push("/perpetualHistory?symbol=" + this.symbol);
+ }
+ console.log(this.fromPath);
+ },
+ },
+ activated() {
+ // if (!this.sockets.quote && this.symbol) {
+ // this.startQuoteScoket()
+ // }
+ // if (this.tab === '1' && !this.sockets.askBid && this.symbol) {
+ // this.startAskBidSocket()
+ // }
+ if (!this.symbol) {
+ this.symbol = this.$route.params.symbol;
+ this.fetchData();
+ this.closeSocket();
+ }
+ if (this.tab === "2" && !this.sockets.deals && this.symbol) {
+ this.startDealsSocket();
+ }
+ this.continueOrder();
+ this.kineType = this.$route.query.kineType;
+ },
+ deactivated() {
+ this.closeSocket();
+ },
+ beforeDestroy() {
+ this.sockets.quote && this.sockets.quote.close();
+ this.sockets.deals && this.sockets.deals.close();
+ this.sockets.askBid && this.sockets.askBid.close();
+ this.sockets.quote = null;
+ this.sockets.deals = null;
+ this.sockets.askBid = null;
+ },
+ beforeRouteEnter(to, from, next) {
+ const {
+ params: { symbol },
+ } = to;
+ console.log(symbol);
+ next((vm) => {
+ vm.fromPath = from.name;
+ vm.symbol = symbol;
+ vm.closeSocket();
+ vm.fetchData();
+ });
+ },
+};
</script>
<style lang="scss" scoped>
@import "../../assets/init.scss";
-
@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;
}
.tabBtn {
- border: 2px solid #EAEDF2;
- border-radius: 9px;
- color: #868D9A;
- ;
+ border: 2px solid #eaedf2;
+ border-radius: 9px;
+ color: #868d9a;
}
.activeBtn {
- @include themify() {
- background: themed("btn_main");
- }
+ @include themify() {
+ background: themed("btn_main");
+ }
- color: #fff;
- border: none;
+ color: #fff;
+ border: none;
}
.pb-180 {
- ::v-deep .van-tab {
- flex: initial;
- padding: 0 32px;
- }
+ ::v-deep .van-tab {
+ flex: initial;
+ padding: 0 32px;
+ }
- ::v-deep .van-tab__text--ellipsis {
- padding: 14px 0;
- }
+ ::v-deep .van-tab__text--ellipsis {
+ padding: 14px 0;
+ }
- ::v-deep .van-tabs__line {
- width: 160px;
- }
+ ::v-deep .van-tabs__line {
+ width: 160px;
+ }
}
.buttonSafe {
- bottom: calc(constant(safe-area-inset-bottom));
- bottom: calc(env(safe-area-inset-bottom));
+ bottom: calc(constant(safe-area-inset-bottom));
+ bottom: calc(env(safe-area-inset-bottom));
}
-
.trend-detail {
- .tabBtn {
- @include themify() {
- border: 2px solid themed("border_color");
- }
+ .tabBtn {
+ @include themify() {
+ border: 2px solid themed("border_color");
}
+ }
- ::v-deep .van-tabs__nav {
- @include themify() {
- background: themed("main_background") !important;
- }
+ ::v-deep .van-tabs__nav {
+ @include themify() {
+ background: themed("main_background") !important;
}
+ }
- ::v-deep .van-tab--active {
- @include themify() {
- color: themed("text_color");
- }
+ ::v-deep .van-tab--active {
+ @include themify() {
+ color: themed("text_color");
}
+ }
- ul li {
- @include themify() {
- background: themed("main_background");
- }
+ ul li {
+ @include themify() {
+ background: themed("main_background");
}
+ }
- .activeBtn {
- border: none !important;
- }
-
+ .activeBtn {
+ border: none !important;
+ }
}
-
.deep-chart-box {
- padding-left: 30px;
- overflow: hidden;
+ padding-left: 30px;
+ overflow: hidden;
}
.capital-box {
- padding: 30px 30px;
+ padding: 30px 30px;
- .capital-flows {
- display: flex;
- align-items: center;
+ .capital-flows {
+ display: flex;
+ align-items: center;
- .title {
- color: #ECF0F8;
- font-size: 16px;
- font-weight: bold;
- margin-right: 10px;
- display: flex;
- }
+ .title {
+ color: #ecf0f8;
+ font-size: 16px;
+ font-weight: bold;
+ margin-right: 10px;
+ display: flex;
+ }
+ }
+
+ .tab-box {
+ display: flex;
+ flex-wrap: wrap;
+ margin-top: 20px;
+
+ .tab-item {
+ padding: 15px 22px;
+ background: #171a27;
+ border-radius: 2px;
+ color: #ffffff;
+ font-size: 30px;
+ margin-right: 30px;
+ margin-bottom: 20px;
+ font-size: 14px;
+ }
+ }
+
+ .pie-box {
+ background: #161d2b;
+ padding: 50px 0;
+ }
+
+ .order-box {
+ border: 1px dashed #3c3f55;
+ border-radius: 3px;
+ margin-top: 20px;
+ color: #c5cbd8;
+
+ .order-header {
+ display: flex;
}
- .tab-box {
- display: flex;
- flex-wrap: wrap;
- margin-top: 20px;
+ .flex-item {
+ flex: 1;
+ text-align: center;
+ padding: 20px 0;
+ }
+ }
- .tab-item {
- padding: 15px 22px;
- background: #171A27;
- border-radius: 2px;
- color: #FFFFFF;
- font-size: 30px;
- margin-right: 30px;
- margin-bottom: 20px;
- font-size: 14px;
- }
+ .capital-title {
+ padding-top: 30px;
+
+ .title {
+ color: #ecf0f8;
+ font-size: 30px;
+ font-weight: bold;
+ margin-right: 10px;
}
- .pie-box {
- background: #161D2B;
- padding: 50px 0;
+ .text {
+ color: #c5cbd8;
+ font-size: 14px;
+ margin-top: 10px;
}
-
- .order-box {
- border: 1px dashed #3C3F55;
- border-radius: 3px;
- margin-top: 20px;
- color: #C5CBD8;
-
- .order-header {
- display: flex;
- }
-
- .flex-item {
- flex: 1;
- text-align: center;
- padding: 20px 0;
-
- }
- }
-
- .capital-title {
- padding-top: 30px;
-
- .title {
- color: #ECF0F8;
- font-size: 30px;
- font-weight: bold;
- margin-right: 10px;
- }
-
- .text {
- color: #C5CBD8;
- font-size: 14px;
- margin-top: 10px;
- }
- }
+ }
}
.buy-sell-box {
+ display: flex;
+ justify-content: center;
+ margin: 30px 0px;
+
+ .buy-item {
display: flex;
- justify-content: center;
- margin: 30px 0px;
- .buy-item {
- display: flex;
-
- @include themify() {
- color: themed("text_color");
- }
-
- .bg-line {
- width: 40px;
- height: 40px;
- background: #D9001B;
- border-radius: 5px;
- margin-right: 10px;
- }
+ @include themify() {
+ color: themed("text_color");
}
- .sell-item {
- margin-left: 30px;
- display: flex;
-
- @include themify() {
- color: themed("text_color");
- }
-
- .bg-line {
- width: 40px;
- height: 40px;
- background: #2EBD85;
- border-radius: 5px;
- margin-right: 10px;
- }
+ .bg-line {
+ width: 40px;
+ height: 40px;
+ background: #d9001b;
+ border-radius: 5px;
+ margin-right: 10px;
}
+ }
+
+ .sell-item {
+ margin-left: 30px;
+ display: flex;
+
+ @include themify() {
+ color: themed("text_color");
+ }
+
+ .bg-line {
+ width: 40px;
+ height: 40px;
+ background: #2ebd85;
+ border-radius: 5px;
+ margin-right: 10px;
+ }
+ }
}
.bg-white {
- .capital-flows {
- display: flex;
- align-items: center;
+ .capital-flows {
+ display: flex;
+ align-items: center;
- .title {
- color: #000;
- font-size: 16px;
- font-weight: bold;
- margin-right: 10px;
- display: flex;
- }
+ .title {
+ color: #000;
+ font-size: 16px;
+ font-weight: bold;
+ margin-right: 10px;
+ display: flex;
+ }
+ }
+
+ .tab-box {
+ .tab-item {
+ background: #f7f8fa;
+ color: #000;
+ font-size: 14px;
+ }
+ }
+
+ .pie-box {
+ background: #fff;
+ padding: 50px 0;
+ }
+
+ .order-box {
+ border: 1px dashed #000;
+ border-radius: 3px;
+ margin-top: 20px;
+ color: #000;
+ }
+
+ .capital-title {
+ padding-top: 30px;
+
+ .title {
+ color: #000;
+ font-size: 30px;
+ font-weight: bold;
+ margin-right: 10px;
}
-
- .tab-box {
- .tab-item {
- background: #f7f8fa;
- color: #000;
- font-size: 14px;
- }
+ .text {
+ color: #000;
+ font-size: 14px;
+ margin-top: 10px;
}
-
- .pie-box {
- background: #fff;
- padding: 50px 0;
- }
-
- .order-box {
- border: 1px dashed #000;
- border-radius: 3px;
- margin-top: 20px;
- color: #000;
- }
-
- .capital-title {
- padding-top: 30px;
-
- .title {
- color: #000;
- font-size: 30px;
- font-weight: bold;
- margin-right: 10px;
- }
-
- .text {
- color: #000;
- font-size: 14px;
- margin-top: 10px;
- }
- }
+ }
}
::v-deep .van-popup {
- @include themify() {
- background: themed("main_background");
- }
+ @include themify() {
+ background: themed("main_background");
+ }
}
.tabContent {
- ::v-deep .van-tabs__wrap {
- height: 100% !important;
- }
+ ::v-deep .van-tabs__wrap {
+ height: 100% !important;
+ }
}
</style>
diff --git a/src/page/assetsCenter/index.vue b/src/page/assetsCenter/index.vue
index 9ffa5a9..57fb534 100644
--- a/src/page/assetsCenter/index.vue
+++ b/src/page/assetsCenter/index.vue
@@ -118,7 +118,7 @@
import { _getAllWallet } from "@/API/fund.api";
import Axios from "@/API/assets";
-import { mapGetters } from "vuex";
+import { mapActions, mapGetters } from "vuex";
import { _futrueOrderList, _orderListHold } from "@/API/trade.api";
import PerpetualPositionList from "@/components/perpetual-position-list/index.vue";
import futrueHoldList from "@/page/deliveryContract/hold.vue";
@@ -188,6 +188,9 @@
this.getAssetsFunds();
this.getAssets();
},
+ mounted() {
+ this.GET_UERS_KYC();
+ },
computed: {
...mapGetters("home", ["currency", "theme"]),
allAssets() {
@@ -246,6 +249,8 @@
},
},
methods: {
+ ...mapActions("user", ["GET_UERS_KYC"]),
+
routerList(item) {
this.$router.push({ path: item.route, query: item.query });
},
diff --git a/src/page/assetsCenter/profile.vue b/src/page/assetsCenter/profile.vue
index 4c27a4e..e74cb25 100644
--- a/src/page/assetsCenter/profile.vue
+++ b/src/page/assetsCenter/profile.vue
@@ -83,7 +83,7 @@
</template>
<script>
-import { mapGetters } from "vuex";
+import { mapActions, mapGetters } from "vuex";
import tabsProfile from "./tabs-profile.vue";
import { setStorage } from "@/utils/utis";
@@ -96,7 +96,12 @@
userInfo: "user/userInfo",
}),
},
+ mounted() {
+ this.GET_UERS_KYC();
+ },
methods: {
+ ...mapActions("user", ["GET_UERS_KYC"]),
+
loginOut() {
this.$store.commit("user/SET_OUT");
setStorage("popNotice", false);
diff --git a/src/page/authentication/index.vue b/src/page/authentication/index.vue
index f591cd2..230774e 100644
--- a/src/page/authentication/index.vue
+++ b/src/page/authentication/index.vue
@@ -4,79 +4,181 @@
<assets-head :title="$t('进阶认证')" />
<!-- <country-list /> -->
<div v-if="show">
- <div class=" pt-58 pb-54 box-border border-b-color" v-if="disabled() || status === 3">
- <div class="flex justify-between items-center px-30 textColor">
- <div class="font-50">{{ $t('身份认证') }}</div>
- <div class="flex items-center" v-if="resultArr[this.status]">
- <img
- :src="require(`@/assets/image/assets-center/${resultArr[this.status] && resultArr[this.status].split('_')[0]}.png`)"
- alt="success img" class="w-36 h-36" />
- <div class="font-32 ml-18">{{resultArr[this.status] && resultArr[this.status].split('_')[1] }}</div>
- </div>
- </div>
- </div>
- <div class="pl-30 pr-30">
- <div class="mb-40">
- <div class="mt-54 mb-25 font-24 textColor">{{ $t('国籍') }}</div>
- <div class="pt-28 pb-28 pl-38 pr-38 flex justify-between items-center rounded inputBackground textColor" @click="openBtn">
- <div class="flex items-center">
- <!-- <div class="iti-flag mr-20" :class="countryCode" style="transform: scale(2.1)"></div> -->
- <div>{{ countryName }}</div>
- </div>
-
- <img v-if="resultArr.length === 0" src="../../assets/image/public/down-arrow.png" class="w-33 h-20" alt="arrow" />
- </div>
- </div>
- <ExInput :label="$t('真实姓名')" :disabled="disabled()" :clearBtn="!disabled()" :placeholderText="$t('请输入真实姓名')"
- v-model="name" />
- <ExInput :label="$t('证件/护照号码')" :disabled="disabled()" :clearBtn="!disabled()" :placeholderText="$t('请输入您的证件/护照号码')"
- v-model="idnumber" />
- <div>
- <div v-if="resultArr.length > 0" class="mt-4 mb-25 textColor">{{ $t('证件照/上传护照') }}</div>
- <div v-else class="mt-4 mb-25 textColor">{{ $t('证件/护照认证图片上传') }}</div>
- <div class="flex mt-33 mb-80 justify-between">
- <div class="flex-1 flex flex-col text-center justify-center items-center">
- <div class="upload-wrap">
- <img src="@/assets/image/kyc/0.png" alt="" class="w-full"
- v-if="[1,2].includes(status) && frontFile.length === 0" />
- <van-uploader v-model="frontFile" multiple :max-count="1" :disabled="disabled()" :deletable="!disabled()"
- :after-read="afterRead" @click-upload="onClickUpload('frontFile')" v-else />
- </div>
- <div class="mt-32 font-26 h-20" style="color:#868D9A;">{{ $t('证件正面') }}</div>
- </div>
- <div class="flex-1 flex flex-col text-center justify-center items-center">
- <div class="upload-wrap">
- <img src="@/assets/image/kyc/1.png" alt="" class="w-full"
- v-if="[1,2].includes(status) && reverseFile.length === 0" />
- <van-uploader v-model="reverseFile" multiple :max-count="1" :disabled="disabled()" :deletable="!disabled()"
- :after-read="afterRead" @click-upload="onClickUpload('reverseFile')" v-else />
- </div>
- <div class="mt-32 font-26 h-20" style="color:#868D9A;">{{ $t('证件反面') }}</div>
- </div>
- <div class="flex-1 flex flex-col text-center justify-center items-center">
- <div class="upload-wrap">
- <img src="@/assets/image/kyc/2.png" alt="" class="w-full"
- v-if="[1,2].includes(status) && fileList.length === 0" />
- <van-uploader v-model="fileList" multiple :max-count="1" :disabled="disabled()" :deletable="!disabled()"
- :after-read="afterRead" @click-upload="onClickUpload('fileList')" v-else />
- </div>
- <div class="mt-32 font-26 h-20" style="color:#868D9A;">{{ $t('手持证件照') }}</div>
- </div>
- </div>
- </div>
- <template v-if="!disabled()">
- <div class="font-35 mb-32 textColor">{{ $t('拍摄示例') }}</div>
- <img src="../../assets/image/kyc/kyc-demo.png" alt="" style="width:100%;height:auto;" class="w-756 h-220 mb-100">
- </template>
- <button class="apply-btn btnMain text-white font-35 h-100 rounded" @click="onSubmit" v-if="!disabled()">{{
- $t('申请认证') }}</button>
- <div class="pt-35 pb-60 font-30" v-if="!disabled() || status === 3">
- <span class="text-grey">{{ $t('上传证件照失败,请联系客服获取邮箱地址发送证件照或者重新上传') }}</span>
- <span class="text-blue service-text" @click="tokefu"> {{ $t('联系客服') }}</span>
- </div>
- <nationality-list ref='controlChild' :title="$t('请选择国家')" @getName="getName(arguments)" v-if="!disabled()">
- </nationality-list>
- </div>
+ <div
+ class="pt-58 pb-54 box-border border-b-color"
+ v-if="disabled() || status === 3"
+ >
+ <div class="flex justify-between items-center px-30 textColor">
+ <div class="font-50">{{ $t("身份认证") }}</div>
+ <div class="flex items-center" v-if="resultArr[this.status]">
+ <img
+ :src="
+ require(`@/assets/image/assets-center/${
+ resultArr[this.status] && resultArr[this.status].split('_')[0]
+ }.png`)
+ "
+ alt="success img"
+ class="w-36 h-36"
+ />
+ <div class="font-32 ml-18">
+ {{
+ resultArr[this.status] && resultArr[this.status].split("_")[1]
+ }}
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="pl-30 pr-30">
+ <div class="mb-40">
+ <div class="mt-54 mb-25 font-24 textColor">{{ $t("国籍") }}</div>
+ <div
+ class="pt-28 pb-28 pl-38 pr-38 flex justify-between items-center rounded inputBackground textColor"
+ @click="openBtn"
+ >
+ <div class="flex items-center">
+ <!-- <div class="iti-flag mr-20" :class="countryCode" style="transform: scale(2.1)"></div> -->
+ <div>{{ countryName }}</div>
+ </div>
+
+ <img
+ v-if="resultArr.length === 0"
+ src="../../assets/image/public/down-arrow.png"
+ class="w-33 h-20"
+ alt="arrow"
+ />
+ </div>
+ </div>
+ <ExInput
+ :label="$t('真实姓名')"
+ :disabled="disabled()"
+ :clearBtn="!disabled()"
+ :placeholderText="$t('请输入真实姓名')"
+ v-model="name"
+ />
+ <ExInput
+ :label="$t('证件/护照号码')"
+ :disabled="disabled()"
+ :clearBtn="!disabled()"
+ :placeholderText="$t('请输入您的证件/护照号码')"
+ v-model="idnumber"
+ />
+ <div>
+ <div v-if="resultArr.length > 0" class="mt-4 mb-25 textColor">
+ {{ $t("证件照/上传护照") }}
+ </div>
+ <div v-else class="mt-4 mb-25 textColor">
+ {{ $t("证件/护照认证图片上传") }}
+ </div>
+ <div class="flex mt-33 mb-80 justify-between">
+ <div
+ class="flex-1 flex flex-col text-center justify-center items-center"
+ >
+ <div class="upload-wrap">
+ <img
+ src="@/assets/image/kyc/0.png"
+ alt=""
+ class="w-full"
+ v-if="[1, 2].includes(status) && frontFile.length === 0"
+ />
+ <van-uploader
+ v-model="frontFile"
+ multiple
+ :max-count="1"
+ :disabled="disabled()"
+ :deletable="!disabled()"
+ :after-read="afterRead"
+ @click-upload="onClickUpload('frontFile')"
+ v-else
+ />
+ </div>
+ <div class="mt-32 font-26 h-20" style="color: #868d9a">
+ {{ $t("证件正面") }}
+ </div>
+ </div>
+ <div
+ class="flex-1 flex flex-col text-center justify-center items-center"
+ >
+ <div class="upload-wrap">
+ <img
+ src="@/assets/image/kyc/1.png"
+ alt=""
+ class="w-full"
+ v-if="[1, 2].includes(status) && reverseFile.length === 0"
+ />
+ <van-uploader
+ v-model="reverseFile"
+ multiple
+ :max-count="1"
+ :disabled="disabled()"
+ :deletable="!disabled()"
+ :after-read="afterRead"
+ @click-upload="onClickUpload('reverseFile')"
+ v-else
+ />
+ </div>
+ <div class="mt-32 font-26 h-20" style="color: #868d9a">
+ {{ $t("证件反面") }}
+ </div>
+ </div>
+ <!-- <div
+ class="flex-1 flex flex-col text-center justify-center items-center"
+ >
+ <div class="upload-wrap">
+ <img
+ src="@/assets/image/kyc/2.png"
+ alt=""
+ class="w-full"
+ v-if="[1, 2].includes(status) && fileList.length === 0"
+ />
+ <van-uploader
+ v-model="fileList"
+ multiple
+ :max-count="1"
+ :disabled="disabled()"
+ :deletable="!disabled()"
+ :after-read="afterRead"
+ @click-upload="onClickUpload('fileList')"
+ v-else
+ />
+ </div>
+ <div class="mt-32 font-26 h-20" style="color: #868d9a">
+ {{ $t("手持证件照") }}
+ </div>
+ </div> -->
+ </div>
+ </div>
+ <template v-if="!disabled()">
+ <div class="font-35 mb-32 textColor">{{ $t("拍摄示例") }}</div>
+ <img
+ src="../../assets/image/kyc/kyc-demo.png"
+ alt=""
+ style="width: 100%; height: auto"
+ class="w-756 h-220 mb-100"
+ />
+ </template>
+ <button
+ class="apply-btn btnMain text-white font-35 h-100 rounded"
+ @click="onSubmit"
+ v-if="!disabled()"
+ >
+ {{ $t("申请认证") }}
+ </button>
+ <div class="pt-35 pb-60 font-30" v-if="!disabled() || status === 3">
+ <span class="text-grey">{{
+ $t("上传证件照失败,请联系客服获取邮箱地址发送证件照或者重新上传")
+ }}</span>
+ <span class="text-blue service-text" @click="tokefu">
+ {{ $t("联系客服") }}</span
+ >
+ </div>
+ <nationality-list
+ ref="controlChild"
+ :title="$t('请选择国家')"
+ @getName="getName(arguments)"
+ v-if="!disabled()"
+ >
+ </nationality-list>
+ </div>
</div>
</div>
</template>
@@ -84,137 +186,162 @@
<script>
// import { ActionSheet,Search } from 'vant';
import assetsHead from "@/components/assets-head";
-import nationalityList from './components/nationalityList.vue'
-import { Uploader} from 'vant';
-import { _uploadImage, _applyIdentify, _getIdentify } from '@/API/fund.api'
+import nationalityList from "./components/nationalityList.vue";
+import { Uploader } from "vant";
+import { _uploadImage, _applyIdentify, _getIdentify } from "@/API/fund.api";
// import CountryList from '@/components/country-list' // 我页不知道为啥要先调用这个,先放着
import countries from "./components/countryList";
import ExInput from "@/components/ex-input";
+import { mapActions } from "vuex";
export default {
- name:"AuthenticationPage",
- components:{
- assetsHead,
- nationalityList,
- [Uploader.name]:Uploader,
- ExInput
- // CountryList
- },
- data() {
- return {
- countryName:this.$t("请选择国家"), //国家名称
- countryCode:"af", //国家地区号
- idnumber: '',
- name: '',
- frontFile:[],
- reverseFile:[],
- fileList:[],
- curFile: 'frontFile',
- status: '', // 0
- imgs: [],
- idcard_path_front_path: '',
- idcard_path_back_path: '',
- idcard_path_hold_path: '',
- resultArr: ['small-success_' + this.$t('已申请未审核'), 'identifing_' + this.$t('审核中'), 'small-success_' + this.$t('审核通过'), 'icon-close_' + this.$t('审核未通过')], // 0 好像是未提交
- show:false,
- language: 'en',
+ name: "AuthenticationPage",
+ components: {
+ assetsHead,
+ nationalityList,
+ [Uploader.name]: Uploader,
+ ExInput,
+ // CountryList
+ },
+ data() {
+ return {
+ countryName: this.$t("请选择国家"), //国家名称
+ countryCode: "af", //国家地区号
+ idnumber: "",
+ name: "",
+ frontFile: [],
+ reverseFile: [],
+ fileList: [],
+ curFile: "frontFile",
+ status: "", // 0
+ imgs: [],
+ idcard_path_front_path: "",
+ idcard_path_back_path: "",
+ idcard_path_hold_path: "",
+ resultArr: [
+ "small-success_" + this.$t("已申请未审核"),
+ "identifing_" + this.$t("审核中"),
+ "small-success_" + this.$t("审核通过"),
+ "icon-close_" + this.$t("审核未通过"),
+ ], // 0 好像是未提交
+ show: false,
+ language: "en",
+ };
+ },
+ created() {
+ this.language = this.$i18n.locale;
+ this.fetchInfo();
+ },
+ methods: {
+ ...mapActions("user", ["GET_UERS_KYC"]),
+
+ fetchInfo() {
+ // 获取状态
+ _getIdentify().then((data) => {
+ this.show = true;
+ this.status = data.status;
+ if (data.status !== 0) {
+ this.countryName =
+ countries[this.language][data.nationality.toLowerCase()]["name"];
+ this.countryCode = data.nationality.toLowerCase();
+ this.idnumber = data.idnumber;
+ this.name = data.name;
+ this.frontFile = data.idimg_1
+ ? [{ url: data.idimg_1_path, resURL: data.idimg_1 }]
+ : [];
+ this.reverseFile = data.idimg_2
+ ? [{ url: data.idimg_2_path, resURL: data.idimg_2 }]
+ : [];
+ this.fileList = data.idimg_3
+ ? [{ url: data.idimg_3_path, resURL: data.idimg_3 }]
+ : [];
}
+ });
},
- created() {
- this.language = this.$i18n.locale
- this.fetchInfo()
+ onClickUpload(type) {
+ this.curFile = type;
},
- methods:{
- fetchInfo() { // 获取状态
- _getIdentify().then(data => {
- this.show = true
- this.status = data.status
- if (data.status !== 0) {
- this.countryName = countries[this.language][data.nationality.toLowerCase()]['name']
- this.countryCode = data.nationality.toLowerCase()
- this.idnumber = data.idnumber
- this.name = data.name
- this.frontFile = data.idimg_1 ? [{ url: data.idimg_1_path, resURL: data.idimg_1 }] : []
- this.reverseFile = data.idimg_2 ? [{ url: data.idimg_2_path, resURL: data.idimg_2 }] : []
- this.fileList = data.idimg_3 ? [{ url: data.idimg_3_path, resURL: data.idimg_3 }] : []
- }
- })
- },
- onClickUpload(type) {
- this.curFile = type
- },
- onClickLeft() {
- this.$router.go(-1);
- },
- disabled() { // 是否禁用按钮
- return ![0, 3, ''].includes(this.status)
- },
- afterRead(file) { /// 处理文件
- console.log(file)
- file.status = 'uploading'
- file.message = this.$t('上传中...')
- _uploadImage(file).then(data => {
- file.status = 'success';
- file.message = this.$t('上传成功');
- file.resURL = data
- this[this.curFile] = [file]
- }).catch(err => {
- file.status = 'failed';
- file.message = this.$t('图片上传失败');
- })
- },
- //打开国家列表底部弹窗
- openBtn() {
- if (!this.disabled()) {
- this.$refs.controlChild.open();
+ onClickLeft() {
+ this.$router.go(-1);
+ },
+ disabled() {
+ // 是否禁用按钮
+ return ![0, 3, ""].includes(this.status);
+ },
+ afterRead(file) {
+ /// 处理文件
+ console.log(file);
+ file.status = "uploading";
+ file.message = this.$t("上传中...");
+ _uploadImage(file)
+ .then((data) => {
+ file.status = "success";
+ file.message = this.$t("上传成功");
+ file.resURL = data;
+ this[this.curFile] = [file];
+ })
+ .catch((err) => {
+ file.status = "failed";
+ file.message = this.$t("图片上传失败");
+ });
+ },
+ //打开国家列表底部弹窗
+ openBtn() {
+ if (!this.disabled()) {
+ this.$refs.controlChild.open();
+ }
+ },
+ //获取到当前选中国家的code值
+ getName(params) {
+ this.countryName = params[0];
+ this.countryCode = params[1];
+ },
+ onSubmit() {
+ if (!this.countryName) {
+ this.$toast(this.$t("请选择国家"));
+ return;
+ }
+ if (!this.name) {
+ this.$toast(this.$t("请输入姓名"));
+ return;
+ }
+ if (!this.idnumber) {
+ this.$toast(this.$t("请输入证件号码"));
+ return;
+ }
+ console.log(this.frontFile, this.reverseFile);
+ if (!this.frontFile.length || !this.reverseFile.length) {
+ this.$toast(this.$t("请上传完整证件信息"));
+ return;
+ }
+ _applyIdentify({
+ name: this.name,
+ idnumber: this.idnumber,
+ frontFile: this.frontFile,
+ reverseFile: this.reverseFile,
+ countryName: this.countryCode, // this.countryName 存储的 code, 回来再遍历
+ })
+ .then(() => {
+ this.GET_UERS_KYC();
+ this.$toast(this.$t("提交成功"));
+ this.$router.push("/verified");
+ // this.fetchInfo()
+ })
+ .catch((err) => {
+ if (err.code === "ECONNABORTED") {
+ this.$toast(this.$t("网络超时!"));
+ } else if (err.msg !== undefined) {
+ this.$toast(this.$t(err.msg));
}
- },
- //获取到当前选中国家的code值
- getName(params) {
- this.countryName = params[0];
- this.countryCode = params[1];
- },
- onSubmit() {
- if (!this.countryName) {
- this.$toast(this.$t('请选择国家'))
- return
- }
- if (!this.name) {
- this.$toast(this.$t('请输入姓名'))
- return
- }
- if (!this.idnumber) {
- this.$toast(this.$t('请输入证件号码'))
- return
- }
- if (!this.frontFile.length || !this.reverseFile.length ||!this.fileList.length) {
- this.$toast(this.$t('请上传完整证件信息'))
- return
- }
- _applyIdentify({
- name: this.name,
- idnumber: this.idnumber,
- frontFile: this.frontFile,
- reverseFile: this.reverseFile ,
- fileList: this.fileList,
- countryName: this.countryCode // this.countryName 存储的 code, 回来再遍历
- }).then(() => {
- this.$toast(this.$t('提交成功'))
- this.$router.push('/verified')
- // this.fetchInfo()
- }).catch(err => {
- if(err.code === 'ECONNABORTED'){this.$toast(this.$t('网络超时!'));}
- else if(err.msg !== undefined){this.$toast(this.$t(err.msg));}
- })
- },
- tokefu() {
- this.$router.push('/customerService')
- }
- }
-}
+ });
+ },
+ tokefu() {
+ this.$router.push("/customerService");
+ },
+ },
+};
</script>
<style lang="scss" scoped>
-
-.authentication{
+.authentication {
width: 100%;
box-sizing: border-box;
}
@@ -231,25 +358,24 @@
input:disabled {
background: #fff;
}
-.list-view{
- overflow-y:scroll;
- border-bottom:1px solid #e5e5e5;
+.list-view {
+ overflow-y: scroll;
+ border-bottom: 1px solid #e5e5e5;
}
-.kyc-input{
- width:100%;
- border:none;
+.kyc-input {
+ width: 100%;
+ border: none;
}
-.apply-btn{
- border:none;
- outline:none;
- width:100%;
- line-height:100px;
+.apply-btn {
+ border: none;
+ outline: none;
+ width: 100%;
+ line-height: 100px;
}
-.service-text{
- text-decoration:underline;
+.service-text {
+ text-decoration: underline;
}
-
</style>
diff --git a/src/page/new-urrency/components/placing-list-index.vue b/src/page/new-urrency/components/placing-list-index.vue
index 0a95e89..f47dac8 100644
--- a/src/page/new-urrency/components/placing-list-index.vue
+++ b/src/page/new-urrency/components/placing-list-index.vue
@@ -82,7 +82,7 @@
.item-box {
padding: 0 20px;
border-bottom: 1px solid #eee;
- height: 100px;
+ min-height: 100px;
}
.fg {
@@ -91,7 +91,9 @@
}
.bt {
width: 100%;
- height: 50px;
+ // height: 50px;
+ margin: 10px 0;
+
line-height: 50px;
text-align: center;
background-color: #def7ef;
diff --git a/src/page/new-urrency/components/placing-list.vue b/src/page/new-urrency/components/placing-list.vue
index fcb0d83..000a5c1 100644
--- a/src/page/new-urrency/components/placing-list.vue
+++ b/src/page/new-urrency/components/placing-list.vue
@@ -17,12 +17,18 @@
</van-row>
</div>
<div v-for="item in showList" :key="item.id" class="list-call">
- <van-row type="flex" justify="space-between" align="center">
+ <van-row
+ type="flex"
+ justify="space-between"
+ align="center"
+ style="min-height: 30px; margin: 10px 0"
+ >
<van-col span="4">
<div class="state">{{ getstatus(item.status) }}</div>
</van-col>
- <van-col span="2"></van-col>
+ <van-col span="1"></van-col>
<van-col span="4">{{ item.newCoinName }}</van-col>
+ <van-col span="1"></van-col>
<van-col span="4">{{ item.lotteryQuantity }}</van-col>
<van-col span="10" style="text-align: right">
<div v-if="item.status === 2" class="gm">
@@ -93,13 +99,12 @@
.list-call {
border-bottom: 1px solid #f0f0f0;
margin: 0 20px;
- line-height: 100px;
}
.state {
color: #1553e6;
border: 1px solid #1553e6;
text-align: center;
- height: 40px;
+ // height: 40px;
line-height: 40px;
font-size: 26px;
}
diff --git a/src/page/new-urrency/components/subscription-list-index.vue b/src/page/new-urrency/components/subscription-list-index.vue
index 48935f0..b8d6a36 100644
--- a/src/page/new-urrency/components/subscription-list-index.vue
+++ b/src/page/new-urrency/components/subscription-list-index.vue
@@ -102,7 +102,7 @@
.item-box {
padding: 0 20px;
border-bottom: 1px solid #eee;
- height: 100px;
+ min-height: 100px;
}
.fg {
@@ -111,8 +111,9 @@
}
.bt {
width: 100%;
- height: 50px;
+ // height: 50px;
line-height: 50px;
+ margin: 10px 0;
text-align: center;
background-color: #def7ef;
color: #22d27f;
diff --git a/src/page/new-urrency/components/subscription-list.vue b/src/page/new-urrency/components/subscription-list.vue
index 7341a4e..5ce4f5d 100644
--- a/src/page/new-urrency/components/subscription-list.vue
+++ b/src/page/new-urrency/components/subscription-list.vue
@@ -17,12 +17,18 @@
</van-row>
</div>
<div v-for="item in showList" :key="item.id" class="list-call">
- <van-row type="flex" justify="space-between" align="center">
+ <van-row
+ type="flex"
+ justify="space-between"
+ align="center"
+ style="min-height: 30px; margin: 10px 0"
+ >
<van-col span="4">
<div class="state">{{ getstatus(item.status) }}</div>
</van-col>
- <van-col span="2"></van-col>
+ <van-col span="1"></van-col>
<van-col span="4">{{ item.newCoinName }}</van-col>
+ <van-col span="1"></van-col>
<van-col span="4">{{ item.lotteryQuantity }}</van-col>
<van-col span="10" style="text-align: right">
<div v-if="item.status === 2" class="gm">
@@ -97,13 +103,12 @@
.list-call {
border-bottom: 1px solid #f0f0f0;
margin: 0 20px;
- line-height: 100px;
}
.state {
color: #1553e6;
border: 1px solid #1553e6;
text-align: center;
- height: 40px;
+ // height: 40px;
line-height: 40px;
font-size: 26px;
}
diff --git a/src/page/new-urrency/index.vue b/src/page/new-urrency/index.vue
index 0c01562..59c57da 100644
--- a/src/page/new-urrency/index.vue
+++ b/src/page/new-urrency/index.vue
@@ -293,7 +293,9 @@
}
.bt {
width: 100%;
- height: 50px;
+ // height: 50px;
+ margin: 10px 0;
+
line-height: 50px;
text-align: center;
background-color: #def7ef;
@@ -364,7 +366,7 @@
}
.item-box {
- height: 100px;
+ min-height: 100px;
padding: 0 20px;
}
.zongjia {
diff --git a/src/page/perpetualContract/index.vue b/src/page/perpetualContract/index.vue
index 24dea2c..4ba2dfc 100644
--- a/src/page/perpetualContract/index.vue
+++ b/src/page/perpetualContract/index.vue
@@ -84,9 +84,9 @@
</div>
<div class="fixed w-full shadow z-10 tabBackground1">
<div class="flex justify-between px-30 py-10">
- <span class="font-24 textColor2"
- >{{ symbol.toUpperCase() }}/USDT {{ $t("k线图表") }}</span
- >
+ <span class="font-24 textColor2">
+ {{ symbol | _symbolName(1) }} {{ $t("k线图表") }}
+ </span>
<van-icon
class="textColor"
@click.stop="showCharts = !showCharts"
@@ -207,6 +207,8 @@
},
methods: {
...mapActions("home", [SET_COIN_LIST]),
+ ...mapActions("user", ["GET_UERS_KYC"]),
+
onUpdate(symbol) {
// 更新
this.symbol = symbol;
@@ -309,6 +311,9 @@
});
},
handleDeep(data) {
+ if (this.symbol !== data.symbol) {
+ return;
+ }
this.deepData = data;
const { asks, bids } = data;
this.asks = asks.sort((a, b) => a.price - b.price).slice(0, showLength);
@@ -330,15 +335,34 @@
};
},
startDeepSocket() {
- this.sockets.deep = new WebSocket(`${WS_URL}/3/${this.symbol}`);
- this.sockets.deep.onmessage = (evt) => {
+ // 开启socket链接
+ this.closeSocket();
+
+ this.socket = new WebSocket(`${WS_URL}/3/${this.symbol}`);
+
+ this.socket.onopen = () => {
+ console.log("WebSocket connection established");
+ };
+
+ this.socket.onmessage = (evt) => {
const { data } = evt;
const { code, data: _data } = JSON.parse(data);
if (code / 1 === 0) {
this.handleDeep(_data);
}
};
+
+ this.socket.onerror = (error) => {
+ console.error("WebSocket error:", error);
+ setTimeout(this.startDeepSocket, 5000); // 5秒后尝试重新连接
+ };
+
+ this.socket.onclose = (event) => {
+ console.log("WebSocket connection closed:", event);
+ // 重新连接,可以根据需求添加重连的逻辑,这里只是简单的示例
+ };
},
+
initParam(symbol, type) {
// 初始化参数
if (type === "open" || type === "long" || type === "short" || !type) {
@@ -514,6 +538,7 @@
},
},
mounted() {
+ this.GET_UERS_KYC();
let symbol = this.$route.params.symbol;
let catchSymbol = getStorage("symbol");
if (!symbol && catchSymbol) {
@@ -541,36 +566,7 @@
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();
diff --git a/src/page/perpetualContract/perpetualHistory.vue b/src/page/perpetualContract/perpetualHistory.vue
index 4d75ea6..c7f6a9f 100644
--- a/src/page/perpetualContract/perpetualHistory.vue
+++ b/src/page/perpetualContract/perpetualHistory.vue
@@ -1,369 +1,360 @@
<template>
- <!-- U本位合约历史 -->
- <div class="perpetualHistory">
- <assets-head :title="$t('U本位合约历史')" :backFunc="() => {
- if ($route.query.goback) {
- $router.push({
- path: '/funds',
- query: {
- tab: 2,
- index: 0 // 0: 查看理财订单 1: 矿机
+ <!-- U本位合约历史 -->
+ <div class="perpetualHistory">
+ <assets-head
+ :title="$t('U本位合约历史')"
+ :backFunc="
+ () => {
+ if ($route.query.goback) {
+ $router.push({
+ path: '/funds',
+ query: {
+ tab: 2,
+ index: 0, // 0: 查看理财订单 1: 矿机
+ },
+ });
+ } else {
+ //$router.push(`/perpetualContract/${symbol}?selectIndex=1`)
+ $router.go(-1);
}
- })
- } else {
- //$router.push(`/perpetualContract/${symbol}?selectIndex=1`)
- $router.go(-1)
- }
- }" />
- <div>
- <van-tabs ref="tabs" v-model="type" @change="onChange" sticky>
- <van-tab :title="item.title" v-for="item in selectData" :key="item.title" :name="item.type">
- <div class="all-select flex justify-end" v-if="symbol">
- <div class="select-box flex" @click.stop="isAll = !isAll">
- <div class="flex-1 font-24" v-if="symbol === 'wld'">
- FTB/USDT
- </div>
- <div class="flex-1 font-24" v-else-if="symbol === 'mln'">
- DKL/USDT
- </div>
- <div class="flex-1 font-24" v-else-if="symbol === 'qtum'">
- BQHN/USDT
- </div>
- <div class="flex-1 font-24" v-else-if="symbol === 'knc'">
- XCM/USDT
- </div>
- <div class="flex-1 font-24" v-else-if="symbol === 'vet'">
- ACG/USDT
- </div>
-
- <div class="flex-1 font-24" v-else>
- {{ symbol.toUpperCase() }}/USDT
- </div>
- <van-icon name="arrow-down" />
- <div class="select-data" v-if="isAll">
- <div class="select-item font-24" @click.stop="selectItem(item2)" v-for="(item2, index) in currencyList"
- :key="index">{{ item2.symbolFullName }}</div>
+ }
+ "
+ />
+ <div>
+ <van-tabs ref="tabs" v-model="type" @change="onChange" sticky>
+ <van-tab
+ :title="item.title"
+ v-for="item in selectData"
+ :key="item.title"
+ :name="item.type"
+ >
+ <div class="all-select flex justify-end">
+ <div class="select-box flex" @click.stop="isAll = !isAll">
+ <div class="flex-1 font-24">{{ symbol.toUpperCase() }}/USDT</div>
+ <van-icon name="arrow-down" />
+ <div class="select-data" v-if="isAll">
+ <div
+ class="select-item font-24"
+ @click.stop="selectItem(item2)"
+ v-for="(item2, index) in currencyList"
+ :key="index"
+ >
+ {{ item2.symbol.toUpperCase() }}/USDT
+ </div>
</div>
- <!-- <div data-v-5764026c="" class="select-data" @click.stop="selectItem(item2)" v-if="isAll">
- <div data-v-5764026c="" class="select-item font-24">WLD/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">WDC/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">BTC/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">ETH/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">XTZ/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">ADA/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">YFII/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">MLN/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">YFI/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">DAI/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">ETC/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">XRP/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">LTC/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">USDC/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">KNC/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">DOGE/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">VET/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">SHIB/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">QTUM/USDT</div>
- <div data-v-5764026c="" class="select-item font-24">ICP/USDT</div>
- </div> -->
- </div>
- </div>
- <template v-if="type === 'orders'">
- <van-list v-model="loading" :loading-text="$t('加载中...')" :finished="finished"
- :finished-text="dataList.orders.length ? $t('已经全部加载完毕') : ''" @load="onLoad" :offset="130">
- <PerpetualEntrustList v-if="type === 'orders'" :list-data="dataList.orders"
- @recall="recall">
- </PerpetualEntrustList>
- <div class="flex flex-col justify-center pt-50 pb-20 items-center"
- v-if="!dataList.orders.length && !loading">
- <img src="@/assets/image/assets-center/no-data.png" alt="" class="w-180 h-180" />
- <p class="text-grey mt-10">{{ $t('暂无记录') }}</p>
- </div>
- </van-list>
- </template>
+ </div>
+ </div>
+ <template v-if="type === 'orders'">
+ <van-list
+ v-model="loading"
+ :loading-text="$t('加载中...')"
+ :finished="finished"
+ :finished-text="
+ dataList.orders.length ? $t('已经全部加载完毕') : ''
+ "
+ @load="onLoad"
+ :offset="130"
+ >
+ <PerpetualEntrustList
+ v-if="type === 'orders'"
+ :list-data="dataList.orders"
+ @recall="recall"
+ >
+ </PerpetualEntrustList>
+ <div
+ class="flex flex-col justify-center pt-50 pb-20 items-center"
+ v-if="!dataList.orders.length && !loading"
+ >
+ <img
+ src="@/assets/image/assets-center/no-data.png"
+ alt=""
+ class="w-180 h-180"
+ />
+ <p class="text-grey mt-10">{{ $t("暂无记录") }}</p>
+ </div>
+ </van-list>
+ </template>
- <template v-if="type === 'hisorders'">
-
- <van-list v-model="loading" :loading-text="$t('加载中...')" :finished="finished"
- :finished-text="dataList.hisorders.length ? $t('已经全部加载完毕') : ''" @load="onLoad"
- :offset="130">
-
- <PerpetualHistoryPosition :list-data="dataList.hisorders"></PerpetualHistoryPosition>
- <div class="flex flex-col justify-center pt-50 pb-20 items-center"
- v-if="!dataList.hisorders.length && !loading">
- <img src="@/assets/image/assets-center/no-data.png" alt="" class="w-180 h-180" />
- <p class="text-grey mt-10">{{ $t('暂无记录') }}</p>
- </div>
- </van-list>
- </template>
- </van-tab>
- </van-tabs>
- </div>
- </div>
+ <template v-if="type === 'hisorders'">
+ <van-list
+ v-model="loading"
+ :loading-text="$t('加载中...')"
+ :finished="finished"
+ :finished-text="
+ dataList.hisorders.length ? $t('已经全部加载完毕') : ''
+ "
+ @load="onLoad"
+ :offset="130"
+ >
+ <PerpetualHistoryPosition
+ :list-data="dataList.hisorders"
+ ></PerpetualHistoryPosition>
+ <div
+ class="flex flex-col justify-center pt-50 pb-20 items-center"
+ v-if="!dataList.hisorders.length && !loading"
+ >
+ <img
+ src="@/assets/image/assets-center/no-data.png"
+ alt=""
+ class="w-180 h-180"
+ />
+ <p class="text-grey mt-10">{{ $t("暂无记录") }}</p>
+ </div>
+ </van-list>
+ </template>
+ </van-tab>
+ </van-tabs>
+ </div>
+ </div>
</template>
<script>
- 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 {
- _orderListCur,
- _orderListHold
- } from '@/API/trade.api'
- import {
- _getCoins
- } from '@/API/home.api'
- import {
- List,
- Tab,
- Tabs,
- DropdownMenu,
- DropdownItem
- } from 'vant';
- export default {
- data() {
- return {
- type: "orders",
- dataList: {
- orders: [],
- hisorders: []
- },
- isAll: false,
- symbol: '',
- selectData: [{
- title: this.$t('当前委托'),
- type: 'orders'
- },
- {
- title: this.$t('历史仓位'),
- type: 'hisorders'
- },
- ],
- loading: false,
- finished: false,
- page: 1,
- };
- },
- mounted() {
- this.getCoins()
- this.symbol = this.$route.query.symbol
- },
- methods: {
- getCoins() {
- _getCoins().then((res) => {
- console.log(res)
- this.currencyList = res
- })
- },
- onChange(e) {
- this.dataList[e] = []
- this.finished = false
- this.page = 1
- this.type = e
- this.loading = true;
- if (this.loading) {
- this.fetchList(this.symbol)
- }
- },
- onClickLeft() {
- this.$router.go(-1);
- },
- async fetchList(symbol) {
- const _api = this.type === 'orders' ? _orderListCur : _orderListHold
- const type = this.type
- _api(symbol, type, this.page).then(data => {
- this.dataList[type] = this.dataList[type].concat(data)
- this.loading = false
- if (data.length < 10) {
- this.finished = true
- }
- this.page++
- })
- },
- recall() {
- this.page = 1;
- this.dataList.orders = []
- this.fetchList(this.symbol)
- },
- onLoad() {
- this.fetchList(this.symbol)
- },
- //选择币种
- selectItem(item) {
- this.dataList[this.type] = []
- this.page = 1
- this.symbol = item.symbol
- this.fetchList(this.symbol)
- this.isAll = false
- }
- },
- components: {
- PerpetualEntrustList,
- PerpetualHistoryPosition,
- assetsHead,
- [DropdownMenu.name]: DropdownMenu,
- [DropdownItem.name]: DropdownItem,
- [List.name]: List,
- [Tabs.name]: Tabs,
- [Tab.name]: Tab
- },
- beforeRouteEnter(to, from, next) {
- const {
- query: {
- symbol
- }
- } = to
- next(vm => {
- vm.symbol = symbol
-
- })
- }
- }
+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 { _orderListCur, _orderListHold } from "@/API/trade.api";
+import { _getCoins } from "@/API/home.api";
+import { List, Tab, Tabs, DropdownMenu, DropdownItem } from "vant";
+import { _symbolName } from "@/utils/filter";
+export default {
+ data() {
+ return {
+ type: "orders",
+ dataList: {
+ orders: [],
+ hisorders: [],
+ },
+ isAll: false,
+ symbol: "",
+ selectData: [
+ {
+ title: this.$t("当前委托"),
+ type: "orders",
+ },
+ {
+ title: this.$t("历史仓位"),
+ type: "hisorders",
+ },
+ ],
+ loading: false,
+ finished: false,
+ page: 1,
+ };
+ },
+ mounted() {
+ this.getCoins();
+ this.symbol = this.$route.query.symbol;
+ },
+ methods: {
+ getCoins() {
+ _getCoins().then((res) => {
+ console.log(res);
+ this.currencyList = res;
+ });
+ },
+ onChange(e) {
+ this.dataList[e] = [];
+ this.finished = false;
+ this.page = 1;
+ this.type = e;
+ this.loading = true;
+ if (this.loading) {
+ this.fetchList(this.symbol);
+ }
+ },
+ onClickLeft() {
+ this.$router.go(-1);
+ },
+ async fetchList(symbol) {
+ const _api = this.type === "orders" ? _orderListCur : _orderListHold;
+ const type = this.type;
+ _api(symbol, type, this.page).then((data) => {
+ this.dataList[type] = this.dataList[type].concat(data);
+ this.loading = false;
+ if (data.length < 10) {
+ this.finished = true;
+ }
+ this.page++;
+ });
+ },
+ recall() {
+ this.page = 1;
+ this.dataList.orders = [];
+ this.fetchList(this.symbol);
+ },
+ onLoad() {
+ this.fetchList(this.symbol);
+ },
+ //选择币种
+ selectItem(item) {
+ this.dataList[this.type] = [];
+ this.page = 1;
+ this.symbol = item.symbol;
+ this.fetchList(this.symbol);
+ this.isAll = false;
+ },
+ },
+ components: {
+ PerpetualEntrustList,
+ PerpetualHistoryPosition,
+ assetsHead,
+ [DropdownMenu.name]: DropdownMenu,
+ [DropdownItem.name]: DropdownItem,
+ [List.name]: List,
+ [Tabs.name]: Tabs,
+ [Tab.name]: Tab,
+ },
+ beforeRouteEnter(to, from, next) {
+ const {
+ query: { symbol },
+ } = to;
+ next((vm) => {
+ vm.symbol = symbol;
+ });
+ },
+};
</script>
<style lang="scss" scoped>
- .perpetualHistory {
- width: 100%;
- box-sizing: border-box;
- min-height: 100vh;
+.perpetualHistory {
+ width: 100%;
+ box-sizing: border-box;
+ min-height: 100vh;
- @include themify() {
- background: themed("main_background");
- }
+ @include themify() {
+ background: themed("main_background");
+ }
- ::v-deep .van-tab {
- @include themify() {
- color: themed("text_color");
- }
- }
+ ::v-deep .van-tab {
+ @include themify() {
+ color: themed("text_color");
+ }
+ }
- ::v-deep .van-tabs__nav {
- @include themify() {
- background: themed("tab_background");
- }
- }
+ ::v-deep .van-tabs__nav {
+ @include themify() {
+ background: themed("tab_background");
+ }
+ }
- ::v-deep .van-tab--active {
- background: #1194F7;
- border-radius: 5px;
- color: #fff !important;
- }
+ ::v-deep .van-tab--active {
+ background: #1194f7;
+ border-radius: 5px;
+ color: #fff !important;
+ }
- ::v-deep .van-nav-bar {
- @include themify() {
- background: themed("main_background");
- }
- }
+ ::v-deep .van-nav-bar {
+ @include themify() {
+ background: themed("main_background");
+ }
+ }
- ::v-deep .van-nav-bar__title {
- @include themify() {
- color: themed("text_color");
- }
- }
+ ::v-deep .van-nav-bar__title {
+ @include themify() {
+ color: themed("text_color");
+ }
+ }
- ::v-deep .van-tabs__nav {
- @include themify() {
- background: themed("tab_background");
- }
- }
+ ::v-deep .van-tabs__nav {
+ @include themify() {
+ background: themed("tab_background");
+ }
+ }
- ::v-deep .van-tabs__line {
- background-color: transparent !important;
+ ::v-deep .van-tabs__line {
+ background-color: transparent !important;
+ }
+}
- }
+.active-line {
+ position: relative;
+ padding-bottom: 30px;
+ color: #1194f7;
+}
- }
+.active-line::after {
+ content: "";
+ position: absolute;
+ left: 50%;
+ transform: translateX(-50%);
+ bottom: 0;
+ right: 0;
+ width: 280px;
+ height: 8px;
- .active-line {
- position: relative;
- padding-bottom: 30px;
- color: #1194F7;
- }
+ @include themify() {
+ background-color: themed("color_main");
+ }
+}
- .active-line::after {
- content: '';
- position: absolute;
- left: 50%;
- transform: translateX(-50%);
- bottom: 0;
- right: 0;
- width: 280px;
- height: 8px;
+::v-deep .van-tabs {
+ padding: 0 40px !important;
+}
- @include themify() {
- background-color: themed("color_main");
- }
- }
+::v-deep .van-nav-bar {
+ @include themify() {
+ background: themed("main_background");
+ }
+}
- ::v-deep .van-tabs {
- padding: 0 40px !important;
- }
+::v-deep .van-nav-bar__title {
+ @include themify() {
+ color: themed("text_color");
+ }
+}
- ::v-deep .van-nav-bar {
- @include themify() {
- background: themed("main_background");
- }
- }
+::v-deep .van-tabs__nav {
+ @include themify() {
+ background: themed("main_background");
+ }
+}
- ::v-deep .van-nav-bar__title {
- @include themify() {
- color: themed("text_color");
- }
- }
+::v-deep .van-tab--active {
+ color: #fff;
+}
- ::v-deep .van-tabs__nav {
- @include themify() {
- background: themed("main_background");
- }
- }
+.all-select {
+ padding: 30px 30px;
- ::v-deep .van-tab--active {
- color: #fff;
- }
+ .select-box {
+ width: 160px;
+ height: 50px;
- .all-select {
- padding: 30px 30px;
+ @include themify() {
+ background: themed("input_background");
+ }
- .select-box {
- width: 160px;
- height: 50px;
+ @include themify() {
+ color: themed("text_color");
+ }
- @include themify() {
- background: themed("input_background");
- }
+ display: flex;
+ align-items: center;
+ font-size: 14px;
+ padding: 0 20px;
+ position: relative;
- @include themify() {
- color: themed("text_color");
- }
+ .select-data {
+ position: absolute;
+ top: 55px;
+ left: 0;
+ z-index: 10;
+ width: 100%;
+ height: 300px;
+ overflow-y: auto;
- display: flex;
- align-items: center;
- font-size: 14px;
- padding: 0 20px;
- position: relative;
+ @include themify() {
+ background: themed("input_background");
+ }
- .select-data {
- position: absolute;
- top: 55px;
- left: 0;
- z-index: 10;
- width: 100%;
- height: 300px;
- overflow-y: auto;
+ .select-item {
+ padding: 20px 20px;
+ text-align: center;
- @include themify() {
- background: themed("input_background");
- }
-
-
- .select-item {
- padding: 20px 20px;
- text-align: center;
-
- @include themify() {
- border-bottom: 1px solid themed("border_color");
- }
- }
- }
- }
- }
+ @include themify() {
+ border-bottom: 1px solid themed("border_color");
+ }
+ }
+ }
+ }
+}
</style>
diff --git a/src/page/quotes.vue b/src/page/quotes.vue
index 8b6e047..6b730b2 100644
--- a/src/page/quotes.vue
+++ b/src/page/quotes.vue
@@ -95,9 +95,7 @@
[Tab.name]: Tab,
[Tabs.name]: Tabs,
},
- mounted() {
- this.NEW_CION_LIST();
- },
+
async created() {
this.keywords = this.$route.query.inputdata;
// console.log(this.inputdata, "this.inputdata");
@@ -139,13 +137,18 @@
sortVal: 0,
};
},
+ mounted() {
+ this.NEW_CION_LIST();
+ this.GET_UERS_KYC();
+ },
methods: {
- ...mapActions("home", [SET_COIN_LIST], "NEW_CION_LIST"),
+ ...mapActions("home", [SET_COIN_LIST, "NEW_CION_LIST"]),
+ ...mapActions("user", ["GET_UERS_KYC"]),
+
listSort(val) {
this.sortVal = val;
},
async fetchQoutes() {
- console.log(this.coinList, "======");
// 现货/合约
if (!this.coinList.length) {
await this.SET_COIN_LIST();
@@ -153,7 +156,6 @@
const coins = this.coinList.map((item) => item.symbol);
const mainArray = coins.filter((item) => !this.newcoinArr.includes(item));
const data = await _getHomeList(mainArray.join(","));
- console.log(data);
this.tabList[0]["data"] = data.filter((item) =>
this.myList.includes(item.symbol)
);
@@ -167,7 +169,6 @@
clearTimeout(this.timeout);
this.timeout = null;
}
- console.log(this.tabList[1]);
//排序
if (this.sortVal == 1) {
this.tabList[0]["data"] = this.tabList[0]["data"].sort(
@@ -277,7 +278,8 @@
getFilterData() {
// 过滤后的数据
const index = this.active / 1 - 1;
- console.log(index);
+
+ console.log(index, "====", this.keywords, this.tabList);
this.tabList[index]["data"] = this.tabList[index]["data"].filter((item) =>
item.symbol.includes(this.keywords.toLocaleLowerCase())
);
diff --git a/src/page/register/identity.vue b/src/page/register/identity.vue
index 034657e..1c3196a 100644
--- a/src/page/register/identity.vue
+++ b/src/page/register/identity.vue
@@ -1,281 +1,382 @@
<template>
- <!-- 申请身份认证 -->
- <div class="identity pl-30 pr-30 font-24" style="padding-bottom: 30px;">
- <div class=" header">
- <div @click="$router.go(-1)"><img src="../../assets/image/assets-center/left-arrow.png" alt=""
- class="w-14 h-27" /></div>
-<!-- <div class="textColor" @click="$router.push('/finish')">{{ $t('跳过') }}</div>-->
- </div>
- <Step :step="2"></Step>
- <div class="title textColor">{{ $t('实名认证') }}</div>
- <div class=" pt-58 pb-54 box-border border-b-color" v-if="disabled() || status === 3">
- <div class="flex justify-between items-center px-30">
- <div class="font-50">{{ $t('身份认证') }}</div>
- <div class="flex items-center" v-if="resultArr[this.status]">
- <img :src="require(`@/assets/image/assets-center/${resultArr[this.status] && resultArr[this.status].split('_')[0]}.png`)"
- alt="success img" class="w-36 h-36" />
- <div class="font-32 ml-18">{{ resultArr[this.status] && resultArr[this.status].split('_')[1] }}
- </div>
- </div>
- </div>
- </div>
- <div>
- <div class="mb-40">
- <div class="mt-54 mb-25 font-24 textColor">{{ $t('国籍') }}</div>
- <div class="pt-28 pb-28 pl-38 pr-38 flex justify-between items-center rounded inputBackground textColor" @click="openBtn">
- <div class="flex items-center">
- <!-- <div class="iti-flag mr-20" :class="countryCode" style="transform: scale(2.1)"></div> -->
- <div>{{ countryName }}</div>
- </div>
-
- <img v-if="resultArr.length === 0" src="../../assets/image/public/down-arrow.png" class="w-33 h-20"
- alt="arrow" />
- </div>
- </div>
- <ExInput :label="$t('真实姓名')" :placeholderText="$t('请输入真实姓名')" v-model="name" />
- <ExInput :label="$t('证件/护照号码')" :placeholderText="$t('请输入您的证件/护照号码')" v-model="idnumber" />
- <div>
- <div v-if="resultArr.length > 0" class="mb-25 textColor">{{ $t('证件照/上传护照') }}</div>
- <div v-else class="mt-109 mb-25">{{ $t('证件/护照认证图片上传') }}</div>
- <div class="flex mt-33 mb-80 justify-between">
- <div class="flex-1 flex flex-col text-center justify-center items-center">
- <div class="upload-wrap">
- <img src="@/assets/image/kyc/0.png" alt="" class="w-full"
- v-if="[1, 2].includes(status) && frontFile.length === 0" />
- <van-uploader v-model="frontFile" multiple :max-count="1" :disabled="disabled()"
- :deletable="!disabled()" :after-read="afterRead"
- @click-upload="onClickUpload('frontFile')" v-else />
- </div>
- <div class="mt-32 font-26 h-20 textColor">{{ $t('证件正面') }}</div>
- </div>
- <div class="flex-1 flex flex-col text-center justify-center items-center">
- <div class="upload-wrap">
- <img src="@/assets/image/kyc/1.png" alt="" class="w-full"
- v-if="[1, 2].includes(status) && reverseFile.length === 0" />
- <van-uploader v-model="reverseFile" multiple :max-count="1" :disabled="disabled()"
- :deletable="!disabled()" :after-read="afterRead"
- @click-upload="onClickUpload('reverseFile')" v-else />
- </div>
- <div class="mt-32 font-26 h-20 textColor">{{ $t('证件反面') }}</div>
- </div>
- <div class="flex-1 flex flex-col text-center justify-center items-center">
- <div class="upload-wrap">
- <img src="@/assets/image/kyc/2.png" alt="" class="w-full"
- v-if="[1, 2].includes(status) && fileList.length === 0" />
- <van-uploader v-model="fileList" multiple :max-count="1" :disabled="disabled()"
- :deletable="!disabled()" :after-read="afterRead"
- @click-upload="onClickUpload('fileList')" v-else />
- </div>
- <div class="mt-32 font-26 h-20 textColor">{{ $t('手持证件照') }}</div>
- </div>
- </div>
- </div>
- <template v-if="!disabled()">
- <div class="mb-32 textColor">{{ $t('拍摄示例') }}</div>
- <img src="../../assets/image/kyc/kyc-demo.png" alt="" style="width:100%;height:auto;"
- class="w-756 h-220 mb-100">
- </template>
- <button class="apply-btn text-white font-36 h-96 rounded btnMain" @click="onSubmit">{{
- $t('下一步')
- }}</button>
- <nationality-list ref='controlChild' :title="$t('请选择国家')" @getName="getName(arguments)" v-if="!disabled()">
- </nationality-list>
- </div>
+ <!-- 申请身份认证 -->
+ <div class="identity pl-30 pr-30 font-24" style="padding-bottom: 30px">
+ <div class="header">
+ <div @click="$router.go(-1)">
+ <img
+ src="../../assets/image/assets-center/left-arrow.png"
+ alt=""
+ class="w-14 h-27"
+ />
+ </div>
+ <!-- <div class="textColor" @click="$router.push('/finish')">{{ $t('跳过') }}</div>-->
</div>
+ <Step :step="2"></Step>
+ <div class="title textColor">{{ $t("实名认证") }}</div>
+ <div
+ class="pt-58 pb-54 box-border border-b-color"
+ v-if="disabled() || status === 3"
+ >
+ <div class="flex justify-between items-center px-30">
+ <div class="font-50">{{ $t("身份认证") }}</div>
+ <div class="flex items-center" v-if="resultArr[this.status]">
+ <img
+ :src="
+ require(`@/assets/image/assets-center/${
+ resultArr[this.status] && resultArr[this.status].split('_')[0]
+ }.png`)
+ "
+ alt="success img"
+ class="w-36 h-36"
+ />
+ <div class="font-32 ml-18">
+ {{ resultArr[this.status] && resultArr[this.status].split("_")[1] }}
+ </div>
+ </div>
+ </div>
+ </div>
+ <div>
+ <div class="mb-40">
+ <div class="mt-54 mb-25 font-24 textColor">{{ $t("国籍") }}</div>
+ <div
+ class="pt-28 pb-28 pl-38 pr-38 flex justify-between items-center rounded inputBackground textColor"
+ @click="openBtn"
+ >
+ <div class="flex items-center">
+ <!-- <div class="iti-flag mr-20" :class="countryCode" style="transform: scale(2.1)"></div> -->
+ <div>{{ countryName }}</div>
+ </div>
+
+ <img
+ v-if="resultArr.length === 0"
+ src="../../assets/image/public/down-arrow.png"
+ class="w-33 h-20"
+ alt="arrow"
+ />
+ </div>
+ </div>
+ <ExInput
+ :label="$t('真实姓名')"
+ :placeholderText="$t('请输入真实姓名')"
+ v-model="name"
+ />
+ <ExInput
+ :label="$t('证件/护照号码')"
+ :placeholderText="$t('请输入您的证件/护照号码')"
+ v-model="idnumber"
+ />
+ <div>
+ <div v-if="resultArr.length > 0" class="mb-25 textColor">
+ {{ $t("证件照/上传护照") }}
+ </div>
+ <div v-else class="mt-109 mb-25">{{ $t("证件/护照认证图片上传") }}</div>
+ <div class="flex mt-33 mb-80 justify-between">
+ <div
+ class="flex-1 flex flex-col text-center justify-center items-center"
+ >
+ <div class="upload-wrap">
+ <img
+ src="@/assets/image/kyc/0.png"
+ alt=""
+ class="w-full"
+ v-if="[1, 2].includes(status) && frontFile.length === 0"
+ />
+ <van-uploader
+ v-model="frontFile"
+ multiple
+ :max-count="1"
+ :disabled="disabled()"
+ :deletable="!disabled()"
+ :after-read="afterRead"
+ @click-upload="onClickUpload('frontFile')"
+ v-else
+ />
+ </div>
+ <div class="mt-32 font-26 h-20 textColor">{{ $t("证件正面") }}</div>
+ </div>
+ <div
+ class="flex-1 flex flex-col text-center justify-center items-center"
+ >
+ <div class="upload-wrap">
+ <img
+ src="@/assets/image/kyc/1.png"
+ alt=""
+ class="w-full"
+ v-if="[1, 2].includes(status) && reverseFile.length === 0"
+ />
+ <van-uploader
+ v-model="reverseFile"
+ multiple
+ :max-count="1"
+ :disabled="disabled()"
+ :deletable="!disabled()"
+ :after-read="afterRead"
+ @click-upload="onClickUpload('reverseFile')"
+ v-else
+ />
+ </div>
+ <div class="mt-32 font-26 h-20 textColor">{{ $t("证件反面") }}</div>
+ </div>
+ <div
+ class="flex-1 flex flex-col text-center justify-center items-center"
+ >
+ <div class="upload-wrap">
+ <img
+ src="@/assets/image/kyc/2.png"
+ alt=""
+ class="w-full"
+ v-if="[1, 2].includes(status) && fileList.length === 0"
+ />
+ <van-uploader
+ v-model="fileList"
+ multiple
+ :max-count="1"
+ :disabled="disabled()"
+ :deletable="!disabled()"
+ :after-read="afterRead"
+ @click-upload="onClickUpload('fileList')"
+ v-else
+ />
+ </div>
+ <div class="mt-32 font-26 h-20 textColor">
+ {{ $t("手持证件照") }}
+ </div>
+ </div>
+ </div>
+ </div>
+ <template v-if="!disabled()">
+ <div class="mb-32 textColor">{{ $t("拍摄示例") }}</div>
+ <img
+ src="../../assets/image/kyc/kyc-demo.png"
+ alt=""
+ style="width: 100%; height: auto"
+ class="w-756 h-220 mb-100"
+ />
+ </template>
+ <button
+ class="apply-btn text-white font-36 h-96 rounded btnMain"
+ @click="onSubmit"
+ >
+ {{ $t("下一步") }}
+ </button>
+ <nationality-list
+ ref="controlChild"
+ :title="$t('请选择国家')"
+ @getName="getName(arguments)"
+ v-if="!disabled()"
+ >
+ </nationality-list>
+ </div>
+ </div>
</template>
<script>
// import { ActionSheet,Search } from 'vant';
import Step from "./step.vue";
-import nationalityList from '../authentication/components/nationalityList.vue'
-import { Uploader } from 'vant';
-import { _uploadImage, _applyIdentify, _getIdentify } from '@/API/fund.api'
+import nationalityList from "../authentication/components/nationalityList.vue";
+import { Uploader } from "vant";
+import { _uploadImage, _applyIdentify, _getIdentify } from "@/API/fund.api";
import countries from "../authentication/components/countryList";
import ExInput from "@/components/ex-input";
-import {GET_USERINFO, SET_USERINFO} from "@/store/const.store";
-import {mapActions} from "vuex";
-import {setStorage} from "@/utils/utis";
+import { GET_USERINFO, SET_USERINFO } from "@/store/const.store";
+import { mapActions } from "vuex";
+import { setStorage } from "@/utils/utis";
export default {
- name: "AuthenticationPage",
- components: {
- nationalityList,
- [Uploader.name]: Uploader,
- ExInput,
- Step
- },
- data() {
- return {
- countryName: this.$t("请选择国家"), //国家名称
- countryCode: "af", //国家地区号
- idnumber: '',
- name: '',
- frontFile: [],
- reverseFile: [],
- fileList: [],
- curFile: 'frontFile',
- status: '', // 0
- imgs: [],
- resultArr: ['small-success_' + this.$t('已申请未审核'), 'identifing_' + this.$t('审核中'), 'small-success_' + this.$t('审核通过'), 'icon-close_' + this.$t('审核未通过')] // 0 好像是未提交
+ name: "AuthenticationPage",
+ components: {
+ nationalityList,
+ [Uploader.name]: Uploader,
+ ExInput,
+ Step,
+ },
+ data() {
+ return {
+ countryName: this.$t("请选择国家"), //国家名称
+ countryCode: "af", //国家地区号
+ idnumber: "",
+ name: "",
+ frontFile: [],
+ reverseFile: [],
+ fileList: [],
+ curFile: "frontFile",
+ status: "", // 0
+ imgs: [],
+ resultArr: [
+ "small-success_" + this.$t("已申请未审核"),
+ "identifing_" + this.$t("审核中"),
+ "small-success_" + this.$t("审核通过"),
+ "icon-close_" + this.$t("审核未通过"),
+ ], // 0 好像是未提交
+ };
+ },
+ created() {
+ this.fetchInfo();
+ },
+ methods: {
+ ...mapActions("user", ["GET_UERS_KYC"]),
+ fetchInfo() {
+ // 获取状态
+ _getIdentify().then((data) => {
+ this.status = data.status;
+ if (data.status !== 0) {
+ this.countryName =
+ countries[this.$i18n.locale][data.nationality]["name"];
+ this.countryCode = data.nationality;
+ this.idnumber = data.idnumber;
+ this.name = data.name;
+ this.frontFile = data.idimg_1 ? [{ url: data.idimg_1_path }] : [];
+ this.reverseFile = data.idimg_2 ? [{ url: data.idimg_2_path }] : [];
+ this.fileList = data.idimg_3 ? [{ url: data.idimg_3_path }] : [];
}
+ });
},
- created() {
- this.fetchInfo()
+ onClickUpload(type) {
+ this.curFile = type;
},
- methods: {
- ...mapActions('user', [SET_USERINFO]),
- fetchInfo() { // 获取状态
- _getIdentify().then(data => {
- this.status = data.status
- if (data.status !== 0) {
- this.countryName = countries[this.$i18n.locale][data.nationality]['name']
- this.countryCode = data.nationality
- this.idnumber = data.idnumber
- this.name = data.name
- this.frontFile = data.idimg_1 ? [{ url: data.idimg_1_path }] : []
- this.reverseFile = data.idimg_2 ? [{ url: data.idimg_2_path }] : []
- this.fileList = data.idimg_3 ? [{ url: data.idimg_3_path }] : []
- }
- })
- },
- onClickUpload(type) {
- this.curFile = type
- },
- onClickLeft() {
- this.$router.go(-1);
- },
- disabled() { // 是否禁用按钮
- return ![0, 3, ''].includes(this.status)
- },
- afterRead(file) { /// 处理文件
- file.status = 'uploading'
- file.message = this.$t('上传中...')
- _uploadImage(file).then(data => {
- file.status = 'success';
- file.message = this.$t('上传成功');
- file.resURL = data
- this[this.curFile] = [file]
- }).catch(err => {
- file.status = 'failed';
- file.message = this.$t('图片上传失败');
- })
- },
- //打开国家列表底部弹窗
- openBtn() {
- if (!this.disabled()) {
- this.$refs.controlChild.open();
- }
- },
- //获取到当前选中国家的code值
- getName(params) {
- this.countryName = params[0];
- this.countryCode = params[1];
- },
- onSubmit() {
- if (!this.countryName) {
- this.$toast(this.$t('请选择国家'))
- return
- }
- if (!this.name) {
- this.$toast(this.$t('请输入姓名'))
- return
- }
- if (!this.idnumber) {
- this.$toast(this.$t('请输入证件号码'))
- return
- }
+ onClickLeft() {
+ this.$router.go(-1);
+ },
+ disabled() {
+ // 是否禁用按钮
+ return ![0, 3, ""].includes(this.status);
+ },
+ afterRead(file) {
+ /// 处理文件
+ file.status = "uploading";
+ file.message = this.$t("上传中...");
+ _uploadImage(file)
+ .then((data) => {
+ file.status = "success";
+ file.message = this.$t("上传成功");
+ file.resURL = data;
+ this[this.curFile] = [file];
+ })
+ .catch((err) => {
+ file.status = "failed";
+ file.message = this.$t("图片上传失败");
+ });
+ },
+ //打开国家列表底部弹窗
+ openBtn() {
+ if (!this.disabled()) {
+ this.$refs.controlChild.open();
+ }
+ },
+ //获取到当前选中国家的code值
+ getName(params) {
+ this.countryName = params[0];
+ this.countryCode = params[1];
+ },
+ onSubmit() {
+ if (!this.countryName) {
+ this.$toast(this.$t("请选择国家"));
+ return;
+ }
+ if (!this.name) {
+ this.$toast(this.$t("请输入姓名"));
+ return;
+ }
+ if (!this.idnumber) {
+ this.$toast(this.$t("请输入证件号码"));
+ return;
+ }
- if (!this.frontFile.length || !this.reverseFile.length ||!this.fileList.length) {
- this.$toast(this.$t('请上传完整证件信息'))
- return
- }
+ if (!this.frontFile.length || !this.reverseFile.length) {
+ this.$toast(this.$t("请上传完整证件信息"));
+ return;
+ }
- if (this.status!==0){
- this.$router.push('/finish');
- }else{
- _applyIdentify({
- name: this.name,
- idnumber: this.idnumber,
- frontFile: this.frontFile,
- reverseFile: this.reverseFile,
- fileList: this.fileList,
- countryName: this.countryCode // this.countryName 存储的 code, 回来再遍历
- }).then(() => {
- this.$toast(this.$t('提交成功'))
- this.$router.push('/finish');
- this.$store.commit('user/SET_OUT')
- setStorage('popNotice', false)
- //this.fetchInfo()
- }).catch(err => {
- if(err.code === 'ECONNABORTED'){this.$toast(this.$t('网络超时!'));}
- else if (err.msg !== undefined) { this.$toast(this.$t(err.msg)); }
- else if (err.message !== undefined) { this.$toast(this.$t(err.message)); }
- })
+ if (this.status !== 0) {
+ this.$router.push("/finish");
+ } else {
+ _applyIdentify({
+ name: this.name,
+ idnumber: this.idnumber,
+ frontFile: this.frontFile,
+ reverseFile: this.reverseFile,
+ countryName: this.countryCode, // this.countryName 存储的 code, 回来再遍历
+ })
+ .then(() => {
+ this.GET_UERS_KYC();
+ this.$toast(this.$t("提交成功"));
+ this.$router.push("/finish");
+ this.$store.commit("user/SET_OUT");
+ setStorage("popNotice", false);
+ //this.fetchInfo()
+ })
+ .catch((err) => {
+ if (err.code === "ECONNABORTED") {
+ this.$toast(this.$t("网络超时!"));
+ } else if (err.msg !== undefined) {
+ this.$toast(this.$t(err.msg));
+ } else if (err.message !== undefined) {
+ this.$toast(this.$t(err.message));
}
-
- }
- }
-}
+ });
+ }
+ },
+ },
+};
</script>
<style lang="scss" scoped>
-
-.identity{
- width: 100%;
- box-sizing: border-box;
+.identity {
+ width: 100%;
+ box-sizing: border-box;
}
.upload-wrap {
- width: 220px;
- height: 220px;
- display: flex;
- justify-content: center;
- align-items: center;
+ width: 220px;
+ height: 220px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
}
input {
- font-size: 35px;
+ font-size: 35px;
}
input:disabled {
- background: #fff;
+ background: #fff;
}
.list-view {
- overflow-y: scroll;
- border-bottom: 1px solid #e5e5e5;
+ overflow-y: scroll;
+ border-bottom: 1px solid #e5e5e5;
}
.kyc-input {
- width: 100%;
- border: none;
+ width: 100%;
+ border: none;
}
.apply-btn {
- border: none;
- outline: none;
- width: 100%;
- line-height: 96px;
+ border: none;
+ outline: none;
+ width: 100%;
+ line-height: 96px;
}
.service-text {
- text-decoration: underline;
+ text-decoration: underline;
}
.header {
- display: flex;
- justify-content: space-between;
- padding: 0 26px;
- font-size: 28px;
- height: 100px;
- line-height: 100px;
+ display: flex;
+ justify-content: space-between;
+ padding: 0 26px;
+ font-size: 28px;
+ height: 100px;
+ line-height: 100px;
}
-.stepBox{
- padding: 0 30px;
+.stepBox {
+ padding: 0 30px;
}
.title {
- font-weight: 700;
- font-size: 52px;
- margin-top: 50px;
- margin-bottom: 60px;
+ font-weight: 700;
+ font-size: 52px;
+ margin-top: 50px;
+ margin-bottom: 60px;
}
-.city{
- background: #F5F5F5;
+.city {
+ background: #f5f5f5;
}
</style>
diff --git a/src/page/trade/index.vue b/src/page/trade/index.vue
index 4ec2d1b..22287f3 100644
--- a/src/page/trade/index.vue
+++ b/src/page/trade/index.vue
@@ -179,9 +179,9 @@
</div>
<div class="fixed w-full shadow z-10 tabBackground1">
<div class="flex justify-between px-30 py-10">
- <span class="font-24 textColor2"
- >{{ symbol.toUpperCase() }}/USDT {{ $t("k线图表") }}</span
- >
+ <span class="font-24 textColor2">
+ {{ symbol | _symbolName(1) }} {{ $t("k线图表") }}
+ </span>
<van-icon
class="textColor"
@click.stop="showCharts = !showCharts"
@@ -309,8 +309,13 @@
await this.SET_COIN_LIST();
}
},
+ mounted() {
+ this.GET_UERS_KYC();
+ },
methods: {
...mapActions("home", [SET_COIN_LIST]),
+ ...mapActions("user", ["GET_UERS_KYC"]),
+
onUpdate(symbol) {
// 更新
this.symbol = symbol;
@@ -365,6 +370,7 @@
this.socket.onmessage = (evt) => {
const { data } = evt;
const { code, data: _data } = JSON.parse(data);
+ console.log(_data);
if (code / 1 === 0) {
this.handleQoutes(_data);
}
@@ -494,12 +500,10 @@
let {
params: { symbol },
} = to;
- console.log("to", to);
let catchTradeSymbol = getStorage("tradeSymbol");
if (catchTradeSymbol) {
symbol = catchTradeSymbol;
}
- console.log(catchTradeSymbol);
if (symbol) {
next((vm) => {
vm.symbol = symbol;
diff --git a/src/page/tradeRecord/index.vue b/src/page/tradeRecord/index.vue
index 2b835ab..cedf94c 100644
--- a/src/page/tradeRecord/index.vue
+++ b/src/page/tradeRecord/index.vue
@@ -1,279 +1,309 @@
<template>
- <div class="tradeRecord">
- <assets-head :title="$t('交易记录')" />
- <div class="content">
- <van-tabs v-model="active" class="w-full px-32 box-border" sticky @click="changeType">
-
- <van-tab :title="$t('当前委托')" class="font-30">
- <div class="all-select flex justify-end">
- <div class="select-box flex" @click.stop="isAll = !isAll">
- <div class="flex-1 font-24">
- {{ symbol.toUpperCase() }}/USDT
- </div>
- <van-icon name="arrow-down" />
- <div class="select-data" v-if="isAll">
- <div class="select-item font-24" @click.stop="selectItem(item)"
- v-for="(item, index) in currencyList" :key="index">{{ item.symbol.toUpperCase() }}/USDT
- </div>
- </div>
- </div>
- </div>
- <entrust-item v-for="item in entrustList" :key="item.order_no" :entrust="item" :state="item.state"
- @cancelOrder="cancelOrder" />
- </van-tab>
- <van-tab :title="$t('历史委托')">
- <div class="all-select flex justify-end">
- <div class="select-box flex" @click.stop="isAll = !isAll">
- <div class="flex-1">
- {{ symbol.toUpperCase() }}/USDT
- </div>
- <van-icon name="arrow-down" />
- <div class="select-data" v-if="isAll">
- <div class="select-item" @click.stop="selectItem(item)"
- v-for="(item, index) in currencyList" :key="index">{{ item.symbol.toUpperCase() }}/USDT
- </div>
- </div>
- </div>
- </div>
- <history-item :coinPrice="coinPrice" v-for="item in entrustList" :key="item.order_no" :entrust="item"
- :state="item.state" @cancelOrder="cancelOrder" />
- </van-tab>
- <van-tab :title="$t('成交历史')" class="font-30">
- <div class="all-select flex justify-end">
- <div class="select-box flex" @click.stop="isAll = !isAll">
- <div class="flex-1">
- {{ symbol.toUpperCase() }}/USDT
- </div>
- <van-icon name="arrow-down" />
- <div class="select-data" v-if="isAll">
- <div class="select-item" @click.stop="selectItem(item)"
- v-for="(item, index) in currencyList" :key="index">{{ item.symbol.toUpperCase() }}/USDT
- </div>
- </div>
- </div>
- </div>
- <entrust-item v-for="item in entrustList" :key="item.order_no" :entrust="item" :state="item.state"
- @cancelOrder="cancelOrder" />
- </van-tab>
- </van-tabs>
- <div v-if="!entrustList.length" class="flex flex-col justify-center items-center pt-185">
- <img src="@/assets/image/assets-center/no-data.png" alt="no-date" class="w-180 h-180" />
- <p class="textColor">{{ $t('暂无数据') }}</p>
+ <div class="tradeRecord">
+ <assets-head :title="$t('交易记录')" />
+ <div class="content">
+ <van-tabs
+ v-model="active"
+ class="w-full px-32 box-border"
+ sticky
+ @click="changeType"
+ >
+ <van-tab :title="$t('当前委托')" class="font-30">
+ <div class="all-select flex justify-end">
+ <div class="select-box flex" @click.stop="isAll = !isAll">
+ <div class="flex-1 font-24">{{ symbol.toUpperCase() }}/USDT</div>
+ <van-icon name="arrow-down" />
+ <div class="select-data" v-if="isAll">
+ <div
+ class="select-item font-24"
+ @click.stop="selectItem(item)"
+ v-for="(item, index) in currencyList"
+ :key="index"
+ >
+ {{ item.symbol.toUpperCase() }}/USDT
+ </div>
+ </div>
</div>
- </div>
+ </div>
+ <entrust-item
+ v-for="item in entrustList"
+ :key="item.order_no"
+ :entrust="item"
+ :state="item.state"
+ @cancelOrder="cancelOrder"
+ />
+ </van-tab>
+ <van-tab :title="$t('历史委托')">
+ <div class="all-select flex justify-end">
+ <div class="select-box flex" @click.stop="isAll = !isAll">
+ <div class="flex-1">{{ symbol.toUpperCase() }}/USDT</div>
+ <van-icon name="arrow-down" />
+ <div class="select-data" v-if="isAll">
+ <div
+ class="select-item"
+ @click.stop="selectItem(item)"
+ v-for="(item, index) in currencyList"
+ :key="index"
+ >
+ {{ item.symbol.toUpperCase() }}/USDT
+ </div>
+ </div>
+ </div>
+ </div>
+ <history-item
+ :coinPrice="coinPrice"
+ v-for="item in entrustList"
+ :key="item.order_no"
+ :entrust="item"
+ :state="item.state"
+ @cancelOrder="cancelOrder"
+ />
+ </van-tab>
+ <van-tab :title="$t('成交历史')" class="font-30">
+ <div class="all-select flex justify-end">
+ <div class="select-box flex" @click.stop="isAll = !isAll">
+ <div class="flex-1">{{ symbol.toUpperCase() }}/USDT</div>
+ <van-icon name="arrow-down" />
+ <div class="select-data" v-if="isAll">
+ <div
+ class="select-item"
+ @click.stop="selectItem(item)"
+ v-for="(item, index) in currencyList"
+ :key="index"
+ >
+ {{ item.symbol.toUpperCase() }}/USDT
+ </div>
+ </div>
+ </div>
+ </div>
+ <entrust-item
+ v-for="item in entrustList"
+ :key="item.order_no"
+ :entrust="item"
+ :state="item.state"
+ @cancelOrder="cancelOrder"
+ />
+ </van-tab>
+ </van-tabs>
+ <div
+ v-if="!entrustList.length"
+ class="flex flex-col justify-center items-center pt-185"
+ >
+ <img
+ src="@/assets/image/assets-center/no-data.png"
+ alt="no-date"
+ class="w-180 h-180"
+ />
+ <p class="textColor">{{ $t("暂无数据") }}</p>
+ </div>
</div>
+ </div>
</template>
<script>
import assetsHead from "@/components/assets-head";
-import { Tabs, Tab, DropdownMenu, DropdownItem } from 'vant';
-import EntrustItem from '@/components/entrust-item'
-import historyItem from '@/components/history-item'
+import { Tabs, Tab, DropdownMenu, DropdownItem } from "vant";
+import EntrustItem from "@/components/entrust-item";
+import historyItem from "@/components/history-item";
import TradeApi from "@/API/trading.js";
-import { _getCoins, _getHomeList } from '@/API/home.api'
+import { _getCoins, _getHomeList } from "@/API/home.api";
export default {
- props: {
-
+ props: {},
+ components: {
+ assetsHead,
+ [Tabs.name]: Tabs,
+ [Tab.name]: Tab,
+ [DropdownMenu.name]: DropdownMenu,
+ [DropdownItem.name]: DropdownItem,
+ EntrustItem,
+ historyItem,
+ },
+ data() {
+ return {
+ active: 0,
+ entrustList: [],
+ historyList: [],
+ finishList: [],
+ type: "orders",
+ isAll: false,
+ symbol: "",
+ currencyList: [],
+ coinPrice: 0,
+ };
+ },
+ watch: {
+ active() {
+ this.isAll = false;
},
- components: {
- assetsHead,
- [Tabs.name]: Tabs,
- [Tab.name]: Tab,
- [DropdownMenu.name]: DropdownMenu,
- [DropdownItem.name]: DropdownItem,
- EntrustItem,
- historyItem
+ },
+ mounted() {
+ this.getCoins();
+ this.symbol = this.$route.params.symbol;
+ this.getOrderList(this.type);
+ this.getCoinPrce(this.symbol);
+ },
+ computed: {},
+ methods: {
+ getCoins() {
+ _getCoins().then((res) => {
+ console.log(res);
+ this.currencyList = res;
+ });
},
- data() {
- return {
- active: 0,
- entrustList: [],
- historyList: [],
- finishList: [],
- type: 'orders',
- isAll: false,
- symbol: '',
- currencyList: [],
- coinPrice: 0
- }
+ getCoinPrce(val) {
+ _getHomeList(val).then((res) => {
+ this.coinPrice = res[0].close;
+ });
},
- watch: {
- active() {
- this.isAll = false
- }
+ getOrderList(type) {
+ this.entrustList = [];
+ TradeApi.tradeRecord({
+ page_no: 1,
+ symbol: this.symbol,
+ type: type,
+ })
+ .then((res) => {
+ console.log(res.data);
+ this.entrustList = res.data;
+ })
+ .catch(() => {});
},
- mounted() {
- this.getCoins()
- this.symbol = this.$route.params.symbol
- this.getOrderList(this.type)
- this.getCoinPrce(this.symbol)
+ changeType() {
+ this.entrustList = [];
+ if (this.active == 0) {
+ this.type = "orders";
+ } else if (this.active == 1) {
+ this.type = "hisorders";
+ } else {
+ this.type = "opponent";
+ }
+ this.getOrderList(this.type);
},
- computed: {
+ cancelOrder(order) {
+ TradeApi.tradeCancel({
+ order_no: order,
+ })
+ .then((res) => {
+ this.$toast(this.$t("成功"));
+ this.getOrderList(this.type);
+ })
+ .catch(() => {});
},
- methods: {
- getCoins() {
- _getCoins().then((res) => {
- console.log(res)
- this.currencyList = res
- })
- },
- getCoinPrce(val) {
- _getHomeList(val).then((res) => {
- this.coinPrice = res[0].close
- })
- },
- getOrderList(type) {
- this.entrustList = []
- TradeApi.tradeRecord({
- page_no: 1,
- symbol: this.symbol,
- type: type
- }).then(res => {
- console.log(res.data)
- this.entrustList = res.data;
- }).catch(() => {
-
- })
- },
- changeType() {
- this.entrustList = [];
- if (this.active == 0) {
- this.type = 'orders'
- } else if (this.active == 1) {
- this.type = 'hisorders'
- } else {
- this.type = 'opponent'
- }
- this.getOrderList(this.type);
- },
- cancelOrder(order) {
- TradeApi.tradeCancel({
- order_no: order,
- }).then(res => {
- this.$toast(this.$t('成功'));
- this.getOrderList(this.type)
- }).catch(() => {
-
- })
- },
- //选择币种
- selectItem(item) {
- this.symbol = item.symbol
- this.getOrderList()
- this.getCoinPrce(item.symbol)
- this.isAll = false
- }
- }
-}
+ //选择币种
+ selectItem(item) {
+ this.symbol = item.symbol;
+ this.getOrderList();
+ this.getCoinPrce(item.symbol);
+ this.isAll = false;
+ },
+ },
+};
</script>
<style lang="scss" scoped>
.tradeRecord {
- width: 100%;
- min-height: 100vh;
- box-sizing: border-box;
+ width: 100%;
+ min-height: 100vh;
+ box-sizing: border-box;
+ @include themify() {
+ background: themed("main_background");
+ }
+
+ ::v-deep .van-tab {
@include themify() {
- background: themed("main_background");
+ color: themed("text_color");
}
+ }
- ::v-deep .van-tab {
- @include themify() {
- color: themed("text_color");
- }
+ ::v-deep .van-tabs__nav {
+ @include themify() {
+ background: themed("tab_background");
}
+ }
- ::v-deep .van-tabs__nav {
- @include themify() {
- background: themed("tab_background");
- }
+ ::v-deep .van-tab--active {
+ background: #1194f7;
+ border-radius: 5px;
+ color: #fff !important;
+ }
+ ::v-deep .van-nav-bar {
+ @include themify() {
+ background: themed("main_background");
}
+ }
- ::v-deep .van-tab--active {
- background: #1194F7;
- border-radius: 5px;
- color: #fff !important;
+ ::v-deep .van-nav-bar__title {
+ @include themify() {
+ color: themed("text_color");
}
+ }
- ::v-deep .van-nav-bar {
- @include themify() {
- background: themed("main_background");
- }
+ ::v-deep .van-tabs__nav {
+ @include themify() {
+ background: themed("main_background");
}
+ }
- ::v-deep .van-nav-bar__title {
- @include themify() {
- color: themed("text_color");
- }
- }
-
- ::v-deep .van-tabs__nav {
- @include themify() {
- background: themed("main_background");
- }
- }
-
- ::v-deep .van-tabs__line {
- background-color: transparent !important;
-
- }
+ ::v-deep .van-tabs__line {
+ background-color: transparent !important;
+ }
}
.listItem {
- border-bottom: 1px solid #484756;
- display: flex;
- justify-content: space-between;
+ border-bottom: 1px solid #484756;
+ display: flex;
+ justify-content: space-between;
}
.all-select {
- padding: 30px 0;
+ padding: 30px 0;
- .select-box {
- width: 160px;
- height: 50px;
+ .select-box {
+ width: 160px;
+ height: 50px;
- @include themify() {
- background: themed("input_background");
- }
-
- @include themify() {
- color: themed("text_color");
- }
-
- display: flex;
- align-items: center;
- font-size: 14px;
- padding: 0 20px;
- position: relative;
-
- .select-data {
- position: absolute;
- top: 55px;
- left: 0;
- z-index: 10;
- width: 100%;
- height: 300px;
- overflow-y: auto;
-
- @include themify() {
- background: themed("input_background");
- }
-
-
- .select-item {
- padding: 20px 20px;
- text-align: center;
-
- @include themify() {
- border-bottom: 1px solid themed("border_color");
- }
- }
- }
+ @include themify() {
+ background: themed("input_background");
}
+
+ @include themify() {
+ color: themed("text_color");
+ }
+
+ display: flex;
+ align-items: center;
+ font-size: 14px;
+ padding: 0 20px;
+ position: relative;
+
+ .select-data {
+ position: absolute;
+ top: 55px;
+ left: 0;
+ z-index: 10;
+ width: 100%;
+ height: 300px;
+ overflow-y: auto;
+
+ @include themify() {
+ background: themed("input_background");
+ }
+
+ .select-item {
+ padding: 20px 20px;
+ text-align: center;
+
+ @include themify() {
+ border-bottom: 1px solid themed("border_color");
+ }
+ }
+ }
+ }
}
.textColor {
- color: #DAD5DC;
+ color: #dad5dc;
}
</style>
diff --git a/src/request/axios.js b/src/request/axios.js
index e4bb916..1f8e7cf 100644
--- a/src/request/axios.js
+++ b/src/request/axios.js
@@ -1,11 +1,12 @@
-import axios from 'axios'; // 引入axios
+import axios from "axios"; // 引入axios
//import QS from 'qs'; // 引入qs模块,用来序列化post类型的数据,后面会提到
-import { Toast, Dialog } from 'vant';
+import { Toast, Dialog } from "vant";
import store from "@/store/index";
-import i18n from '@/i18n';
-import router from '@/router/router'
-import { signatureGenerate } from "@/utils/signatureUtil"
+import i18n from "@/i18n";
+import router from "@/router/router";
+import { signatureGenerate } from "@/utils/signatureUtil";
+import urlKyc from "./urlKyc";
class AxiosRequest {
/**
* @description Class AxiosRequest constructor.
@@ -29,8 +30,8 @@
// alert: Axios default base url param is "baseURL" not is "baseUrl" !
baseURL: this.baseUrl,
headers: this.headers,
- timeout: 10000
- }
+ timeout: 10000,
+ };
return config;
}
@@ -57,11 +58,15 @@
interceptors(instance, url) {
// Request intercept.
instance.interceptors.request.use(
- config => {
- var token = store.state.user.userInfo.token
+ (config) => {
+ const arr = urlKyc.filter((item) => item === url);
+ if (arr.length !== 0 && store.state.user.kyc !== 2) {
+ return Toast.fail(i18n.t("请先实名认证!"));
+ }
+ var token = store.state.user.userInfo.token;
if (token) {
if (!config.params) {
- config.params = {}
+ config.params = {};
}
config.params.token = token;
// console.log(config)
@@ -87,19 +92,19 @@
duration: 0,
forbidClick: true,
loadingType: "spinner",
- message: i18n.t('加载中...')
+ message: i18n.t("加载中..."),
});
}
this.queue[url] = true;
}
// 获取请求头参数
- const { timestamp, signature } = signatureGenerate()
+ const { timestamp, signature } = signatureGenerate();
// 分别将签名、时间戳 至请求头
- if (signature) config.headers["sign"] = signature
- if (timestamp) config.headers["tissuePaper"] = timestamp
+ if (signature) config.headers["sign"] = signature;
+ if (timestamp) config.headers["tissuePaper"] = timestamp;
return config;
},
- error => {
+ (error) => {
if (this.isLoading) {
Toast.clear();
}
@@ -108,21 +113,21 @@
);
// Response intercept.
instance.interceptors.response.use(
- result => {
+ (result) => {
this.destroy(url);
- if (result.data.code == 0||result.data.code == 200) {
+ if (result.data.code == 0 || result.data.code == 200) {
return result.data;
} else if (result.data.code == 401) {
Dialog.confirm({
- confirmButtonText: i18n.t('确定'),
- cancelButtonText: i18n.t('取消'),
- title: i18n.t('提示'),
- message: i18n.t('未实名认证,是否认证?'),
+ confirmButtonText: i18n.t("确定"),
+ cancelButtonText: i18n.t("取消"),
+ title: i18n.t("提示"),
+ message: i18n.t("未实名认证,是否认证?"),
beforeClose: (action, done) => {
- if (action === 'confirm') {
+ if (action === "confirm") {
done();
router.push({
- path: '/authentication'
+ path: "/authentication",
});
} else {
done();
@@ -132,24 +137,26 @@
return result.data;
} else if (result.data.code == 403) {
router.replace({
- path: '/login',
+ path: "/login",
query: {
- redirect: router.currentRoute.fullPath
- }
+ redirect: router.currentRoute.fullPath,
+ },
});
- store.commit('user/SET_OUT');
+ store.commit("user/SET_OUT");
} else {
- if (result.data.msg != undefined) { Toast(i18n.t(result.data.msg)); }
+ if (result.data.msg != undefined) {
+ Toast(i18n.t(result.data.msg));
+ }
return Promise.reject(result.data);
}
},
- error => {
+ (error) => {
if (this.isLoading) {
Toast.clear();
}
- if (error.code == 'ERR_NETWORK') {
- Toast({ message: 'ERR_NETWORK', type: 'fail', duration: 1000 })
- } else if (error.code == 'ECONNABORTED') {
+ if (error.code == "ERR_NETWORK") {
+ Toast({ message: "ERR_NETWORK", type: "fail", duration: 1000 });
+ } else if (error.code == "ECONNABORTED") {
//Toast({ message: 'Network Timeout', type: 'fail', duration: 2000 })
return Promise.reject(error);
}
diff --git a/src/request/http.js b/src/request/http.js
index 0ce13d9..8a4aa2e 100644
--- a/src/request/http.js
+++ b/src/request/http.js
@@ -6,13 +6,13 @@
import AxiosReques from "./axios";
import qs from "qs";
-import {BASE_URL, BASE_URL2} from "@/config";
-import { getSessionStorage } from '@/utils/utis'
+import { BASE_URL, BASE_URL2 } from "@/config";
+import { getSessionStorage } from "@/utils/utis";
-let baseUrl = BASE_URL
-let baseUrl2 = BASE_URL2
-if (getSessionStorage('tzlj')) {
- baseUrl = getSessionStorage('tzlj');
+let baseUrl = BASE_URL;
+let baseUrl2 = BASE_URL2;
+if (getSessionStorage("tzlj")) {
+ baseUrl = getSessionStorage("tzlj");
}
/**
* @description Create axios.
@@ -22,62 +22,62 @@
* @returns axios request instance.
*/
const createAxiosRequest = (baseUrl, headers, isLoading) => {
- return new AxiosReques(baseUrl, headers, isLoading);
-}
+ return new AxiosReques(baseUrl, headers, isLoading);
+};
/**
* @description Axios request params format is JSON.
* @param {Boolean} isLoading Request loading switch.
*/
const axiosJson = (isLoading) => {
- return createAxiosRequest(
- baseUrl,
- {
- "Content-Type": "application/json;charset=UTF-8"
- },
- isLoading
- );
-}
+ return createAxiosRequest(
+ baseUrl,
+ {
+ "Content-Type": "application/json;charset=UTF-8",
+ },
+ isLoading
+ );
+};
/**
* @description Axios request params format is JSON.
* @param {Boolean} isLoading Request loading switch.
*/
const axiosJson2 = (isLoading) => {
- return createAxiosRequest(
- baseUrl2,
- {
- "Content-Type": "application/json;charset=UTF-8"
- },
- isLoading
- );
-}
+ return createAxiosRequest(
+ baseUrl2,
+ {
+ "Content-Type": "application/json;charset=UTF-8",
+ },
+ isLoading
+ );
+};
/**
* @description Axios request params format is FromData.
* @param {Boolean} isLoading Request loading switch.
*/
const axiosForm = (isLoading) => {
- return createAxiosRequest(
- baseUrl,
- {
- "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
- },
- isLoading
- );
-}
+ return createAxiosRequest(
+ baseUrl,
+ {
+ "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
+ },
+ isLoading
+ );
+};
/**
* @description Axios request params format is multipart.
* @param {Boolean} isLoading Request loading switch.
*/
const axiosMultipart = (isLoading) => {
- return createAxiosRequest(
- baseUrl,
- {
- "Content-Type": "multipart/form-data;"
- },
- isLoading
- );
-}
+ return createAxiosRequest(
+ baseUrl,
+ {
+ "Content-Type": "multipart/form-data;",
+ },
+ isLoading
+ );
+};
/**
* @description Create axios request function.
* @param {String} axiosType Request function type name, "axiosForm": FormData, "axiosJson": JSON.
@@ -87,26 +87,26 @@
* @param {Object} param Request params.
*/
const createAxios = (axiosType, { url, method, isLoading }, params) => {
- const axios = axiosType(isLoading);
- if (method.toLocaleLowerCase() === "get") {
- // var token;
- // if(local.get('token')){
- // token=local.get('token')
- // console.log('token',token)
- // }
- return axios.request({
- url,
- params: params ? params : {},
- method
- });
- } else {
- return axios.request({
- url,
- data: params ? params : {},
- method
- });
- }
-}
+ const axios = axiosType(isLoading);
+ if (method.toLocaleLowerCase() === "get") {
+ // var token;
+ // if(local.get('token')){
+ // token=local.get('token')
+ // console.log('token',token)
+ // }
+ return axios.request({
+ url,
+ params: params ? params : {},
+ method,
+ });
+ } else {
+ return axios.request({
+ url,
+ data: params ? params : {},
+ method,
+ });
+ }
+};
/**
* @description Request method of params format is JSON.
@@ -116,9 +116,8 @@
* @param {Object} param Request params.
*/
export const httpJson = ({ url, method, isLoading }, params) => {
- return createAxios(axiosJson, { url, method, isLoading }, params);
-}
-
+ return createAxios(axiosJson, { url, method, isLoading }, params);
+};
/**
* @description Request method of params format is JSON.
@@ -128,8 +127,8 @@
* @param {Object} param Request params.
*/
export const httpJson2 = ({ url, method, isLoading }, params) => {
- return createAxios(axiosJson2, { url, method, isLoading }, params);
-}
+ return createAxios(axiosJson2, { url, method, isLoading }, params);
+};
/**
* @description Request method of params format is FormData.
@@ -139,9 +138,10 @@
* @param {Object} param Request params.
*/
export const httpForm = ({ url, method, isLoading }, params) => {
- const resParams = (method.toLocaleLowerCase() === 'get') ? params : qs.stringify(params);
- return createAxios(axiosForm, { url, method, isLoading }, resParams);
-}
+ const resParams =
+ method.toLocaleLowerCase() === "get" ? params : qs.stringify(params);
+ return createAxios(axiosForm, { url, method, isLoading }, resParams);
+};
/**
* @description Request method of params format is multipart.指定传输数据为二进制数据,主要用于图片、mp3、文件等上传;
* @param {String} url Request url.
@@ -150,5 +150,5 @@
* @param {Object} param Request params.
*/
export const httpMultipart = ({ url, method, isLoading }, params) => {
- return createAxios(axiosMultipart, { url, method, isLoading }, params);
-}
+ return createAxios(axiosMultipart, { url, method, isLoading }, params);
+};
diff --git a/src/request/httpAxios.js b/src/request/httpAxios.js
index cb55437..be46a15 100644
--- a/src/request/httpAxios.js
+++ b/src/request/httpAxios.js
@@ -3,6 +3,7 @@
import { Toast } from "vant";
import i18n from "@/i18n";
import router from "@/router/router";
+import urlKyc from "./urlKyc";
import { signatureGenerate } from "@/utils/signatureUtil";
import { getStorage } from "@/utils/utis";
axios.defaults.headers.post["Content-Type"] =
@@ -26,6 +27,10 @@
// 拦截请求
request.interceptors.request.use(
(config) => {
+ const arr = urlKyc.filter((item) => item === config.url);
+ if (arr.length !== 0 && store.state.user.kyc !== 2) {
+ return Toast.fail(i18n.t("请先实名认证!"));
+ }
if (config.loading) {
Toast.loading({ duration: 0, forbidClick: true });
}
diff --git a/src/request/index.js b/src/request/index.js
index 2567875..0a6f940 100644
--- a/src/request/index.js
+++ b/src/request/index.js
@@ -6,6 +6,7 @@
import router from "@/router/router";
import { getSessionStorage } from "@/utils/utis";
import { signatureGenerate } from "@/utils/signatureUtil";
+import urlKyc from "./urlKyc";
axios.defaults.headers.post["Content-Type"] =
"application/x-www-form-urlencoded";
@@ -29,10 +30,13 @@
// 拦截请求
request.interceptors.request.use(
(config) => {
+ const arr = urlKyc.filter((item) => item === config.url);
+ if (arr.length !== 0 && store.state.user.kyc !== 2) {
+ return Toast.fail(i18n.t("请先实名认证!"));
+ }
if (config.loading) {
Toast.loading({ duration: 0, forbidClick: true });
}
-
if (config.url !== "api/syspara!getSyspara.action") {
if (
diff --git a/src/request/urlKyc.js b/src/request/urlKyc.js
new file mode 100644
index 0000000..aa907d6
--- /dev/null
+++ b/src/request/urlKyc.js
@@ -0,0 +1,9 @@
+// export default ["api/icoNewCurrency/getList.action"];
+// export default [];
+export default [
+ "/api/exchangeapplyorder!open.action",
+ "/api/exchangeapplyorder!close.action",
+ "/api/contractApplyOrder!open.action",
+ "/api/futuresOrder!open.action",
+ "api/withdraw!withdraw_open.action",
+];
diff --git a/src/router/router.js b/src/router/router.js
index a881ce0..171e0eb 100644
--- a/src/router/router.js
+++ b/src/router/router.js
@@ -3,6 +3,7 @@
import store from "../store";
Vue.use(Router);
import { Toast } from "vant";
+import i18n from "@/i18n";
const router = new Router({
scrollBehavior(to, from, savedPosition) {
@@ -109,7 +110,7 @@
//提现页面
path: "/withdraw/withdrawPage",
name: "withdrawPage",
- meta: { index: 9 },
+ meta: { index: 9, kyc: true, requireAuth: true },
component: () =>
import(
/* webpackChunkName: "withdrawPage" */ /* webpackPrefetch: true */ "@/page/withdraw/withdrawPage.vue"
@@ -1376,15 +1377,17 @@
// 判断该路由是否需要登录权限
if (store.state.user.userInfo.token) {
// 通过vuex state获取当前的token是否存在
+ if (to.meta.kyc && store.state.user.userInfo.kyc !== 2) {
+ return Toast.fail(i18n.t("请先实名认证!"));
+ }
if (to.meta.isMerchant) {
if (store.state.user.userInfo.c2c_user_type !== 0) {
next();
} else {
- Toast(this.$t("您不是承兑商"));
+ Toast.fail(i18n.t("您不是承兑商!"));
+
next("/");
}
- } else {
- next();
}
next();
} else {
diff --git a/src/store/modules/home.store.js b/src/store/modules/home.store.js
index edf6ef0..2e708e9 100644
--- a/src/store/modules/home.store.js
+++ b/src/store/modules/home.store.js
@@ -44,7 +44,7 @@
},
SET_NEW_CION_LIST(state, currency) {
const arr = [];
- currency.map((item) => {
+ currency?.map((item) => {
arr.push(item.tokenCode);
});
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index f526efe..a0b63fd 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,128 +1,160 @@
// import { getStorage, setStorage, getBrowserLang } from "@/utils/utis";
import { Toast } from "vant";
-import { _register, _info, perpetualContracts } from '@/API/user.api'
-import { SET_USERINFO, GET_USERINFO, SET_OUT,CONNECT_WALLET, SET_STATUS, SET_CONFIG,GET_DAPPUSERINFO } from "@/store/const.store";
-import { _getBalance } from '@/API/trade.api'
+import { _register, _info, perpetualContracts } from "@/API/user.api";
+import {
+ SET_USERINFO,
+ GET_USERINFO,
+ SET_OUT,
+ CONNECT_WALLET,
+ SET_STATUS,
+ SET_CONFIG,
+ GET_DAPPUSERINFO,
+} from "@/store/const.store";
+import { _getBalance } from "@/API/trade.api";
import i18n from "@/i18n";
+import { _getIdentify } from "@/API/fund.api";
export default {
namespaced: true,
state: {
status: 0, // 状态
+ kyc: "",
gasObj: {}, //
userInfo: {
- usercode: '', //
- token: '', // 登录token
- username: '',
+ usercode: "", //
+ token: "", // 登录token
+ username: "",
perpetual_contracts_status: 0,
- account: '', // 钱包地址
- }
+ account: "", // 钱包地址
+ },
},
getters: {
- mingStatus: state => state.status,
- isToken: state => state.token,
- userInfo: state => state.userInfo
+ mingStatus: (state) => state.status,
+ isToken: (state) => state.token,
+ userInfo: (state) => state.userInfo,
+ kyc: (state) => state.kyc,
},
mutations: {
// SET_GAS_OBJ(state,gasObj){
// state.gasObj=gasObj
// },
- [SET_STATUS](state, status) { // 质押状态
+ [SET_STATUS](state, status) {
+ // 质押状态
state.status = status;
},
[SET_USERINFO](state, info) {
- console.log('用户信息', info)
- state.userInfo = { ...state.userInfo, ...info }
+ console.log("用户信息", info);
+ state.userInfo = { ...state.userInfo, ...info };
},
- [SET_OUT](state) { // 退出
- state.userInfo = {}
+ [SET_OUT](state) {
+ // 退出
+ state.userInfo = {};
},
[SET_CONFIG](state, status) {
// console.log('statusstatus',status)
- state.userInfo.perpetual_contracts_status = status
- }
+ state.userInfo.perpetual_contracts_status = status;
+ },
+ SET_UERS_KYC(state, data) {
+ state.kyc = data;
+ },
},
actions: {
// actionsGasObj({commit},data){
// commit("SET_GAS_OBJ", data);
// },
- // actionsLogin({ commit }, data) {
- // commit("SET_UESR_OBJ", data);
- // },
- async [GET_USERINFO]({ commit }, accounts) { // 发送请求获取信息
- commit(SET_USERINFO, accounts) // 登陆
- let data = await _info()
- commit(SET_USERINFO, data) // 用户信息
- data = await _getBalance()
- commit(SET_USERINFO, { balance: data.money }) // 余额
+ actionsLogin({ commit }, data) {
+ // commit("SET_UESR_OBJ", data);
+ },
+ async [GET_USERINFO]({ commit }, accounts) {
+ // 发送请求获取信息
+ commit(SET_USERINFO, accounts); // 登陆
+ let data = await _info();
+ commit(SET_USERINFO, data); // 用户信息
+ data = await _getBalance();
+ commit(SET_USERINFO, { balance: data.money }); // 余额
},
- async [SET_CONFIG]({ commit, state, }) {
- const data = await perpetualContracts().catch(err => Promise.reject((err)))
+ async GET_UERS_KYC({ commit, state }) {
+ const data = await _getIdentify().catch((err) => Promise.reject(err));
+ console.log("data222222222222", data.status);
+ // let status = data.perpetual_contracts
+ commit("SET_UERS_KYC", data.status);
+ },
+ async [SET_CONFIG]({ commit, state }) {
+ const data = await perpetualContracts().catch((err) =>
+ Promise.reject(err)
+ );
// console.log('data222222222222',data)
- let status = data.perpetual_contracts
- commit(SET_CONFIG, status)
+ let status = data.perpetual_contracts;
+ commit(SET_CONFIG, status);
},
- async [GET_DAPPUSERINFO]({ commit }, accounts) { // 发送请求获取信息
+ async [GET_DAPPUSERINFO]({ commit }, accounts) {
+ // 发送请求获取信息
// console.log('accounts', accounts)
- Toast.loading({ duration: 0, forbidClick: true })
- commit(SET_USERINFO, { account: accounts[0] }) // 钱包地址
- let data = await _register(accounts[0], localStorage.getItem('usercode'))
- commit(SET_USERINFO, data) // 登陆
- data = await _info()
- commit(SET_USERINFO, data) // 用户信息
- data = await _getBalance()
- commit(SET_USERINFO, { balance: data.money }) // 余额
+ Toast.loading({ duration: 0, forbidClick: true });
+ commit(SET_USERINFO, { account: accounts[0] }); // 钱包地址
+ let data = await _register(accounts[0], localStorage.getItem("usercode"));
+ commit(SET_USERINFO, data); // 登陆
+ data = await _info();
+ commit(SET_USERINFO, data); // 用户信息
+ data = await _getBalance();
+ commit(SET_USERINFO, { balance: data.money }); // 余额
},
async [CONNECT_WALLET]({ commit, state, dispatch }, type) {
- Toast.loading({ duration: 0, forbidClick: true })
+ Toast.loading({ duration: 0, forbidClick: true });
setTimeout(async () => {
- const eth = window.ethereum
- if (eth) { // 钱包环境
- const accounts = await eth.request({ method: "eth_requestAccounts" }).catch(err => {
- const { code } = err
- if (code === 4001) {
- Toast.fail(i18n.t('您拒绝了链接'));
- return;
- } if (code === 'ECONNABORTED') {
- this.$toast(this.$t('网络超时!'));
- return;
- }
- })
+ const eth = window.ethereum;
+ if (eth) {
+ // 钱包环境
+ const accounts = await eth
+ .request({ method: "eth_requestAccounts" })
+ .catch((err) => {
+ const { code } = err;
+ if (code === 4001) {
+ Toast.fail(i18n.t("您拒绝了链接"));
+ return;
+ }
+ if (code === "ECONNABORTED") {
+ this.$toast(this.$t("网络超时!"));
+ return;
+ }
+ });
if (accounts) {
if (!state.userInfo.token) {
- await dispatch(GET_DAPPUSERINFO, accounts)
- Toast.success(i18n.t('连接钱包成功'))
- return false
+ await dispatch(GET_DAPPUSERINFO, accounts);
+ Toast.success(i18n.t("连接钱包成功"));
+ return false;
} else {
- if (type == 'connect') {
- await dispatch(GET_DAPPUSERINFO, accounts)
- Toast.success(i18n.t('连接钱包成功'))
+ if (type == "connect") {
+ await dispatch(GET_DAPPUSERINFO, accounts);
+ Toast.success(i18n.t("连接钱包成功"));
} else {
- Toast.success(i18n.t('刷新完成'))
+ Toast.success(i18n.t("刷新完成"));
}
}
// await dispatch(GET_DAPPUSERINFO, accounts)
// Toast.success(i18n.t('连接钱包成功'))
- eth.on('accountsChanged', async (accounts) => { // 登录变了
- commit(SET_OUT)
+ eth.on("accountsChanged", async (accounts) => {
+ // 登录变了
+ commit(SET_OUT);
if (!accounts.length) {
- Toast.fail(i18n.t('已断开钱包连接'))
- } else { // 重新请求数据
- await dispatch(GET_DAPPUSERINFO, accounts)
- const data = await _checkStatus()
- commit(SET_STATUS, data.status)
- Toast.success(i18n.t('钱包切换成功'))
+ Toast.fail(i18n.t("已断开钱包连接"));
+ } else {
+ // 重新请求数据
+ await dispatch(GET_DAPPUSERINFO, accounts);
+ const data = await _checkStatus();
+ commit(SET_STATUS, data.status);
+ Toast.success(i18n.t("钱包切换成功"));
}
- })
+ });
} else {
// Toast('连接钱包异常')
}
} else {
- Toast.fail(i18n.t('请先安装钱包插件'))
+ Toast.fail(i18n.t("请先安装钱包插件"));
}
}, 300);
- }
+ },
},
};
diff --git a/src/utils/filter.js b/src/utils/filter.js
new file mode 100644
index 0000000..c4cea28
--- /dev/null
+++ b/src/utils/filter.js
@@ -0,0 +1,18 @@
+import store from "@/store";
+export function _symbolName(str, type) {
+ const data = store.state?.home?.coinList;
+ let symbol = "";
+ if (data) {
+ let arr = data.filter((item) => item.symbol === str);
+ if (arr[0] && arr[0]?.symbol === str) {
+ let symbol1 = arr[0].symbolFullName;
+ if (type) {
+ symbol = symbol1;
+ } else {
+ symbol = symbol1.replace("/USDT", "");
+ }
+ }
+ }
+
+ return symbol;
+}
--
Gitblit v1.9.3