mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-10 23:28:46 +08:00
fix:转存报错没有提示
This commit is contained in:
@@ -272,14 +272,14 @@ export const useResourceStore = defineStore("resource", {
|
||||
},
|
||||
|
||||
// 获取资源列表并选择
|
||||
async getResourceListAndSelect(resource: ResourceItem): Promise<void> {
|
||||
async getResourceListAndSelect(resource: ResourceItem): Promise<boolean> {
|
||||
const { cloudType } = resource;
|
||||
const drive = CLOUD_DRIVES.find((x) => x.type === cloudType);
|
||||
if (!drive) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
const link = resource.cloudLinks.find((link) => drive.regex.test(link));
|
||||
if (!link) return;
|
||||
if (!link) return false;
|
||||
|
||||
const match = link.match(drive.regex);
|
||||
if (!match) throw new Error("链接解析失败");
|
||||
@@ -296,6 +296,7 @@ export const useResourceStore = defineStore("resource", {
|
||||
? await drive.api.getShareInfo(parsedCode as { shareCode: string; receiveCode: string })
|
||||
: await drive.api.getShareInfo(parsedCode as { pwdId: string });
|
||||
}
|
||||
this.setLoadTree(false);
|
||||
if (shareInfo) {
|
||||
if (Array.isArray(shareInfo)) {
|
||||
shareInfo = {
|
||||
@@ -308,10 +309,13 @@ export const useResourceStore = defineStore("resource", {
|
||||
...parsedCode,
|
||||
};
|
||||
}
|
||||
this.shareInfo = shareInfo;
|
||||
this.setSelectedResource(this.shareInfo.list);
|
||||
return true;
|
||||
} else {
|
||||
ElMessage.error("获取资源信息失败,请先检查cookie!");
|
||||
return false;
|
||||
}
|
||||
this.shareInfo = shareInfo;
|
||||
this.setSelectedResource(this.shareInfo.list);
|
||||
this.setLoadTree(false);
|
||||
},
|
||||
|
||||
// 统一错误处理
|
||||
|
||||
@@ -117,11 +117,13 @@ const saveDialogMap = {
|
||||
},
|
||||
};
|
||||
|
||||
const handleSave = (resource: ResourceItem) => {
|
||||
const handleSave = async (resource: ResourceItem) => {
|
||||
currentResource.value = resource;
|
||||
saveDialogVisible.value = true;
|
||||
saveDialogStep.value = 1;
|
||||
resourceStore.getResourceListAndSelect(currentResource.value);
|
||||
if (!(await resourceStore.getResourceListAndSelect(currentResource.value))) {
|
||||
saveDialogVisible.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleFolderSelect = async (folderId: string) => {
|
||||
@@ -156,7 +158,6 @@ const handleLoadMore = (channelId: string) => {
|
||||
};
|
||||
|
||||
const searchMovieforTag = (tag: string) => {
|
||||
console.log("iiii");
|
||||
router.push({ path: "/", query: { keyword: tag } });
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user