errorcorrection.vue 5.0 KB

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