diff --git a/src/api/market.js b/src/api/market.js
index 785c28c..7fa807b 100644
--- a/src/api/market.js
+++ b/src/api/market.js
@@ -63,6 +63,10 @@ class Market {
static getstockCoinInfo(params) {
return server.get(`/stock/getCoinInfo`,{ params });
}
+ // 是否显示颜色
+ static getstocktradingOpen(params) {
+ return server.get(`/stock/tradingOpen`,{ params });
+ }
}
export default Market;
\ No newline at end of file
diff --git a/src/components/CommonFooter.vue b/src/components/CommonFooter.vue
index 7294744..fd7a6c2 100644
--- a/src/components/CommonFooter.vue
+++ b/src/components/CommonFooter.vue
@@ -352,11 +352,11 @@ export default {
label: "Turkey",
url: require("../assets/img/tr.jpg"),
},
- // {
- // value: 'ar',
- // label: 'عربي',
- // url:require('../assets/img/polski.png')
- // },
+ {
+ value: 'ar',
+ label: 'عربي',
+ url:require('../assets/img/polski.png')
+ },
{
value: "tw", // zh-TW
label: "繁体中文",
@@ -485,11 +485,11 @@ export default {
this.getServiceLink();
// console.log(this.service);
this.getEmial();
- if(this.isLogin){
- this.chatcount = setInterval(()=>{
- this.chat()
- },5000)
- }
+ // if(this.isLogin){
+ // this.chatcount = setInterval(()=>{
+ // this.chat()
+ // },5000)
+ // }
},
};
diff --git a/src/components/CommonHeader.vue b/src/components/CommonHeader.vue
index f1d4b62..b016780 100644
--- a/src/components/CommonHeader.vue
+++ b/src/components/CommonHeader.vue
@@ -42,9 +42,9 @@
{{ contract.label }}
-
+
{{ learn.label }}
@@ -419,11 +419,11 @@ export default {
label: "Turkey",
url: require("../assets/img/tr.jpg"),
},
- // {
- // value: 'ar',
- // label: 'عربي',
- // url:require('../assets/img/polski.png')
- // },
+ {
+ value: 'ar',
+ label: 'عربي',
+ url:require('../assets/img/polski.png')
+ },
{
value: "tw", // zh-TW
label: "繁体中文",
diff --git a/src/views/exchangeStock/index.vue b/src/views/exchangeStock/index.vue
index b8c9596..e3c1672 100644
--- a/src/views/exchangeStock/index.vue
+++ b/src/views/exchangeStock/index.vue
@@ -491,8 +491,11 @@
Exchange.getstockUserBalance(this.marketInfo.pair_name).then(data => {
+ // this.fromBalance = data[this.pair.from.toUpperCase()].usable_balance;
+ // this.toBalance = data[this.pair.to.toUpperCase()].usable_balance;
+ console.log(data[this.activeContract.coin_name].usable_balance,'111');
this.fromBalance = data[this.pair.from.toUpperCase()].usable_balance;
- this.toBalance = data[this.pair.to.toUpperCase()].usable_balance;
+ this.toBalance = data[this.activeContract.coin_name].usable_balance;
}).catch(err => {
@@ -504,6 +507,9 @@
// 更新接口数据
update() {
this.getBalance();
+ setTimeout(()=>{
+ this.getBalance();
+ },2000)
this.getOrders();
this.getCurrencyExCny();
},
diff --git a/src/views/exchangeStock/make-deal.vue b/src/views/exchangeStock/make-deal.vue
index fc9ae5e..455d806 100644
--- a/src/views/exchangeStock/make-deal.vue
+++ b/src/views/exchangeStock/make-deal.vue
@@ -191,7 +191,8 @@
{{ $t('exchange.balance') }}
{{fromBalance}} {{pair.from}}
-
+
+
@@ -237,7 +238,8 @@
- {{ msgList.sell[2] }}
+
+ {{ msgList.sell[4] }}
@@ -272,7 +274,8 @@
{{ $t('exchange.balance') }}
{{fromBalance}} {{pair.from}}
-
+
+
@@ -298,6 +301,11 @@ export default {
cacheTotal: 0, // 存放市价单输入的总值
cachePrice: null, // 存放最新价格
+
+ timeoutId: null,
+ intervalId: null,
+ tradingOpenshow:false,
+ timer: null,
// 气泡弹框内容和触发
visibles: {
@@ -454,6 +462,91 @@ export default {
});
},
+
+
+ tradingOpen(){
+ Market.getstocktradingOpen().then(res => {
+ // console.log(res);
+ this.tradingOpenshow = res
+ }).catch(err => {});
+ },
+ // 开启定时任务逻辑
+ startSchedule() {
+ // const now = new Date();
+ // const minutes = now.getMinutes();
+ // const seconds = now.getSeconds();
+ // const milliseconds = now.getMilliseconds();
+
+ // let msUntilNextTime = 0; // 距离下一次调用的毫秒数
+
+ // // 计算距离下一个 00分 或 30分 还有多久
+ // if (minutes < 30) {
+ // // 当前在 0~29 分之间,目标是 30 分
+ // msUntilNextTime = (30 - minutes) * 60000 - seconds * 1000 - milliseconds;
+ // } else {
+ // // 当前在 30~59 分之间,目标是下一个 00 分 (60分)
+ // msUntilNextTime = (60 - minutes) * 60000 - seconds * 1000 - milliseconds;
+ // }
+
+ // console.log(`距离下次刷新还有 ${Math.round(msUntilNextTime / 1000)} 秒`);
+
+ // // 1. 先用 setTimeout 等待到下一个整点或半点
+ // this.timeoutId = setTimeout(() => {
+ // // 到达整点/半点,执行一次请求
+ // this.tradingOpen();
+
+ // // 2. 之后开启 setInterval,每隔固定的 30 分钟执行一次
+ // const THIRTY_MINUTES_MS = 30 * 60 * 1000;
+ // this.intervalId = setInterval(() => {
+ // this.tradingOpen();
+ // }, THIRTY_MINUTES_MS);
+
+ // }, msUntilNextTime);
+
+ this.timer = setInterval(() => {
+ const now = new Date();
+ const minutes = now.getMinutes();
+ const seconds = now.getSeconds();
+
+ let remainingSeconds = 0;
+
+ // 1. 如果正好是 00分00秒 或 30分00秒,说明时间到了!
+ if (minutes % 30 === 0 && seconds === 0) {
+ remainingSeconds = 0;
+ console.log(`距离下次刷新还有 ${remainingSeconds} 秒,正在执行刷新...`);
+
+ // 触发接口调用
+ this.tradingOpen();
+ }
+ // 2. 否则,计算距离下一次刷新的秒数
+ else {
+ if (minutes < 30) {
+ // 如果当前是 0~29 分,目标是 30 分
+ remainingSeconds = (30 - minutes) * 60 - seconds;
+ } else {
+ // 如果当前是 30~59 分,目标是 60 分 (下一个整点)
+ remainingSeconds = (60 - minutes) * 60 - seconds;
+ }
+
+ // 一直打印倒计时提示
+ // console.log(`距离下次刷新还有 ${remainingSeconds} 秒`);
+ }
+ }, 1000);
+ },
+
+ // 清除定时器的方法
+ // clearSchedule() {
+ // if (this.timeoutId) {
+ // clearTimeout(this.timeoutId);
+ // this.timeoutId = null;
+ // }
+ // if (this.intervalId) {
+ // clearInterval(this.intervalId);
+ // this.intervalId = null;
+ // }
+ // },
+
+
renderBuyAmount(val, index) {
// console.Info(val)
// console.Info(this.buyorder)
@@ -646,10 +739,12 @@ export default {
if (this.empty(order.amount)) {
flag = false;
this.visibles[orderType].marketAmount = true;
+ this.visibles[orderType].limitAmount = true;
this.msgList[orderType][4] = this.$t('nav.a6');
} else if (order.amount < this.minQty) {
flag = false;
this.visibles[orderType].marketAmount = true;
+ this.visibles[orderType].limitAmount = true;
this.msgList[orderType][4] = this.$t('nav.a7')+` ${this.minQty}`;
}
}
@@ -718,9 +813,18 @@ export default {
created() {
this.getCoinInfo()
+
+ this.tradingOpen()
+ this.startSchedule();
+
this.reset();
},
-
+ beforeDestroy() {
+ // this.clearSchedule();
+ if (this.timer) {
+ clearInterval(this.timer);
+ }
+ },
}
@@ -822,4 +926,13 @@ export default {
.market-trade p{
color: #e7e7e7;
}
+.colorless{
+ background: #999999;
+ color: #fff;
+ text-transform: uppercase;
+ padding: 10px;
+ margin-top: 30px;
+ width: 100%;
+ box-shadow: 0px 0px 15px 0px rgba(199, 199, 199, 0.7);
+}
diff --git a/src/views/exchangeStock/order-list.vue b/src/views/exchangeStock/order-list.vue
index 84a4339..2cb2f64 100644
--- a/src/views/exchangeStock/order-list.vue
+++ b/src/views/exchangeStock/order-list.vue
@@ -101,9 +101,9 @@
{{item.usable_balance}} |
{{item.realtimePrice}} |
{{item.cost_price}} |
- {{item.dayProfit}} |
- {{item.unRealProfit}} |
- {{item.profitRate}} |
+ {{item.dayProfit}} |
+ {{item.unRealProfit}} |
+ {{item.profitRate}} |