comment.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view>
  3. <view class="cu-form-group solid-top">
  4. <textarea maxlength="120" v-model="comment" placeholder="请输入您的评价"/>
  5. <text class="text-gray font-num-view">{{comment.length}} / 120字</text>
  6. </view>
  7. <view @click="save" class="cu-btn lg radius flex base-bg-color footer-fixed">
  8. 确认保存
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. var app=getApp()
  14. export default {
  15. data() {
  16. return {
  17. comment:'',
  18. dataDetail:{}
  19. }
  20. },
  21. onLoad(e) {
  22. },
  23. onShow() {
  24. this.dataDetail=app.globalData.dataDetail
  25. },
  26. methods: {
  27. save(){
  28. let that=this
  29. if (this.$isEmpty(this.dataDetail)) {
  30. app.globalData.oneFailHint("系统异常");
  31. return
  32. }
  33. if (this.comment.length<2) {
  34. this.$u.toast('评价内容过短')
  35. return
  36. }
  37. this.dataDetail.comment=this.comment
  38. this.dataDetail.estimateStatus=1
  39. let operation='estateRepair/addEstateRepair'
  40. app.globalData.postRequest(this.dataDetail, operation, function (res) {
  41. if (res.data.add_result==true) {
  42. app.globalData.oneFailHint("评价成功",function(){
  43. app.globalData.dataDetail=that.dataDetail
  44. uni.navigateBack({
  45. delta:1
  46. })
  47. });
  48. }else{
  49. app.globalData.oneFailHint(res.data.add_result);
  50. }
  51. });
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss">
  57. .cu-form-group {
  58. textarea {
  59. height: 8.6em;
  60. }
  61. .font-num-view {
  62. position: absolute;
  63. bottom: 9.09rpx;
  64. right: 27.27rpx;
  65. }
  66. }
  67. </style>