Send.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <div>
  3. <common @asynCallBack="asynCallBack"></common>
  4. <top-header :pageTitle="pageTitle"></top-header>
  5. <div class="mui-content margin60">
  6. <form class="mui-input-group vongi-send">
  7. <div class="mui-input-row">
  8. <label>通知标题</label>
  9. <input type="text" v-model="addForm.title" placeholder="请输入标题">
  10. </div>
  11. <textarea-check v-model="addForm.content" :max="1000" :placeholder="'请填写内容,最多可输入1000字'"></textarea-check>
  12. </form>
  13. </div>
  14. <div class="fyy-footer">
  15. <div class="bindfyy-btn">
  16. <button type="submit" class="mui-btn mui-btn-primary " @click="submit">发送</button></div>
  17. </div>
  18. <loading :visible="isLoading"></loading>
  19. </div>
  20. </template>
  21. <script>
  22. import * as API_Notice from '@/apis/Common/notice'
  23. import Common from '$project/components/Common.vue'
  24. import Loading from '$project/components/Loading.vue'
  25. import TopHeader from '$project/components/TopHeader.vue'
  26. import TextareaCheck from '$project/components/TextareaCheck.vue'
  27. import {
  28. mapGetters,
  29. mapMutations
  30. } from 'vuex'
  31. export default {
  32. name: 'CommonNoticeSend',
  33. components: {
  34. Common,
  35. Loading,
  36. TopHeader,
  37. TextareaCheck
  38. },
  39. data() {
  40. return {
  41. pageTitle: '发送通知',
  42. isLoading: false,
  43. addForm: {
  44. title: '',
  45. content: '',
  46. },
  47. detail: {},
  48. }
  49. },
  50. created() {
  51. },
  52. methods: {
  53. //表单校验
  54. checkForm() {
  55. if (!this.addForm.title) {
  56. mui.toast('请输入通知标题');
  57. return false;
  58. } else if (!this.addForm.content) {
  59. mui.toast('请输入通知内容');
  60. return false;
  61. } else {
  62. return true;
  63. }
  64. },
  65. //提交
  66. submit() {
  67. if (this.checkForm()) {
  68. this.isLoading = true;
  69. API_Notice.sendMessage(this.addForm).then(response => {
  70. this.isLoading = false;
  71. mui.toast("发送成功");
  72. //跳转首页
  73. this.$router.push({
  74. name: 'Master',
  75. query: {}
  76. })
  77. }).catch(error => {
  78. this.isLoading = false;
  79. mui.toast(error);
  80. })
  81. }
  82. },
  83. asynCallBack() {
  84. },
  85. },
  86. mounted() {
  87. },
  88. destroyed() {},
  89. computed: {
  90. }
  91. }
  92. </script>
  93. <style scoped src="$project/assets/css/xpwyfyy.css"></style>
  94. <style src="$project/assets/css/iconfont.css"></style>
  95. <style scoped>
  96. </style>