12.3
This commit is contained in:
@@ -122,9 +122,9 @@
|
||||
<view class="bottom-box">
|
||||
<view class="storage-info">
|
||||
<text
|
||||
>手机存储:总空间{{ storageInfo.total }}G/剩余{{
|
||||
>手机存储:总空间{{ storageInfo.total }}/剩余{{
|
||||
storageInfo.available
|
||||
}}G可用</text
|
||||
}}可用</text
|
||||
>
|
||||
</view>
|
||||
<view class="footer-btn" v-if="isEditMode">
|
||||
@@ -157,8 +157,8 @@ const selectedItems = ref([]);
|
||||
const activeTab = ref("completed"); // completed: 已完成, downloading: 缓存中
|
||||
const isEditMode = ref(false);
|
||||
const storageInfo = ref({
|
||||
total: "461.31",
|
||||
available: "312.92",
|
||||
total: "461.31G",
|
||||
available: "312.92G",
|
||||
});
|
||||
const delTask=()=>{
|
||||
if(selectedItems.value.length === 0){
|
||||
@@ -360,11 +360,16 @@ const getStorageInfo = () => {
|
||||
// 获取手机存储信息
|
||||
// #ifdef APP-PLUS
|
||||
if (uni.getSystemInfoSync().platform !== 'android') {
|
||||
console.log('此方法仅适用于Android平台');
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. 导入所需的Android类
|
||||
uni.sendNativeEvent('getSysSpace',{
|
||||
msg: 'getSysSpace'
|
||||
},(res) => {
|
||||
storageInfo.value = {
|
||||
total: res.total,
|
||||
available: res.available,
|
||||
};
|
||||
});
|
||||
}else{
|
||||
// 1. 导入所需的Android类
|
||||
const Environment = plus.android.importClass("android.os.Environment");
|
||||
const StatFs = plus.android.importClass("android.os.StatFs");
|
||||
|
||||
@@ -402,14 +407,17 @@ const getStorageInfo = () => {
|
||||
|
||||
// 可以根据需要返回不同单位的值
|
||||
storageInfo.value = {
|
||||
total: totalSizeInGB,
|
||||
available: availableSizeInGB,
|
||||
total: totalSizeInGB+"G",
|
||||
available: availableSizeInGB+"G",
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.error('获取存储信息时发生错误:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// #endif
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user