diff --git a/src/components/common/UserLogin.vue b/src/components/common/UserLogin.vue index f283c0c2..eda82e05 100644 --- a/src/components/common/UserLogin.vue +++ b/src/components/common/UserLogin.vue @@ -52,8 +52,8 @@ export default { loading: false, svg: "", formData: { - sTId: "213010127", - password: "0127", + sTId: "Admin", + password: "12345678", }, rules: { sTId: { required: true, message: "请输入学号/工号!" }, diff --git a/src/components/edit/tinymce.vue b/src/components/edit/tinymce.vue index a241a84b..1f19f81f 100644 --- a/src/components/edit/tinymce.vue +++ b/src/components/edit/tinymce.vue @@ -287,25 +287,43 @@ export default { articleContent: this.myValue, }; - // 根据是否有ID决定调用创建还是更新 const apiCall = this.articleId - ? UpArtile({ ...data, articleId: this.articleId }) // 编辑需要传ID - : createArticle(data); // 创建不需要ID + ? UpArtile({ ...data, articleId: this.articleId }) + : createArticle(data); apiCall .then((res) => { - const successMsg = this.articleId ? "修改成功" : "发布成功"; - this.$message.success(successMsg); + if (res.code == 200) { + this.$message.success(this.articleId ? "修改成功" : "发布成功"); + // this.articleId = res.data; - // 如果是新建且类型为公告,保留原有通知逻辑 - if (!this.articleId && this.articleType == "公告") { - // ...原有通知逻辑... + if (this.articleType == "公告") { + this.$modal.confirm({ + title: `确认发送短信与邮件通知用户?`, + onOk: () => { + console.log("articleId", this.articleId, this.articleId); + let notificationData = { + competitionId: this.competitionId, + articleId: this.articleId, + }; + this.$api + .SendEmail(notificationData) + .then(() => { + return this.$api.SendSMS(notificationData); + }) + .then(() => { + this.$message.success("短信邮件提醒成功!"); + }) + .catch((e) => { + this.$message.error(e.msg || "发送失败!"); + throw e; + }); + }, + }); + } + } else { + throw new Error("发布失败"); } - - // 跳转到文章列表 - setTimeout(() => { - this.$router.push("/account/center"); - }, 1500); }) .catch((error) => { console.error(error);