This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user