postmessage.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 44px;">
  5. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="发帖"></uni-nav-bar>
  6. <view class="post">
  7. <view class="post_title">
  8. <input type="text" placeholder="请输入标题" v-model="title" />
  9. </view>
  10. <view class="post_contert">
  11. <textarea v-model="mainbody" placeholder="请输入正文" />
  12. </view>
  13. <button class="post_btn" @click="post">发布</button>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. title:'',
  23. mainbody:''
  24. }
  25. },
  26. methods: {
  27. async getPostmessage(data) { //发帖
  28. const res = await this.$myRequest({
  29. url: '/api/api_gateway?method=pest.pests.pests_new_idea',
  30. data:{
  31. title:data.title,
  32. content:data.content
  33. }
  34. })
  35. console.log(res)
  36. },
  37. post(){
  38. if(this.title!=''&&this.mainbody!=''){
  39. let obj ={}
  40. obj.title=this.title
  41. obj.content=this.mainbody
  42. this.getPostmessage(obj)
  43. }
  44. },
  45. clickLeft(){
  46. uni.navigateTo({
  47. url: './exchangeShare'
  48. })
  49. },
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. .post {
  55. background-color: #F5F5F5;
  56. width: 100%;
  57. height: 93vh;
  58. padding-top: 16rpx;
  59. .post_title {
  60. padding: 40rpx 20rpx;
  61. background-color: white;
  62. width: 100%;
  63. input {
  64. width: 90%;
  65. margin: 0 auto;
  66. }
  67. }
  68. .post_contert {
  69. margin-top: 16rpx;
  70. padding: 40rpx 20rpx;
  71. background-color: white;
  72. width: 100%;
  73. height: 660rpx;
  74. textarea{
  75. width: 90%;
  76. margin: 0 auto;
  77. }
  78. }
  79. .post_btn{
  80. width: 90%;
  81. margin: 40rpx auto;
  82. background-color: #57C878;
  83. color: white;
  84. font-size: 32rpx;
  85. }
  86. }
  87. </style>