From c7b66d5aba43dfd7cc058e6cbe0ce5926d8d56f5 Mon Sep 17 00:00:00 2001 From: Shu Guang <61069967+shuguangnet@users.noreply.github.com> Date: Fri, 23 May 2025 08:51:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/UserLogin.vue | 4 +-- src/components/edit/tinymce.vue | 44 ++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 15 deletions(-) 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);