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