jubao.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view>
  3. <view class="Regular header-title">我是公司名称我是公司名称</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='status' placeholder="请输入举报事项" placeholder-style="color:#AFB3BF;" />
  9. <view class='Regular words'>{{status.length}}/150个字</view>
  10. </view>
  11. </view>
  12. <view class="uploading">
  13. <view class="title Regular">上传图片</view>
  14. <!-- <u-upload width='140' height='140' :file-list="fileList" :custom-btn="true" :show-upload-list="showUploadList" ref="uUpload" :max-size="5 * 1024 * 1024" max-count="6" :action="$uploadUrl">
  15. <view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
  16. <image style='width:23px;height:23px;margin-top:10px;' src="../../static/img/liangmai/xiangji-2.png" mode=""></image>
  17. <view style='color:#AFB3BF;font-size:10px;' class='Medium'>上传图片</view>
  18. </view>
  19. </u-upload> -->
  20. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  21. :size-type="['compressed']" :custom="uploadCustom" :options="uploadOptions" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  22. @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
  23. </view>
  24. </view>
  25. <view class="commitwrap">
  26. <view class='commit' @click='commit'>提交</view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import upload from '@/components/upload.vue';
  32. export default {
  33. components: {
  34. upload
  35. },
  36. data() {
  37. return {
  38. action: this.$uploadUrl,
  39. maxSize: 5 * 1024 * 1024, //限制文件大小 5M
  40. btnLoading: false, //防止重复点击
  41. isAdd: true,
  42. imgUrls: [],
  43. status:'',
  44. fileList:[],
  45. uploadOptions: {
  46. "text": "",
  47. "bgc": ""
  48. },
  49. }
  50. },
  51. onReady() {
  52. // 得到整个组件对象,内部图片列表变量为"lists"
  53. // this.fileList = this.$refs.uUpload.lists;
  54. },
  55. onLoad(){
  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);
  74. },
  75. commit(){
  76. console.log(this.fileList)
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. page{
  83. background:#F5F6FA;
  84. }
  85. .header-title{
  86. margin:9.5px;
  87. padding:16.5px 12.5px;
  88. background:#fff;
  89. border-radius:10px;
  90. height:51px;
  91. }
  92. .content{
  93. padding:12.5px;margin:9px;
  94. background:#fff;
  95. border-radius:10px;
  96. }
  97. .matter .title{
  98. font-size:14px;
  99. margin-bottom:15px;
  100. }
  101. .uploading .title{
  102. font-size:14px;margin-top:13px;margin-bottom:13px;
  103. }
  104. .textarea{
  105. background:#F9F9FA;
  106. font-size:12px;
  107. padding:6.5px;
  108. width:326.5px;height:70px;
  109. border-radius:5px;
  110. }
  111. .words{
  112. font-size:10px;color:#AFB3BF;position: absolute;right:5px;
  113. bottom:8px;
  114. }
  115. .slot-btn{
  116. width: 70px;
  117. height: 70px;
  118. border-radius: 4px;
  119. border: 2px dashed #AFB3BF;
  120. text-align:center;
  121. }
  122. .commitwrap{
  123. position:fixed;bottom:0;left:0;
  124. width:100%;
  125. }
  126. .commit{
  127. background:#22C572;
  128. margin:10px 24px;
  129. text-align:center;
  130. height:46px;line-height:46px;
  131. color:#fff;
  132. font-size:17px;
  133. border-radius:20px;
  134. }
  135. /deep/.u-delete-icon{
  136. top:0;
  137. right:0;
  138. border-radius:0 0 0 15px;
  139. background:rgba(17, 26, 52, 0.5) !important;
  140. }
  141. </style>