fix: 优化体验
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m37s

This commit is contained in:
sexygoat
2026-05-09 16:14:06 +08:00
parent c798cdba7f
commit 3f997063f4
27 changed files with 1191 additions and 62 deletions

View File

@@ -113,6 +113,7 @@
onMounted,
computed
} from 'vue';
import { onShow } from '@dcloudio/uni-app';
import UserInfoCard from '@/components/UserInfoCard.vue';
import DeviceStatusCard from '@/components/DeviceStatusCard.vue';
import VoiceCard from '@/components/VoiceCard.vue';
@@ -207,6 +208,7 @@
let showSmsCode = ref(false);
let smsCodePhone = ref('');
let smsCode = ref('');
let indexEntryChecking = ref(false);
const formatDate = (dateStr) => {
if (!dateStr) return '-';
@@ -293,10 +295,33 @@
}
// 到期时间由 TrafficCard 组件获取套餐信息时一并返回
return data;
} catch (e) {
console.error('加载资产信息失败', e);
return null;
} finally {
loading.value = false;
}
};
const handleIndexEntry = async () => {
const token = uni.getStorageSync('token');
if (!token) {
uni.reLaunch({ url: '/pages/login/login' });
return;
}
if (indexEntryChecking.value) return;
indexEntryChecking.value = true;
try {
const data = await loadAssetInfo();
if (data && !data.bound_phone) {
uni.redirectTo({ url: '/pages/bind/bind?fromLogin=true' });
}
} finally {
indexEntryChecking.value = false;
}
loading.value = false;
};
// 处理套餐加载完成事件(从 TrafficCard 组件传递过来)
@@ -736,13 +761,11 @@
};
onMounted(() => {
const token = uni.getStorageSync('token');
if (!token) {
uni.reLaunch({ url: '/pages/login/login' });
return;
}
initCurrentMonth();
loadAssetInfo();
});
onShow(() => {
handleIndexEntry();
});
</script>