fix:删除上网检测
This commit is contained in:
@@ -5,7 +5,7 @@ import { useAppStore } from '@/store/modules/app';
|
|||||||
import type { ECOption } from '@/hooks/common/echarts';
|
import type { ECOption } from '@/hooks/common/echarts';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useAuthStore } from '@/store/modules/auth';
|
import { useAuthStore } from '@/store/modules/auth';
|
||||||
import { clientAuth } from '@/service/ue/client';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
@@ -257,27 +257,6 @@ const updateGaugeData = (opts: ECOption, data: GaugeDisplayData, progressRatio?:
|
|||||||
// 添加峰值速率的 ref
|
// 添加峰值速率的 ref
|
||||||
const peakTrafficRate = ref(0);
|
const peakTrafficRate = ref(0);
|
||||||
|
|
||||||
// 添加检查是否可以上网的函数
|
|
||||||
function checkAndTriggerAuth(dashboardData: any) {
|
|
||||||
// 检查是否有余额
|
|
||||||
const hasBalance = dashboardData.balance > 0;
|
|
||||||
|
|
||||||
// 检查是否不限制流量
|
|
||||||
const noTrafficLimit = !dashboardData.trafficEnable;
|
|
||||||
|
|
||||||
// 检查是否有剩余流量
|
|
||||||
const hasRemainingTraffic = dashboardData.trafficEnable &&
|
|
||||||
(dashboardData.traffic - dashboardData.trafficUsed) > 0;
|
|
||||||
|
|
||||||
// 如果满足任一条件,触发上网
|
|
||||||
if (hasBalance || noTrafficLimit || hasRemainingTraffic) {
|
|
||||||
clientAuth().then((res) => {
|
|
||||||
console.log('Auto auth triggered:', res);
|
|
||||||
}).catch(err => {
|
|
||||||
console.error('Auto auth failed:', err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改 mockDataUpdate 函数,在获取数据后添加检查
|
// 修改 mockDataUpdate 函数,在获取数据后添加检查
|
||||||
async function mockDataUpdate() {
|
async function mockDataUpdate() {
|
||||||
@@ -350,9 +329,6 @@ async function mockDataUpdate() {
|
|||||||
subTitle: t('page.headerbanner.maxspeed') + `: ${peakSpeed.value}${peakSpeed.unit}`
|
subTitle: t('page.headerbanner.maxspeed') + `: ${peakSpeed.value}${peakSpeed.unit}`
|
||||||
};
|
};
|
||||||
|
|
||||||
// 在数据处理完成后,添加自动上网检查
|
|
||||||
checkAndTriggerAuth(response);
|
|
||||||
|
|
||||||
// 统一更新所有图表
|
// 统一更新所有图表
|
||||||
updateGauge1(opts => updateGaugeData(opts, baseData.value[0]));
|
updateGauge1(opts => updateGaugeData(opts, baseData.value[0]));
|
||||||
updateGauge2(opts => {
|
updateGauge2(opts => {
|
||||||
|
|||||||
Reference in New Issue
Block a user