refactor(app): 优化多个组件和 API 请求处理

- 移除不必要的 Promise.reject
- 修正请求体参数名
- 移除未使用的 import
- 优化首页布局和弹窗组件
- 添加文本溢出样式
This commit is contained in:
xingyy 2025-01-22 13:28:21 +08:00
parent 63e24791f2
commit 05cd427430
5 changed files with 65 additions and 7 deletions

View File

@ -5,7 +5,7 @@ export async function senCode(data) {
return await request({
url:'/api/v1/m/user/send',
method: 'POST',
body: data,
data
})
}
export async function userLogin(data) {

View File

@ -61,7 +61,6 @@ export function setupHttp() {
// 处理业务错误
if (data.status === 1) {
message.error(data.msg || '操作失败')
return Promise.reject(new Error(data.msg))
}
// 处理登录失效
@ -69,7 +68,6 @@ export function setupHttp() {
message.error('登录已过期,请重新登录')
token.value = '' // 清除 token
router.replace('/login')
return Promise.reject(new Error('未登录或登录已过期'))
}
return response

View File

@ -40,5 +40,6 @@ const { quoteStatus, changeStatus,show,show1 } = liveStore();
<div class="text-10px">去支付</div>
</div>
</PressableButton>
</div>
</template>

View File

@ -1,6 +1,5 @@
<script setup>
import { useImage } from '@vueuse/core'
const props = defineProps({
items: Array,
colIndex: {

View File

@ -5,7 +5,9 @@ import ItemList from './components/ItemList/index.vue'
import Cescribe from './components/Cescribe/index.vue'
import {artworkList} from "~/api/goods/index.js";
const {fullLive,getAuctionDetail,auctionDetail,itemList,pageRef,liveRef} = goodStore();
import {ref} from "vue";
const {fullLive, getAuctionDetail, auctionDetail, itemList, pageRef, liveRef} = goodStore();
definePageMeta({
layout: 'default',
i18n: 'menu.home',
@ -13,14 +15,16 @@ definePageMeta({
const changeLive = () => {
fullLive.value = true;
};
const showBottom = ref(true)
</script>
<template>
<div class="flex-grow-1">
<client-only>
<LiveRoom @click="changeLive" :class="['changeLive', fullLive ? 'expanded' : 'collapsed']" ref="liveRef" :fullLive="fullLive"/>
</client-only>
<LiveRoom @click="changeLive" :class="['changeLive', fullLive ? 'expanded' : 'collapsed']" ref="liveRef"
:fullLive="fullLive"/>
</client-only>
<div v-show="!fullLive" class="bg-#fff">
<van-tabs sticky animated>
<van-tab title="拍品列表">
@ -32,6 +36,55 @@ const changeLive = () => {
</van-tabs>
<van-back-top right="15vw" bottom="10vh"/>
</div>
<van-popup
v-model:show="showBottom"
position="bottom"
:style="{ height: '74%' }"
>
<div class="flex flex-col">
<div class="h-40px flex items-center pl-16px pr-19px border-b-1px border-b-[#D3D3D3]">
<div class="text-#000 text-16px">拍品列表</div>
<div class="text-#939393 text-16px ml-14px">共188个拍品</div>
<div class="ml-auto flex items-center">
<van-icon size="20" name="cross" color="#939393"/>
</div>
</div>
<div class="flex-grow-1 px-16px py-18px">
<div>
<div class="flex mb-21px">
<div class="mr-10px flex-shrink-0">
<img class="w-80px h-80px" src="@/static/images/ddfdcaer.png" alt="">
</div>
<div>
<div class="ellipsis line-height-20px text-16px font-600 min-h-40px">张天赐 | 日出而作日落而息撒打算撒打算撒打决赛多久啊是世奥兰日落而息撒打算撒打算撒打决赛多久啊是世奥兰</div>
<div class="text-14px text-#575757">起拍价RMB 1,000</div>
<div class="text-14px text-#B58047">成交价等待更新</div>
</div>
</div>
<div class="flex mb-21px">
<div class="mr-10px flex-shrink-0">
<img class="w-80px h-80px" src="@/static/images/ddfdcaer.png" alt="">
</div>
<div>
<div class="ellipsis line-height-20px text-16px font-600 min-h-40px">张天赐 | 日出而作日落而息撒打算撒打算撒打决赛多久啊是世奥兰日落而息撒打算撒打算撒打决赛多久啊是世奥兰</div>
<div class="text-14px text-#575757">起拍价RMB 1,000</div>
<div class="text-14px text-#B58047">成交价等待更新</div>
</div>
</div>
<div class="flex mb-21px">
<div class="mr-10px flex-shrink-0">
<img class="w-80px h-80px" src="@/static/images/ddfdcaer.png" alt="">
</div>
<div>
<div class="ellipsis line-height-20px text-16px font-600 min-h-40px">张天赐 | 日出而作</div>
<div class="text-14px text-#575757">起拍价RMB 1,000</div>
<div class="text-14px text-#B58047">成交价等待更新</div>
</div>
</div>
</div>
</div>
</div>
</van-popup>
</div>
</template>
<style>
@ -40,6 +93,13 @@ const changeLive = () => {
}
</style>
<style scoped lang="scss">
.ellipsis {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
}
:deep(.van-swipe__indicator) {
width: 8px;
height: 8px;