feedback.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="flex-common-css iPhone-bottom box-border-box">
  3. <Nav title="问题反馈" titleColor="#333" bgckgroundBox='#fff'></Nav>
  4. <scroll-view :scroll-y="true" class="scroll-view-css">
  5. <view class="content-box box-border-box">
  6. <view class="bgc-f p-24 b-rad-20 mb-20 box-sizing-border">
  7. <view class="fs-32 fw-600 fc-3 mb-20">
  8. 请描述你的建议和想法,我们会不断优化改进
  9. </view>
  10. <view class="textarea-box">
  11. <textarea class="textarea-box" v-model="formData.content" placeholder-style="color:#ccc" maxlength='100' placeholder="还有更多建议和想法?快告诉我们吧~" />
  12. </view>
  13. <view class="up-img-box align-items-center flex-wrap-wrap">
  14. <view class="up-img" v-for="(itme, i) in formData.image" :key="i">
  15. <image class="img" :src="itme" mode="aspectFill"></image>
  16. <uni-icons @click="deleteImg(i)" class="delete-icons" color="#000" type="clear"
  17. size="20"></uni-icons>
  18. </view>
  19. <view @click="upImg()" v-if="formData.image.length < 3" class="add-img-box flex-direction flex-justify-center align-items-center bgc-F6F6F6 bgc-F6F6F6">
  20. <image class="add-img" src="@/static/img/my/sc.png" mode=""></image>
  21. <view class="fs-24 fc-9">
  22. 上传照片
  23. </view>
  24. <view class="fs-24 fc-9">
  25. (最多3张)
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="bgc-f b-rad-20 box-sizing-border phone-box">
  31. <view class="fs-32 fc-3 mb-20 fw-600">
  32. 联系方式
  33. </view>
  34. <input v-model="formData.phone" class="uni-input" placeholder="请输入手机号(选填)" type="number" />
  35. </view>
  36. </view>
  37. </scroll-view>
  38. <view class="bot-box bgc-f" @click="save()">
  39. <view class="bot-but fc-f fs-32 text-align-center b-rad-200 bgc-4FB3EF">
  40. 提交反馈
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import {upLoadingFileOss,} from "@/service/upLoadingFile.js"
  47. import {setFeedback} from '@/api/common.js'
  48. import tools from '@/service/tools';
  49. export default {
  50. components: {},
  51. data() {
  52. return {
  53. formData: {
  54. phone:'',
  55. content: '',
  56. image: [],
  57. },
  58. isAJAX:false,
  59. };
  60. },
  61. methods: {
  62. deleteImg(index) {
  63. this.formData.image.splice(index, 1)
  64. },
  65. upImg() {
  66. uni.chooseImage({
  67. count: 3,
  68. sizeType: ["compressed", "camera"],
  69. sourceType: ["album", "camera"],
  70. success: (res) => {
  71. res.tempFiles.forEach((file) => {
  72. this.uploadingFile(file);
  73. })
  74. }
  75. })
  76. },
  77. uploadingFile(file) {
  78. upLoadingFileOss(file.path).then((res) => {
  79. if (res) {
  80. this.formData.image.push(res)
  81. } else {
  82. tools.error('图片上传失败')
  83. }
  84. })
  85. },
  86. save(){
  87. if(this.isAJAX){
  88. return
  89. }
  90. this.isAJAX = true;
  91. setFeedback(this.formData).then((res)=>{
  92. if(res.code === 1){
  93. this.isAJAX = false;
  94. tools.success('提交成功');
  95. setTimeout(()=>{
  96. uni.reLaunch({
  97. url:'/pages/me/index'
  98. })
  99. },1500)
  100. }else{
  101. this.isAJAX = false;
  102. tools.error(res.msg);
  103. }
  104. })
  105. },
  106. },
  107. }
  108. </script>
  109. <style lang="scss" scoped>
  110. .content-box {
  111. padding: 26rpx 24rpx 0;
  112. }
  113. .textarea-box {
  114. width: 100%;
  115. height: 200rpx;
  116. }
  117. .up-img {
  118. width: 152rpx;
  119. height: 152rpx;
  120. margin: 0 10rpx 10rpx 0;
  121. position: relative;
  122. .img {
  123. width: 100%;
  124. height: 100%;
  125. border-radius: 4rpx;
  126. }
  127. .delete-icons {
  128. position: absolute;
  129. right: 0;
  130. top: 0;
  131. }
  132. }
  133. .add-img-box {
  134. width: 152rpx;
  135. height: 152rpx;
  136. border: 1px dashed #ccc;
  137. border-radius: 4rpx;
  138. margin: 0 0 10rpx 0;
  139. .add-img {
  140. width: 56rpx;
  141. height: 56rpx;
  142. }
  143. }
  144. .phone-box {
  145. padding: 32rpx 24rpx;
  146. }
  147. .uni-input {
  148. // width: 100%;
  149. height: 92rpx;
  150. line-height: 92rpx;
  151. background: #F6F6F6;
  152. border-radius: 12rpx;
  153. padding: 0 0 0 26rpx;
  154. font-size: 28rpx
  155. }
  156. .bot-box {
  157. width: 100%;
  158. padding: 12rpx 32rpx;
  159. box-sizing: border-box;
  160. .bot-but {
  161. width: 100%;
  162. height: 92rpx;
  163. line-height: 92rpx;
  164. }
  165. }
  166. </style>