时区渲染

This commit is contained in:
luyuan 2020-11-18 10:51:03 +08:00
parent 849b04a1ee
commit da8c001b44
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
3 changed files with 24 additions and 6 deletions

View File

@ -51,7 +51,8 @@ export default createStore({
willsayValue: [{name: "0", level: 0}],
zoneStr: "中途岛GMT-11:00",
zoneid: 1,
symbol: "$"
symbol: "$",
zoneValue:""
},
islogin: false,
seting:{

View File

@ -64,8 +64,18 @@ export function getdate(yue?: number): GetDate{
}
export function getweek(time: string,zhou?: number){
let now = dayjs((!time ? undefined : time))
export function getweek(time: string, id: string,zhou?: number){
/* eslint-disable */
const utc = require('dayjs/plugin/utc') // dependent on utc plugin
/* eslint-disable */
const timezone = require('dayjs/plugin/timezone')
dayjs.extend(utc)
dayjs.extend(timezone)
const days: any = dayjs;
console.log(id, 11111)
let now = days((!time ? undefined : time)).tz(id)
console.log(now, 11111)
if(zhou != undefined){
now = now.day(now.day() + (zhou * 6));
}

View File

@ -259,7 +259,7 @@ export default defineComponent({
setup() {
const zhou = ref(0);
const time: any = useRoute().query.time;
const week = ref<any>(getweek(time));
const week = ref<any>(getweek(time, store.state.userinfo.zoneValue));
const userid = store.state.userinfo.memberid;
console.log(week.value);
function getdates(userid: number){
@ -291,7 +291,14 @@ export default defineComponent({
const times = ref('');
const xs = ref(0);
setInterval(()=>{
const now = dayjs();
/* eslint-disable */
const utc = require('dayjs/plugin/utc') // dependent on utc plugin
/* eslint-disable */
const timezone = require('dayjs/plugin/timezone')
dayjs.extend(utc)
dayjs.extend(timezone)
const days: any = dayjs;
const now = days().tz(store.state.userinfo.zoneValue)
const xiaoshi = now.hour()
const fenzhong = now.minute()
top.value = (xiaoshi + (fenzhong / 60)) * 0.63;
@ -300,7 +307,7 @@ export default defineComponent({
}, 2000)
watch(zhou, (value) => {
week.value = getweek(time, value);
week.value = getweek(time, store.state.userinfo.zoneValue, value);
console.log(week.value);
getdates(userid)
});