mirror of
https://github.com/imsyy/SPlayer.git
synced 2025-11-25 11:29:26 +08:00
🎈 perf: 优化云盘缓存
This commit is contained in:
@@ -49,7 +49,7 @@ module.exports = {
|
|||||||
$notification: true,
|
$notification: true,
|
||||||
$changeThemeColor: true,
|
$changeThemeColor: true,
|
||||||
$canNotConnect: true,
|
$canNotConnect: true,
|
||||||
$refreshCloudList: true,
|
$refreshCloudCatch: true,
|
||||||
$cleanAll: true,
|
$cleanAll: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
1
components.d.ts
vendored
1
components.d.ts
vendored
@@ -44,7 +44,6 @@ declare module 'vue' {
|
|||||||
NGi: typeof import('naive-ui')['NGi']
|
NGi: typeof import('naive-ui')['NGi']
|
||||||
NGlobalStyle: typeof import('naive-ui')['NGlobalStyle']
|
NGlobalStyle: typeof import('naive-ui')['NGlobalStyle']
|
||||||
NGrid: typeof import('naive-ui')['NGrid']
|
NGrid: typeof import('naive-ui')['NGrid']
|
||||||
NGridItem: typeof import('naive-ui')['NGridItem']
|
|
||||||
NH1: typeof import('naive-ui')['NH1']
|
NH1: typeof import('naive-ui')['NH1']
|
||||||
NH3: typeof import('naive-ui')['NH3']
|
NH3: typeof import('naive-ui')['NH3']
|
||||||
NH4: typeof import('naive-ui')['NH4']
|
NH4: typeof import('naive-ui')['NH4']
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ const setCloudSongMatchBtn = async (data) => {
|
|||||||
allCloudSongs[cloudMatchIndex.value] = JSON.parse(JSON.stringify(cloudMatchSongData.value));
|
allCloudSongs[cloudMatchIndex.value] = JSON.parse(JSON.stringify(cloudMatchSongData.value));
|
||||||
await indexedDB.setfilesDB("userCloudList", allCloudSongs.slice());
|
await indexedDB.setfilesDB("userCloudList", allCloudSongs.slice());
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
if (typeof $refreshCloudList !== "undefined") $refreshCloudList();
|
if (typeof $refreshCloudCatch !== "undefined") $refreshCloudCatch();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("更改云盘列表时出错:", error);
|
console.error("更改云盘列表时出错:", error);
|
||||||
$message.error("更改云盘列表时出错,请刷新后重试");
|
$message.error("更改云盘列表时出错,请刷新后重试");
|
||||||
|
|||||||
@@ -104,10 +104,9 @@ const searchValue = ref(null);
|
|||||||
const searchData = ref([]);
|
const searchData = ref([]);
|
||||||
|
|
||||||
// 获取用户云盘缓存数据
|
// 获取用户云盘缓存数据
|
||||||
const getUserCloudDataList = async () => {
|
const getUserCloudDataCatch = async () => {
|
||||||
await indexedDB.getfilesDB("userCloudList").then((res) => {
|
const result = await indexedDB.getfilesDB("userCloudList");
|
||||||
userCloudData.value = res;
|
userCloudData.value = result;
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取用户云盘列表
|
// 获取用户云盘列表
|
||||||
@@ -117,7 +116,6 @@ const getUserCloudData = async (isOnce = false) => {
|
|||||||
let offset = 0;
|
let offset = 0;
|
||||||
let totalCount = null;
|
let totalCount = null;
|
||||||
let resultArr = [];
|
let resultArr = [];
|
||||||
userCloudData.value = [];
|
|
||||||
// 获取数据
|
// 获取数据
|
||||||
while (totalCount === null || offset < totalCount) {
|
while (totalCount === null || offset < totalCount) {
|
||||||
const res = await getUserCloud(100, offset);
|
const res = await getUserCloud(100, offset);
|
||||||
@@ -191,12 +189,12 @@ const goBuy = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getUserCloudDataList();
|
await getUserCloudDataCatch();
|
||||||
await getUserCloudData();
|
await getUserCloudData();
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.$refreshCloudList = getUserCloudDataList;
|
window.$refreshCloudCatch = getUserCloudDataCatch;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user