feat: 新增未展览点赞提示

This commit is contained in:
zheng020 2026-05-12 16:45:38 +08:00
parent 11df4cd8e9
commit 023d708bf9

View File

@ -10,21 +10,21 @@
</view>
</view>
<!-- 加载中 -->
<view v-if="loading" class="loading-wrapper">
<!-- 旋转光环 -->
<view class="loading-ring-outer">
<view class="loading-ring"></view>
<!-- 加载中 -->
<view v-if="loading" class="loading-wrapper">
<!-- 旋转光环 -->
<view class="loading-ring-outer">
<view class="loading-ring"></view>
</view>
<!-- 三颗脉冲粒子 -->
<view class="loading-dots">
<view class="loading-dot dot-1"></view>
<view class="loading-dot dot-2"></view>
<view class="loading-dot dot-3"></view>
</view>
<!-- 文字淡入淡出 -->
<text class="loading-text">正在加载藏品...</text>
</view>
<!-- 三颗脉冲粒子 -->
<view class="loading-dots">
<view class="loading-dot dot-1"></view>
<view class="loading-dot dot-2"></view>
<view class="loading-dot dot-3"></view>
</view>
<!-- 文字淡入淡出 -->
<text class="loading-text">正在加载藏品...</text>
</view>
<!-- 错误状态 -->
<view v-else-if="loadError" class="error-wrapper">
@ -38,23 +38,16 @@
<!-- 藏品卡片区域 -->
<view class="card-section">
<view class="card-wrapper">
<NftCard
:cover-image="coverUrl"
:width="cardSize"
:height="cardSize"
:custom-style="nftCardStyle"
/>
<NftCard :cover-image="coverUrl" :width="cardSize" :height="cardSize"
:custom-style="nftCardStyle" />
</view>
<!-- 点赞 + 倒计时行 -->
<view class="card-meta-row">
<!-- 点赞 -->
<view class="like-area" @tap="handleLike">
<image
:src="isLiked ? '/static/icon/like-after.png' : '/static/icon/like-before.png'"
class="like-icon"
mode="aspectFit"
/>
<view class="like-area" @tap="handleLike">
<image :src="isLiked ? '/static/icon/like-after.png' : '/static/icon/like-before.png'"
class="like-icon" mode="aspectFit" />
<text class="like-num">{{ likeCount }}</text>
</view>
@ -101,10 +94,7 @@
</view>
<view class="chain-row">
<text class="chain-label">交易哈希</text>
<text
class="chain-value chain-hash"
@longpress="copyHash"
>{{ displayTxHash }}</text>
<text class="chain-value chain-hash" @longpress="copyHash">{{ displayTxHash }}</text>
</view>
</view>
</view>
@ -268,9 +258,9 @@ const handleLike = async () => {
// isLiked.value = false;
// likeCount.value = Math.max(0, likeCount.value - 1);
// } else {
await likeAssetApi(assetData.value.asset_id);
isLiked.value = true;
likeCount.value += 1;
await likeAssetApi(assetData.value.asset_id);
isLiked.value = true;
likeCount.value += 1;
// }
//
uni.$emit('assetLikeChanged', {
@ -279,7 +269,13 @@ const handleLike = async () => {
is_liked: isLiked.value
});
} catch (err) {
uni.showToast({ title: err.message || '操作失败', icon: 'none', duration: 2000 });
const errMsg = err?.message || '';
const errCode = err?.code || err?.data?.code || '';
if (errMsg.includes('未在展示中')) {
uni.showToast({ title: '未展览无法点赞', icon: 'none', duration: 2000 });
} else {
uni.showToast({ title: '今日已点赞', icon: 'none', duration: 2000 });
}
} finally {
liking.value = false;
}
@ -407,8 +403,13 @@ onUnmounted(() => {
}
@keyframes ring-spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* 三颗脉冲粒子 */
@ -444,10 +445,13 @@ onUnmounted(() => {
}
@keyframes dot-pulse {
0%, 100% {
0%,
100% {
transform: scale(0.6);
opacity: 0.4;
}
50% {
transform: scale(1.3);
opacity: 1;
@ -464,8 +468,15 @@ onUnmounted(() => {
}
@keyframes text-breathe {
0%, 100% { opacity: 0.5; }
50% { opacity: 1; }
0%,
100% {
opacity: 0.5;
}
50% {
opacity: 1;
}
}
.error-text {