修复了刷新报错
This commit is contained in:
parent
b5edb78131
commit
cf87e7e9f7
@ -52,7 +52,7 @@ export default createStore({
|
||||
zoneStr: "中途岛GMT-11:00",
|
||||
zoneid: 1,
|
||||
symbol: "$",
|
||||
zoneValue:"",
|
||||
zoneValue: "Atlantic/South_Georgia",
|
||||
currencytag: 0
|
||||
},
|
||||
islogin: false,
|
||||
@ -123,7 +123,7 @@ export default createStore({
|
||||
const user = await userinfo();
|
||||
if(user != '未登录'){
|
||||
saveValue("Lanvuage", user.languageValue);
|
||||
commit('setUserInfo', user);
|
||||
// commit('setUserInfo', user);
|
||||
} else {
|
||||
const info = await getaddr();
|
||||
commit("setLanguage", info)
|
||||
|
@ -249,7 +249,7 @@
|
||||
}
|
||||
</style>
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, watch } from "vue";
|
||||
import { computed, defineComponent, ref, watch } from "vue";
|
||||
import { getDay, gethour, getminute, gettime, getweek } from "@/utils/date";
|
||||
import store from '@/store';
|
||||
import { getdatelist, userinfo } from '@/api';
|
||||
@ -260,11 +260,12 @@ import { useRoute } from 'vue-router';
|
||||
export default defineComponent({
|
||||
props: {},
|
||||
setup() {
|
||||
const userinfo = computed(()=>store.state.userinfo)
|
||||
const zhou = ref(0);
|
||||
const time: any = useRoute().query.time;
|
||||
const week = ref<any>(getweek(time, store.state.userinfo.zoneValue));
|
||||
const userid = store.state.userinfo.memberid;
|
||||
console.log(week.value);
|
||||
let userid = userinfo.value.memberid;
|
||||
const week = ref<any>(getweek(time, userinfo.value.zoneValue));
|
||||
|
||||
function getdates(userid: number){
|
||||
getdatelist(week.value.start, week.value.end, userid).then((res: any)=>{
|
||||
console.log(res)
|
||||
@ -287,6 +288,13 @@ export default defineComponent({
|
||||
console.log(week.value)
|
||||
})
|
||||
}
|
||||
watch(userinfo,()=>{
|
||||
userid = userinfo.value.memberid;
|
||||
getdates(userid);
|
||||
week.value = getweek(time, userinfo.value.zoneValue);
|
||||
})
|
||||
console.log(week.value);
|
||||
|
||||
|
||||
getdates(userid);
|
||||
|
||||
@ -301,7 +309,7 @@ export default defineComponent({
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
const days: any = dayjs;
|
||||
const now = days().tz(store.state.userinfo.zoneValue)
|
||||
const now = days().tz(userinfo.value.zoneValue)
|
||||
const xiaoshi = now.hour()
|
||||
const fenzhong = now.minute()
|
||||
top.value = (xiaoshi + (fenzhong / 60)) * 0.63;
|
||||
@ -310,7 +318,7 @@ export default defineComponent({
|
||||
}, 2000)
|
||||
|
||||
watch(zhou, (value) => {
|
||||
week.value = getweek(time, store.state.userinfo.zoneValue, value);
|
||||
week.value = getweek(time, userinfo.value.zoneValue, value);
|
||||
console.log(week.value);
|
||||
getdates(userid)
|
||||
});
|
||||
@ -341,6 +349,7 @@ export default defineComponent({
|
||||
console.log(url)
|
||||
router.push(url)
|
||||
}
|
||||
|
||||
return {
|
||||
zhou,
|
||||
week,
|
||||
|
Loading…
Reference in New Issue
Block a user