diff --git a/pages/admin/articles.vue b/pages/admin/articles.vue index 7e1feb1..2c56d0c 100644 --- a/pages/admin/articles.vue +++ b/pages/admin/articles.vue @@ -158,16 +158,14 @@ export default { articlePerfect: '1' }).then(function (res) { if (res) { - if (res.success) { - _ts.$store.commit('admin/updateArticlePreference', { - index: index, - idArticle: idArticle, - articlePerfect: '1' - }) - _ts.$message.success("设置成功!"); - } else { - _ts.$message.error(_ts.message); - } + _ts.$store.commit('admin/updateArticlePreference', { + index: index, + idArticle: idArticle, + articlePerfect: '1' + }) + _ts.$message.success("设置成功!"); + } else { + _ts.$message.error("设置失败!"); } }) }, @@ -178,16 +176,14 @@ export default { articlePerfect: '0' }).then(function (res) { if (res) { - if (res.success) { - _ts.$store.commit('admin/updateArticlePreference', { - index: index, - idArticle: idArticle, - articlePerfect: '0' - }) - _ts.$message.success("取消成功!"); - } else { - _ts.$message.error(_ts.message); - } + _ts.$store.commit('admin/updateArticlePreference', { + index: index, + idArticle: idArticle, + articlePerfect: '0' + }) + _ts.$message.success("取消成功!"); + } else { + _ts.$message.error("取消失败!"); } }) }, diff --git a/pages/admin/dashboard.vue b/pages/admin/dashboard.vue index a404252..3c37755 100644 --- a/pages/admin/dashboard.vue +++ b/pages/admin/dashboard.vue @@ -504,16 +504,14 @@ export default { articlePerfect: '1' }).then(function (res) { if (res) { - if (res.success) { - _ts.$store.commit('admin/updateArticlePreference', { - index: index, - idArticle: idArticle, - articlePerfect: '1' - }) - _ts.$message.success("设置成功!"); - } else { - _ts.$message.error(_ts.message); - } + _ts.$store.commit('admin/updateArticlePreference', { + index: index, + idArticle: idArticle, + articlePerfect: '1' + }) + _ts.$message.success("设置成功!"); + } else { + _ts.$message.error("设置失败!"); } }) }, @@ -524,16 +522,14 @@ export default { articlePerfect: '0' }).then(function (res) { if (res) { - if (res.success) { - _ts.$store.commit('admin/updateArticlePreference', { - index: index, - idArticle: idArticle, - articlePerfect: '0' - }) - _ts.$message.success("取消成功!"); - } else { - _ts.$message.error(_ts.message); - } + _ts.$store.commit('admin/updateArticlePreference', { + index: index, + idArticle: idArticle, + articlePerfect: '0' + }) + _ts.$message.success("取消成功!"); + } else { + _ts.$message.error("取消失败!"); } }) }, diff --git a/pages/article/_article_id.vue b/pages/article/_article_id.vue index 2f53a9d..1a99618 100644 --- a/pages/article/_article_id.vue +++ b/pages/article/_article_id.vue @@ -335,19 +335,17 @@ export default { _ts.gotoLogin(); } }, - setPreference() { + setPreference() { let _ts = this; _ts.$axios.$patch("/api/admin/article/update-perfect", { idArticle: _ts.article.idArticle, articlePerfect: '1', }).then(function (res) { if (res) { - if (res.success) { - _ts.$set(_ts, 'isPerfect', false); - _ts.$message.success("设置成功!"); - } else { - _ts.$message.error(_ts.message); - } + _ts.$set(_ts, 'isPerfect', true); + _ts.$message.success("设置成功!"); + } else { + _ts.$message.error("设置失败!"); } }) }, @@ -358,12 +356,10 @@ export default { articlePerfect: '0', }).then(function (res) { if (res) { - if (res.success) { - _ts.$set(_ts, 'isPerfect', true); - _ts.$message.success("取消成功!"); - } else { - _ts.$message.error(_ts.message); - } + _ts.$set(_ts, 'isPerfect', false); + _ts.$message.success("取消成功!"); + } else { + _ts.$message.error("设置失败!"); } }) },