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> </view>
<!-- 加载中 --> <!-- 加载中 -->
<view v-if="loading" class="loading-wrapper"> <view v-if="loading" class="loading-wrapper">
<!-- 旋转光环 --> <!-- 旋转光环 -->
<view class="loading-ring-outer"> <view class="loading-ring-outer">
<view class="loading-ring"></view> <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>
<!-- 三颗脉冲粒子 -->
<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"> <view v-else-if="loadError" class="error-wrapper">
@ -38,23 +38,16 @@
<!-- 藏品卡片区域 --> <!-- 藏品卡片区域 -->
<view class="card-section"> <view class="card-section">
<view class="card-wrapper"> <view class="card-wrapper">
<NftCard <NftCard :cover-image="coverUrl" :width="cardSize" :height="cardSize"
:cover-image="coverUrl" :custom-style="nftCardStyle" />
:width="cardSize"
:height="cardSize"
:custom-style="nftCardStyle"
/>
</view> </view>
<!-- 点赞 + 倒计时行 --> <!-- 点赞 + 倒计时行 -->
<view class="card-meta-row"> <view class="card-meta-row">
<!-- 点赞 --> <!-- 点赞 -->
<view class="like-area" @tap="handleLike"> <view class="like-area" @tap="handleLike">
<image <image :src="isLiked ? '/static/icon/like-after.png' : '/static/icon/like-before.png'"
:src="isLiked ? '/static/icon/like-after.png' : '/static/icon/like-before.png'" class="like-icon" mode="aspectFit" />
class="like-icon"
mode="aspectFit"
/>
<text class="like-num">{{ likeCount }}</text> <text class="like-num">{{ likeCount }}</text>
</view> </view>
@ -101,10 +94,7 @@
</view> </view>
<view class="chain-row"> <view class="chain-row">
<text class="chain-label">交易哈希</text> <text class="chain-label">交易哈希</text>
<text <text class="chain-value chain-hash" @longpress="copyHash">{{ displayTxHash }}</text>
class="chain-value chain-hash"
@longpress="copyHash"
>{{ displayTxHash }}</text>
</view> </view>
</view> </view>
</view> </view>
@ -268,9 +258,9 @@ const handleLike = async () => {
// isLiked.value = false; // isLiked.value = false;
// likeCount.value = Math.max(0, likeCount.value - 1); // likeCount.value = Math.max(0, likeCount.value - 1);
// } else { // } else {
await likeAssetApi(assetData.value.asset_id); await likeAssetApi(assetData.value.asset_id);
isLiked.value = true; isLiked.value = true;
likeCount.value += 1; likeCount.value += 1;
// } // }
// //
uni.$emit('assetLikeChanged', { uni.$emit('assetLikeChanged', {
@ -279,7 +269,13 @@ const handleLike = async () => {
is_liked: isLiked.value is_liked: isLiked.value
}); });
} catch (err) { } 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 { } finally {
liking.value = false; liking.value = false;
} }
@ -305,7 +301,7 @@ onShow(() => {
console.log('onShow 触发'); console.log('onShow 触发');
const currentKey = `${assetIdParam.value}_${orderIdParam.value}`; const currentKey = `${assetIdParam.value}_${orderIdParam.value}`;
console.log('当前key:', currentKey, '上次key:', lastLoadKey.value); console.log('当前key:', currentKey, '上次key:', lastLoadKey.value);
// //
if ((assetIdParam.value || orderIdParam.value) && currentKey !== lastLoadKey.value) { if ((assetIdParam.value || orderIdParam.value) && currentKey !== lastLoadKey.value) {
lastLoadKey.value = currentKey; lastLoadKey.value = currentKey;
@ -407,8 +403,13 @@ onUnmounted(() => {
} }
@keyframes ring-spin { @keyframes ring-spin {
0% { transform: rotate(0deg); } 0% {
100% { transform: rotate(360deg); } transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
} }
/* 三颗脉冲粒子 */ /* 三颗脉冲粒子 */
@ -444,10 +445,13 @@ onUnmounted(() => {
} }
@keyframes dot-pulse { @keyframes dot-pulse {
0%, 100% {
0%,
100% {
transform: scale(0.6); transform: scale(0.6);
opacity: 0.4; opacity: 0.4;
} }
50% { 50% {
transform: scale(1.3); transform: scale(1.3);
opacity: 1; opacity: 1;
@ -464,8 +468,15 @@ onUnmounted(() => {
} }
@keyframes text-breathe { @keyframes text-breathe {
0%, 100% { opacity: 0.5; }
50% { opacity: 1; } 0%,
100% {
opacity: 0.5;
}
50% {
opacity: 1;
}
} }
.error-text { .error-text {