智慧保安互联网APP
shuishen
2021-10-11 b48a5f64fe196bee6f1c7eb0be1b78c9ebec0860
pages/message/addMessage.vue
@@ -1,6 +1,8 @@
<template>
   <view class="container">
      <view class='initiae-box'>
      <view class="group-chat-box">
         <u-form :model="form" ref="uForm">
            <u-form-item label-width='132' prop="title" label="通知标题" :required="true">
@@ -12,13 +14,18 @@
            </u-form-item>
         </u-form>
         <view>
            <u-button type="primary" @click="initiateClick" style="margin-top: 4%; width: 60%;">发送</u-button>
         </view>
         <view>
            <u-toast ref="uToast" />
         </view>
      </view>
      <view class="establish-box">
         <u-button class="submit" type="primary" @click="initiateClick">发送
         </u-button>
      </view>
      <view>
         <u-toast ref="uToast" />
      </view>
   </view>
</template>
@@ -81,7 +88,7 @@
            this.$refs.uForm.validate(valid => {
               if (valid) {
                  uni.request({
                     url: this.$store.state.piAPI + "/blade-system/dept/detail",
                     method: "get",
@@ -91,46 +98,85 @@
                     success: (result) => {
                        var deptCategory = result.data.data.deptCategory;
                           uni.request({
                              url: this.$store.state.piAPI + "/blade-desk/notice/submit",
                              method: "post",
                              data: {
                                 title: this.form.title,
                                 content: this.form.content,
                                 category: deptCategory,
                                 deptId: result.data.data.deptCategory,
                                 releaseTime: this.getCurrentTime(),
                              },
                              success: (res) => {
                                 if (res.data.msg == "操作成功") {
                                    this.$refs.uToast.show({
                                       title: '新增通知成功',
                                       type: 'success',
                                       url: '/pages/message/message'
                                    })
                                 }
                        uni.request({
                           url: this.$store.state.piAPI + "/blade-desk/notice/submit",
                           method: "post",
                           data: {
                              type: 1,
                              title: this.form.title,
                              content: this.form.content,
                              category: deptCategory,
                              deptId: this.createData.dept_id,
                              releaseTime: this.getCurrentTime(),
                           },
                           success: (res) => {
                              if (res.data.msg == "操作成功") {
                                 this.$refs.uToast.show({
                                    title: '新增通知成功',
                                    type: 'success',
                                    url: '/pages/message/message'
                                 })
                              }
                           });
                           }
                        });
                     }
                  });
               } else {
                  console.log('验证失败');
               }
            });
         },
      }
   };
</script>
<style lang="scss">
   .initiae-box {
      padding: 0 30rpx;
   .submit {
      border: none;
      width: 94%;
      height: 86rpx;
      line-height: 86rpx;
      box-sizing: border-box;
      border-radius: 15rpx;
      color: #ffffff;
      font-size: 38rpx;
   }
   .container {
      height: 100%;
      .group-chat-box {
         height: calc(100% - 116rpx);
         padding: 0 36rpx;
         box-sizing: border-box;
         overflow-y: auto;
      }
      .establish-box {
         position: relative;
         height: 116rpx;
         background: #fff;
         text-align: center;
         uni-button {
            margin: 0;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            margin: auto;
         }
      }
   }
</style>