From bb3502774b770b69d9cf85f5314f12fad6817320 Mon Sep 17 00:00:00 2001 From: haiyangcui Date: Thu, 27 Aug 2020 15:05:57 +0200 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=97=B6=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=94=B6=E8=97=8F=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Star.vue | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/components/Star.vue b/src/components/Star.vue index a15ae88..ac43fc4 100644 --- a/src/components/Star.vue +++ b/src/components/Star.vue @@ -130,27 +130,30 @@ export default { }, updateEvent (e) { zy.detail(e.key, e.ids).then(res => { + var doc = { + key: e.key, + id: e.id, + ids: res.id, + last: res.last, + name: res.name, + type: res.type, + year: res.year, + note: res.note + } if (e.last === res.last) { - var msg = `同步"${e.name}"成功, 未查询到更新。` - this.$message.info(msg) + doc.hasUpdate = false + star.update(e.id, doc).then(res => { + var msg = `同步"${e.name}"成功, 未查询到更新。` + this.$message.info(msg) + }) } else { - const doc = { - key: e.key, - id: e.id, - ids: res.id, - last: res.last, - name: res.name, - type: res.type, - year: res.year, - note: res.note, - hasUpdate: true - } + doc.hasUpdate = true star.update(e.id, doc).then(res => { var msg = `同步"${e.name}"成功, 检查到更新。` this.$message.success(msg) }) - this.getStarList() } + this.getStarList() }).catch(err => { var msg = `同步"${e.name}"失败, 请重试。` this.$message.warning(msg, err)