|
|
|
@ -8,11 +8,13 @@
|
|
|
|
|
action="#"
|
|
|
|
|
class="avatar-uploader"
|
|
|
|
|
>
|
|
|
|
|
<img v-if="imageUrl" :src="imageUrl" class="avatar"/>
|
|
|
|
|
<el-icon v-else class="avatar-uploader-icon">
|
|
|
|
|
<el-icon class="avatar-uploader-icon">
|
|
|
|
|
<Plus/>
|
|
|
|
|
</el-icon>
|
|
|
|
|
</el-upload>
|
|
|
|
|
<div v-for="item in imageUrl" style="margin: 0 12px">
|
|
|
|
|
<img v-if="item" :src="item" class="avatar"/>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" @click="onSubmit">Create</el-button>
|
|
|
|
@ -35,23 +37,22 @@ const {t} = useI18n();
|
|
|
|
|
const locale = (Cookies.get('language') || 'zhCn') === 'zhCn'
|
|
|
|
|
const {proxy} = getCurrentInstance();
|
|
|
|
|
const {sys_normal_disable} = proxy.useDict("sys_normal_disable");
|
|
|
|
|
const imageUrl = ref('')
|
|
|
|
|
const imageUrl = ref([''])
|
|
|
|
|
|
|
|
|
|
const form = reactive({
|
|
|
|
|
imgUrl: '',
|
|
|
|
|
const form = ref({
|
|
|
|
|
imgUrl: [''],
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const onSubmit = () => {
|
|
|
|
|
console.log('submit!')
|
|
|
|
|
}
|
|
|
|
|
const requestUpload = (e) => {
|
|
|
|
|
console.log(e)
|
|
|
|
|
let formData = new FormData();
|
|
|
|
|
formData.append("avatarfile", e.file);
|
|
|
|
|
uploadImg(formData).then(response => {
|
|
|
|
|
console.log(response)
|
|
|
|
|
form.value.imgUrl = response.imgUrl
|
|
|
|
|
imageUrl.value = import.meta.env.VITE_APP_BASE_API+response.imgUrl
|
|
|
|
|
form.value.imgUrl.push(response.imgUrl)
|
|
|
|
|
imageUrl.value.push(import.meta.env.VITE_APP_BASE_API + response.imgUrl)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|