pinglun.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="contentbg">
  3. <customNav :shownav="true" :title="$t('index.pinglun')" titledetl=""></customNav>
  4. <view class="xuanxing">
  5. <image class="buyimage" src="/static/logo.png" mode="aspectFit"></image>
  6. <label class="xuanxingtext">{{$t('index.zonghepf')}}</label>
  7. <uni-rate class="rateV" allow-half v-model="rateValue" @change="onChange" />
  8. </view>
  9. <textarea class="pinglun" :value="pinglunnr" :placeholder="$t('index.qingshuru')" @input="sumfontnum"></textarea>
  10. <view class="text2">
  11. <text class="">{{fontNum}}/150</text>
  12. </view>
  13. <checkbox-group class="radio" @change="checkSelect" >
  14. <checkbox :checked="checkTrue"></checkbox>
  15. <text>{{$t('index.nimingpj')}}</text>
  16. </checkbox-group>
  17. <view class="updata" @click="updata()">{{$t('order.fabiaopinglun')}}</view>
  18. </view>
  19. </template>
  20. <script>
  21. import api from "@/pages/api/api.js"
  22. export default {
  23. data() {
  24. return {
  25. fontNum:0,
  26. rateValue: 3.5,
  27. checkTrue: false, //全选选中
  28. pinglunnr:'',
  29. mendid:'',
  30. ddId:''
  31. }
  32. },
  33. onLoad(option) {
  34. this.mendid=option.mendid;
  35. this.ddId=option.ddId;
  36. },
  37. methods: {
  38. // 限制文本框字数
  39. sumfontnum(e) {
  40. console.log(e)
  41. this.fontNum = e.detail.value.length
  42. this.pinglunnr = e.detail.value;
  43. console.log(this.pinglunnr)
  44. },
  45. onChange(e) {
  46. this.rateValue=e.value;
  47. console.log(this.rateValue);
  48. },
  49. checkSelect(e){
  50. },
  51. updata(){
  52. //发表评论
  53. this.addrevew();
  54. },
  55. addrevew(){
  56. api('addrevew',{
  57. "ddId": this.ddId,
  58. "mdId": this.mendid,
  59. "score": this.rateValue,
  60. "content":this.pinglunnr,
  61. "anonymous": 1
  62. },res=>{
  63. console.log('1---------1:',res);
  64. uni.navigateBack();
  65. },failc=>{
  66. //console.log('getadvertis----',failc)
  67. })
  68. },
  69. }
  70. }
  71. </script>
  72. <style>
  73. .contentbg{
  74. }
  75. .xuanxing{
  76. margin: 16rpx;
  77. display: flex;
  78. flex-direction: row;
  79. }
  80. .buyimage{
  81. width: 100rpx;
  82. height: 100rpx;
  83. }
  84. .xuanxingtext{
  85. padding-left:10rpx;
  86. height: 100rpx;
  87. line-height: 100rpx;
  88. }
  89. .rateV{
  90. padding-top:25rpx;
  91. padding-left:10rpx;
  92. }
  93. .pinglun{
  94. margin: 16rpx;
  95. padding: 10rpx;
  96. width: 91%;
  97. height: 200rpx;
  98. border-radius: 15rpx;
  99. border: 2rpx solid darkgray;
  100. }
  101. .text2{
  102. height: 30rpx;
  103. line-height: 30rpx;
  104. color: #000000;
  105. font-size: 20rpx;
  106. margin-right: 30rpx;
  107. display: flex;
  108. justify-content:flex-end;
  109. }
  110. .updata{
  111. background-color: green;
  112. color: white;
  113. text-align: center;
  114. height: 80rpx;
  115. line-height: 80rpx;
  116. width: 80%;
  117. margin-left: 10%;
  118. border-radius: 15rpx;
  119. }
  120. .radio{
  121. margin: 16rpx;
  122. display: flex;
  123. flex-direction: row;
  124. }
  125. </style>