From e77db4711e79d0b88a50e8b6020b99c227c24651 Mon Sep 17 00:00:00 2001 From: Hunlongyu Date: Wed, 28 Oct 2020 15:33:30 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=A2=20=E4=BC=98=E5=8C=96=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E6=BA=90=E6=A3=80=E6=B5=8B=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/scss/style.scss | 2 +- src/components/EditSites.vue | 43 +++++++++++++++++++++++++----------- src/lib/site/tools.js | 5 +++++ 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src/assets/scss/style.scss b/src/assets/scss/style.scss index b50d81d..3c885ea 100644 --- a/src/assets/scss/style.scss +++ b/src/assets/scss/style.scss @@ -229,7 +229,7 @@ } } .is-loading:before { - background-color: none; + background-color: none !important; } .el-input{ width: 200px; diff --git a/src/components/EditSites.vue b/src/components/EditSites.vue index a319270..d3a05ec 100644 --- a/src/components/EditSites.vue +++ b/src/components/EditSites.vue @@ -3,12 +3,12 @@
> - 新增 - 导出 - 导入 - 检测 - 清空 - 重置 + 新增 + 导出 + 导入 + 检测 + 清空 + 重置
@@ -56,11 +56,11 @@ { this.getSites() }).catch(err => { @@ -336,6 +347,10 @@ export default { this.$message.success('重置源成功') }, moveToTopEvent (i) { + if (this.checkAllSiteLoading) { + this.$message.info('正在检测, 请勿操作.') + return false + } this.sites.sort(function (x, y) { return x.key === i.key ? -1 : y.key === i.key ? 1 : 0 }) this.updateDatabase() }, @@ -380,24 +395,26 @@ export default { } }) }, - async checkSite () { - this.checkSiteLoading = true + async checkAllSite () { + this.checkAllSiteLoading = true for (const i of this.sites) { - i.status = 'loading' + i.status = '' this.tableKey = Math.random() const flag = await zy.check(i.key) if (flag) { i.status = '可用' } else { i.status = '失效' + i.isActive = 0 } this.tableKey = Math.random() } - this.checkSiteLoading = false + this.checkAllSiteLoading = false } }, mounted () { this.rowDrop() + this.checkAllSiteLoading = false }, created () { this.getSites() diff --git a/src/lib/site/tools.js b/src/lib/site/tools.js index 1152a14..432ce9a 100644 --- a/src/lib/site/tools.js +++ b/src/lib/site/tools.js @@ -194,6 +194,11 @@ const zy = { }) }) }, + /** + * 检查资源 + * @param {*} key 资源网 key + * @returns boolean + */ async check (key, id) { try { const cls = await this.class(key)