comment.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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" style="padding: 46rpx;" class="cu-btn lg flex bg-blue 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. onShow() {
  22. this.dataDetail=app.globalData.dataDetail
  23. },
  24. methods: {
  25. save(){
  26. let that=this
  27. if (this.$isEmpty(this.dataDetail)) {
  28. app.globalData.oneFailHint("系统异常");
  29. return
  30. }
  31. if (this.comment.length<2) {
  32. this.$u.toast('评价内容过短')
  33. return
  34. }
  35. this.dataDetail.comment=this.comment
  36. this.dataDetail.estimateStatus=1
  37. // let operation='estateRepair/addEstateRepair'
  38. that.$http.addEstateRepair(this.dataDetail).then(res =>{
  39. if (res.data.add_result==true) {
  40. app.globalData.oneFailHint("评价成功",function(){
  41. uni.navigateBack({
  42. delta:1
  43. })
  44. });
  45. }else{
  46. app.globalData.oneFailHint(res.data.add_result);
  47. }
  48. });
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. .cu-form-group {
  55. textarea {
  56. height: 8.6em;
  57. }
  58. .font-num-view {
  59. position: absolute;
  60. bottom: 9.09rpx;
  61. right: 27.27rpx;
  62. }
  63. }
  64. </style>