From 8598c9d66820b04a05d38df566294f6d54061280 Mon Sep 17 00:00:00 2001 From: gzezFISHER Date: Thu, 13 Aug 2020 13:18:27 +0800 Subject: [PATCH 1/4] fix columns --- src/components/lib/AjaxTable.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/lib/AjaxTable.vue b/src/components/lib/AjaxTable.vue index 6f9d2fc6..01f21b22 100644 --- a/src/components/lib/AjaxTable.vue +++ b/src/components/lib/AjaxTable.vue @@ -45,6 +45,7 @@ export default { this.load_data(); }, load_data() { + let limit = this.limit; this.loading = true; this.$axios .get(this.ajax_url, { @@ -54,9 +55,11 @@ export default { } }) .then(res => { - this.total = res.data.count; - this.tableData = res.data.res.map(this.process); - this.loading = false; + if (limit === this.limit) { + this.total = res.data.count; + this.tableData = res.data.res.map(this.process); + this.loading = false; + } }) .catch(err => { this.$SegmentMessage.error(this, '[Ajax Table] Request Failed'); From 2c1fc5f05393dd6b5a4f9036db562a9d781d2d9d Mon Sep 17 00:00:00 2001 From: gzezFISHER Date: Thu, 13 Aug 2020 14:29:52 +0800 Subject: [PATCH 2/4] add lock --- src/methods/lock.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/methods/lock.js diff --git a/src/methods/lock.js b/src/methods/lock.js new file mode 100644 index 00000000..c0e67c09 --- /dev/null +++ b/src/methods/lock.js @@ -0,0 +1,28 @@ +const Lock = () => { + return { + lockQueue: new Array(), + locked: false + } +} + +const acquire = async (lock) => { + if (lock.locked) { + let that = lock; + await new Promise((resolve) => { + that.lockQueue.push(resolve); + }); + } + lock.locked = true; + return true; +}; + + +const release = (lock) => { + lock.locked = false; + const resolve = lock.lockQueue.pop(); + if (resolve) { + resolve(); + } +} + +export {Lock, acquire, release}; \ No newline at end of file From 216dc22f3047a473108c2d3254e835e92e18c49b Mon Sep 17 00:00:00 2001 From: gzezFISHER Date: Thu, 13 Aug 2020 15:10:01 +0800 Subject: [PATCH 3/4] fix lock --- src/methods/lock.js | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/methods/lock.js b/src/methods/lock.js index c0e67c09..f4e9aa68 100644 --- a/src/methods/lock.js +++ b/src/methods/lock.js @@ -1,28 +1,27 @@ -const Lock = () => { - return { - lockQueue: new Array(), - locked: false +class AWaitLock { + constructor() { + this.lockQueue = []; + this.locked = false; } -} -const acquire = async (lock) => { - if (lock.locked) { - let that = lock; - await new Promise((resolve) => { - that.lockQueue.push(resolve); - }); + async acquire() { + if (this.locked) { + let that = this; + await new Promise((resolve) => { + that.lockQueue.push(resolve); + }); + } + this.locked = true; + return true; } - lock.locked = true; - return true; -}; - -const release = (lock) => { - lock.locked = false; - const resolve = lock.lockQueue.pop(); - if (resolve) { - resolve(); + release() { + this.locked = false; + let resolve = this.lockQueue.pop(); + if (resolve) { + resolve(); + } } } -export {Lock, acquire, release}; \ No newline at end of file +export default AWaitLock; \ No newline at end of file From 1411f271a7a7a8defa8116030540e04c5d90f5a9 Mon Sep 17 00:00:00 2001 From: gzezFISHER Date: Thu, 13 Aug 2020 15:10:15 +0800 Subject: [PATCH 4/4] fix tags --- src/components/problem/listTag.vue | 49 +++++++++++++++++++++--------- src/store/tags.js | 4 ++- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/components/problem/listTag.vue b/src/components/problem/listTag.vue index 4aa13a6b..0bc4fdac 100644 --- a/src/components/problem/listTag.vue +++ b/src/components/problem/listTag.vue @@ -17,45 +17,64 @@ diff --git a/src/store/tags.js b/src/store/tags.js index 5342f35d..f1f6853b 100644 --- a/src/store/tags.js +++ b/src/store/tags.js @@ -1,6 +1,8 @@ const tagsstore = { state: { - displayTags: false + displayTags: false, + tagsData: new Array(), + tagsLock: new Array() }, mutations: { setDisplayTag(state, data) {