瑶都万能墙
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.

180 lines
3.1 KiB

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