feedback.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <div class="feedback">
  3. <ul class="detailUl">
  4. <div class="record" @click.stop="toRecord">
  5. 反馈记录 <img src="https://www.idea-co-sf.com/gardenProduct/image/rightIcon.png" class="recordImg">
  6. </div>
  7. <li class="detailLi2">
  8. <div class="detailLi2Box">
  9. <van-field
  10. :value="form.feedbackContent"
  11. autosize
  12. type="textarea"
  13. placeholder="请输入文字进行描述"
  14. class="myField"
  15. maxlength="800"
  16. show-word-limit
  17. @change="changeField"
  18. />
  19. </div>
  20. </li>
  21. <li class="detailLi2">
  22. <span class="liName">
  23. 上传照片
  24. <span style="color: #B3B3B3;font-size: 28rpx">(支持图片/视频上传限20M内,最多6张)</span>
  25. </span>
  26. <div class="detailLi2Box" style="margin: 24rpx 0 0 0">
  27. <van-uploader
  28. :max-count="6"
  29. @delete="deleteRYXXZP"
  30. :file-list="fileList"
  31. @after-read="uploadRYXXZP"
  32. :show-upload="true"
  33. />
  34. </div>
  35. </li>
  36. </ul>
  37. <button class="submitBtn" @tap="submit">
  38. 提交
  39. </button>
  40. </div>
  41. </template>
  42. <script>
  43. import { parkFeedbackInfoAdd,getUserLocalStorageInfo } from "@/js_sdk/http.js";
  44. export default {
  45. name: "feedback",
  46. data(){
  47. return{
  48. form:{
  49. feedbackContent:'',
  50. feedbackPicture: '',
  51. feedbackId: getUserLocalStorageInfo().userId,
  52. feedbackName:getUserLocalStorageInfo().username
  53. },
  54. fileList:[]
  55. }
  56. },
  57. methods:{
  58. changeField(e){
  59. // console.log(e.detail)
  60. this.form.feedbackContent = e.detail
  61. },
  62. submit(){
  63. let picArr = []
  64. this.fileList.forEach(item=>{
  65. picArr.push(item.id)
  66. })
  67. this.form.feedbackPicture = picArr.toString()
  68. // console.log(this.form.feedbackld)
  69. if (!this.form.feedbackContent){
  70. uni.showToast({
  71. title: '请描述反馈内容',
  72. icon: 'error',
  73. mask: true,
  74. duration: 1000
  75. });
  76. }else{
  77. parkFeedbackInfoAdd(this.form).then(res=>{
  78. console.log(res)
  79. uni.showToast({
  80. title: res.msg,
  81. icon: 'none',
  82. mask: true,
  83. duration: 1000
  84. });
  85. })
  86. }
  87. },
  88. toRecord(){
  89. uni.navigateTo({
  90. url:'/pages/subPackages/minePages/feedback_record'
  91. })
  92. },
  93. deleteRYXXZP(event) {
  94. this.fileList.splice(event.detail.index, 1);
  95. this.$forceUpdate();
  96. },
  97. uploadRYXXZP(event) {
  98. console.log(event)
  99. let that = this;
  100. const { file } = event.detail;
  101. uni.uploadFile({
  102. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  103. filePath: file.url,
  104. name: "file",
  105. formData: { user: "test" },
  106. success(res) {
  107. // 上传完成需要更新 fileList
  108. let data = JSON.parse(res.data);
  109. console.log('data',data)
  110. that.fileList.push({
  111. imgUrl: "/FileController/download/" + data.data[0],
  112. id: data.data[0],
  113. url:
  114. that.$constant.BASE_URI +
  115. "/FileController/download/" +
  116. data.data[0],
  117. isImage: true,
  118. });
  119. },
  120. fail(res) {},
  121. });
  122. },
  123. }
  124. }
  125. </script>
  126. <style lang="scss">
  127. .feedback{
  128. .record {
  129. display: flex;
  130. align-items: center;
  131. justify-content: flex-end;
  132. color: #0365F9;
  133. font-size: 32rpx;
  134. padding-top: 24rpx;
  135. .recordImg{
  136. width: 36rpx;
  137. height: 36rpx;
  138. padding: 5rpx 0 0 10rpx;
  139. }
  140. }
  141. .detailUl{
  142. margin-top: 20rpx;
  143. background: white;
  144. padding: 0 32rpx;
  145. .liName{
  146. font-size: 32rpx;
  147. color: rgba(51, 51, 51, 1);
  148. white-space: nowrap;
  149. }
  150. .detailLi{
  151. display: flex;
  152. justify-content: space-between;
  153. align-items: center;
  154. padding: 32rpx 0;
  155. border-bottom: 2rpx solid #E6E6E6;
  156. .liInfo{
  157. display: inline-block;
  158. text-align: right;
  159. max-width: 428rpx;
  160. color: rgba(102, 102, 102, 1);
  161. font-size: 32rpx;
  162. line-height: 38rpx;
  163. .radio{
  164. margin-left: 64rpx;
  165. }
  166. }
  167. }
  168. .detailLi2{
  169. display: flex;
  170. flex-direction: column;
  171. padding: 32rpx 0;
  172. border-bottom: 2rpx solid #E6E6E6;
  173. .detailLi2BoxTop{
  174. display: flex;
  175. flex-wrap: wrap;
  176. justify-content: space-between;
  177. margin: 12rpx 0;
  178. .checkItem{
  179. width: 160rpx;
  180. height: 64rpx;
  181. font-size: 28rpx;
  182. color: #666666;
  183. display: flex;
  184. align-items: center;
  185. justify-content: center;
  186. background: #F5F7FA;
  187. border-radius: 8rpx;
  188. margin: 12rpx 0;
  189. }
  190. .checked{
  191. background: #0365F9;
  192. color: white;
  193. }
  194. }
  195. }
  196. .van-cell {
  197. background: #F5F7FA !important;
  198. border-radius: 8rpx;
  199. font-size: 28rpx;
  200. }
  201. }
  202. .submitBtn{
  203. width: 654rpx;
  204. height: 96rpx;
  205. background: #0365F9;
  206. border-radius: 8rpx;
  207. display: flex;
  208. align-items: center;
  209. justify-content: center;
  210. margin: 64rpx 48rpx;
  211. color: white;
  212. }
  213. }
  214. </style>