feedback.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="content">
  3. <form action="">
  4. <view class="textBox">
  5. <textarea v-model="content" class="textarea" placeholder-class="textareaHolder" placeholder="写下您的意见反馈,我们会用心聆听,做的更好!" maxlength="200" />
  6. <text class="numBox">{{changeLen}}/200</text>
  7. </view>
  8. <button type="primary" class="submitBtn" @click="toSubmit">提交反馈</button>
  9. </form>
  10. </view>
  11. </template>
  12. <script>
  13. import { feedBack } from "../../api/index.js"
  14. export default{
  15. data(){
  16. return{
  17. content:""
  18. }
  19. },
  20. methods:{
  21. toSubmit(){
  22. const that=this
  23. if(!this.content){
  24. uni.showToast({
  25. title:'未填写意见反馈',
  26. icon:'none'
  27. })
  28. return false;
  29. }
  30. feedBack({
  31. contents: that.content
  32. }).then(res=>{
  33. const {error_code,msg} = res
  34. uni.showToast({
  35. title:msg,
  36. icon: error_code ===200 ? 'success':'none',
  37. duration:2500
  38. })
  39. if(error_code===200){
  40. that.content=""
  41. }
  42. })
  43. }
  44. },
  45. computed:{
  46. changeLen:function(){
  47. return this.content.length;
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss">
  53. page{
  54. width: 100%;
  55. height: 100%;
  56. background: $uni-bg-color-normal;
  57. }
  58. .textarea{
  59. display: block;
  60. width: calc(100% - 74rpx);
  61. height: 410rpx;
  62. border: 1px solid #DBDBDB;
  63. background: $uni-bg-color;
  64. font-size: 28rpx;
  65. padding: 20rpx 37rpx;
  66. margin-top: 20rpx;
  67. margin-bottom: 100rpx;
  68. }
  69. .textareaHolder{
  70. color: #B2B2B2;
  71. }
  72. .submitBtn{
  73. background: #2E8BFC !important;
  74. width: 650rpx;
  75. height: 85rpx;
  76. line-height: 85rpx;
  77. font-size: 28rpx;
  78. }
  79. .textBox{
  80. position: relative;
  81. }
  82. .numBox{
  83. color: #999999;
  84. font-size: 26rpx;
  85. position: absolute;
  86. right: 27rpx;
  87. bottom: 31rpx;
  88. }
  89. </style>