feedback.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view>
  3. <view class="cn">
  4. <view class="info">
  5. <view class="form_group hr">
  6. <view class="lable">标题名称</view>
  7. <input type="text" placeholder="请输入标题名称" v-model="item.title" />
  8. </view>
  9. <view class="form_group"><view class="lable">投诉内容</view></view>
  10. <textarea placeholder="请输入投诉内容(500字以内)" v-model="item.content" maxlength="500" style="height: 150px;" />
  11. <view class="form_group">
  12. <view class="lable">投诉图片</view>
  13. <view class="text">最多上传5张图片</view>
  14. </view>
  15. <view class="pl5">
  16. <u-upload
  17. :ip="ip"
  18. :action="upload.action"
  19. :header="upload.header"
  20. :size-type="upload.size"
  21. :max-count="upload.count"
  22. :name="upload.name"
  23. :file-list="item.pic"
  24. :deletable="item.auditFlag != 1"
  25. :show-progress="item.auditFlag != 1"
  26. :custom-btn="item.auditFlag == 1"
  27. ref="uUpload"
  28. width="140"
  29. height="140"
  30. ></u-upload>
  31. </view>
  32. <view class="form_group">
  33. <view class="lable">手机号码</view>
  34. <input type="text" placeholder="(选填),以便将处理结果反馈给你" v-model="item.phone" style="flex: 0.8;" />
  35. </view>
  36. </view>
  37. <button class="btn" @click="up()">提交投诉</button>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. ip: this.$http.urls.ip,
  46. item: { pic: [] },
  47. upload: {
  48. header: { apiToken: this.$getUser().apiToken },
  49. name: 'img',
  50. action: this.$http.urls.uploadImg,
  51. size_type: 'compressed ',
  52. count: 5
  53. }
  54. };
  55. },
  56. onLoad(e) {},
  57. methods: {
  58. up() {
  59. this.item.pic = [];
  60. let files = this.$refs.uUpload.lists.filter(val => {
  61. return val.progress == 100;
  62. });
  63. //投诉图片
  64. files.forEach(item => {
  65. if (item.response) {
  66. this.item.pic.push(item.response.fileName); //获取上传成功的网络地址
  67. } else {
  68. this.item.pic.push(item.url); //原来的地址
  69. }
  70. });
  71. let rule = [{ name: 'title', checkType: 'notnull', errorMsg: '请输入标题名称' }, { name: 'content', checkType: 'notnull', errorMsg: '请输入投诉内容' }];
  72. if (!this.$verify.check(this.item, rule)) {
  73. uni.showModal({ content: this.$verify.error, showCancel: false });
  74. return;
  75. }
  76. this.item.pic = this.item.pic.toString();
  77. this.$http.request({
  78. method: 'POST',
  79. url: this.$http.urls.feedback,
  80. data: this.item,
  81. success: res => {
  82. uni.showToast({ title: '提交成功' });
  83. setTimeout(() => {
  84. uni.navigateBack();
  85. }, 700);
  86. }
  87. });
  88. }
  89. }
  90. };
  91. </script>
  92. <style lang="scss">
  93. .steps {
  94. text-align: center;
  95. margin-top: 20px;
  96. }
  97. .u-subsection {
  98. margin-top: 20px;
  99. }
  100. .cn {
  101. padding: 15px;
  102. .info {
  103. background-color: white;
  104. border-radius: 5px;
  105. margin-top: 10px;
  106. padding-bottom: 10px;
  107. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  108. .dw {
  109. top: 11px;
  110. font-size: 19px;
  111. right: 9px;
  112. position: absolute;
  113. }
  114. }
  115. textarea {
  116. margin-left: 17px;
  117. font-size: 14px;
  118. padding: 10px;
  119. width: 85%;
  120. height: 85px;
  121. border: 1px solid #f1f1f1;
  122. border-radius: 5px;
  123. }
  124. .btn {
  125. margin-top: 25px;
  126. }
  127. }
  128. .text {
  129. font-size: 11px;
  130. font-weight: normal;
  131. color: $dar;
  132. flex: 0.8;
  133. text-align: right;
  134. }
  135. </style>