feedback.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. uni.navigateBack({});
  86. })
  87. }
  88. },
  89. toRecord(){
  90. uni.navigateTo({
  91. url:'/pages/subPackages/minePages/feedback_record'
  92. })
  93. },
  94. deleteRYXXZP(event) {
  95. this.fileList.splice(event.detail.index, 1);
  96. this.$forceUpdate();
  97. },
  98. uploadRYXXZP(event) {
  99. console.log(event)
  100. let that = this;
  101. const { file } = event.detail;
  102. uni.uploadFile({
  103. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  104. filePath: file.url,
  105. name: "file",
  106. formData: { user: "test" },
  107. success(res) {
  108. // 上传完成需要更新 fileList
  109. let data = JSON.parse(res.data);
  110. console.log('data',data)
  111. that.fileList.push({
  112. imgUrl: "/FileController/download/" + data.data[0],
  113. id: data.data[0],
  114. url:
  115. that.$constant.BASE_URI +
  116. "/FileController/download/" +
  117. data.data[0],
  118. isImage: true,
  119. });
  120. },
  121. fail(res) {},
  122. });
  123. },
  124. }
  125. }
  126. </script>
  127. <style lang="scss">
  128. .feedback{
  129. .record {
  130. display: flex;
  131. align-items: center;
  132. justify-content: flex-end;
  133. color: #0365F9;
  134. font-size: 32rpx;
  135. padding-top: 24rpx;
  136. .recordImg{
  137. width: 36rpx;
  138. height: 36rpx;
  139. padding: 5rpx 0 0 10rpx;
  140. }
  141. }
  142. .detailUl{
  143. margin-top: 20rpx;
  144. background: white;
  145. padding: 0 32rpx;
  146. .liName{
  147. font-size: 32rpx;
  148. color: rgba(51, 51, 51, 1);
  149. white-space: nowrap;
  150. }
  151. .detailLi{
  152. display: flex;
  153. justify-content: space-between;
  154. align-items: center;
  155. padding: 32rpx 0;
  156. border-bottom: 2rpx solid #E6E6E6;
  157. .liInfo{
  158. display: inline-block;
  159. text-align: right;
  160. max-width: 428rpx;
  161. color: rgba(102, 102, 102, 1);
  162. font-size: 32rpx;
  163. line-height: 38rpx;
  164. .radio{
  165. margin-left: 64rpx;
  166. }
  167. }
  168. }
  169. .detailLi2{
  170. display: flex;
  171. flex-direction: column;
  172. padding: 32rpx 0;
  173. border-bottom: 2rpx solid #E6E6E6;
  174. .detailLi2BoxTop{
  175. display: flex;
  176. flex-wrap: wrap;
  177. justify-content: space-between;
  178. margin: 12rpx 0;
  179. .checkItem{
  180. width: 160rpx;
  181. height: 64rpx;
  182. font-size: 28rpx;
  183. color: #666666;
  184. display: flex;
  185. align-items: center;
  186. justify-content: center;
  187. background: #F5F7FA;
  188. border-radius: 8rpx;
  189. margin: 12rpx 0;
  190. }
  191. .checked{
  192. background: #0365F9;
  193. color: white;
  194. }
  195. }
  196. }
  197. .van-cell {
  198. background: #F5F7FA !important;
  199. border-radius: 8rpx;
  200. font-size: 28rpx;
  201. }
  202. }
  203. .submitBtn{
  204. width: 654rpx;
  205. height: 96rpx;
  206. background: #0365F9;
  207. border-radius: 8rpx;
  208. display: flex;
  209. align-items: center;
  210. justify-content: center;
  211. margin: 64rpx 48rpx;
  212. color: white;
  213. }
  214. }
  215. </style>