From c61b7cea5d6106c725cd18eac3717be38eba37eb Mon Sep 17 00:00:00 2001 From: ronger Date: Tue, 1 Nov 2022 07:38:52 +0800 Subject: [PATCH] Update articles.vue --- pages/admin/articles.vue | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/pages/admin/articles.vue b/pages/admin/articles.vue index 0a0cfb3..2a75f49 100644 --- a/pages/admin/articles.vue +++ b/pages/admin/articles.vue @@ -157,12 +157,16 @@ export default { idArticle: idArticle, articlePerfect: '1' }).then(function (res) { - _ts.$store.commit('admin/updateArticlePreference', { - index: index, - idArticle: idArticle, - articlePerfect: '1' - }) - _ts.$message.success("设置成功!"); + if (res) { + _ts.$store.commit('admin/updateArticlePreference', { + index: index, + idArticle: idArticle, + articlePerfect: '1' + }) + _ts.$message.success("设置成功!"); + } else { + _ts.$message.error("设置失败!"); + } }) }, cancelPreference(index, idArticle) { @@ -171,12 +175,16 @@ export default { idArticle: idArticle, articlePerfect: '0' }).then(function (res) { - _ts.$store.commit('admin/updateArticlePreference', { - index: index, - idArticle: idArticle, - articlePerfect: '0' - }) - _ts.$message.success("取消成功!"); + if (res) { + _ts.$store.commit('admin/updateArticlePreference', { + index: index, + idArticle: idArticle, + articlePerfect: '0' + }) + _ts.$message.success("取消成功!"); + } else { + _ts.$message.error("取消失败!"); + } }) }, updateTags(index, article) {