feedBack.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="content">
  3. <view class="main">
  4. <!-- 建议 -->
  5. <view class="firstView">
  6. <view class="title">您的问题或建议</view>
  7. <view>
  8. <textarea placeholder-style="color:#999999" placeholder="输入个人意见反馈" v-model="exeContent"
  9. class="textareaCont" maxlength="-1" auto-height="true" @confirm="feedDone" />
  10. </view>
  11. </view>
  12. <!-- 图片 -->
  13. <view class="secondView">
  14. <view class="title">上传图片</view>
  15. <view class="imgBox">
  16. <view class="imgLine" v-for="(img,imgindex) in imgArr">
  17. <image :class="{img4:(imgindex+1)%4==0}" :src="img" mode="" class="itemImg"></image>
  18. <image src="../../static/img/icon_del_red.png" mode="" class="delImg" @click="delimg(imgindex)">
  19. </image>
  20. </view>
  21. <view class="imgLine" @click="uploadImg">
  22. <image src="../../static/img/btn_pic.png" mode="" class="itemImg"></image>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="bottom">
  28. <view class="shoreDz" @click="submit">提交</view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import nodata from '@/components/nodata/nodata.vue'
  34. export default {
  35. components: {
  36. nodata
  37. },
  38. data() {
  39. return {
  40. imgArr: [],
  41. exeContent: '',
  42. }
  43. },
  44. methods: {
  45. feedDone(e) {
  46. this.exeContent = e.target.value
  47. },
  48. uploadImg() {
  49. var that = this;
  50. var length = this.imgArr.length;
  51. var num = 9;
  52. if (length > 8) {
  53. uni.showToast({
  54. title: '最多上传9张',
  55. icon: 'none',
  56. duration: 2000,
  57. });
  58. return false;
  59. }
  60. uni.chooseImage({
  61. sourceType: ['album', 'camera'],
  62. count: num - length,
  63. success: (chooseImageRes) => {
  64. const tempFilePaths = chooseImageRes.tempFilePaths;
  65. /* uni.uploadFile({
  66. url: that.$request.baseUrl+'accompany/SuperCheckSheet/uploadFile', //仅为示例,非真实的接口地址
  67. filePath: tempFilePaths[0],
  68. name: 'file',
  69. formData: {
  70. 'user': 'test'
  71. },
  72. success: (uploadFileRes) => {
  73. console.log(JSON.parse(uploadFileRes.data).data );
  74. that.imgArr=that.imgArr.concat(JSON.parse(uploadFileRes.data).data) ;
  75. }
  76. }); */
  77. tempFilePaths.forEach(v => {
  78. console.log(that.$request.baseUrl + 'tuhuUploadFile');
  79. uni.uploadFile({
  80. url: that.$request.baseUrl + 'tuhuUploadFile',
  81. filePath: v,
  82. name: 'file',
  83. formData: {
  84. 'user': 'test'
  85. },
  86. success: (uploadFileRes) => {
  87. console.log(JSON.parse(uploadFileRes.data).data);
  88. that.imgArr = that.imgArr.concat(JSON.parse(
  89. uploadFileRes.data).data);
  90. }
  91. });
  92. })
  93. /* that.$http('accompany/SuperCheckSheet/uploadFile', tempFilePaths[0], 'POST').then(res => {
  94. }) */
  95. }
  96. });
  97. },
  98. delimg(index) {
  99. this.imgArr.splice(index, 1)
  100. },
  101. submit() {
  102. if (!this.exeContent) {
  103. uni.showToast({
  104. title: '请输入个人意见反馈',
  105. icon: 'none',
  106. duration: 2000,
  107. });
  108. return;
  109. }
  110. // if (this.imgArr.length == 0) {
  111. // uni.showToast({
  112. // title: '请上传图片',
  113. // icon: 'none',
  114. // duration: 2000,
  115. // });
  116. // return ;
  117. // }
  118. uni.showLoading({
  119. title: '保存中'
  120. })
  121. var exeImg = this.imgArr.join(',')
  122. this.$http('worldKeepCar/keepCarMy/addTMemberSuggest', {
  123. contents: this.exeContent,
  124. img: exeImg
  125. }, 'POST').then(res => {
  126. //this.submitSuperCheckSheet()
  127. if (res.code == 0) {
  128. uni.showToast({
  129. title: '提交成功',
  130. icon: 'none',
  131. duration: 2000,
  132. });
  133. setTimeout(function() {
  134. uni.navigateBack({
  135. })
  136. }, 2000);
  137. } else {
  138. uni.showToast({
  139. title: '提交失败',
  140. icon: 'none',
  141. duration: 2000,
  142. });
  143. }
  144. })
  145. }
  146. }
  147. }
  148. </script>
  149. <style scoped>
  150. .content {
  151. background: #F4F5F7;
  152. min-height: 100vh;
  153. }
  154. /* #ifdef H5 */
  155. .content {
  156. background: #F4F5F7;
  157. min-height: calc(100vh - 44px);
  158. }
  159. /* #endif */
  160. .main {
  161. background: #F4F5F7;
  162. padding: 20rpx 24rpx;
  163. }
  164. .firstView,
  165. .secondView {
  166. background-color: #FFFFFF;
  167. border-radius: 10rpx;
  168. }
  169. .firstView {
  170. margin-bottom: 20rpx;
  171. }
  172. .title {
  173. font-size: 30rpx;
  174. color: #3C3C3C;
  175. padding: 20rpx;
  176. }
  177. .textareaCont {
  178. padding: 20rpx;
  179. min-height: 150rpx;
  180. width: 95%;
  181. }
  182. .imgBox {
  183. display: flex;
  184. flex-wrap: wrap;
  185. padding: 20rpx;
  186. }
  187. .imgLine {
  188. position: relative;
  189. margin-right: 10rpx;
  190. }
  191. .itemImg {
  192. width: 150rpx;
  193. height: 150rpx;
  194. margin-right: 5rpx;
  195. }
  196. /* .img4 {
  197. margin-right: 20rpx;
  198. } */
  199. .delImg {
  200. width: 32rpx;
  201. height: 32rpx;
  202. position: absolute;
  203. right: 0rpx;
  204. top: 0rpx;
  205. }
  206. .bottom {
  207. width: 750rpx;
  208. height: 120rpx;
  209. background: #FFFFFF;
  210. box-shadow: 0px -4px 8px 0px rgba(153, 153, 153, 0.08);
  211. position: fixed;
  212. left: 0;
  213. bottom: 0;
  214. display: flex;
  215. justify-content: space-around;
  216. padding-bottom: constant(safe-area-inset-bottom);
  217. padding-bottom: env(safe-area-inset-bottom);
  218. }
  219. .shoreDz {
  220. width: 702rpx;
  221. height: 74rpx;
  222. background: linear-gradient(124deg, #FF8700 0%, #FF4F00 100%);
  223. border-radius: 37rpx;
  224. text-align: center;
  225. line-height: 74rpx;
  226. color: #FFFFFF;
  227. font-size: 30rpx;
  228. margin-top: 24rpx;
  229. }
  230. </style>