瑶都万能墙
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
3.2 KiB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
  1. <template>
  2. <view class="commemt">
  3. <view class="comment-list">
  4. <commentItem
  5. v-for="(item,index) in list"
  6. :key="index"
  7. :parentId="item.id"
  8. :sourceType="params.type"
  9. :sourceId="params.orderId"
  10. :item="item" />
  11. </view>
  12. <view class="submit-box">
  13. <view class="top">
  14. <button
  15. class="share"
  16. open-type="share">
  17. <uv-icon
  18. color="#00cf05"
  19. size="50rpx"
  20. name="weixin-fill"></uv-icon>
  21. </button>
  22. <input type="text"
  23. disabled
  24. @click="$refs.popup.open('bottom')"
  25. :placeholder="'评论给' + params.name"
  26. v-model="form.userValue"/>
  27. <!-- <view class="submit"
  28. @click="submit">
  29. 发布
  30. </view> -->
  31. </view>
  32. </view>
  33. <uv-popup ref="popup" :round="30">
  34. <view class="popup">
  35. <view class="content-input">
  36. <uv-textarea
  37. v-model="form.userValue"
  38. :maxlength="200"
  39. autoHeight
  40. count
  41. focus
  42. :placeholder="'评论给' + params.name"></uv-textarea>
  43. </view>
  44. <view class="images box">
  45. <uv-upload
  46. :fileList="fileList"
  47. :maxCount="imageMax"
  48. multiple
  49. width="150rpx"
  50. height="150rpx"
  51. @delete="deleteImage"
  52. @afterRead="afterRead"
  53. :previewFullImage="true"></uv-upload>
  54. </view>
  55. <view class="uni-color-btn"
  56. @click="submit">
  57. 发布
  58. </view>
  59. </view>
  60. </uv-popup>
  61. </view>
  62. </template>
  63. <script>
  64. import commentItem from './commentItem.vue'
  65. export default {
  66. components: {
  67. commentItem,
  68. },
  69. props: ['list', 'params'],
  70. data() {
  71. return {
  72. form : {},
  73. imageMax : 9,
  74. fileList : [],
  75. }
  76. },
  77. methods: {
  78. submit(){
  79. let data = {
  80. ...this.form,
  81. ...this.params,
  82. }
  83. if (this.$utils.verificationAll(data, {
  84. userValue: '说点什么吧',
  85. type: '缺少type',
  86. orderId: '缺少orderId',
  87. })) {
  88. return
  89. }
  90. data.userImage = this.fileList.map((item) => item.url).join(",")
  91. this.$api('addComment', data, res => {
  92. if(res.code == 200){
  93. this.$refs.popup.close()
  94. this.form.userValue = ''
  95. uni.showToast({
  96. title: '发布成功!',
  97. icon: 'none'
  98. })
  99. this.$emit('getData')
  100. }
  101. })
  102. },
  103. deleteImage(e){
  104. this.fileList.splice(e.index, 1)
  105. },
  106. afterRead(e){
  107. let self = this
  108. e.file.forEach(file => {
  109. self.$Oss.ossUpload(file.url).then(url => {
  110. self.fileList.push({
  111. url
  112. })
  113. })
  114. })
  115. },
  116. }
  117. }
  118. </script>
  119. <style scoped lang="scss">
  120. .commemt{
  121. padding-bottom: env(safe-area-inset-bottom);
  122. }
  123. .comment-list {
  124. margin-top: 20rpx;
  125. padding-bottom: 150rpx;
  126. }
  127. .submit-box {
  128. position: fixed;
  129. bottom: 0;
  130. left: 0;
  131. background-color: #fff;
  132. width: 100%;
  133. box-shadow: 0 0 6rpx 6rpx #00000011;
  134. padding-bottom: env(safe-area-inset-bottom);
  135. .top {
  136. align-items: center;
  137. display: flex;
  138. justify-content: center;
  139. input {
  140. background-color: #f3f3f3;
  141. width: 460rpx;
  142. height: 40rpx;
  143. border-radius: 40rpx;
  144. margin: 20rpx;
  145. padding: 20rpx 30rpx;
  146. font-size: 28rpx;
  147. }
  148. .submit {}
  149. }
  150. }
  151. .popup{
  152. .content-input{
  153. min-height: 400rpx;
  154. }
  155. .box{
  156. padding: 0 20rpx;
  157. }
  158. .images{
  159. display: flex;
  160. flex-wrap: wrap;
  161. padding: 20rpx;
  162. }
  163. }
  164. </style>