mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-07 21:46:12 +08:00
修正排序逻辑
This commit is contained in:
parent
450d70c954
commit
93963f0473
@ -184,7 +184,9 @@ export default {
|
|||||||
this.errCommandsCount++;
|
this.errCommandsCount++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.commands.push(command);
|
command.updated
|
||||||
|
? this.commands.unshift(command.data)
|
||||||
|
: this.commands.push(command.data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -216,7 +218,11 @@ export default {
|
|||||||
// 如果远端更新时间和本地相同则读取本地缓存,否则更新
|
// 如果远端更新时间和本地相同则读取本地缓存,否则更新
|
||||||
async getCommand(id, updateTime, authorName, authorId) {
|
async getCommand(id, updateTime, authorName, authorId) {
|
||||||
let localCache = JSON.parse(localStorage.getItem(id));
|
let localCache = JSON.parse(localStorage.getItem(id));
|
||||||
if (localCache?.updateTime === updateTime) return localCache;
|
if (localCache?.updateTime === updateTime)
|
||||||
|
return {
|
||||||
|
data: localCache,
|
||||||
|
updated: false,
|
||||||
|
};
|
||||||
let res = await window.yuQueClient(
|
let res = await window.yuQueClient(
|
||||||
`repos/${this.releaseRepo}/docs/${id}?raw=1`
|
`repos/${this.releaseRepo}/docs/${id}?raw=1`
|
||||||
);
|
);
|
||||||
@ -231,7 +237,10 @@ export default {
|
|||||||
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));
|
||||||
return command;
|
return {
|
||||||
|
data: command,
|
||||||
|
updated: true,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
fetchCommands() {
|
fetchCommands() {
|
||||||
window.yuQueClient(`repos/${this.releaseRepo}/docs`).then((res) => {
|
window.yuQueClient(`repos/${this.releaseRepo}/docs`).then((res) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user