Merge pull request #61 from Undertone0809/preference-patch

fix: the preference button does not render correctly in time.
This commit is contained in:
ronger 2022-11-01 07:48:09 +08:00 committed by GitHub
commit 20173b669e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 53 deletions

View File

@ -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("取消失败!");
}
})
},

View File

@ -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("取消失败!");
}
})
},

View File

@ -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("设置失败!");
}
})
},