2025-02-08 02:06:21 +00:00
|
|
|
<script setup>
|
|
|
|
import itemDetail from '@/components/itemDetail/index.vue'
|
2025-02-08 02:16:54 +00:00
|
|
|
import {userArtwork} from "~/api/goods/index.js";
|
2025-02-10 07:47:26 +00:00
|
|
|
|
2025-02-08 02:16:54 +00:00
|
|
|
const route = useRoute()
|
2025-02-10 07:47:26 +00:00
|
|
|
const detail = ref({})
|
2025-02-08 02:16:54 +00:00
|
|
|
const uuid = route.query.uuid
|
2025-02-08 08:24:26 +00:00
|
|
|
|
2025-02-10 07:47:26 +00:00
|
|
|
const initData = async () => {
|
|
|
|
const res = await userArtwork({uuid})
|
|
|
|
if (res.status === 0) {
|
|
|
|
detail.value = res.data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const position = ref({x: window?.innerWidth - 120 || 0, y: 240}) // 设置初始位置在右侧
|
|
|
|
const startPosition = ref({x: 0, y: 0})
|
|
|
|
const isDragging = ref(false)
|
|
|
|
|
|
|
|
const startDrag = (e) => {
|
|
|
|
isDragging.value = true
|
|
|
|
const clientX = e.touches ? e.touches[0].clientX : e.clientX
|
|
|
|
const clientY = e.touches ? e.touches[0].clientY : e.clientY
|
|
|
|
startPosition.value = {
|
|
|
|
x: clientX - position.value.x,
|
|
|
|
y: clientY - position.value.y
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const onDrag = (e) => {
|
|
|
|
if (isDragging.value) {
|
|
|
|
const clientX = e.touches ? e.touches[0].clientX : e.clientX
|
|
|
|
const clientY = e.touches ? e.touches[0].clientY : e.clientY
|
|
|
|
|
|
|
|
// 获取窗口尺寸
|
|
|
|
const maxX = window.innerWidth - 108 // 减去元素宽度
|
|
|
|
const maxY = window.innerHeight - 137 // 减去元素高度
|
|
|
|
|
|
|
|
// 限制范围
|
|
|
|
const x = Math.min(Math.max(0, clientX - startPosition.value.x), maxX)
|
|
|
|
const y = Math.min(Math.max(0, clientY - startPosition.value.y), maxY)
|
|
|
|
|
|
|
|
position.value = {x, y}
|
2025-02-08 02:16:54 +00:00
|
|
|
}
|
|
|
|
}
|
2025-02-10 07:47:26 +00:00
|
|
|
|
|
|
|
const stopDrag = () => {
|
|
|
|
isDragging.value = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
// 鼠标事件
|
|
|
|
document.addEventListener('mousemove', onDrag)
|
|
|
|
document.addEventListener('mouseup', stopDrag)
|
|
|
|
// 触摸事件
|
|
|
|
document.addEventListener('touchmove', onDrag)
|
|
|
|
document.addEventListener('touchend', stopDrag)
|
|
|
|
})
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
document.removeEventListener('mousemove', onDrag)
|
|
|
|
document.removeEventListener('mouseup', stopDrag)
|
|
|
|
document.removeEventListener('touchmove', onDrag)
|
|
|
|
document.removeEventListener('touchend', stopDrag)
|
|
|
|
})
|
|
|
|
|
2025-02-08 02:16:54 +00:00
|
|
|
initData()
|
2025-02-08 02:06:21 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2025-02-10 07:47:26 +00:00
|
|
|
<div class="relative h-screen-nav flex flex-col">
|
|
|
|
<itemDetail class="grow-1" :detail-info="detail.auctionArtworkInfo"/>
|
|
|
|
<div v-if="[1,3,4].includes(detail.status)" class="h-81px bg-#fff flex justify-center pt-7px">
|
|
|
|
<van-button class="w-213px !h-38px" type="primary">
|
2025-02-12 06:34:05 +00:00
|
|
|
<span class="text-#fff text-14px">{{ $t('art_detail_page.button') }} RMB10,000</span>
|
2025-02-10 07:47:26 +00:00
|
|
|
</van-button>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
class="w-108px h-137px absolute cursor-move"
|
|
|
|
:style="{
|
|
|
|
left: position.x + 'px',
|
|
|
|
top: position.y + 'px'
|
|
|
|
}"
|
|
|
|
@mousedown="startDrag"
|
|
|
|
@touchstart.prevent="startDrag"
|
|
|
|
>
|
|
|
|
<img src="@/static/images/zd5530@2x.png" class="w-full h-full" alt="">
|
|
|
|
<div
|
|
|
|
class="flex flex-col items-center absolute bottom-25px text-14px text-#B58047 left-1/2 transform translate-x--1/2 whitespace-nowrap">
|
2025-02-12 06:34:05 +00:00
|
|
|
<div>{{ $t('art_detail_page.prompt_title')}}</div>
|
|
|
|
<div>{{ $t('art_detail_page.prompt_desc')}}</div>
|
2025-02-10 07:47:26 +00:00
|
|
|
</div>
|
2025-02-08 02:06:21 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
2025-02-10 07:47:26 +00:00
|
|
|
.cursor-move {
|
|
|
|
touch-action: none;
|
|
|
|
user-select: none;
|
|
|
|
}
|
2025-02-08 02:06:21 +00:00
|
|
|
</style>
|