errorcorrection.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view>
  3. <view class="Regular header-title">{{jubaolist.compName}}</view>
  4. <view class='content'>
  5. <view class='matter'>
  6. <view class="title Regular">纠错事项<text style='color:#FB1E1E;'>*</text></view>
  7. <view style='position:relative;'>
  8. <textarea class='textarea Regular' maxlength="150" v-model='jubaolist.error' placeholder="请输入举报事项" placeholder-style="color:#AFB3BF;" />
  9. <view class='Regular words'>{{jubaolist.error.length}}/150个字</view>
  10. </view>
  11. </view>
  12. <view class="uploading">
  13. <view class="title Regular">上传图片</view>
  14. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="6"
  15. :size-type="['compressed']" :options="uploadOptions" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  16. @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
  17. </view>
  18. </view>
  19. <view class="commitwrap">
  20. <view class='commit' @click='commit'>提交</view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import upload from '@/components/upload.vue';
  26. export default {
  27. components: {
  28. upload
  29. },
  30. data() {
  31. return {
  32. action: this.$uploadUrl,
  33. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  34. btnLoading: false, //防止重复点击
  35. isAdd: true,
  36. imgUrls: [],
  37. status:'',
  38. fileList:[],
  39. jubaolist:{
  40. error:''
  41. },
  42. uploadOptions: {
  43. "text": "",
  44. "bgc": ""
  45. },
  46. }
  47. },
  48. onReady() {
  49. // 得到整个组件对象,内部图片列表变量为"lists"
  50. // this.fileList = this.$refs.uUpload.lists;
  51. },
  52. onLoad(options){
  53. this.jubaolist.id=options.id
  54. this.jubaolist.compName=options.compName
  55. },
  56. methods: {
  57. filterFileType(index, lists) {
  58. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  59. lists.splice(index, 1);
  60. // 当前文件不支持
  61. uni.showModal({
  62. title: '暂不支持当前图片类型',
  63. showCancel: false
  64. });
  65. } else {
  66. this.isAdd = false;
  67. }
  68. },
  69. getImgUrl(res) {
  70. console.log(res)
  71. console.log('------------res-----------')
  72. this.imgUrls.push(res);
  73. },
  74. commit(){
  75. var that=this
  76. this.jubaolist.address=this.imgUrls.toString()
  77. uni.showModal({
  78. content: "确定提交纠错内容?",
  79. showCancel: true,
  80. confirmText: '确定',
  81. success: function(res) {
  82. if (res.confirm) {
  83. that.$api.doRequest('post','/settledCompanyInfo/api/addSettledCompanyError',that.jubaolist).then(res => {
  84. if(res.data.code==200){
  85. uni.showToast({
  86. title: '感谢您的反馈,平台会尽快核实',
  87. icon: 'none',
  88. duration: 2000
  89. })
  90. uni.navigateBack({
  91. })
  92. }else{
  93. uni.showToast({
  94. title: res.message,
  95. icon: 'none',
  96. duration: 2000
  97. })
  98. }
  99. })
  100. }
  101. },
  102. })
  103. },
  104. //删除一张图片的回调,lists这是成功删除一个图片后,还剩余的图片集合
  105. onRemove(data, lists){
  106. //lists.length > 0说明删除之前已经上传了多余两张的图片
  107. if(lists.length > 0 ){
  108. var currentfileList = [];
  109. //遍历this.fileList 与剩余的lists进行匹配,来组成一个新的格式合适的剩余图片集合
  110. this.fileList.forEach((item, index)=>{
  111. lists.forEach((item1, index1)=>{
  112. if(item.name == JSON.parse(item1.response).name){
  113. currentfileList.push(item);
  114. }
  115. });
  116. })
  117. //删除后对图片集合及时冬天更新,即对this.fileList重新赋值
  118. this.fileList = currentfileList;
  119. }else{//说明删除之前只有一张图片,删除成功后把this.fileList清空即可
  120. this.fileList = [];
  121. }
  122. this.form.pictureUrl = JSON.stringify(this.fileList)
  123. //console.log("打印图片List:onRemove", this.fileList);
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang="scss" scoped>
  129. page{
  130. background:#F5F6FA;
  131. }
  132. .header-title{
  133. margin:9.5px;
  134. padding:16.5px 12.5px;
  135. background:#fff;
  136. border-radius:10px;
  137. height:51px;
  138. }
  139. .content{
  140. padding:12.5px;margin:9px;
  141. background:#fff;
  142. border-radius:10px;
  143. }
  144. .matter .title{
  145. font-size:14px;
  146. margin-bottom:15px;
  147. }
  148. .uploading .title{
  149. font-size:14px;margin-top:13px;margin-bottom:13px;
  150. }
  151. .textarea{
  152. background:#F9F9FA;
  153. font-size:12px;
  154. padding:6.5px;
  155. width:326.5px;height:70px;
  156. border-radius:5px;
  157. }
  158. .words{
  159. font-size:10px;color:#AFB3BF;position: absolute;right:5px;
  160. bottom:8px;
  161. }
  162. .slot-btn{
  163. width: 70px;
  164. height: 70px;
  165. border-radius: 4px;
  166. border: 2px dashed #AFB3BF;
  167. text-align:center;
  168. }
  169. .commitwrap{
  170. position:fixed;bottom:0;left:0;
  171. width:100%;
  172. }
  173. .commit{
  174. background:#22C572;
  175. margin:10px 24px;
  176. text-align:center;
  177. height:46px;line-height:46px;
  178. color:#fff;
  179. font-size:17px;
  180. border-radius:20px;
  181. }
  182. /deep/.u-delete-icon{
  183. top:0;
  184. right:0;
  185. border-radius:0 0 0 15px;
  186. background:rgba(17, 26, 52, 0.5) !important;
  187. }
  188. </style>