Browse Source

修改k线为自动切换夏令时和冬令时

master
liaoxinyu 11 months ago
parent
commit
3035921ece
  1. 8
      i18n/lang/en.json
  2. 8
      i18n/lang/zh-TW.json
  3. 4
      pages/exchange/open-position.vue
  4. 66
      pages/purchase/index.vue
  5. 21
      static/chart_main/sevencoin.js

8
i18n/lang/en.json

@ -430,7 +430,13 @@
"b6": "Project Details",
"b7": "Whether to use",
"b8": "Buy",
"b9": "Subscription is successful"
"b9": "Subscription is successful",
"issueNumber" :"issue number",
"Countdown" :"Subscription Countdown",
"hour" :"hour",
"point" :"minute",
"Second" :"second",
"day":"day"
},
"reg": {
"a0": "Mobile registration",

8
i18n/lang/zh-TW.json

@ -430,7 +430,13 @@
"b6": "項目詳情",
"b7": "是否使用",
"b8": "購買",
"b9": "申購成功"
"b9": "申購成功",
"issueNumber" :"發行數量",
"Countdown" :"申購倒數計時",
"hour" :"时",
"point" :"分",
"Second" :"秒",
"day":"天"
},
"reg": {
"a0": "手機註冊",

4
pages/exchange/open-position.vue

@ -741,7 +741,7 @@
</view>
</view>
<view class="p-x-md p-t-0">
<v-input class="p-sm rounded border m-t-sm" :placeholder="$t('contract.i3')" type="number"
<v-input class="p-sm rounded border m-t-sm" :placeholder="$t('contract.i3')"
v-model="strategyForm.tp_trigger_price">
<template #left>
<span class="color-default">{{ $t("contract.i4") }}</span>
@ -757,7 +757,7 @@
}}
USDT
</view> -->
<v-input class="p-sm rounded border m-t-sm" :placeholder="$t('contract.i3')" type="number"
<v-input class="p-sm rounded border m-t-sm" :placeholder="$t('contract.i3')"
v-model="strategyForm.sl_trigger_price">
<template #left>
<span class="color-default">{{ $t("contract.i7") }}</span>

66
pages/purchase/index.vue

@ -2,7 +2,7 @@
<v-page>
<view class="layout-main">
<!-- 申购数据和申购周期 -->
<v-header class="nav-head" :border="false" :title="$t('purchase.a5')">
<v-header class="nav-head" :border="false" :title="$t('purchase.a5')" :left-arrow="false">
<template #right>
<v-link :to="'/pages/purchase/bill?issue_price='+detail.issue_price">
<van-icon class="fn-20 m-t-xs" name="todo-list-o"/>
@ -34,6 +34,8 @@
<!-- </view>-->
<!--</van-circle>-->
<view class="m-b-xs">
<view class="label fn-10">{{ $t('purchase.issueNumber') }}</view>
<view class="color-light">{{price1(detail.issue_num)}}</view>
<view class="label fn-10">{{ $t("purchase.a0") }}</view>
<view class="color-light">1 {{ detail.coin_name }}{{ detail.issue_price }}<!-- 0.035USDT --></view>
<view class="label fn-10">{{ $t("purchase.a1") }}</view>
@ -69,6 +71,7 @@
<!-- 申购 -->
<view class="bg-panel-3 p-md box-shadow">
<view class="title p-b-xs border-b">{{ $t("purchase.a5") }}</view>
<view class="title border-b" style="padding:10px 0px">{{ $t("purchase.Countdown") }}<span style="margin-right: 7px;">{{ days }}{{$t("purchase.day")}}</span><span>{{ hours }}:</span><span>{{ minutes }}:</span><span>{{ seconds }}</span></view>
<view class="m-y-md">
<view class="label">{{ $t("purchase.a1") }}</view>
<v-picker
@ -214,7 +217,14 @@ export default {
coin: "",
subscription: false,
subscriptionCode: "",
activityStep: 0
activityStep: 0,
days: 0,
hours: '00',
minutes: '00',
seconds: '00',
timer1: null,
//
remainingSeconds: 0
}
},
computed: {
@ -321,12 +331,62 @@ export default {
.catch(() => {
});
},
price1(item){
if (item) {
let price = item.toString();
let parts = price.split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(".");
}
},
startTimer() {
this.timer1 = setInterval(() => {
this.remainingSeconds -= 1; // 1
this.updateDisplay();
if (this.remainingSeconds <= 0) {
this.clearTimer();
this.$emit('time-end');
}
}, 1000);
this.updateDisplay(); //
},
clearTimer() {
if (this.timer1) {
clearInterval(this.timer1);
this.timer1 = null;
}
},
updateDisplay() {
const seconds = this.remainingSeconds % 60;
const minutes = Math.floor(this.remainingSeconds / 60) % 60;
const hours = Math.floor(this.remainingSeconds / 3600) % 24;
const days = Math.floor(this.remainingSeconds / 86400);
this.days = days;
this.hours = this.padZero(hours);
this.minutes = this.padZero(minutes);
this.seconds = this.padZero(seconds);
},
padZero(num) {
return num < 10 ? `0${num}` : num.toString();
}
},
created() {
this.subscribeTokenList();
this.getInfo();
},
mounted() {
//
const start = new Date(this.detail.start_subscription_time).getTime();
const end = new Date(this.detail.end_subscription_time).getTime();
const now = Date.now();
if (now > start && now < end) {
this.remainingSeconds = Math.floor((end - now) / 1000);
this.startTimer()
}
},
};
</script>
<style lang="scss" scoped>

21
static/chart_main/sevencoin.js

@ -271,11 +271,20 @@ $(function () {
}
return dateStr
}
adjustToEasternTime(date) {
aadjustToEasternTime(date) {
let timestamp;
// 调整时间为美国东部时间
timestamp = date - (-28800000)+(new Date(new Date().getTime()).getTimezoneOffset()* 60 * 1000) - 46800000;
// 判断日期是否在夏令时
const dates = new Date(date);
const isInEDT = this.dateIsInEDT(dates);
// 根据是否在夏令时来调整时间
if (isInEDT) {
// 在夏令时期间
timestamp = date - (-28800000)+(new Date(new Date().getTime()).getTimezoneOffset()* 60 * 1000) - 43200000; // 使用43200000毫秒 = 12小时
} else {
// 在冬令时期间
timestamp = date - (-28800000)+(new Date(new Date().getTime()).getTimezoneOffset()* 60 * 1000) - 46800000; // 使用46800000毫秒 = 13小时
}
// 创建新的日期对象,并使用调整后的时间戳
const adjustedDate = new Date(timestamp);
@ -285,9 +294,9 @@ $(function () {
// 判断日期是否在夏令时(简化的逻辑,实际应用中需要考虑更多的边界情况)
dateIsInEDT(date) {
const year = date.getUTCFullYear();
const start = new Date(Date.UTC(year, 2, 13, 7)); // March, 2nd Sunday
const end = new Date(Date.UTC(year, 10, 6, 6)); // November, 1st Sunday
const start = new Date(Date.UTC(year, 2, 8, 18)); // March, 2nd Sunday
const end = new Date(Date.UTC(year, 10, 3, 18)); // November, 1st Sunday
console.log(start);
start.setUTCDate(14 - start.getUTCDay());
end.setUTCDate(7 - end.getUTCDay());

Loading…
Cancel
Save