zlwu 3 bulan lalu
induk
melakukan
3959292c7f
2 mengubah file dengan 14 tambahan dan 21 penghapusan
  1. 4 0
      web-admin/src/style.css
  2. 10 21
      web-admin/src/views/AdminView.vue

+ 4 - 0
web-admin/src/style.css

@@ -852,6 +852,10 @@ body,
   gap: 20px;
 }
 
+.inbox-form-upper--single {
+  grid-template-columns: minmax(0, 1fr);
+}
+
 .inbox-form-lang-col {
   display: flex;
   flex-direction: column;

+ 10 - 21
web-admin/src/views/AdminView.vue

@@ -501,29 +501,27 @@ async function submitNewsNotice(): Promise<void> {
   }
 }
 
+function syncAbNoticeZhFromEn(): void {
+  abNoticeForm.titleZh = abNoticeForm.titleEn.trim();
+  abNoticeForm.contentZh = abNoticeForm.contentEn.trim();
+}
+
 async function submitAbNotice(): Promise<void> {
-  if (!abNoticeForm.titleZh.trim()) {
-    ElMessage.error(t("message.enterTitleZh"));
-    return;
-  }
   if (!abNoticeForm.titleEn.trim()) {
     ElMessage.error(t("message.enterTitleEn"));
     return;
   }
-  if (!abNoticeForm.contentZh.trim()) {
-    ElMessage.error(t("message.enterContentZh"));
-    return;
-  }
   if (!abNoticeForm.contentEn.trim()) {
     ElMessage.error(t("message.enterContentEn"));
     return;
   }
+  syncAbNoticeZhFromEn();
   submittingAbNotice.value = true;
   try {
     const response = await createAbNotice({
-      title_zh: abNoticeForm.titleZh.trim(),
+      title_zh: abNoticeForm.titleZh,
       title_en: abNoticeForm.titleEn.trim(),
-      content_zh: abNoticeForm.contentZh.trim(),
+      content_zh: abNoticeForm.contentZh,
       content_en: abNoticeForm.contentEn.trim(),
     });
     ElMessage.success(
@@ -1563,21 +1561,12 @@ watch(isAbTestLayout, (abTestLayout) => {
       v-model="abNoticeCreateDialogVisible"
       class="admin-dialog"
       :title="t('dialog.abNoticeCreate.title')"
-      width="960px"
+      width="520px"
       destroy-on-close
     >
       <p class="dialog-desc">{{ t("dialog.abNoticeCreate.desc") }}</p>
       <el-form label-position="top" class="inbox-form">
-        <div class="inbox-form-upper">
-          <div class="inbox-form-lang-col">
-            <span class="inbox-form-lang-badge">{{ t("dialog.energyCreate.langZh") }}</span>
-            <el-form-item :label="t('dialog.energyCreate.titleZh')" required>
-              <el-input v-model="abNoticeForm.titleZh" maxlength="200" show-word-limit />
-            </el-form-item>
-            <el-form-item :label="t('dialog.energyCreate.contentZh')" required>
-              <el-input v-model="abNoticeForm.contentZh" type="textarea" :rows="8" maxlength="10000" show-word-limit />
-            </el-form-item>
-          </div>
+        <div class="inbox-form-upper inbox-form-upper--single">
           <div class="inbox-form-lang-col">
             <span class="inbox-form-lang-badge">{{ t("dialog.energyCreate.langEn") }}</span>
             <el-form-item :label="t('dialog.energyCreate.titleEn')" required>