Просмотр исходного кода

登录提示;公告save校验

cyy 2 лет назад
Родитель
Сommit
47117c7b61
2 измененных файлов с 43 добавлено и 15 удалено
  1. 20 13
      src/utils/request.js
  2. 23 2
      src/views/platform/notice/edit.vue

+ 20 - 13
src/utils/request.js

@@ -217,22 +217,29 @@ service.interceptors.response.use(response => {
   } else { // 错误处理
     let errorMsg = ''
     if (Utils.isNotEmpty(message)) { // 有错误消息
-      errorMsg = Utils.isNotEmpty(dataAxios.cause) ? I18n.t('error.messageCause', {
-        message,
-        cause: dataAxios.cause
-      }) : I18n.t('error.message', {
-        message
-      })
+      errorMsg = '错误原因:用户名或密码错误'
+      // errorMsg = Utils.isNotEmpty(dataAxios.cause) ? I18n.t('error.messageCause', {
+      //   message,
+      //   cause: dataAxios.cause
+      // }) : I18n.t('error.message', {
+      //   message
+      // })
     } else if (Utils.isNotEmpty(cause)) { // 只有错误原因
-      errorMsg = I18n.t('error.cause', {
-        cause
-      })
+      errorMsg = '错误原因:用户名或密码错误'
+
+      // errorMsg = I18n.t('error.cause', {
+      //   cause
+      // })
     } else if (I18n.te('error.status.' + state)) { // 有错误编码
-      errorMsg = I18n.t('error.status.' + state)
+      errorMsg = '错误原因:用户名或密码错误'
+
+      // errorMsg = I18n.t('error.status.' + state)
     } else { // 未知
-      errorMsg = message || I18n.t('error.unknown', {
-        state
-      })
+      errorMsg = '错误原因:用户名或密码错误'
+
+      // errorMsg = message || I18n.t('error.unknown', {
+      //   state
+      // })
     }
     Toast({
       message: `${errorMsg}`,

+ 23 - 2
src/views/platform/notice/edit.vue

@@ -268,6 +268,8 @@ export default {
         // editorValue: ''
       },
       form: {},
+      getUserId: '',
+      getStatus: '',
       userSelect: [],
       orgSelect: [],
       publishOptions: publishOptions,
@@ -345,7 +347,8 @@ export default {
               'yyyy-MM-dd'
             )
           }
-
+          this.getUserId = data.userId
+          this.getStatus = data.status
           this.form = data
           if (
             this.$utils.isNotEmpty(this.form.userId) &&
@@ -384,7 +387,25 @@ export default {
         })
         return
       }
-
+      // console.log(this.form, this.id)
+      // this.form.id = '1288815885233946624'
+      // // this.form.userId = '1166765336603656192'
+      // this.form.status = 'publish'
+      if (!this.$utils.isEmpty(this.id)) {
+        if (this.form.userId !== this.$store.getters.userId) {
+          this.$notify({
+            type: 'warning',
+            message: '非当前人员公告!'
+          })
+          return
+        } else if (this.form.status === 'publish' || this.form.status === 'expired') {
+          this.$notify({
+            type: 'warning',
+            message: '已发布,无法再次发布!'
+          })
+          return
+        }
+      }
       if (this.$utils.isNotEmpty(data.publicDate)) {
         data.publicDate += ' 00:00:00'
       }