2024-04-12 17:57:52 +08:00
|
|
|
<template>
|
2024-04-19 15:55:13 +08:00
|
|
|
<view class="content_upload" :style="contentStyle">
|
2024-04-12 17:57:52 +08:00
|
|
|
<u-upload :fileList="ImgUrl" @afterRead="afterRead" :deletable="true" @delete="deletePic" name="6" :maxCount="1"
|
2024-04-18 14:30:35 +08:00
|
|
|
:width="width" :height="height">
|
2024-04-19 15:55:13 +08:00
|
|
|
<image :src="backImg" :style="`width: ${width}px;height: ${height}px;`"></image>
|
|
|
|
|
<image class="iconimg" src="/static/img/Takingpictures.png"
|
|
|
|
|
:style="`width: ${width/4}px;height: ${width/4}px;`"></image>
|
2024-04-12 17:57:52 +08:00
|
|
|
</u-upload>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
uploadFile
|
|
|
|
|
} from '@/api/upload.js'
|
|
|
|
|
export default {
|
|
|
|
|
name: 'UploadIdNumber',
|
|
|
|
|
props: {
|
|
|
|
|
backImg: {
|
|
|
|
|
type: String,
|
|
|
|
|
require: true,
|
|
|
|
|
},
|
|
|
|
|
value: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: null
|
2024-04-18 14:30:35 +08:00
|
|
|
},
|
|
|
|
|
width: {
|
|
|
|
|
type: Number,
|
2024-04-19 15:55:13 +08:00
|
|
|
default: 280
|
2024-04-18 14:30:35 +08:00
|
|
|
},
|
|
|
|
|
height: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: 150
|
|
|
|
|
},
|
2024-04-19 15:55:13 +08:00
|
|
|
contentStyle: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ''
|
|
|
|
|
}
|
2024-04-12 17:57:52 +08:00
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
ImgUrl(val) {
|
2024-04-22 15:59:25 +08:00
|
|
|
return this.value ? [{
|
|
|
|
|
name: 'img.jpg',
|
|
|
|
|
url: this.value
|
|
|
|
|
}] : []
|
2024-04-12 17:57:52 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
afterRead({
|
|
|
|
|
file,
|
|
|
|
|
index,
|
|
|
|
|
name
|
|
|
|
|
}) {
|
|
|
|
|
// this.$emit("input", file);
|
2024-04-22 15:59:25 +08:00
|
|
|
uploadFile(file).then((url) => {
|
2024-04-12 17:57:52 +08:00
|
|
|
this.$emit("input", url);
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
deletePic() {
|
|
|
|
|
this.$emit("input", null);
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2024-04-19 15:55:13 +08:00
|
|
|
.content_upload {
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.iconimg {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 50%;
|
|
|
|
|
top: 50%;
|
|
|
|
|
transform: translate(-50%, -50%);
|
2024-04-12 17:57:52 +08:00
|
|
|
}
|
|
|
|
|
</style>
|