feat: 以服务器时间为准

main
shengwen.chen 5 days ago
parent 855ffa543e
commit 9011d459e3

@ -96,8 +96,7 @@
</template>
<script>
import { getDynamicTableHeader, getDynamicTableList, getGlobeConfig, getDepList } from '@/api/publishApi';
import { getServerDateTime } from '@/api/publishApi';
import { getDynamicTableHeader, getDynamicTableList, getGlobeConfig, getDepList, getServerDateTime } from '@/api/publishApi';
import { Carousel, CarouselItem, Select, Option } from 'element-ui';
import { statusToTxt, textToColor } from '@/utils/common';
import dayjs from 'dayjs';
@ -319,11 +318,11 @@ export default {
//
getServerDateTime().then(res => {
if (dayjs().utcOffset() == 480) {
this.serverTimeStamp = dayjs(res['Data']).valueOf()
} else {
this.serverTimeStamp = dayjs(res['Data']).valueOf() + 8 * 60 * 60 * 1000
}
// if (dayjs().utcOffset() == 480) {
this.serverTimeStamp = dayjs(res['Data']).valueOf()
// } else {
// this.serverTimeStamp = dayjs(res['Data']).valueOf() + 8 * 60 * 60 * 1000
// }
this.dateTimer = setInterval(() => {
this.currentDateTime = dayjs(this.serverTimeStamp).format(`YYYY-MM-DD HH:mm dddd`);
this.serverTimeStamp += 1000

@ -97,8 +97,7 @@
</template>
<script>
import { getDynamicTableHeader, getDynamicTableList, getGlobeConfig, getAudio } from '@/api/publishApi';
import { getServerDateTime } from '@/api/publishApi';
import { getDynamicTableHeader, getDynamicTableList, getGlobeConfig, getAudio, getServerDateTime } from '@/api/publishApi';
import { Carousel, CarouselItem } from 'element-ui';
import dayjs from 'dayjs';
import { statusToTxt, textWaitToColor } from '@/utils/common';
@ -364,11 +363,11 @@ export default {
//
getServerDateTime().then(res => {
if (dayjs().utcOffset() == 480) {
this.serverTimeStamp = dayjs(res['Data']).valueOf()
} else {
this.serverTimeStamp = dayjs(res['Data']).valueOf() + 8 * 60 * 60 * 1000
}
// if (dayjs().utcOffset() == 480) {
this.serverTimeStamp = dayjs(res['Data']).valueOf()
// } else {
// this.serverTimeStamp = dayjs(res['Data']).valueOf() + 8 * 60 * 60 * 1000
// }
this.dateTimer = setInterval(() => {
this.currentDateTime = dayjs(this.serverTimeStamp).format(`YYYY-MM-DD HH:mm dddd`);
this.serverTimeStamp += 1000

Loading…
Cancel
Save