|
@@ -15,10 +15,10 @@
|
|
|
</li>
|
|
</li>
|
|
|
</div>
|
|
</div>
|
|
|
<div v-if='disableds'>
|
|
<div v-if='disableds'>
|
|
|
- <li v-if="showImgList.length < num" class="uploadImg"
|
|
|
|
|
|
|
+ <li v-if="showImgList.length < num" class="uploadImg"
|
|
|
:style="{ width: size + 'rpx', height: size + 'rpx' }">
|
|
:style="{ width: size + 'rpx', height: size + 'rpx' }">
|
|
|
<view class="iconfont"></view>
|
|
<view class="iconfont"></view>
|
|
|
- </li>
|
|
|
|
|
|
|
+ </li>
|
|
|
</div>
|
|
</div>
|
|
|
<!-- <li v-if="(showImgList.length < num)&&(disabled==false)" class="uploadImg" @click="chooseImage"
|
|
<!-- <li v-if="(showImgList.length < num)&&(disabled==false)" class="uploadImg" @click="chooseImage"
|
|
|
:style="{ width: size + 'rpx', height: size + 'rpx' }">
|
|
:style="{ width: size + 'rpx', height: size + 'rpx' }">
|
|
@@ -91,8 +91,8 @@ export default {
|
|
|
showImgList: [],
|
|
showImgList: [],
|
|
|
base64ImgList: [],
|
|
base64ImgList: [],
|
|
|
xssarr: ['data:', 'text', 'txt', 'html', 'js', 'css', 'json', 'exe', 'sql', 'xml', 'doc', 'docx'],
|
|
xssarr: ['data:', 'text', 'txt', 'html', 'js', 'css', 'json', 'exe', 'sql', 'xml', 'doc', 'docx'],
|
|
|
- disableds:true,
|
|
|
|
|
- http:this.$constant.formal
|
|
|
|
|
|
|
+ disableds: true,
|
|
|
|
|
+ http: this.$constant.formal
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onLoad() {
|
|
onLoad() {
|
|
@@ -109,13 +109,13 @@ export default {
|
|
|
uni.removeStorageSync(this.saveStr)
|
|
uni.removeStorageSync(this.saveStr)
|
|
|
}
|
|
}
|
|
|
this.showImgList = [...this.imgList]
|
|
this.showImgList = [...this.imgList]
|
|
|
- //this.showImgList = this.imgList
|
|
|
|
|
- //console.log('组件',this.imgList)
|
|
|
|
|
|
|
+ // this.showImgList = this.imgList
|
|
|
|
|
+ // console.log('组件',this.imgList)
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
chooseImage: async function() {
|
|
chooseImage: async function() {
|
|
|
if (this.disabled) {
|
|
if (this.disabled) {
|
|
|
- return
|
|
|
|
|
|
|
+ return
|
|
|
}
|
|
}
|
|
|
let that = this
|
|
let that = this
|
|
|
let tempFilePaths = await that.getImage()
|
|
let tempFilePaths = await that.getImage()
|
|
@@ -134,7 +134,7 @@ export default {
|
|
|
let base64ImgList = that.base64ImgList
|
|
let base64ImgList = that.base64ImgList
|
|
|
let params = {}
|
|
let params = {}
|
|
|
if (base64ImgList.length === 1) {
|
|
if (base64ImgList.length === 1) {
|
|
|
- //params['file[content]'] = base64ImgList[0]
|
|
|
|
|
|
|
+ // params['file[content]'] = base64ImgList[0]
|
|
|
params.coding = base64ImgList[0]
|
|
params.coding = base64ImgList[0]
|
|
|
} else {
|
|
} else {
|
|
|
base64ImgList.forEach((item, index) => {
|
|
base64ImgList.forEach((item, index) => {
|
|
@@ -157,15 +157,15 @@ export default {
|
|
|
that.showImgList.unshift(imgs)
|
|
that.showImgList.unshift(imgs)
|
|
|
let showing = that.showImgList
|
|
let showing = that.showImgList
|
|
|
let imgbox = []
|
|
let imgbox = []
|
|
|
- showing.map((item,index)=>{
|
|
|
|
|
|
|
+ showing.map((item, index) => {
|
|
|
let imgs = {}
|
|
let imgs = {}
|
|
|
- if(item.url){
|
|
|
|
|
- imgs.url = item.url
|
|
|
|
|
- // imgs.urls = that.$constant.formal + item.url
|
|
|
|
|
- }else{
|
|
|
|
|
|
|
+ if (item.url) {
|
|
|
|
|
+ imgs.url = item.url
|
|
|
|
|
+ // imgs.urls = that.$constant.formal + item.url
|
|
|
|
|
+ } else {
|
|
|
imgs.url = item
|
|
imgs.url = item
|
|
|
- // imgs.urls = that.$constant.formal +item
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // imgs.urls = that.$constant.formal +item
|
|
|
|
|
+ }
|
|
|
imgbox.push(imgs)
|
|
imgbox.push(imgs)
|
|
|
})
|
|
})
|
|
|
that.showImgList = imgbox
|
|
that.showImgList = imgbox
|
|
@@ -292,7 +292,7 @@ export default {
|
|
|
// })
|
|
// })
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
|
- //文件类型设置
|
|
|
|
|
|
|
+ // 文件类型设置
|
|
|
let spl = tempFiles[i].path.split('.')
|
|
let spl = tempFiles[i].path.split('.')
|
|
|
let fileType = spl[spl.length - 1]
|
|
let fileType = spl[spl.length - 1]
|
|
|
if (fileType && this.xssarr.indexOf(fileType) >= 0) {
|
|
if (fileType && this.xssarr.indexOf(fileType) >= 0) {
|
|
@@ -309,8 +309,8 @@ export default {
|
|
|
res.tempFiles = newtempFiles
|
|
res.tempFiles = newtempFiles
|
|
|
res.tempFilePaths = newtempFilePaths
|
|
res.tempFilePaths = newtempFilePaths
|
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
|
- title: '图片上传中...',
|
|
|
|
|
- mask: true
|
|
|
|
|
|
|
+ title: '图片上传中...',
|
|
|
|
|
+ mask: true
|
|
|
})
|
|
})
|
|
|
// console.log('过滤完了')
|
|
// console.log('过滤完了')
|
|
|
},
|
|
},
|