add.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view class="">
  3. <u-toast ref="uToast"/>
  4. <view class="content">
  5. <u-form :model="model" label-position="top" ref="uForm">
  6. <u-form-item :required="true" label="公告标题">
  7. <u-input :border="true" v-model="model.title" placeholder="请输入公告标题"/>
  8. </u-form-item>
  9. <u-form-item :required="true" label="公告内容">
  10. <u-input :border="true" type="textarea" height="500" placeholder="请输入公告内容" v-model="model.notice" />
  11. </u-form-item>
  12. </u-form>
  13. </view>
  14. <view @click="confirm" class="bottom-bar" style="position: fixed;bottom:40rpx;">
  15. <view class="cu-btn base-bg-color radius" style="width: 80%;height: 84rpx;">
  16. 提交
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. model:{}
  26. }
  27. },
  28. methods: {
  29. confirm(){
  30. let agencyId=this.$cache.get('agencyId')
  31. if (this.$isEmpty(agencyId)) {
  32. this.$showToast('系统错误','error')
  33. return
  34. }
  35. if (this.$isEmpty(this.model.title)) {
  36. this.$showToast('请输入标题','error')
  37. return
  38. }
  39. if (this.$isEmpty(this.model.notice)) {
  40. this.$showToast('请输入内容','error')
  41. return
  42. }
  43. this.model.agencyId=agencyId
  44. this.$api.notice.submit(this.model).then(res=>{
  45. if (res.success) {
  46. this.$showModel('发布成功',false).then(res=>{
  47. uni.navigateBack({
  48. delta:1
  49. })
  50. })
  51. }else{
  52. this.$showToast('发布失败')
  53. }
  54. })
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss">
  60. page{
  61. background-color: #FFFFFF;
  62. }
  63. .content{
  64. padding: 30rpx;
  65. }
  66. </style>