feedBack.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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_delpic@2x.png" mode="" class="delImg"
  19. @click="delimg(imgindex)"></image>
  20. </view>
  21. <view class="imgLine" @click="uploadImg">
  22. <image src="../../static/img/icon_addpic@2x.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. var exeImg = this.imgArr.join(',')
  120. this.$http('miniAppMyBMemberCar/addBMemberSuggest', {
  121. contents: this.exeContent,
  122. img: exeImg
  123. }, 'POST').then(res => {
  124. //this.submitSuperCheckSheet()
  125. if(res.code==0){
  126. uni.showToast({
  127. title: '提交成功',
  128. icon: 'none',
  129. duration: 2000,
  130. });
  131. setTimeout(function() {
  132. uni.navigateBack({
  133. })
  134. }, 2000);
  135. }else{
  136. uni.showToast({
  137. title: '提交失败',
  138. icon: 'none',
  139. duration: 2000,
  140. });
  141. }
  142. })
  143. }
  144. }
  145. }
  146. </script>
  147. <style scoped>
  148. .content {
  149. background: #F4F5F7;
  150. min-height: 100vh;
  151. }
  152. /* #ifdef H5 */
  153. .content {
  154. background: #F4F5F7;
  155. min-height: calc(100vh - 44px);
  156. }
  157. /* #endif */
  158. .main {
  159. background: #F4F5F7;
  160. padding: 20rpx 24rpx;
  161. }
  162. .firstView,
  163. .secondView {
  164. background-color: #FFFFFF;
  165. border-radius: 10rpx;
  166. }
  167. .firstView {
  168. margin-bottom: 20rpx;
  169. }
  170. .title {
  171. font-size: 30rpx;
  172. color: #3C3C3C;
  173. padding: 20rpx;
  174. }
  175. .textareaCont {
  176. padding: 20rpx;
  177. min-height: 150rpx;
  178. width: 95%;
  179. }
  180. .imgBox {
  181. display: flex;
  182. flex-wrap: wrap;
  183. padding: 20rpx;
  184. }
  185. .imgLine{
  186. position: relative;
  187. margin-right: 10rpx;
  188. }
  189. .itemImg {
  190. width: 150rpx;
  191. height: 150rpx;
  192. margin-right: 5rpx;
  193. }
  194. /* .img4 {
  195. margin-right: 20rpx;
  196. } */
  197. .delImg {
  198. width: 32rpx;
  199. height: 32rpx;
  200. position: absolute;
  201. right: 0rpx;
  202. top: 0rpx;
  203. }
  204. .bottom {
  205. width: 750rpx;
  206. height: 120rpx;
  207. background: #FFFFFF;
  208. box-shadow: 0px -4px 8px 0px rgba(153, 153, 153, 0.08);
  209. position: fixed;
  210. left: 0;
  211. bottom: 0;
  212. display: flex;
  213. justify-content: space-around;
  214. }
  215. .shoreDz {
  216. width: 702rpx;
  217. height: 74rpx;
  218. background: linear-gradient(124deg, #FF8700 0%, #FF4F00 100%);
  219. border-radius: 37rpx;
  220. text-align: center;
  221. line-height: 74rpx;
  222. color: #FFFFFF;
  223. font-size: 30rpx;
  224. margin-top: 24rpx;
  225. }
  226. </style>