This commit is contained in:
sa_10_0 2024-10-31 19:43:35 +08:00
parent 3f1c339634
commit b0615ba36d

View File

@ -109,7 +109,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref,reactive,onMounted } from 'vue'; import { ref,reactive,onMounted } from 'vue';
import { Delete, Plus, ZoomIn } from '@element-plus/icons-vue'; import { Delete, Plus, ZoomIn } from '@element-plus/icons-vue';
import type { UploadFile } from 'element-plus'; import {ElMessage, type UploadFile} from 'element-plus';
import myAxios from "@/api/myAxios"; import myAxios from "@/api/myAxios";
const dialogImageUrl = ref(''); const dialogImageUrl = ref('');
@ -139,6 +139,7 @@ const form = reactive({
}) })
onMounted(()=>{ onMounted(()=>{
addProduct() addProduct()
upload()
}) })
const addProduct = async () => { const addProduct = async () => {
const res = await myAxios.post('goods/add',{ const res = await myAxios.post('goods/add',{
@ -148,11 +149,25 @@ const addProduct = async () => {
type: form.resource, type: form.resource,
label : form.label, label : form.label,
intro : form.desc, intro : form.desc,
goodImage : file.url,
introDetail : file.url,
festivalOrder : form.festivalName festivalOrder : form.festivalName
}) })
console.log(res.data) if(res.data.code == 1){
ElMessage({
message: '上架成功',
type: 'success'
})
}else{
ElMessage({
message: '上架失败',
type: 'error'
})
}
}
const upload = async () => {
const res = await myAxios.post('file/upload/server',{
multipartFile : uploadedFiles.value,
biz : uploadedDescription.value
})
} }
// onMounted(() => { // onMounted(() => {
// getProductInformation() // getProductInformation()