123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <template>
- <view>
- <view class="Regular header-title">{{jubaolist.compName}}</view>
- <view class='content'>
- <view class='matter'>
- <view class="title Regular">举报事项<text style='color:#FB1E1E;'>*</text></view>
- <view style='position:relative;'>
- <textarea class='textarea Regular' maxlength="150" v-model='jubaolist.error' placeholder="请输入举报事项" placeholder-style="color:#AFB3BF;" />
- <view class='Regular words'>{{jubaolist.error.length}}/150个字</view>
- </view>
- </view>
- <view class="uploading">
- <view class="title Regular">上传图片</view>
- <upload :form-data="{companyId: pcUserInfo.compId,
- modelId: '',
- vesselId: ''}" class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="6"
- :size-type="['compressed']" :options="uploadOptions" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
- @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
- </view>
- </view>
- <view class="commitwrap">
- <view class='commit' @click='commit'>提交</view>
- </view>
-
- </view>
- </template>
- <script>
- import upload from '@/components/upload.vue';
- export default {
- components: {
- upload
- },
- data() {
- return {
- action: this.$uploadUrl,
- pcUserInfo :uni.getStorageSync('pcUserInfo'),
- maxSize: 50 * 1024 * 1024, //限制文件大小 50M
- btnLoading: false, //防止重复点击
- isAdd: true,
- imgUrls: [],
- status:'',
- fileList:[],
- jubaolist:{
- error:''
- },
- uploadOptions: {
- "text": "",
- "bgc": ""
- },
- }
- },
- onReady() {
- // 得到整个组件对象,内部图片列表变量为"lists"
- // this.fileList = this.$refs.uUpload.lists;
- },
- onLoad(options){
- this.jubaolist.id=options.id
- this.jubaolist.compName=options.compName
- },
- methods: {
- filterFileType(index, lists) {
- if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
- lists.splice(index, 1);
- // 当前文件不支持
- uni.showModal({
- title: '暂不支持当前图片类型',
- showCancel: false
- });
- } else {
- this.isAdd = false;
- }
- },
- getImgUrl(res) {
- console.log(res)
- console.log('------------res-----------')
- this.imgUrls.push(res.data.appendixPath);
- },
- commit(){
- var that=this
- this.jubaolist.address=this.imgUrls.toString()
- uni.showModal({
- content: "确定提交举报内容?",
- showCancel: true,
- confirmText: '确定',
- success: function(res) {
- if (res.confirm) {
- that.$api.doRequest('post','/settledCompanyInfo/api/addSettledCompanyError',that.jubaolist).then(res => {
- if(res.data.code==200){
- uni.showToast({
- title: '感谢您的反馈,平台会尽快核实',
- icon: 'none',
- duration: 2000
- })
- uni.navigateBack({
-
- })
- }else{
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration: 2000
- })
- }
- })
- }
- },
- })
- },
- //删除一张图片的回调,lists这是成功删除一个图片后,还剩余的图片集合
- onRemove(data, lists){
- //lists.length > 0说明删除之前已经上传了多余两张的图片
- if(lists.length > 0 ){
- var currentfileList = [];
- //遍历this.fileList 与剩余的lists进行匹配,来组成一个新的格式合适的剩余图片集合
- this.fileList.forEach((item, index)=>{
- lists.forEach((item1, index1)=>{
- if(item.name == JSON.parse(item1.response).name){
- currentfileList.push(item);
- }
- });
- })
- //删除后对图片集合及时冬天更新,即对this.fileList重新赋值
- this.fileList = currentfileList;
- }else{//说明删除之前只有一张图片,删除成功后把this.fileList清空即可
- this.fileList = [];
- }
- this.form.pictureUrl = JSON.stringify(this.fileList)
- //console.log("打印图片List:onRemove", this.fileList);
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page{
- background:#F5F6FA;
- }
- .header-title{
- margin:9.5px;
- padding:16.5px 12.5px;
- background:#fff;
- border-radius:10px;
- height:51px;
- }
- .content{
- padding:12.5px;margin:9px;
- background:#fff;
- border-radius:10px;
- }
- .matter .title{
- font-size:14px;
- margin-bottom:15px;
- }
- .uploading .title{
- font-size:14px;margin-top:13px;margin-bottom:13px;
- }
- .textarea{
- background:#F9F9FA;
- font-size:12px;
- padding:6.5px;
- width:326.5px;height:70px;
- border-radius:5px;
- }
- .words{
- font-size:10px;color:#AFB3BF;position: absolute;right:5px;
- bottom:8px;
- }
- .slot-btn{
- width: 70px;
- height: 70px;
- border-radius: 4px;
- border: 2px dashed #AFB3BF;
- text-align:center;
- }
- .commitwrap{
- position:fixed;bottom:0;left:0;
- width:100%;
- }
- .commit{
- background:#22C572;
- margin:10px 24px;
- text-align:center;
- height:46px;line-height:46px;
- color:#fff;
- font-size:17px;
- border-radius:20px;
- }
- /deep/.u-delete-icon{
- top:0;
- right:0;
- border-radius:0 0 0 15px;
- background:rgba(17, 26, 52, 0.5) !important;
- }
- </style>
|