diff --git a/src/App.vue b/src/App.vue index 5bb3432..6a25ebd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -75,7 +75,7 @@ setInterval(() => { ) rs.then((res) => { if (res.status === 0) { - store.set_user_info(res); + store.commit('set_user_info', res); // localStorage.setItem('proxies', res.proxies_num) // localStorage.setItem('traffic', res.traffic) // localStorage.setItem('set_limit', res) diff --git a/src/utils/stores/store.js b/src/utils/stores/store.js index be4988d..0bc98de 100644 --- a/src/utils/stores/store.js +++ b/src/utils/stores/store.js @@ -10,7 +10,8 @@ const store = new vuex.Store({ inbound: 0, outbound: 0, avatar: '', - traffic: '' + traffic: '', + proxies_num: 0 }, getters: { get_token(state) { @@ -37,6 +38,9 @@ const store = new vuex.Store({ }, get_traffic(state) { return Number(state.traffic) / 1024 || Number(localStorage.getItem('traffic')) / 1024 || 0 + }, + get_proxies_num(state) { + return state.proxies_num || localStorage.getItem('proxies_num') || 0 } }, mutations: { @@ -58,6 +62,7 @@ const store = new vuex.Store({ state.outbound = userdata.outbound state.avatar = userdata.avatar state.traffic = userdata.traffic + state.proxies_num = userdata.proxies_num localStorage.setItem('username', userdata.username) localStorage.setItem('email', userdata.email) localStorage.setItem('traffic', userdata.traffic) @@ -65,6 +70,7 @@ const store = new vuex.Store({ localStorage.setItem('inbound', userdata.inbound) localStorage.setItem('outbound', userdata.outbound) localStorage.setItem('avatar', userdata.avatar) + localStorage.setItem('proxies_num', userdata.proxies_num) }, set_limit(state, limit_info) { state.inbound = limit_info.inbound diff --git a/src/views/DashBoard.vue b/src/views/DashBoard.vue index 9fc0a99..3b2817a 100644 --- a/src/views/DashBoard.vue +++ b/src/views/DashBoard.vue @@ -50,7 +50,7 @@ 您的邮箱为:{{ email }}
- + @@ -182,7 +182,7 @@ notice_res.then((res) => { } }) -async function changeShouFrptoken(event) { +async function changeShowFrptoken(event) { DontShowFrptoken.value = !DontShowFrptoken.value clipboard(frptoken, event) setTimeout(() => { @@ -191,7 +191,7 @@ async function changeShouFrptoken(event) { } const traffic = ref(Number(localStorage.getItem('traffic')) / 1024 + 'GB') -const Proxiesanimation = ref(Number(localStorage.getItem('proxies'))) +const Proxiesanimation = ref(Number(localStorage.getItem('proxies_num'))) const TrafficRef = ref(null) const boardcast_html = ref('') const boardcast_show = ref(true) @@ -255,7 +255,7 @@ function howtosayhi() { } setInterval(() => { - Proxiesanimation.value = Number(localStorage.getItem('proxies')) + Proxiesanimation.value = Number(localStorage.getItem('proxies_num')) traffic.value = Number(localStorage.getItem('traffic')) / 1024 + 'GB' inbound.value = store.getters.get_in_bound + 'Mbps 下行' outbound.value = store.getters.get_out_bound + 'Mbps 上行'