|
@@ -8,14 +8,18 @@
|
|
|
<view class="mack" @tap.stop="() => {}"></view>
|
|
|
<image @tap.stop="() => {}" class="uploadImg" mode="aspectFit" src="/static/upload/loading.png"> </image>
|
|
|
</template>
|
|
|
- <image class="delImg" mode="aspectFit" src="/static/upload/del.png" @tap.stop="del(index)"> </image>
|
|
|
+ <template v-if="!disabled">
|
|
|
+ <image class="delImg" mode="aspectFit" src="/static/upload/del.png" @tap.stop="del(index)"> </image>
|
|
|
+ </template>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view v-if="count === 0 ? true : count - files.length" class="file-upload-view" @click="upload">
|
|
|
- <view class="file-upload-ckick">
|
|
|
- <image class="uploadImg" mode="aspectFit" src="/static/upload/upload.png"> </image>
|
|
|
+ <template v-if="!disabled">
|
|
|
+ <view v-if="count === 0 ? true : count - files.length" class="file-upload-view" @click="upload">
|
|
|
+ <view class="file-upload-ckick">
|
|
|
+ <image class="uploadImg" mode="aspectFit" src="/static/upload/upload.png"> </image>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </template>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -27,6 +31,10 @@ import { b64_md5 } from '@/common/utils/md5.js'
|
|
|
import loadingImg from './loading.png'
|
|
|
export default {
|
|
|
props: {
|
|
|
+ disabled: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
count: {
|
|
|
type: Number,
|
|
|
default: 0
|
|
@@ -59,7 +67,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 检查文件类型
|
|
|
+ // 检查文件类型
|
|
|
checkFileType(url) {
|
|
|
if (!url) return ''
|
|
|
const fileSuffix = url.substring(url.lastIndexOf('.') + 1)
|
|
@@ -81,7 +89,7 @@ export default {
|
|
|
return 'pdf'
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
setFileVal(arr) {
|
|
|
return arr.map(item => {
|
|
|
if (typeof item == 'string') {
|
|
@@ -98,14 +106,14 @@ export default {
|
|
|
uni.chooseImage({
|
|
|
count: this.count === 0 ? 0 : this.count - this.files.length,
|
|
|
success: async res => {
|
|
|
- let pathType = this.checkFileType(res.tempFiles[0].name)
|
|
|
- if(pathType !== 'image'){
|
|
|
+ let pathType = this.checkFileType(res.tempFiles[0].name)
|
|
|
+ if (pathType !== 'image') {
|
|
|
return this.$toast('当前格式仅支持jpg, jpeg, png,请检查')
|
|
|
}
|
|
|
// #ifdef H5
|
|
|
- uploadImgs(res.tempFiles[0]).then(res=>{
|
|
|
+ uploadImgs(res.tempFiles[0]).then(res => {
|
|
|
this.files.push({
|
|
|
- url:res.url
|
|
|
+ url: res.url
|
|
|
})
|
|
|
})
|
|
|
// #endif
|
|
@@ -113,7 +121,6 @@ export default {
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
|
// #endif
|
|
|
-
|
|
|
},
|
|
|
fail: err => {
|
|
|
console.log(err)
|