feat: sketchDetail接口
This commit is contained in:
24
src/views/SellerDashboard/MyListings/EditDetail/api.ts
Normal file
24
src/views/SellerDashboard/MyListings/EditDetail/api.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Https } from "@/tool/https"
|
||||
|
||||
interface SketchIDs {
|
||||
designItemIds: Array
|
||||
}
|
||||
export const fetchSketchDetail = (data: SketchIDs) => {
|
||||
let params = "?"
|
||||
data.forEach((id, index) => {
|
||||
if (index === data.length - 1) {
|
||||
params += `designItemIds=${id}`
|
||||
} else {
|
||||
params += `designItemIds=${id}&`
|
||||
}
|
||||
})
|
||||
return Https.axiosGet(`/api/seller/sketchDetail${params}`)
|
||||
}
|
||||
|
||||
export const uploadFile = (file) => {
|
||||
const formData = new FormData()
|
||||
formData.append("file", file)
|
||||
return Https.axiosPost("/seller/file/ upload", formData, {
|
||||
headers: { "Content-Type": "multipart/form-data", Accept: "*/*" }
|
||||
})
|
||||
}
|
||||
@@ -230,14 +230,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch, defineOptions } from "vue"
|
||||
import { computed, ref, watch, defineOptions,onMounted } from "vue"
|
||||
import { useRouter } from "vue-router"
|
||||
import SellerHeader from "../../seller-header.vue"
|
||||
import testImg from "@/assets/images/test.png"
|
||||
import Radio from "./components/Radio.vue"
|
||||
import ImageClipDialog from "../../BrandProfile/image-clip-dialog.vue"
|
||||
import { Https } from "@/tool/https"
|
||||
import { useStore } from "vuex"
|
||||
import { fetchSketchDetail, uploadFile } from "./api"
|
||||
|
||||
const ROUTER = useRouter()
|
||||
|
||||
@@ -400,7 +400,7 @@ const handleSelectProdImg = (index: number) => {
|
||||
|
||||
const cropType = ref("")
|
||||
const handleClickCrop = (data, type) => {
|
||||
console.log(data, type)
|
||||
// console.log(data, type)
|
||||
const titleList = {
|
||||
sketch: "Crop Sketch",
|
||||
mainProductImage: "Crop Main Product Image",
|
||||
@@ -412,7 +412,11 @@ const handleClickCrop = (data, type) => {
|
||||
imageClipDialogRef.value.open(
|
||||
data,
|
||||
(file) => {
|
||||
selectList.value[currentIndex.value].sketch = URL.createObjectURL(file)
|
||||
// console.log(file)
|
||||
uploadFile(file).then((res) => {
|
||||
console.log(res)
|
||||
selectList.value[currentIndex.value].sketch = res
|
||||
})
|
||||
},
|
||||
{ ratio, isPreview: true, title: titleList[type], isProduct: true }
|
||||
)
|
||||
@@ -429,6 +433,13 @@ const handleClickMenu = (status: "draft" | "publish") => {
|
||||
ROUTER.push({ name: "Status", params: { status: "publish" } })
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchSketchDetail([666163, 666164]).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
Reference in New Issue
Block a user