mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-07-01 05:23:54 +08:00
命令解析报错的处理
This commit is contained in:
parent
700c3875c1
commit
450d70c954
@ -141,6 +141,7 @@ export default {
|
|||||||
releaseRepo: "fofolee/qcreleases",
|
releaseRepo: "fofolee/qcreleases",
|
||||||
commandTypes: commandTypes,
|
commandTypes: commandTypes,
|
||||||
platform: window.processPlatform,
|
platform: window.processPlatform,
|
||||||
|
errCommandsCount: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -151,9 +152,11 @@ export default {
|
|||||||
return this.commands.length === this.currentPageCounts ? false : true;
|
return this.commands.length === this.currentPageCounts ? false : true;
|
||||||
},
|
},
|
||||||
currentPageCounts() {
|
currentPageCounts() {
|
||||||
return this.currentPage === this.maxPages
|
return (
|
||||||
? this.matchedCommands.length % this.perPage
|
(this.currentPage === this.maxPages
|
||||||
: this.perPage;
|
? this.matchedCommands.length % this.perPage
|
||||||
|
: this.perPage) - this.errCommandsCount
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -166,6 +169,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchCommandDetails(page) {
|
fetchCommandDetails(page) {
|
||||||
|
this.errCommandsCount = 0;
|
||||||
this.commands = [];
|
this.commands = [];
|
||||||
this.matchedCommands
|
this.matchedCommands
|
||||||
.slice((page - 1) * this.perPage, page * this.perPage)
|
.slice((page - 1) * this.perPage, page * this.perPage)
|
||||||
@ -176,6 +180,10 @@ export default {
|
|||||||
item.last_editor.name,
|
item.last_editor.name,
|
||||||
item.last_editor.id
|
item.last_editor.id
|
||||||
).then((command) => {
|
).then((command) => {
|
||||||
|
if (!command) {
|
||||||
|
this.errCommandsCount++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.commands.push(command);
|
this.commands.push(command);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -212,9 +220,14 @@ export default {
|
|||||||
let res = await window.yuQueClient(
|
let res = await window.yuQueClient(
|
||||||
`repos/${this.releaseRepo}/docs/${id}?raw=1`
|
`repos/${this.releaseRepo}/docs/${id}?raw=1`
|
||||||
);
|
);
|
||||||
let command = JSON.parse(
|
let command;
|
||||||
res.data?.data.body.match(/```json([\s\S]*)```/)?.[1]
|
try {
|
||||||
);
|
command = JSON.parse(
|
||||||
|
res.data?.data.body.match(/```json([\s\S]*)```/)?.[1]
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("parseErr", command, error);
|
||||||
|
}
|
||||||
if (!command) return;
|
if (!command) return;
|
||||||
Object.assign(command, { authorName, updateTime, authorId });
|
Object.assign(command, { authorName, updateTime, authorId });
|
||||||
localStorage.setItem(id, JSON.stringify(command));
|
localStorage.setItem(id, JSON.stringify(command));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user