123
This commit is contained in:
parent
c9522f8e24
commit
c4c44a90f5
@ -20,3 +20,11 @@ export const competitionApply = (data) => {
|
||||
data,
|
||||
})
|
||||
}
|
||||
export const uploadFile = (data) => {
|
||||
return request({
|
||||
isFormData:true,
|
||||
url: '/api/upload/file',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ const request = new Request({
|
||||
const token=localStorage.getItem('token')
|
||||
config.headers['Content-Type'] = config.method === 'get' ?
|
||||
'application/x-www-form-urlencoded' :
|
||||
'application/json';
|
||||
'application/json'
|
||||
if (config.isFormData) {
|
||||
config.headers['Content-Type'] = 'multipart/form-data';
|
||||
config.headers['Authorization'] = token
|
||||
|
@ -1,13 +1,19 @@
|
||||
<script setup>
|
||||
import {ref} from "vue";
|
||||
import {useAuth} from "@/store/auth/index.js";
|
||||
import {uploadFile} from "@/api/auth/index.js";
|
||||
const {clickApply,formData,genderOptions,clickAddWorks,removeWorks} =useAuth()
|
||||
const showPicker=ref(false)
|
||||
function onConfirm(data){
|
||||
formData.value.gender=data.selectedValues?.[0]
|
||||
showPicker.value=false
|
||||
}
|
||||
|
||||
const afterRead=(file)=>{
|
||||
const formData = new FormData()
|
||||
formData.append("file", file.file)
|
||||
formData.append("type", 'image')
|
||||
uploadFile(formData)
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div class="box-border relative w-1920px h-screen bg-no-repeat bg-cover bg-[url('@/assets/image/zu3237.png')] flex items-center flex-col">
|
||||
@ -39,11 +45,12 @@ function onConfirm(data){
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex mt-77px flex-col items-center w-full pt-46px h-1382px bg-[#F5F5F5] w-1490px overflow-y-auto pr-44px pl-44px">
|
||||
<div :class="`flex w-full ${formData.works?.length>1?'pb-102px border-b-1px border-b-[#D6E0E9] border-b-solid mb-97px':''}`" v-for="(item,index) of formData.works" :key="index">
|
||||
|
||||
<div :class="`flex w-full ${formData.works?.length>1&&index+1!==formData.works?.length?'border-b-1px border-b-[#D6E0E9] border-b-solid mb-97px pb-102px':''}` " v-for="(item,index) of formData.works" :key="index">
|
||||
<div class="w-265px shrink-0 font-bold text-[#2B69A1]">*作品{{index+1}}</div>
|
||||
<div>
|
||||
<div class="flex items-end">
|
||||
<van-uploader>
|
||||
<van-uploader :after-read="afterRead">
|
||||
<div class="w-410px h-410px bg-[#D6E0E9] rounded-20px flex flex-col items-center justify-center">
|
||||
<img class="w-88px h-88px" src="@/assets/image/zu3264@2x.png" alt="">
|
||||
<div class="mt-36px text-[#2B69A1] text-72px">上传作品</div>
|
||||
|
Loading…
Reference in New Issue
Block a user