Compare commits
13 Commits
210f913aed
...
b37bfcfd02
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b37bfcfd02 | ||
|
|
952acbbf1f | ||
|
|
1865b1cfcd | ||
|
|
edfa8a2d3a | ||
|
|
d28b083630 | ||
|
|
ff8d9836d5 | ||
|
|
f653e6659a | ||
|
|
9c4f0c5650 | ||
|
|
c2b889ac8f | ||
|
|
c624bc2d1d | ||
|
|
2d3cefa43e | ||
|
|
d8c5c3a919 | ||
|
|
14d8e0b349 |
@@ -14,3 +14,10 @@ export const createCardShareToken = async (data) => {
|
|||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getGreetingSceneList = async (exclude) => {
|
||||||
|
return request({
|
||||||
|
url: `/api/blessing/greeting-scene/list?exclude=${exclude}`,
|
||||||
|
method: "GET",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { request } from "@/utils/request.js";
|
import { request } from "@/utils/request.js";
|
||||||
|
import { useUserStore } from "@/stores/user";
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
export const abilityCheck = async (scene) => {
|
export const abilityCheck = async (scene) => {
|
||||||
return request({
|
return request({
|
||||||
@@ -23,11 +25,16 @@ export const getPageDetail = async (shareToken) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getShareReward = async (data) => {
|
export const getShareReward = async (data) => {
|
||||||
return request({
|
const res = await request({
|
||||||
url: "/api/reward/share",
|
url: "/api/reward/share",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
|
console.log("getShareReward res", res);
|
||||||
|
if (res && res.success) {
|
||||||
|
userStore.fetchUserAssets();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const saveRecord = async (data) => {
|
export const saveRecord = async (data) => {
|
||||||
@@ -103,19 +110,22 @@ export const createTracking = async (data) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const watchAdReward = async (token) => {
|
export const watchAdReward = async (token, scene, type, resourceId) => {
|
||||||
return request({
|
return request({
|
||||||
url: "/api/blessing/ad/reward",
|
url: "/api/ad/reward",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: {
|
data: {
|
||||||
rewardToken: token,
|
rewardToken: token,
|
||||||
|
scene,
|
||||||
|
type,
|
||||||
|
resourceId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const watchAdStart = async () => {
|
export const watchAdStart = async () => {
|
||||||
return request({
|
return request({
|
||||||
url: "/api/blessing/ad/start",
|
url: "/api/ad/start",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: {
|
data: {
|
||||||
adPlacementId: "adunit-d7a28e0357d98947",
|
adPlacementId: "adunit-d7a28e0357d98947",
|
||||||
|
|||||||
14
pages.json
14
pages.json
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "新春祝福",
|
"navigationBarTitleText": "祝福 壁纸 头像",
|
||||||
"enablePullDownRefresh": true,
|
"enablePullDownRefresh": true,
|
||||||
"navigationStyle": "custom",
|
"navigationStyle": "custom",
|
||||||
"backgroundColor": "#FFFFFF"
|
"backgroundColor": "#FFFFFF"
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/mine/greeting",
|
"path": "pages/mine/greeting",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "我的新春祝福",
|
"navigationBarTitleText": "我的祝福",
|
||||||
"navigationStyle": "custom",
|
"navigationStyle": "custom",
|
||||||
"enablePullDownRefresh": true
|
"enablePullDownRefresh": true
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/mine/wallpaper",
|
"path": "pages/mine/wallpaper",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "我的新春壁纸",
|
"navigationBarTitleText": "我的壁纸",
|
||||||
"navigationStyle": "custom",
|
"navigationStyle": "custom",
|
||||||
"enablePullDownRefresh": true
|
"enablePullDownRefresh": true
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/avatar/index",
|
"path": "pages/avatar/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "新春头像挂饰",
|
"navigationBarTitleText": "头像挂饰",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/detail/index",
|
"path": "pages/detail/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "新春祝福详情",
|
"navigationBarTitleText": "祝福详情",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/fortune/index",
|
"path": "pages/fortune/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "新年运势",
|
"navigationBarTitleText": "每日好运",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/fortune/detail",
|
"path": "pages/fortune/detail",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "新年运势",
|
"navigationBarTitleText": "每日好运",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
<text class="nickname">{{
|
<text class="nickname">{{
|
||||||
detailData.from?.nickname || "神秘用户"
|
detailData.from?.nickname || "神秘用户"
|
||||||
}}</text>
|
}}</text>
|
||||||
<view class="tag">马年专属</view>
|
<view class="tag">专属头像</view>
|
||||||
</view>
|
</view>
|
||||||
<text class="action-text">换上了新春头像</text>
|
<text class="action-text">换上了专属头像</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- Decorative Elements -->
|
<!-- Decorative Elements -->
|
||||||
<view class="card-footer-text">
|
<view class="card-footer-text">
|
||||||
<text class="icon">🌸</text> 2026 丙午马年限定
|
<text class="icon">🌸</text> 专属限定
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<view class="section-header">
|
<view class="section-header">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<view class="bar"></view>
|
<view class="bar"></view>
|
||||||
<text class="title">热门新春头像</text>
|
<text class="title">热门头像</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="more" @tap="goToMake">查看全部</text>
|
<text class="more" @tap="goToMake">查看全部</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -69,10 +69,10 @@
|
|||||||
</view>
|
</view>
|
||||||
<text class="frame-name">{{
|
<text class="frame-name">{{
|
||||||
item.type === "decor"
|
item.type === "decor"
|
||||||
? "新春饰品"
|
? "精美饰品"
|
||||||
: item.type === "avatar"
|
: item.type === "avatar"
|
||||||
? "新春头像"
|
? "爆款头像"
|
||||||
: "新春相框"
|
: "热门相框"
|
||||||
}}</text>
|
}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -84,8 +84,8 @@
|
|||||||
<text>🏮</text>
|
<text>🏮</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="banner-content">
|
<view class="banner-content">
|
||||||
<text class="banner-title">去抽取新年运势</text>
|
<text class="banner-title">去抽取今日运势</text>
|
||||||
<text class="banner-desc">每日一签,开启你的新年好运</text>
|
<text class="banner-desc">每日一签,开启你的今日好运</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="banner-arrow">›</text>
|
<text class="banner-arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -94,8 +94,8 @@
|
|||||||
<text>🧧</text>
|
<text>🧧</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="banner-content">
|
<view class="banner-content">
|
||||||
<text class="banner-title">去制作新年贺卡</text>
|
<text class="banner-title">制作一张祝福贺卡</text>
|
||||||
<text class="banner-desc">定制专属祝福,传递浓浓年味</text>
|
<text class="banner-desc">写下心意,把祝福送给重要的人</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="banner-arrow">›</text>
|
<text class="banner-arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -104,8 +104,8 @@
|
|||||||
<text>🖼</text>
|
<text>🖼</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="banner-content">
|
<view class="banner-content">
|
||||||
<text class="banner-title">去挑选新年壁纸</text>
|
<text class="banner-title">去挑选精美壁纸</text>
|
||||||
<text class="banner-desc">精选新年壁纸,让手机也过年</text>
|
<text class="banner-desc">换上精选壁纸,让手机也焕新</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="banner-arrow">›</text>
|
<text class="banner-arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -114,10 +114,10 @@
|
|||||||
<view class="page-footer">
|
<view class="page-footer">
|
||||||
<view class="footer-line">
|
<view class="footer-line">
|
||||||
<text class="line"></text>
|
<text class="line"></text>
|
||||||
<text class="text">2026 HAPPY NEW YEAR</text>
|
<text class="text">LUCKY EVERY DAY</text>
|
||||||
<text class="line"></text>
|
<text class="line"></text>
|
||||||
</view>
|
</view>
|
||||||
<text class="footer-sub">新春祝福 · 传递温情</text>
|
<text class="footer-sub">专属头像</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -149,7 +149,7 @@ onShareAppMessage(async () => {
|
|||||||
const token = await getShareToken("avatar_download", detailData.value?.id);
|
const token = await getShareToken("avatar_download", detailData.value?.id);
|
||||||
getShareReward({ scene: "avatar_download" });
|
getShareReward({ scene: "avatar_download" });
|
||||||
return {
|
return {
|
||||||
title: "快来看看我刚领到的新年专属头像 🎊",
|
title: "快来看看我刚领到的专属头像 🎊",
|
||||||
path: `/pages/avatar/detail?shareToken=${token}`,
|
path: `/pages/avatar/detail?shareToken=${token}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
detailData.value?.imageUrl ||
|
detailData.value?.imageUrl ||
|
||||||
@@ -160,7 +160,7 @@ onShareAppMessage(async () => {
|
|||||||
onShareTimeline(async () => {
|
onShareTimeline(async () => {
|
||||||
const token = await getShareToken("avatar_download", detailData.value?.id);
|
const token = await getShareToken("avatar_download", detailData.value?.id);
|
||||||
return {
|
return {
|
||||||
title: "快来看看我刚领到的新年专属头像 🎊",
|
title: "快来看看我刚领到的专属头像 🎊",
|
||||||
query: `shareToken=${token}`,
|
query: `shareToken=${token}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
detailData.value?.imageUrl ||
|
detailData.value?.imageUrl ||
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ onShareAppMessage(async (options) => {
|
|||||||
if (!isLoggedIn.value) {
|
if (!isLoggedIn.value) {
|
||||||
const shareToken = await getShareToken("avatar_download_index", "");
|
const shareToken = await getShareToken("avatar_download_index", "");
|
||||||
return {
|
return {
|
||||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
title: "送你一份好运祝福 🎁|头像·壁纸·祝福卡",
|
||||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -156,13 +156,13 @@ onShareAppMessage(async (options) => {
|
|||||||
options?.target?.dataset?.item?.id,
|
options?.target?.dataset?.item?.id,
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
title: "快来挑选喜欢的新春头像吧",
|
title: "快来挑选喜欢的专属头像吧",
|
||||||
path: `/pages/avatar/download?shareToken=${shareToken}`,
|
path: `/pages/avatar/download?shareToken=${shareToken}`,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const shareToken = await getShareToken("avatar_download_index", "");
|
const shareToken = await getShareToken("avatar_download_index", "");
|
||||||
return {
|
return {
|
||||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
title: "送你一份好运祝福 🎁|头像·壁纸·祝福卡",
|
||||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -173,7 +173,7 @@ onShareAppMessage(async (options) => {
|
|||||||
onShareTimeline(async () => {
|
onShareTimeline(async () => {
|
||||||
const shareToken = await getShareToken("avatar_timeline");
|
const shareToken = await getShareToken("avatar_timeline");
|
||||||
return {
|
return {
|
||||||
title: "精选新年头像,定制专属祝福 🧧",
|
title: "精选头像,定制专属祝福 🧧",
|
||||||
query: `shareToken=${shareToken}`,
|
query: `shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -314,10 +314,7 @@ const downloadAvatar = async (item) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const canProceed = await checkAbilityAndHandle(
|
const canProceed = await checkAbilityAndHandle("avatar_download");
|
||||||
"avatar_download",
|
|
||||||
rewardAdRef,
|
|
||||||
);
|
|
||||||
if (!canProceed) return;
|
if (!canProceed) return;
|
||||||
|
|
||||||
uni.showLoading({ title: "下载中..." });
|
uni.showLoading({ title: "下载中..." });
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
<text>分享或保存即可去除水印</text>
|
<text>分享或保存即可去除水印</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="preview-square">
|
<view class="preview-square">
|
||||||
<view class="watermark">年禧集.马年春节祝福</view>
|
<view class="watermark">精美头像壁纸祝福</view>
|
||||||
<image
|
<image
|
||||||
class="avatar-img"
|
class="avatar-img"
|
||||||
:src="currentAvatar?.imageUrl"
|
:src="currentAvatar?.imageUrl"
|
||||||
@@ -61,7 +61,16 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="action-buttons">
|
<view class="action-buttons">
|
||||||
<button class="btn secondary" @tap="saveAndUse">保存</button>
|
<view class="points-display" v-if="isLoggedIn">
|
||||||
|
<text class="label">当前积分:</text>
|
||||||
|
<text class="value">{{ userPoints }}</text>
|
||||||
|
</view>
|
||||||
|
<button class="btn secondary" @tap="saveAndUse">
|
||||||
|
<view class="btn-content">
|
||||||
|
<text>保存</text>
|
||||||
|
<text class="btn-sub">消耗 20 积分</text>
|
||||||
|
</view>
|
||||||
|
</button>
|
||||||
<button class="btn primary" open-type="share">分享给朋友</button>
|
<button class="btn primary" open-type="share">分享给朋友</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -82,7 +91,7 @@
|
|||||||
></uni-icons>
|
></uni-icons>
|
||||||
<view class="btn-texts">
|
<view class="btn-texts">
|
||||||
<text class="btn-title">上传我的照片</text>
|
<text class="btn-title">上传我的照片</text>
|
||||||
<text class="btn-sub">制作专属新年头像</text>
|
<text class="btn-sub">制作专属头像</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<uni-icons
|
<uni-icons
|
||||||
@@ -122,6 +131,18 @@
|
|||||||
>
|
>
|
||||||
<image :src="item.imageUrl" class="grid-img" mode="aspectFill" />
|
<image :src="item.imageUrl" class="grid-img" mode="aspectFill" />
|
||||||
<view v-if="selectedFrame?.id === item.id" class="check">✓</view>
|
<view v-if="selectedFrame?.id === item.id" class="check">✓</view>
|
||||||
|
<!-- Lock Overlay -->
|
||||||
|
<view v-if="!item.isUnlock && item.unlockType" class="lock-overlay">
|
||||||
|
<!-- Badge -->
|
||||||
|
<view class="unlock-badge" :class="item.unlockType">
|
||||||
|
{{ getUnlockLabel(item.unlockType) }}
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- Center Lock -->
|
||||||
|
<view class="center-lock">
|
||||||
|
<uni-icons type="locked-filled" size="18" color="#fff" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="frameLoading" class="loading-more">加载中...</view>
|
<view v-if="frameLoading" class="loading-more">加载中...</view>
|
||||||
@@ -141,6 +162,18 @@
|
|||||||
>
|
>
|
||||||
<image :src="item.imageUrl" class="grid-img" mode="aspectFill" />
|
<image :src="item.imageUrl" class="grid-img" mode="aspectFill" />
|
||||||
<view v-if="selectedDecor?.id === item.id" class="check">✓</view>
|
<view v-if="selectedDecor?.id === item.id" class="check">✓</view>
|
||||||
|
<!-- Lock Overlay -->
|
||||||
|
<view v-if="!item.isUnlock && item.unlockType" class="lock-overlay">
|
||||||
|
<!-- Badge -->
|
||||||
|
<view class="unlock-badge" :class="item.unlockType">
|
||||||
|
{{ getUnlockLabel(item.unlockType) }}
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- Center Lock -->
|
||||||
|
<view class="center-lock">
|
||||||
|
<uni-icons type="locked-filled" size="18" color="#fff" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="decorLoading" class="loading-more">加载中...</view>
|
<view v-if="decorLoading" class="loading-more">加载中...</view>
|
||||||
@@ -162,6 +195,7 @@
|
|||||||
@logind="handleLogind"
|
@logind="handleLogind"
|
||||||
:share-token="shareToken"
|
:share-token="shareToken"
|
||||||
/>
|
/>
|
||||||
|
<RewardAd ref="rewardAdRef" @onReward="handleAdReward" />
|
||||||
|
|
||||||
<!-- More Avatar Popup -->
|
<!-- More Avatar Popup -->
|
||||||
<!-- <uni-popup ref="morePopup" type="bottom" background-color="#fff">
|
<!-- <uni-popup ref="morePopup" type="bottom" background-color="#fff">
|
||||||
@@ -204,13 +238,14 @@ import {
|
|||||||
onReachBottom,
|
onReachBottom,
|
||||||
} from "@dcloudio/uni-app";
|
} from "@dcloudio/uni-app";
|
||||||
import { useUserStore } from "@/stores/user";
|
import { useUserStore } from "@/stores/user";
|
||||||
import { getShareReward, abilityCheck } from "@/api/system.js";
|
import { checkAbilityAndHandle, getUnlockLabel } from "@/utils/ability.js";
|
||||||
import {
|
import {
|
||||||
getAvatarSystemList,
|
getAvatarSystemList,
|
||||||
getAvatarFrameList,
|
getAvatarFrameList,
|
||||||
getAvatarDecorList,
|
getAvatarDecorList,
|
||||||
avatarCreateComplete,
|
avatarCreateComplete,
|
||||||
} from "@/api/avatar.js";
|
} from "@/api/avatar.js";
|
||||||
|
import { getShareReward, watchAdReward } from "@/api/system.js";
|
||||||
import {
|
import {
|
||||||
saveRecordRequest,
|
saveRecordRequest,
|
||||||
getShareToken,
|
getShareToken,
|
||||||
@@ -221,11 +256,15 @@ import {
|
|||||||
import { trackRecord } from "@/utils/common.js";
|
import { trackRecord } from "@/utils/common.js";
|
||||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||||
|
import RewardAd from "@/components/RewardAd/RewardAd.vue";
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const loginPopupRef = ref(null);
|
const loginPopupRef = ref(null);
|
||||||
|
const rewardAdRef = ref(null);
|
||||||
|
const currentUnlockItem = ref(null);
|
||||||
|
|
||||||
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
||||||
|
const userPoints = computed(() => userStore.userInfo.points || 0);
|
||||||
|
|
||||||
const systemAvatars = ref([]);
|
const systemAvatars = ref([]);
|
||||||
const frames = ref([]);
|
const frames = ref([]);
|
||||||
@@ -305,6 +344,7 @@ const loadFrames = async () => {
|
|||||||
if (list.length > 0) {
|
if (list.length > 0) {
|
||||||
frames.value.push(
|
frames.value.push(
|
||||||
...list.map((item) => ({
|
...list.map((item) => ({
|
||||||
|
...item,
|
||||||
id: item.id,
|
id: item.id,
|
||||||
imageUrl: item.imageUrl,
|
imageUrl: item.imageUrl,
|
||||||
})),
|
})),
|
||||||
@@ -332,6 +372,7 @@ const loadDecors = async () => {
|
|||||||
if (list.length > 0) {
|
if (list.length > 0) {
|
||||||
decors.value.push(
|
decors.value.push(
|
||||||
...list.map((item) => ({
|
...list.map((item) => ({
|
||||||
|
...item,
|
||||||
id: item.id,
|
id: item.id,
|
||||||
imageUrl: item.imageUrl,
|
imageUrl: item.imageUrl,
|
||||||
})),
|
})),
|
||||||
@@ -412,6 +453,10 @@ const toggleAvatar = (avatar) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toggleFrame = (frame) => {
|
const toggleFrame = (frame) => {
|
||||||
|
if (frame.unlockType && !frame.isUnlock) {
|
||||||
|
handleUnlock(frame);
|
||||||
|
return;
|
||||||
|
}
|
||||||
trackRecord({
|
trackRecord({
|
||||||
eventName: "avatar_frame_click",
|
eventName: "avatar_frame_click",
|
||||||
eventType: `select`,
|
eventType: `select`,
|
||||||
@@ -425,6 +470,10 @@ const toggleFrame = (frame) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toggleDecor = (decor) => {
|
const toggleDecor = (decor) => {
|
||||||
|
if (decor.unlockType && !decor.isUnlock) {
|
||||||
|
handleUnlock(decor);
|
||||||
|
return;
|
||||||
|
}
|
||||||
trackRecord({
|
trackRecord({
|
||||||
eventName: "avatar_decor_click",
|
eventName: "avatar_decor_click",
|
||||||
eventType: `select`,
|
eventType: `select`,
|
||||||
@@ -437,6 +486,93 @@ const toggleDecor = (decor) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleUnlock = (item) => {
|
||||||
|
switch (item.unlockType) {
|
||||||
|
case "vip":
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/mine/vip",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "ad":
|
||||||
|
currentUnlockItem.value = item;
|
||||||
|
rewardAdRef.value.show();
|
||||||
|
break;
|
||||||
|
case "sing1":
|
||||||
|
uni.showToast({
|
||||||
|
title: "需要连续签到1天解锁",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "sing3":
|
||||||
|
uni.showToast({
|
||||||
|
title: "需要连续签到3天解锁",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "sing5":
|
||||||
|
uni.showToast({
|
||||||
|
title: "需要连续签到5天解锁",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "sing7":
|
||||||
|
uni.showToast({
|
||||||
|
title: "需要连续签到7天解锁",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
uni.showToast({
|
||||||
|
title: "未满足解锁条件",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAdReward = async (token) => {
|
||||||
|
try {
|
||||||
|
const res = await watchAdReward(
|
||||||
|
token,
|
||||||
|
"unlock",
|
||||||
|
activeTool.value === "frame" ? "avatar_frame" : "avatar_decor",
|
||||||
|
currentUnlockItem.value.id,
|
||||||
|
);
|
||||||
|
if (res) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "解锁成功",
|
||||||
|
icon: "success",
|
||||||
|
});
|
||||||
|
// 解锁成功后,更新本地状态,允许使用
|
||||||
|
if (currentUnlockItem.value) {
|
||||||
|
currentUnlockItem.value.isUnlock = true;
|
||||||
|
|
||||||
|
if (activeTool.value === "frame") {
|
||||||
|
const index = frames.value.findIndex(
|
||||||
|
(t) => t.id === currentUnlockItem.value.id,
|
||||||
|
);
|
||||||
|
if (index !== -1) {
|
||||||
|
frames.value[index].isUnlock = true;
|
||||||
|
}
|
||||||
|
toggleFrame(currentUnlockItem.value);
|
||||||
|
} else if (activeTool.value === "decor") {
|
||||||
|
const index = decors.value.findIndex(
|
||||||
|
(t) => t.id === currentUnlockItem.value.id,
|
||||||
|
);
|
||||||
|
if (index !== -1) {
|
||||||
|
decors.value[index].isUnlock = true;
|
||||||
|
}
|
||||||
|
toggleDecor(currentUnlockItem.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
currentUnlockItem.value = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Reward claim failed", e);
|
||||||
|
uni.showToast({ title: "奖励发放失败", icon: "none" });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 挂饰状态
|
// 挂饰状态
|
||||||
const decorState = ref({
|
const decorState = ref({
|
||||||
x: 300, // 初始中心 X (rpx)
|
x: 300, // 初始中心 X (rpx)
|
||||||
@@ -674,29 +810,20 @@ const saveAndUse = async () => {
|
|||||||
loginPopupRef.value.open();
|
loginPopupRef.value.open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const abilityRes = await abilityCheck("avatar_download");
|
|
||||||
if (!abilityRes.canUse) {
|
const canProceed = await checkAbilityAndHandle("avatar_download");
|
||||||
if (
|
if (!canProceed) return;
|
||||||
abilityRes?.blockType === "need_share" &&
|
|
||||||
abilityRes?.message === "分享可继续"
|
|
||||||
) {
|
|
||||||
uni.showToast({
|
|
||||||
title: "分享给好友可继续使用",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uni.showToast({
|
|
||||||
title: "您今日头像下载次数已用完,明日再试",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const tempPath = await saveByCanvas(true);
|
const tempPath = await saveByCanvas(true);
|
||||||
const id = createAvatarId();
|
const id = createAvatarId();
|
||||||
saveRecordRequest(tempPath, id, "avatar_download");
|
saveRecordRequest(tempPath, id, "avatar_download");
|
||||||
completeCardInfo(id);
|
completeCardInfo(id);
|
||||||
|
|
||||||
|
if (userStore?.userInfo?.points >= 20) {
|
||||||
|
userStore.userInfo.points -= 20;
|
||||||
|
}
|
||||||
|
// userStore.fetchUserAssets();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
// 调用avatarDownloadRecord API记录下载次数
|
// 调用avatarDownloadRecord API记录下载次数
|
||||||
// await avatarDownloadRecord({
|
// await avatarDownloadRecord({
|
||||||
@@ -759,7 +886,6 @@ const completeCardInfo = async (id) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onShareAppMessage(async (options) => {
|
onShareAppMessage(async (options) => {
|
||||||
getShareReward({ scene: "avatar_download" });
|
|
||||||
if (options.from === "button") {
|
if (options.from === "button") {
|
||||||
if (!isLoggedIn.value) {
|
if (!isLoggedIn.value) {
|
||||||
loginPopupRef.value.open();
|
loginPopupRef.value.open();
|
||||||
@@ -771,9 +897,10 @@ onShareAppMessage(async (options) => {
|
|||||||
getShareToken("avatar_download", id),
|
getShareToken("avatar_download", id),
|
||||||
completeCardInfo(id),
|
completeCardInfo(id),
|
||||||
]);
|
]);
|
||||||
|
getShareReward({ scene: "avatar_download" });
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
return {
|
return {
|
||||||
title: "3 秒生成新春专属头像,真的好看😆",
|
title: "3 秒生成专属头像,真的好看😆",
|
||||||
path: `/pages/avatar/detail?shareToken=${shareToken}`,
|
path: `/pages/avatar/detail?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
imageUrl +
|
imageUrl +
|
||||||
@@ -781,8 +908,9 @@ onShareAppMessage(async (options) => {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const shareToken = await getShareToken("avatar_download_not_login", "");
|
const shareToken = await getShareToken("avatar_download_not_login", "");
|
||||||
|
getShareReward({ scene: "avatar_index" });
|
||||||
return {
|
return {
|
||||||
title: "3 秒生成新春专属头像,真的好看😆",
|
title: "3 秒生成专属头像,真的好看😆",
|
||||||
path: `/pages/avatar/index?shareToken=${shareToken}`,
|
path: `/pages/avatar/index?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -793,7 +921,7 @@ onShareAppMessage(async (options) => {
|
|||||||
onShareTimeline(async () => {
|
onShareTimeline(async () => {
|
||||||
const shareToken = await getShareToken("avatar_timeline");
|
const shareToken = await getShareToken("avatar_timeline");
|
||||||
return {
|
return {
|
||||||
title: "快来定制你的新年专属头像 🎊",
|
title: "快来定制你的专属头像 🎊",
|
||||||
query: `shareToken=${shareToken}`,
|
query: `shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -1025,17 +1153,56 @@ onShareTimeline(async () => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: 20rpx;
|
gap: 20rpx;
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.points-display {
|
||||||
|
position: absolute;
|
||||||
|
top: -60rpx;
|
||||||
|
right: 30rpx;
|
||||||
|
background: rgba(255, 255, 255, 0.9);
|
||||||
|
padding: 8rpx 20rpx;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #ff3b30;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-left: 4rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 88rpx;
|
height: 96rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
border-radius: 44rpx;
|
border-radius: 48rpx;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
|
.btn-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
line-height: 1.2;
|
||||||
|
|
||||||
|
.btn-sub {
|
||||||
|
font-size: 20rpx;
|
||||||
|
opacity: 0.8;
|
||||||
|
font-weight: normal;
|
||||||
|
margin-top: 2rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.primary {
|
&.primary {
|
||||||
background: #ff3b30;
|
background: #ff3b30;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@@ -1106,6 +1273,69 @@ onShareTimeline(async () => {
|
|||||||
font-size: 20rpx;
|
font-size: 20rpx;
|
||||||
padding: 4rpx 8rpx;
|
padding: 4rpx 8rpx;
|
||||||
border-radius: 0 0 0 16rpx;
|
border-radius: 0 0 0 16rpx;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 锁定遮罩样式 */
|
||||||
|
.lock-overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.4);
|
||||||
|
z-index: 10;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
pointer-events: none; /* 让点击事件穿透到 grid-item */
|
||||||
|
}
|
||||||
|
|
||||||
|
.unlock-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
background: linear-gradient(
|
||||||
|
135deg,
|
||||||
|
#ff9a9e 0%,
|
||||||
|
#fecfef 99%,
|
||||||
|
#fecfef 100%
|
||||||
|
);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 16rpx;
|
||||||
|
padding: 4rpx 10rpx;
|
||||||
|
border-radius: 0 0 0 12rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
z-index: 20;
|
||||||
|
|
||||||
|
&.vip {
|
||||||
|
background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
|
||||||
|
}
|
||||||
|
&.ad {
|
||||||
|
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
||||||
|
}
|
||||||
|
&.sing1,
|
||||||
|
&.sing3,
|
||||||
|
&.sing5,
|
||||||
|
&.sing7 {
|
||||||
|
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.center-lock {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
backdrop-filter: blur(4px);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.upload-card {
|
&.upload-card {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
/>
|
/>
|
||||||
<view class="user-meta">
|
<view class="user-meta">
|
||||||
<view class="user-name">{{ cardDetail?.blessingFrom }}</view>
|
<view class="user-name">{{ cardDetail?.blessingFrom }}</view>
|
||||||
<view class="user-msg">给你发来了一条新春祝福</view>
|
<view class="user-msg">给你发来了一条专属祝福</view>
|
||||||
<view class="year-tag">
|
<view class="year-tag">
|
||||||
<text class="fire-icon">🎉</text> {{ cardDetail?.year || 2026 }}
|
<text class="fire-icon">🎉</text> {{ cardDetail?.year || 2026 }}
|
||||||
{{ cardDetail?.festival || "丙午马年" }}
|
{{ cardDetail?.festival || "丙午马年" }}
|
||||||
@@ -83,8 +83,8 @@
|
|||||||
<text>🏮</text>
|
<text>🏮</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="banner-content">
|
<view class="banner-content">
|
||||||
<text class="banner-title">去抽取新年运势</text>
|
<text class="banner-title">去抽取今日运势</text>
|
||||||
<text class="banner-desc">每日一签,开启你的新年好运</text>
|
<text class="banner-desc">每日一签,开启你的好运</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="banner-arrow">›</text>
|
<text class="banner-arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -93,8 +93,8 @@
|
|||||||
<text>🧧</text>
|
<text>🧧</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="banner-content">
|
<view class="banner-content">
|
||||||
<text class="banner-title">去制作新年头像</text>
|
<text class="banner-title">换个好看头像吧</text>
|
||||||
<text class="banner-desc">定制专属头像,传递浓浓年味</text>
|
<text class="banner-desc">精选头像合集,找到你的专属风格</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="banner-arrow">›</text>
|
<text class="banner-arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -103,8 +103,8 @@
|
|||||||
<text>🖼</text>
|
<text>🖼</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="banner-content">
|
<view class="banner-content">
|
||||||
<text class="banner-title">去挑选新年壁纸</text>
|
<text class="banner-title">去挑选精美壁纸</text>
|
||||||
<text class="banner-desc">精选新年壁纸,让手机也过年</text>
|
<text class="banner-desc">换上精选壁纸,让手机也焕新</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="banner-arrow">›</text>
|
<text class="banner-arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -113,10 +113,10 @@
|
|||||||
<view class="page-footer">
|
<view class="page-footer">
|
||||||
<view class="footer-line">
|
<view class="footer-line">
|
||||||
<text class="line"></text>
|
<text class="line"></text>
|
||||||
<text class="text">2026 HAPPY NEW YEAR</text>
|
<text class="text">HAPPY EVERY DAY</text>
|
||||||
<text class="line"></text>
|
<text class="line"></text>
|
||||||
</view>
|
</view>
|
||||||
<view class="footer-sub">新春祝福 · 传递温情</view>
|
<view class="footer-sub">专属祝福 · 传递温情</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@@ -196,7 +196,7 @@ onShareAppMessage(async () => {
|
|||||||
const token = await getShareToken("card_generate", cardDetail.value?.id);
|
const token = await getShareToken("card_generate", cardDetail.value?.id);
|
||||||
getShareReward({ scene: "card_generate" });
|
getShareReward({ scene: "card_generate" });
|
||||||
return {
|
return {
|
||||||
title: "送你一张精美的新春祝福卡片 🎊",
|
title: "送你一张精美的专属祝福卡片 🎊",
|
||||||
path: `/pages/detail/index?shareToken=${token || ""}`,
|
path: `/pages/detail/index?shareToken=${token || ""}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
cardDetail.value?.imageUrl ||
|
cardDetail.value?.imageUrl ||
|
||||||
@@ -207,7 +207,7 @@ onShareAppMessage(async () => {
|
|||||||
onShareTimeline(async () => {
|
onShareTimeline(async () => {
|
||||||
const token = await getShareToken("card_generate", cardDetail.value?.id);
|
const token = await getShareToken("card_generate", cardDetail.value?.id);
|
||||||
return {
|
return {
|
||||||
title: "送你一张精美的新春祝福卡片 🎊",
|
title: "送你一张精美的专属祝福卡片 🎊",
|
||||||
query: `shareToken=${token}`,
|
query: `shareToken=${token}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
cardDetail.value?.imageUrl ||
|
cardDetail.value?.imageUrl ||
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
/>
|
/>
|
||||||
<text class="banner-icon" v-else-if="!inviterName">✨</text>
|
<text class="banner-icon" v-else-if="!inviterName">✨</text>
|
||||||
<text class="banner-text" v-if="inviterName"
|
<text class="banner-text" v-if="inviterName"
|
||||||
>你的好友 {{ inviterName }} 正在抽取2026新年运势</text
|
>你的好友 {{ inviterName }} 正在抽取今日运势</text
|
||||||
>
|
>
|
||||||
<text class="banner-text" v-else>2026 灵马贺岁 · 开启你的新年好运</text>
|
<text class="banner-text" v-else>今日运势 · 开启你的好运</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="mini-btn" @click="goTest">
|
<view class="mini-btn" @click="goTest">
|
||||||
我也要测 <text class="mini-arrow">↗</text>
|
我也要测 <text class="mini-arrow">↗</text>
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
<!-- <view class="qr-box">
|
<!-- <view class="qr-box">
|
||||||
<view class="qr-placeholder"></view>
|
<view class="qr-placeholder"></view>
|
||||||
</view> -->
|
</view> -->
|
||||||
<view class="footer-text">2026 灵马贺岁 · 测出你的新年锦鲤关键词</view>
|
<view class="footer-text">2026 灵马贺岁 · 测出你的锦鲤关键词</view>
|
||||||
<view class="footer-sub">2026 HAPPY NEW YEAR</view>
|
<view class="footer-sub">2026 HAPPY NEW YEAR</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="fortune-page">
|
<view class="fortune-page">
|
||||||
<NavBar title="2026 新年运势" :transparent="true" color="#ffd700" />
|
<NavBar title="每日运势" :transparent="true" color="#ffd700" />
|
||||||
|
|
||||||
<!-- 初始状态:签筒 -->
|
<!-- 初始状态:签筒 -->
|
||||||
<view class="state-initial" v-if="status !== 'result'">
|
<view class="state-initial" v-if="status !== 'result'">
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
<text class="result-title">{{ currentFortune.title }}</text>
|
<text class="result-title">{{ currentFortune.title }}</text>
|
||||||
<view class="divider"></view>
|
<view class="divider"></view>
|
||||||
<text class="result-desc">{{ currentFortune.desc }}</text>
|
<text class="result-desc">{{ currentFortune.desc }}</text>
|
||||||
<text class="result-sub">旧岁千般皆如意,新年万事定称心。</text>
|
<text class="result-sub">过往千般皆如意,此后万事定称心。</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="card-footer">
|
<view class="card-footer">
|
||||||
<view class="footer-left">
|
<view class="footer-left">
|
||||||
@@ -125,19 +125,19 @@ import {
|
|||||||
onShareAppMessage,
|
onShareAppMessage,
|
||||||
onShareTimeline,
|
onShareTimeline,
|
||||||
} from "@dcloudio/uni-app";
|
} from "@dcloudio/uni-app";
|
||||||
import { abilityCheck } from "@/api/system.js";
|
|
||||||
import { drawFortune } from "@/api/fortune.js";
|
|
||||||
import { getShareReward } from "@/api/system.js";
|
|
||||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
|
||||||
import { useUserStore } from "@/stores/user";
|
|
||||||
import {
|
import {
|
||||||
getShareToken,
|
|
||||||
saveRemoteImageToLocal,
|
|
||||||
saveRecordRequest,
|
saveRecordRequest,
|
||||||
|
saveRemoteImageToLocal,
|
||||||
|
getShareToken,
|
||||||
saveViewRequest,
|
saveViewRequest,
|
||||||
trackRecord,
|
|
||||||
} from "@/utils/common.js";
|
} from "@/utils/common.js";
|
||||||
|
import { drawFortune } from "@/api/fortune.js";
|
||||||
|
import { abilityCheck } from "@/api/system.js";
|
||||||
|
import { checkAbilityAndHandle } from "@/utils/ability.js";
|
||||||
|
import { useUserStore } from "@/stores/user";
|
||||||
|
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||||
|
import { trackRecord } from "@/utils/common.js";
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const loginPopupRef = ref(null);
|
const loginPopupRef = ref(null);
|
||||||
@@ -185,7 +185,7 @@ onShareAppMessage(async () => {
|
|||||||
const shareToken = await getShareToken("fortune_draw", cardId.value);
|
const shareToken = await getShareToken("fortune_draw", cardId.value);
|
||||||
getRewardByShare();
|
getRewardByShare();
|
||||||
return {
|
return {
|
||||||
title: "马年运势我已经抽过了,你的会是什么?",
|
title: "今日运势我已经抽过了,你的会是什么?",
|
||||||
path: `${cardId.value ? `/pages/fortune/detail?shareToken=${shareToken}` : `/pages/fortune/index?shareToken=${shareToken}`}`,
|
path: `${cardId.value ? `/pages/fortune/detail?shareToken=${shareToken}` : `/pages/fortune/index?shareToken=${shareToken}`}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -195,7 +195,7 @@ onShareAppMessage(async () => {
|
|||||||
onShareTimeline(async () => {
|
onShareTimeline(async () => {
|
||||||
const shareToken = await getShareToken("fortune_timeline");
|
const shareToken = await getShareToken("fortune_timeline");
|
||||||
return {
|
return {
|
||||||
title: "新春到,抽灵签!快来测测你的新年运势 🏮",
|
title: "好运到,抽灵签!快来测测你的今年运势 🏮",
|
||||||
query: `shareToken=${shareToken}`,
|
query: `shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -238,10 +238,8 @@ const startShake = async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remainingCount.value <= 0) {
|
const canProceed = await checkAbilityAndHandle("fortune_draw");
|
||||||
uni.showToast({ title: "今日次数已用完", icon: "none" });
|
if (!canProceed) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
status.value = "shaking";
|
status.value = "shaking";
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,12 @@
|
|||||||
<uni-icons type="sun-filled" size="24" color="#ff9800" />
|
<uni-icons type="sun-filled" size="24" color="#ff9800" />
|
||||||
<text class="header-title">{{ greetingTitle }}</text>
|
<text class="header-title">{{ greetingTitle }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="streak-badge">
|
<!-- <view class="streak-badge">
|
||||||
<text>已连续问候</text>
|
<text>已连续问候</text>
|
||||||
<text class="streak-count">{{ streakDays }}</text>
|
<text class="streak-count">{{ streakDays }}</text>
|
||||||
<text>天</text>
|
<text>天</text>
|
||||||
<text class="fire-icon">🔥</text>
|
<text class="fire-icon">🔥</text>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- Main Card -->
|
<!-- Main Card -->
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- Hot List -->
|
<!-- Hot List -->
|
||||||
<view class="hot-list-section">
|
<!-- <view class="hot-list-section">
|
||||||
<view class="section-title-row">
|
<view class="section-title-row">
|
||||||
<view class="title-bar"></view>
|
<view class="title-bar"></view>
|
||||||
<text class="section-title">今日最热榜单</text>
|
<text class="section-title">今日最热榜单</text>
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
<uni-icons type="right" size="16" color="#ccc" />
|
<uni-icons type="right" size="16" color="#ccc" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<!-- Bottom Actions -->
|
<!-- Bottom Actions -->
|
||||||
<view class="bottom-actions safe-area-bottom">
|
<view class="bottom-actions safe-area-bottom">
|
||||||
@@ -384,7 +384,8 @@ onShareTimeline(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 15rpx;
|
margin-bottom: 40rpx;
|
||||||
|
margin-top: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-left {
|
.header-left {
|
||||||
@@ -433,7 +434,7 @@ onShareTimeline(() => {
|
|||||||
/* Main Card */
|
/* Main Card */
|
||||||
.main-card-container {
|
.main-card-container {
|
||||||
padding: 0 40rpx;
|
padding: 0 40rpx;
|
||||||
margin-bottom: 60rpx;
|
margin-bottom: 80rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quote-card {
|
.quote-card {
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="hero-title">
|
<view class="hero-title">
|
||||||
<text class="year">2026</text>
|
<text class="year">2026</text>
|
||||||
<text class="main">新春祝福</text>
|
<text class="main">专属祝福</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="hero-sub">新年快乐,万事如意!</text>
|
<text class="hero-sub">送你一份好运祝福,万事如意!</text>
|
||||||
<!-- <image class="hero-decor" src="https://file.lihailezzc.com/resource/58c8d19e5f2d9c958a7b8b9f44b8c3e3.png" mode="aspectFill" /> -->
|
<!-- <image class="hero-decor" src="https://file.lihailezzc.com/resource/58c8d19e5f2d9c958a7b8b9f44b8c3e3.png" mode="aspectFill" /> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -217,7 +217,7 @@ onShareAppMessage(async () => {
|
|||||||
const shareToken = await getShareToken("index");
|
const shareToken = await getShareToken("index");
|
||||||
getShareReward({ scene: "index" });
|
getShareReward({ scene: "index" });
|
||||||
return {
|
return {
|
||||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
title: "送你一份好运祝福 🎁|头像·壁纸·祝福卡",
|
||||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -227,7 +227,7 @@ onShareAppMessage(async () => {
|
|||||||
onShareTimeline(async () => {
|
onShareTimeline(async () => {
|
||||||
const shareToken = await getShareToken("index_timeline");
|
const shareToken = await getShareToken("index_timeline");
|
||||||
return {
|
return {
|
||||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
title: "送你一份好运祝福 🎁|头像·壁纸·祝福卡",
|
||||||
query: `shareToken=${shareToken}`,
|
query: `shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -276,20 +276,20 @@ const onNoticeTap = (tip) => {
|
|||||||
|
|
||||||
const features = ref([
|
const features = ref([
|
||||||
{
|
{
|
||||||
title: "新春祝福卡片",
|
title: "专属祝福卡片",
|
||||||
subtitle: "定制专属贺卡吧",
|
subtitle: "定制专属贺卡吧",
|
||||||
icon: "/static/icon/celebrate.png",
|
icon: "/static/icon/celebrate.png",
|
||||||
type: "card",
|
type: "card",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "新年运势",
|
title: "专属运势",
|
||||||
subtitle: "抽取新年关键词",
|
subtitle: "抽取专属关键词",
|
||||||
icon: "/static/icon/yunshi.png",
|
icon: "/static/icon/yunshi.png",
|
||||||
type: "fortune",
|
type: "fortune",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "新春头像",
|
title: "爆款头像",
|
||||||
subtitle: "焕上节日新饰",
|
subtitle: "焕上精美头像",
|
||||||
icon: "/static/icon/guashi.png",
|
icon: "/static/icon/guashi.png",
|
||||||
type: "avatar_decor",
|
type: "avatar_decor",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -268,7 +268,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="rule-item">
|
<view class="rule-item">
|
||||||
<uni-icons type="person-filled" size="18" color="#ff9800" />
|
<uni-icons type="person-filled" size="18" color="#ff9800" />
|
||||||
<text class="rule-text">每日登录:+20积分</text>
|
<text class="rule-text">每日登录:+10积分</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="rule-item">
|
<view class="rule-item">
|
||||||
<uni-icons type="calendar-filled" size="18" color="#ff9800" />
|
<uni-icons type="calendar-filled" size="18" color="#ff9800" />
|
||||||
@@ -302,6 +302,7 @@ import {
|
|||||||
getCardSpecialTopic,
|
getCardSpecialTopic,
|
||||||
getShareReward,
|
getShareReward,
|
||||||
} from "@/api/system";
|
} from "@/api/system";
|
||||||
|
import { getGreetingSceneList } from "@/api/card";
|
||||||
import { getUserSignInfo, userSignIn, getUserLuckInfo } from "@/api/user";
|
import { getUserSignInfo, userSignIn, getUserLuckInfo } from "@/api/user";
|
||||||
import calendar from "@/utils/lunar";
|
import calendar from "@/utils/lunar";
|
||||||
import { getShareToken, saveViewRequest } from "@/utils/common.js";
|
import { getShareToken, saveViewRequest } from "@/utils/common.js";
|
||||||
@@ -410,22 +411,7 @@ const lunarDate = computed(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const sceneList = ref([
|
const sceneList = ref([]);
|
||||||
{ id: 3, name: "每日问候", icon: "/static/icon/yunshi.png", scene: "daily" },
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "生日纪念",
|
|
||||||
icon: "/static/icon/guashi.png",
|
|
||||||
scene: "birthday",
|
|
||||||
},
|
|
||||||
{ id: 4, name: "情感表达", icon: "/static/icon/hongbao.png", scene: "love" },
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "节日祝福",
|
|
||||||
icon: "/static/icon/celebrate.png",
|
|
||||||
scene: "holiday",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
const wallpaperList = ref([]);
|
const wallpaperList = ref([]);
|
||||||
const avatarList = ref([]);
|
const avatarList = ref([]);
|
||||||
@@ -437,18 +423,21 @@ onLoad((options) => {
|
|||||||
fetchUserSingInfo(); // 获取用户签到信息
|
fetchUserSingInfo(); // 获取用户签到信息
|
||||||
fetchHomeData();
|
fetchHomeData();
|
||||||
fetchSpecialTopic();
|
fetchSpecialTopic();
|
||||||
|
fetchSceneList();
|
||||||
});
|
});
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
fetchHomeData();
|
fetchHomeData();
|
||||||
fetchUserSingInfo();
|
fetchUserSingInfo();
|
||||||
fetchSpecialTopic();
|
fetchSpecialTopic();
|
||||||
|
fetchSceneList();
|
||||||
});
|
});
|
||||||
|
|
||||||
onPullDownRefresh(() => {
|
onPullDownRefresh(() => {
|
||||||
fetchHomeData();
|
fetchHomeData();
|
||||||
fetchUserSingInfo();
|
fetchUserSingInfo();
|
||||||
fetchSpecialTopic();
|
fetchSpecialTopic();
|
||||||
|
fetchSceneList();
|
||||||
});
|
});
|
||||||
|
|
||||||
const specialTopic = ref(null);
|
const specialTopic = ref(null);
|
||||||
@@ -466,6 +455,22 @@ const fetchSpecialTopic = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fetchSceneList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getGreetingSceneList();
|
||||||
|
if (res && Array.isArray(res)) {
|
||||||
|
sceneList.value = res.map((item) => ({
|
||||||
|
id: item.id,
|
||||||
|
name: item.sceneName,
|
||||||
|
icon: item.imageUrl,
|
||||||
|
scene: item.scene,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("fetchSceneList error", e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const navToSpecial = () => {
|
const navToSpecial = () => {
|
||||||
if (specialTopic.value && specialTopic.value.scene) {
|
if (specialTopic.value && specialTopic.value.scene) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@@ -565,7 +570,7 @@ const onOpenLucky = async () => {
|
|||||||
const luckRes = await getUserLuckInfo();
|
const luckRes = await getUserLuckInfo();
|
||||||
luckyPopupRef.value?.open(luckRes, false);
|
luckyPopupRef.value?.open(luckRes, false);
|
||||||
|
|
||||||
uni.showToast({ title: "获取40积分", icon: "none" });
|
uni.showToast({ title: "获取20积分", icon: "none" });
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: "签到失败", icon: "none" });
|
uni.showToast({ title: "签到失败", icon: "none" });
|
||||||
}
|
}
|
||||||
@@ -595,20 +600,19 @@ const handleAdReward = async (token) => {
|
|||||||
|
|
||||||
onShareAppMessage(async () => {
|
onShareAppMessage(async () => {
|
||||||
const shareToken = await getShareToken("index");
|
const shareToken = await getShareToken("index");
|
||||||
getShareReward().then((res) => {
|
getShareReward();
|
||||||
if (isLoggedIn && res && res.success) {
|
|
||||||
userStore.fetchUserAssets();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
return {
|
||||||
title: "开启你的2026新春好运!",
|
title: "送你一份好运祝福 🎁|头像·壁纸·祝福卡",
|
||||||
path: "/pages/index/index?shareToken=" + shareToken,
|
path: "/pages/index/index?shareToken=" + shareToken,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
onShareTimeline(() => {
|
onShareTimeline(async () => {
|
||||||
|
const shareToken = await getShareToken("index");
|
||||||
|
getShareReward();
|
||||||
return {
|
return {
|
||||||
title: "开启你的2026新春好运!",
|
title: "送你一份好运祝福 🎁|头像·壁纸·祝福卡",
|
||||||
|
query: `shareToken=${shareToken}`,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -246,12 +246,8 @@ import { ref, onMounted, computed } from "vue";
|
|||||||
import { getStatusBarHeight } from "@/utils/system";
|
import { getStatusBarHeight } from "@/utils/system";
|
||||||
import { onShareAppMessage, onShareTimeline, onShow } from "@dcloudio/uni-app";
|
import { onShareAppMessage, onShareTimeline, onShow } from "@dcloudio/uni-app";
|
||||||
import { useUserStore } from "@/stores/user";
|
import { useUserStore } from "@/stores/user";
|
||||||
import {
|
import { checkAbilityAndHandle } from "@/utils/ability.js";
|
||||||
getRecommendList,
|
import { getRecommendList, getRankList, watchAdReward } from "@/api/system";
|
||||||
getRankList,
|
|
||||||
abilityCheck,
|
|
||||||
watchAdReward,
|
|
||||||
} from "@/api/system";
|
|
||||||
import { saveRemoteImageToLocal, saveRecordRequest } from "@/utils/common";
|
import { saveRemoteImageToLocal, saveRecordRequest } from "@/utils/common";
|
||||||
import { getUserSignInfo, userSignIn } from "@/api/user";
|
import { getUserSignInfo, userSignIn } from "@/api/user";
|
||||||
import { avatarDownloadRecord } from "@/api/avatar";
|
import { avatarDownloadRecord } from "@/api/avatar";
|
||||||
@@ -481,40 +477,8 @@ const handleDownload = async (item) => {
|
|||||||
|
|
||||||
const type =
|
const type =
|
||||||
item.type === "wallpaper" ? "wallpaper_download" : "avatar_download";
|
item.type === "wallpaper" ? "wallpaper_download" : "avatar_download";
|
||||||
const abilityRes = await abilityCheck(type);
|
const canProceed = await checkAbilityAndHandle(type);
|
||||||
|
if (!canProceed) return;
|
||||||
if (!abilityRes.canUse) {
|
|
||||||
if (
|
|
||||||
abilityRes?.blockType === "need_share" &&
|
|
||||||
abilityRes?.message === "分享可继续"
|
|
||||||
) {
|
|
||||||
uni.showToast({
|
|
||||||
title: "分享给好友即可下载",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
abilityRes?.blockType === "need_ad" &&
|
|
||||||
abilityRes?.message === "观看广告可继续"
|
|
||||||
) {
|
|
||||||
uni.showModal({
|
|
||||||
title: "积分不足",
|
|
||||||
content: "观看广告可获得50积分,继续下载",
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
rewardAdRef.value.show();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uni.showToast({
|
|
||||||
title: "您今日下载次数已用完,明日再试",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.showLoading({ title: "下载中..." });
|
uni.showLoading({ title: "下载中..." });
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
/>
|
/>
|
||||||
<view class="card-overlay">
|
<view class="card-overlay">
|
||||||
<view class="watermark">年禧集.马年春节祝福</view>
|
<view class="watermark">精美头像壁纸祝福</view>
|
||||||
<!-- 选中的标题图片 -->
|
<!-- 选中的标题图片 -->
|
||||||
<image
|
<image
|
||||||
v-if="currentTitle"
|
v-if="currentTitle"
|
||||||
@@ -169,6 +169,21 @@
|
|||||||
<view v-if="title?.id === currentTitle?.id" class="tpl-check"
|
<view v-if="title?.id === currentTitle?.id" class="tpl-check"
|
||||||
>✔</view
|
>✔</view
|
||||||
>
|
>
|
||||||
|
<!-- Lock Overlay -->
|
||||||
|
<view
|
||||||
|
v-if="!title.isUnlock && title.unlockType"
|
||||||
|
class="lock-overlay"
|
||||||
|
>
|
||||||
|
<!-- Badge -->
|
||||||
|
<view class="unlock-badge" :class="title.unlockType">
|
||||||
|
{{ getUnlockLabel(title.unlockType) }}
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- Center Lock -->
|
||||||
|
<view class="center-lock">
|
||||||
|
<uni-icons type="locked-filled" size="18" color="#fff" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="loadingTitles" class="loading-more">加载中...</view>
|
<view v-if="loadingTitles" class="loading-more">加载中...</view>
|
||||||
@@ -210,17 +225,7 @@
|
|||||||
>
|
>
|
||||||
<!-- Badge -->
|
<!-- Badge -->
|
||||||
<view class="unlock-badge" :class="tpl.unlockType">
|
<view class="unlock-badge" :class="tpl.unlockType">
|
||||||
{{
|
{{ getUnlockLabel(tpl.unlockType) }}
|
||||||
tpl.unlockType === "sing3"
|
|
||||||
? "登录3天"
|
|
||||||
: tpl.unlockType === "sing1"
|
|
||||||
? "登录1天"
|
|
||||||
: tpl.unlockType === "ad"
|
|
||||||
? "广告"
|
|
||||||
: tpl.unlockType === "vip"
|
|
||||||
? "VIP"
|
|
||||||
: "解锁"
|
|
||||||
}}
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- Center Lock -->
|
<!-- Center Lock -->
|
||||||
@@ -535,8 +540,15 @@
|
|||||||
@tap="selectScene(scene)"
|
@tap="selectScene(scene)"
|
||||||
>
|
>
|
||||||
<view class="scene-icon-box" :style="{ background: scene.bgColor }">
|
<view class="scene-icon-box" :style="{ background: scene.bgColor }">
|
||||||
|
<image
|
||||||
|
v-if="scene.icon && scene.icon.includes('/')"
|
||||||
|
:src="scene.icon"
|
||||||
|
mode="aspectFit"
|
||||||
|
style="width: 52rpx; height: 52rpx"
|
||||||
|
/>
|
||||||
<uni-icons
|
<uni-icons
|
||||||
:type="scene.icon"
|
v-else
|
||||||
|
:type="scene.icon || 'star-filled'"
|
||||||
size="26"
|
size="26"
|
||||||
:color="scene.color"
|
:color="scene.color"
|
||||||
></uni-icons>
|
></uni-icons>
|
||||||
@@ -563,12 +575,9 @@ import {
|
|||||||
getCardTemplateTitleList,
|
getCardTemplateTitleList,
|
||||||
getCardMusicList,
|
getCardMusicList,
|
||||||
} from "@/api/make";
|
} from "@/api/make";
|
||||||
import {
|
import { getGreetingSceneList } from "@/api/card";
|
||||||
abilityCheck,
|
import { getShareReward, msgCheckApi, watchAdReward } from "@/api/system";
|
||||||
getShareReward,
|
import { checkAbilityAndHandle, getUnlockLabel } from "@/utils/ability.js";
|
||||||
msgCheckApi,
|
|
||||||
watchAdReward,
|
|
||||||
} from "@/api/system";
|
|
||||||
import {
|
import {
|
||||||
onShareAppMessage,
|
onShareAppMessage,
|
||||||
onShareTimeline,
|
onShareTimeline,
|
||||||
@@ -973,6 +982,7 @@ onLoad((options) => {
|
|||||||
if (options.author) {
|
if (options.author) {
|
||||||
signatureName.value = decodeURIComponent(options.author);
|
signatureName.value = decodeURIComponent(options.author);
|
||||||
}
|
}
|
||||||
|
fetchSceneList();
|
||||||
});
|
});
|
||||||
|
|
||||||
const loadData = () => {
|
const loadData = () => {
|
||||||
@@ -984,51 +994,37 @@ const loadData = () => {
|
|||||||
|
|
||||||
const currentScene = ref("");
|
const currentScene = ref("");
|
||||||
const scenePopup = ref(null);
|
const scenePopup = ref(null);
|
||||||
const scenes = [
|
const scenes = ref([]);
|
||||||
{
|
|
||||||
name: "节日祝福",
|
const SCENE_PALETTE = [
|
||||||
value: "holiday",
|
{ color: "#FF3B30", bgColor: "#FFF5F5" },
|
||||||
icon: "notification-filled",
|
{ color: "#FF9500", bgColor: "#FFF8E5" },
|
||||||
color: "#FF3B30",
|
{ color: "#FFCC00", bgColor: "#FFFBE6" },
|
||||||
bgColor: "#FFF5F5",
|
{ color: "#FF2D55", bgColor: "#FFF0F5" },
|
||||||
},
|
{ color: "#FF5E3A", bgColor: "#FFF2F0" },
|
||||||
{
|
{ color: "#8B572A", bgColor: "#F9F0E6" },
|
||||||
name: "生日纪念",
|
|
||||||
value: "birthday",
|
|
||||||
icon: "calendar-filled",
|
|
||||||
color: "#FF9500",
|
|
||||||
bgColor: "#FFF8E5",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "每日问候",
|
|
||||||
value: "daily",
|
|
||||||
icon: "star-filled",
|
|
||||||
color: "#FFCC00",
|
|
||||||
bgColor: "#FFFBE6",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "情绪表达",
|
|
||||||
value: "emotion",
|
|
||||||
icon: "heart-filled",
|
|
||||||
color: "#FF2D55",
|
|
||||||
bgColor: "#FFF0F5",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "人际关系",
|
|
||||||
value: "relationship",
|
|
||||||
icon: "gift-filled",
|
|
||||||
color: "#FF5E3A",
|
|
||||||
bgColor: "#FFF2F0",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "职场祝福",
|
|
||||||
value: "workplace",
|
|
||||||
icon: "shop-filled",
|
|
||||||
color: "#8B572A",
|
|
||||||
bgColor: "#F9F0E6",
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const fetchSceneList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getGreetingSceneList("daily");
|
||||||
|
if (res && Array.isArray(res)) {
|
||||||
|
scenes.value = res.map((item, index) => {
|
||||||
|
const style = SCENE_PALETTE[index % SCENE_PALETTE.length];
|
||||||
|
return {
|
||||||
|
name: item.sceneName,
|
||||||
|
value: item.scene,
|
||||||
|
icon: item.imageUrl,
|
||||||
|
color: style.color,
|
||||||
|
bgColor: style.bgColor,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("fetchSceneList error", e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const selectScene = (scene) => {
|
const selectScene = (scene) => {
|
||||||
currentScene.value = scene.value;
|
currentScene.value = scene.value;
|
||||||
scenePopup.value.close();
|
scenePopup.value.close();
|
||||||
@@ -1336,7 +1332,7 @@ onShareAppMessage(async (options) => {
|
|||||||
} else {
|
} else {
|
||||||
const shareToken = await getShareToken("card_generate_index", "");
|
const shareToken = await getShareToken("card_generate_index", "");
|
||||||
return {
|
return {
|
||||||
title: "快来制作新春祝福卡片🎉",
|
title: "快来制作祝福卡片🎉",
|
||||||
path: `/pages/make/index?shareToken=${shareToken}`,
|
path: `/pages/make/index?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -1347,7 +1343,7 @@ onShareAppMessage(async (options) => {
|
|||||||
onShareTimeline(async () => {
|
onShareTimeline(async () => {
|
||||||
const shareToken = await getShareToken("card_timeline");
|
const shareToken = await getShareToken("card_timeline");
|
||||||
return {
|
return {
|
||||||
title: "送你一张精美的新春祝福卡片 🎊",
|
title: "送你一张精美的祝福卡片 🎊",
|
||||||
query: `shareToken=${shareToken}`,
|
query: `shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -1387,7 +1383,7 @@ const currentTemplate = ref(templates.value[0]);
|
|||||||
const currentUnlockTpl = ref(null);
|
const currentUnlockTpl = ref(null);
|
||||||
|
|
||||||
const applyTemplate = (tpl) => {
|
const applyTemplate = (tpl) => {
|
||||||
if (tpl.isUnlock === false) {
|
if (tpl.unlockType && !tpl.isUnlock) {
|
||||||
handleUnlock(tpl);
|
handleUnlock(tpl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1409,17 +1405,23 @@ const handleUnlock = (tpl) => {
|
|||||||
break;
|
break;
|
||||||
case "ad":
|
case "ad":
|
||||||
currentUnlockTpl.value = tpl;
|
currentUnlockTpl.value = tpl;
|
||||||
rewardAdRef.value.showAd();
|
rewardAdRef.value.show();
|
||||||
break;
|
|
||||||
case "sing1":
|
|
||||||
uni.showToast({
|
|
||||||
title: "需要连续登录1天解锁",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case "sing3":
|
case "sing3":
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "需要连续登录3天解锁",
|
title: "需要连续签到1天解锁",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "sing5":
|
||||||
|
uni.showToast({
|
||||||
|
title: "需要连续签到5天解锁",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "sing7":
|
||||||
|
uni.showToast({
|
||||||
|
title: "需要连续签到7天解锁",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@@ -1433,7 +1435,12 @@ const handleUnlock = (tpl) => {
|
|||||||
|
|
||||||
const handleAdReward = async (token) => {
|
const handleAdReward = async (token) => {
|
||||||
try {
|
try {
|
||||||
const res = await watchAdReward(token);
|
const res = await watchAdReward(
|
||||||
|
token,
|
||||||
|
"unlock",
|
||||||
|
activeTool.value === "template" ? "card_template" : "card_title_template",
|
||||||
|
currentUnlockTpl.value.id,
|
||||||
|
);
|
||||||
if (res) {
|
if (res) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "解锁成功",
|
title: "解锁成功",
|
||||||
@@ -1442,15 +1449,27 @@ const handleAdReward = async (token) => {
|
|||||||
// 解锁成功后,更新本地状态,允许使用
|
// 解锁成功后,更新本地状态,允许使用
|
||||||
if (currentUnlockTpl.value) {
|
if (currentUnlockTpl.value) {
|
||||||
currentUnlockTpl.value.isUnlock = true;
|
currentUnlockTpl.value.isUnlock = true;
|
||||||
// 同时更新列表中的状态
|
|
||||||
const index = templates.value.findIndex(
|
if (activeTool.value === "template") {
|
||||||
(t) => t.id === currentUnlockTpl.value.id,
|
// 同时更新列表中的状态
|
||||||
);
|
const index = templates.value.findIndex(
|
||||||
if (index !== -1) {
|
(t) => t.id === currentUnlockTpl.value.id,
|
||||||
templates.value[index].isUnlock = true;
|
);
|
||||||
|
if (index !== -1) {
|
||||||
|
templates.value[index].isUnlock = true;
|
||||||
|
}
|
||||||
|
applyTemplate(currentUnlockTpl.value);
|
||||||
|
} else if (activeTool.value === "title") {
|
||||||
|
// 同时更新列表中的状态
|
||||||
|
const index = titles.value.findIndex(
|
||||||
|
(t) => t.id === currentUnlockTpl.value.id,
|
||||||
|
);
|
||||||
|
if (index !== -1) {
|
||||||
|
titles.value[index].isUnlock = true;
|
||||||
|
}
|
||||||
|
selectTitle(currentUnlockTpl.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyTemplate(currentUnlockTpl.value);
|
|
||||||
currentUnlockTpl.value = null;
|
currentUnlockTpl.value = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1461,6 +1480,10 @@ const handleAdReward = async (token) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const selectTitle = (title) => {
|
const selectTitle = (title) => {
|
||||||
|
if (title.unlockType && !title.isUnlock) {
|
||||||
|
handleUnlock(title);
|
||||||
|
return;
|
||||||
|
}
|
||||||
trackRecord({
|
trackRecord({
|
||||||
eventName: "card_title_choose",
|
eventName: "card_title_choose",
|
||||||
eventType: "click",
|
eventType: "click",
|
||||||
@@ -1505,24 +1528,9 @@ const preview = async () => {
|
|||||||
loginPopupRef.value.open();
|
loginPopupRef.value.open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const abilityRes = await abilityCheck("card_generate");
|
const canProceed = await checkAbilityAndHandle("card_generate");
|
||||||
if (!abilityRes.canUse) {
|
if (!canProceed) return;
|
||||||
if (
|
|
||||||
abilityRes?.blockType === "need_share" &&
|
|
||||||
abilityRes?.message === "分享可继续"
|
|
||||||
) {
|
|
||||||
uni.showToast({
|
|
||||||
title: "分享给好友可继续使用",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uni.showToast({
|
|
||||||
title: "您今日祝福卡下载次数已用完,直接分享给好友或者明日再试",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const tempPath = await saveByCanvas(true);
|
const tempPath = await saveByCanvas(true);
|
||||||
const id = createCard();
|
const id = createCard();
|
||||||
shareOrSave(id);
|
shareOrSave(id);
|
||||||
@@ -2069,7 +2077,9 @@ function drawRoundRect(ctx, x, y, w, h, r, color) {
|
|||||||
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
||||||
}
|
}
|
||||||
&.sing1,
|
&.sing1,
|
||||||
&.sing3 {
|
&.sing3,
|
||||||
|
&.sing5,
|
||||||
|
&.sing7 {
|
||||||
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
|
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2320,7 +2330,9 @@ function drawRoundRect(ctx, x, y, w, h, r, color) {
|
|||||||
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
||||||
}
|
}
|
||||||
&.sing1,
|
&.sing1,
|
||||||
&.sing3 {
|
&.sing3,
|
||||||
|
&.sing5,
|
||||||
|
&.sing7 {
|
||||||
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
|
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ const formatDate = (dateStr) => {
|
|||||||
|
|
||||||
const getDefaultName = (item) => {
|
const getDefaultName = (item) => {
|
||||||
// Simple deterministic name generation based on ID char code sum
|
// Simple deterministic name generation based on ID char code sum
|
||||||
if (!item.id) return "新春头像";
|
if (!item.id) return "精美头像";
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
for (let i = 0; i < item.id.length; i++) {
|
for (let i = 0; i < item.id.length; i++) {
|
||||||
sum += item.id.charCodeAt(i);
|
sum += item.id.charCodeAt(i);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="greeting-page">
|
<view class="greeting-page">
|
||||||
<NavBar title="我的新春祝福" background="transparent" />
|
<NavBar title="我的真挚祝福" background="transparent" />
|
||||||
|
|
||||||
<!-- Header Stats -->
|
<!-- Header Stats -->
|
||||||
<view class="header-stats">
|
<view class="header-stats">
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="divider"></view>
|
<view class="divider"></view>
|
||||||
<view class="stats-right">
|
<view class="stats-right">
|
||||||
<text class="label">马年运势</text>
|
<text class="label">今日运势</text>
|
||||||
<text class="value red-text">一马当先</text>
|
<text class="value red-text">一马当先</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="footer-note" v-if="!loading && list.length > 0">
|
<view class="footer-note" v-if="!loading && list.length > 0">
|
||||||
<text>2026 丙午马年 · 祝福管理助手</text>
|
<text>2026 精美头像壁纸祝福</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
<view class="fab-btn" @tap="onMake">
|
<view class="fab-btn" @tap="onMake">
|
||||||
<view class="fab-content">
|
<view class="fab-content">
|
||||||
<text class="fab-emoji">✍️</text>
|
<text class="fab-emoji">✍️</text>
|
||||||
<text>新春制作</text>
|
<text>快速制作</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -146,7 +146,7 @@ onShareAppMessage(async (options) => {
|
|||||||
const shareToken = await getShareToken("greeting_page", "");
|
const shareToken = await getShareToken("greeting_page", "");
|
||||||
getShareReward({ scene: "greeting_page" });
|
getShareReward({ scene: "greeting_page" });
|
||||||
return {
|
return {
|
||||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
title: "送你一份好运祝福 🎁|头像·壁纸·祝福卡",
|
||||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -197,12 +197,12 @@ const formatDate = (dateStr) => {
|
|||||||
|
|
||||||
const getTagText = (item) => {
|
const getTagText = (item) => {
|
||||||
// if (item.status === "draft") return "草稿";
|
// if (item.status === "draft") return "草稿";
|
||||||
return item?.title?.name || item.festival || "新春快乐";
|
return item?.title?.name || item.festival || "真挚祝福";
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTitle = (item) => {
|
const getTitle = (item) => {
|
||||||
const title =
|
const title =
|
||||||
(item?.blessingTo || "祝您") + (item?.content?.content || "新春快乐");
|
(item?.blessingTo || "祝您") + (item?.content?.content || "万事如意");
|
||||||
return title.length > 10 ? title.substring(0, 10) + "..." : title;
|
return title.length > 10 ? title.substring(0, 10) + "..." : title;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -122,9 +122,9 @@
|
|||||||
<view class="footer">
|
<view class="footer">
|
||||||
<view class="footer-blessing">
|
<view class="footer-blessing">
|
||||||
<uni-icons type="vip-filled" size="14" color="#ff3b30" />
|
<uni-icons type="vip-filled" size="14" color="#ff3b30" />
|
||||||
<text>祝您2026新春大吉,万事如意</text>
|
<text>祝您 万事大吉,万事如意</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="footer-copy">2026 丙午马年 · 官方出品</view>
|
<view class="footer-copy">官方出品</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -193,6 +193,11 @@ const faqList = ref([
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const copyright = [
|
||||||
|
"如有疑问,请通过“我的-使用说明”联系客服处理。",
|
||||||
|
"最终解释权归 2026 助手团队所有。",
|
||||||
|
];
|
||||||
|
|
||||||
const toggleCategory = (index) => {
|
const toggleCategory = (index) => {
|
||||||
faqList.value[index].expanded = !faqList.value[index].expanded;
|
faqList.value[index].expanded = !faqList.value[index].expanded;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -65,22 +65,22 @@
|
|||||||
<view class="menu-group">
|
<view class="menu-group">
|
||||||
<view class="menu-item" @tap="navTo('greetings')">
|
<view class="menu-item" @tap="navTo('greetings')">
|
||||||
<view class="icon-box red-bg"><text>🧧</text></view>
|
<view class="icon-box red-bg"><text>🧧</text></view>
|
||||||
<text class="menu-text">我的新春祝福</text>
|
<text class="menu-text">我的美好祝福</text>
|
||||||
<text class="arrow">›</text>
|
<text class="arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="menu-item" @tap="navTo('fortune-record')">
|
<view class="menu-item" @tap="navTo('fortune-record')">
|
||||||
<view class="icon-box orange-bg"><text>📹</text></view>
|
<view class="icon-box orange-bg"><text>📹</text></view>
|
||||||
<text class="menu-text">我的新年运势</text>
|
<text class="menu-text">我的每日运势</text>
|
||||||
<text class="arrow">›</text>
|
<text class="arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="menu-item" @tap="navTo('avatar')">
|
<view class="menu-item" @tap="navTo('avatar')">
|
||||||
<view class="icon-box pink-bg"><text>☺</text></view>
|
<view class="icon-box pink-bg"><text>☺</text></view>
|
||||||
<text class="menu-text">我的新春头像</text>
|
<text class="menu-text">我的专属头像</text>
|
||||||
<text class="arrow">›</text>
|
<text class="arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="menu-item" @tap="navTo('wallpaper')">
|
<view class="menu-item" @tap="navTo('wallpaper')">
|
||||||
<view class="icon-box yellow-bg"><text>🖼</text></view>
|
<view class="icon-box yellow-bg"><text>🖼</text></view>
|
||||||
<text class="menu-text">我的新春壁纸</text>
|
<text class="menu-text">我的精美壁纸</text>
|
||||||
<view class="new-badge">NEW</view>
|
<view class="new-badge">NEW</view>
|
||||||
<text class="arrow">›</text>
|
<text class="arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<view class="version-info">2026 丙午马年 · 新春助手 v1.0.2</view>
|
<!-- <view class="version-info">2026 丙午马年 · 精美助手 v1.0.2</view> -->
|
||||||
|
|
||||||
<!-- Bottom Spacer for TabBar -->
|
<!-- Bottom Spacer for TabBar -->
|
||||||
<view style="height: 120rpx"></view>
|
<view style="height: 120rpx"></view>
|
||||||
@@ -177,7 +177,7 @@ onShareAppMessage(async () => {
|
|||||||
const shareToken = await getShareToken("mine");
|
const shareToken = await getShareToken("mine");
|
||||||
getShareReward({ scene: "mine" });
|
getShareReward({ scene: "mine" });
|
||||||
return {
|
return {
|
||||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
title: "送你一份好运祝福 🎁|头像·壁纸·祝福卡",
|
||||||
path: "/pages/index/index?shareToken=" + shareToken,
|
path: "/pages/index/index?shareToken=" + shareToken,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="profile-page" >
|
<view class="profile-page">
|
||||||
<NavBar title="个人信息" />
|
<NavBar title="个人信息" />
|
||||||
|
|
||||||
<!-- Content -->
|
<!-- Content -->
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
<!-- <view class="info-item" @click="handleEditManifesto">
|
<!-- <view class="info-item" @click="handleEditManifesto">
|
||||||
<text class="label">新春宣言</text>
|
<text class="label">个性宣言</text>
|
||||||
<view class="value-box">
|
<view class="value-box">
|
||||||
<text class="value red-text">{{ form.bio || "点击选择" }}</text>
|
<text class="value red-text">{{ form.bio || "点击选择" }}</text>
|
||||||
<uni-icons type="compose" size="16" color="#ccc" />
|
<uni-icons type="compose" size="16" color="#ccc" />
|
||||||
@@ -186,12 +186,12 @@ const handleSave = async () => {
|
|||||||
const originalForm = {
|
const originalForm = {
|
||||||
nickName: userInfo.value.nickName || "",
|
nickName: userInfo.value.nickName || "",
|
||||||
gender: userInfo.value.gender || 1,
|
gender: userInfo.value.gender || 1,
|
||||||
bio: userInfo.value.bio || "万事如意,岁岁平安"
|
bio: userInfo.value.bio || "万事如意,岁岁平安",
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await updateUserInfo({
|
const res = await updateUserInfo({
|
||||||
nickname: form.value.nickName,
|
nickname: form.value.nickName,
|
||||||
gender: form.value.gender,
|
gender: form.value.gender,
|
||||||
bio: form.value.bio,
|
bio: form.value.bio,
|
||||||
});
|
});
|
||||||
@@ -204,7 +204,7 @@ const handleSave = async () => {
|
|||||||
} else {
|
} else {
|
||||||
// 恢复之前的内容
|
// 恢复之前的内容
|
||||||
form.value = { ...originalForm };
|
form.value = { ...originalForm };
|
||||||
uni.showToast({ title: res.message || '修改失败', icon: "none" });
|
uni.showToast({ title: res.message || "修改失败", icon: "none" });
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ const notes = [
|
|||||||
"会员服务为虚拟产品,支付后立即生效,不支持退款。",
|
"会员服务为虚拟产品,支付后立即生效,不支持退款。",
|
||||||
"会员权益在有效期内全平台通用。",
|
"会员权益在有效期内全平台通用。",
|
||||||
"如有疑问,请通过“我的-使用说明”联系客服处理。",
|
"如有疑问,请通过“我的-使用说明”联系客服处理。",
|
||||||
"最终解释权归 2026 新春助手团队所有。",
|
"最终解释权归 本平台所有。",
|
||||||
];
|
];
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@@ -30,7 +30,11 @@
|
|||||||
class="grid-item"
|
class="grid-item"
|
||||||
@tap="onPreview(item)"
|
@tap="onPreview(item)"
|
||||||
>
|
>
|
||||||
<image :src="item.imageUrl" mode="aspectFill" class="wallpaper-img" />
|
<image
|
||||||
|
:src="getThumbUrl(item.imageUrl)"
|
||||||
|
mode="aspectFill"
|
||||||
|
class="wallpaper-img"
|
||||||
|
/>
|
||||||
<view class="date-badge">
|
<view class="date-badge">
|
||||||
<text>{{ formatDate(item.createdAt) }}</text>
|
<text>{{ formatDate(item.createdAt) }}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -81,6 +85,10 @@ onReachBottom(() => {
|
|||||||
loadMore();
|
loadMore();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getThumbUrl = (url) => {
|
||||||
|
return `${url}?imageView2/1/w/340/h/600/q/80`;
|
||||||
|
};
|
||||||
|
|
||||||
const fetchList = async (reset = false) => {
|
const fetchList = async (reset = false) => {
|
||||||
if (loading.value) return;
|
if (loading.value) return;
|
||||||
if (reset) {
|
if (reset) {
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ const features = ref([
|
|||||||
type: "avatar_decor",
|
type: "avatar_decor",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "马年主题头像框",
|
title: "主题头像框",
|
||||||
subtitle: "2026限定",
|
subtitle: "2026限定",
|
||||||
icon: "https://file.lihailezzc.com/resource/9f80ab295b7e0a7a5f62c3b0f2d7a11c.png",
|
icon: "https://file.lihailezzc.com/resource/9f80ab295b7e0a7a5f62c3b0f2d7a11c.png",
|
||||||
type: "avatar_frame",
|
type: "avatar_frame",
|
||||||
@@ -235,7 +235,7 @@ onShareAppMessage(async () => {
|
|||||||
const shareToken = await getShareToken("spring_index");
|
const shareToken = await getShareToken("spring_index");
|
||||||
getShareReward({ scene: "spring_index" });
|
getShareReward({ scene: "spring_index" });
|
||||||
return {
|
return {
|
||||||
title: "2026 丙午马年,送你一份新春祝福 🎊",
|
title: "送你一份美好祝福 🎊",
|
||||||
path: `/pages/spring/index?shareToken=${shareToken}`,
|
path: `/pages/spring/index?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -245,7 +245,7 @@ onShareAppMessage(async () => {
|
|||||||
onShareTimeline(async () => {
|
onShareTimeline(async () => {
|
||||||
const shareToken = await getShareToken("spring_timeline");
|
const shareToken = await getShareToken("spring_timeline");
|
||||||
return {
|
return {
|
||||||
title: "2026 丙午马年,送你一份新春祝福 🎊",
|
title: "送你一份美好祝福 🎊",
|
||||||
query: `shareToken=${shareToken}`,
|
query: `shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
<view class="nickname">{{
|
<view class="nickname">{{
|
||||||
detailData.from.nickname || "神秘好友"
|
detailData.from.nickname || "神秘好友"
|
||||||
}}</view>
|
}}</view>
|
||||||
<view class="action-text">给你分享了一张2026新春精美壁纸</view>
|
<view class="action-text">给你分享了一张精美壁纸</view>
|
||||||
<view class="sub-text">★ 2026 且马贺岁</view>
|
<view class="sub-text">★ 幸运每一天</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
class="scroll-img"
|
class="scroll-img"
|
||||||
/>
|
/>
|
||||||
<text class="item-title">{{ item.title || "新春壁纸" }}</text>
|
<text class="item-title">{{ item.title || "精美壁纸" }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
<text class="footer-text">2026 HAPPY NEW YEAR</text>
|
<text class="footer-text">2026 HAPPY NEW YEAR</text>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="footer-sub">新春祝福 · 传递温情</view>
|
<view class="footer-sub">精美壁纸 · 传递温情</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<LoginPopup ref="loginPopupRef" @logind="handleLogind" />
|
<LoginPopup ref="loginPopupRef" @logind="handleLogind" />
|
||||||
@@ -158,7 +158,7 @@ onShareAppMessage(async () => {
|
|||||||
const token = await getShareToken("wallpaper_download", detailData.value?.id);
|
const token = await getShareToken("wallpaper_download", detailData.value?.id);
|
||||||
getShareReward({ scene: "wallpaper_download" });
|
getShareReward({ scene: "wallpaper_download" });
|
||||||
return {
|
return {
|
||||||
title: "快来看看我刚领到的新年精美壁纸 🖼",
|
title: "快来看看我刚领到的精美壁纸 🖼",
|
||||||
path: `/pages/wallpaper/detail?shareToken=${token || ""}`,
|
path: `/pages/wallpaper/detail?shareToken=${token || ""}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
detailData.value?.imageUrl ||
|
detailData.value?.imageUrl ||
|
||||||
@@ -169,7 +169,7 @@ onShareAppMessage(async () => {
|
|||||||
onShareTimeline(async () => {
|
onShareTimeline(async () => {
|
||||||
const token = await getShareToken("wallpaper_download", detailData.value?.id);
|
const token = await getShareToken("wallpaper_download", detailData.value?.id);
|
||||||
return {
|
return {
|
||||||
title: "快来看看我刚领到的新年精美壁纸 🖼",
|
title: "快来看看我刚领到的精美壁纸 🖼",
|
||||||
query: `shareToken=${token}`,
|
query: `shareToken=${token}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
detailData.value?.imageUrl ||
|
detailData.value?.imageUrl ||
|
||||||
@@ -288,10 +288,7 @@ const downloadWallpaper = async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const canProceed = await checkAbilityAndHandle(
|
const canProceed = await checkAbilityAndHandle("wallpaper_download");
|
||||||
"wallpaper_download",
|
|
||||||
rewardAdRef,
|
|
||||||
);
|
|
||||||
if (!canProceed) return;
|
if (!canProceed) return;
|
||||||
|
|
||||||
uni.showLoading({ title: "下载中..." });
|
uni.showLoading({ title: "下载中..." });
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ onShareAppMessage(async (options) => {
|
|||||||
if (!isLoggedIn.value) {
|
if (!isLoggedIn.value) {
|
||||||
const shareToken = await getShareToken("wallpaper_download_index", "");
|
const shareToken = await getShareToken("wallpaper_download_index", "");
|
||||||
return {
|
return {
|
||||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
title: "好运已送达 🎊|祝福卡·头像·壁纸",
|
||||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -145,13 +145,13 @@ onShareAppMessage(async (options) => {
|
|||||||
options?.target?.dataset?.item?.id,
|
options?.target?.dataset?.item?.id,
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
title: "快来挑选喜欢的新春壁纸吧",
|
title: "快来挑选喜欢的壁纸吧",
|
||||||
path: `/pages/wallpaper/detail?shareToken=${shareToken}`,
|
path: `/pages/wallpaper/detail?shareToken=${shareToken}`,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const shareToken = await getShareToken("wallpaper_download_index", "");
|
const shareToken = await getShareToken("wallpaper_download_index", "");
|
||||||
return {
|
return {
|
||||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
title: "送你一份好运祝福 🎁|头像·壁纸·祝福卡",
|
||||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -162,7 +162,7 @@ onShareAppMessage(async (options) => {
|
|||||||
onShareTimeline(async () => {
|
onShareTimeline(async () => {
|
||||||
const shareToken = await getShareToken("wallpaper_timeline");
|
const shareToken = await getShareToken("wallpaper_timeline");
|
||||||
return {
|
return {
|
||||||
title: "精选新年壁纸,让手机也过年 🖼",
|
title: "送你一份好运祝福 🎁|头像·壁纸·祝福卡",
|
||||||
query: `shareToken=${shareToken}`,
|
query: `shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
@@ -304,10 +304,7 @@ const downloadWallpaper = async (item) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const canProceed = await checkAbilityAndHandle(
|
const canProceed = await checkAbilityAndHandle("wallpaper_download");
|
||||||
"wallpaper_download",
|
|
||||||
rewardAdRef,
|
|
||||||
);
|
|
||||||
if (!canProceed) return;
|
if (!canProceed) return;
|
||||||
|
|
||||||
uni.showLoading({ title: "下载中..." });
|
uni.showLoading({ title: "下载中..." });
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
<view class="nickname">{{
|
<view class="nickname">{{
|
||||||
detailData.from.nickname || "神秘好友"
|
detailData.from.nickname || "神秘好友"
|
||||||
}}</view>
|
}}</view>
|
||||||
<view class="action-text">给你分享了一张2026新春精美壁纸</view>
|
<view class="action-text">给你分享了一张精美壁纸</view>
|
||||||
<view class="sub-text">★ 2026 且马贺岁</view>
|
<view class="sub-text">★ 幸运每一天</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
<!-- More Wallpapers -->
|
<!-- More Wallpapers -->
|
||||||
<view class="more-section">
|
<view class="more-section">
|
||||||
<view class="section-header">
|
<view class="section-header">
|
||||||
<text class="section-title">我也要领新春壁纸</text>
|
<text class="section-title">我也要领精美壁纸</text>
|
||||||
<view class="more-link" @tap="goToIndex">
|
<view class="more-link" @tap="goToIndex">
|
||||||
<text>查看更多</text>
|
<text>查看更多</text>
|
||||||
<text class="arrow">›</text>
|
<text class="arrow">›</text>
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
class="scroll-img"
|
class="scroll-img"
|
||||||
/>
|
/>
|
||||||
<text class="item-title">{{ item.title || "新春壁纸" }}</text>
|
<text class="item-title">{{ item.title || "精美壁纸" }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@@ -84,8 +84,8 @@
|
|||||||
<text>🏮</text>
|
<text>🏮</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="banner-content">
|
<view class="banner-content">
|
||||||
<text class="banner-title">去抽取新年运势</text>
|
<text class="banner-title">去抽取每日运势</text>
|
||||||
<text class="banner-desc">每日一签,开启你的新年好运</text>
|
<text class="banner-desc">每日一签,开启你的满满好运</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="banner-arrow">›</text>
|
<text class="banner-arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -94,8 +94,8 @@
|
|||||||
<text>🧧</text>
|
<text>🧧</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="banner-content">
|
<view class="banner-content">
|
||||||
<text class="banner-title">去制作新年贺卡</text>
|
<text class="banner-title">制作一张祝福贺卡</text>
|
||||||
<text class="banner-desc">定制专属祝福,传递浓浓年味</text>
|
<text class="banner-desc">写下心意,把祝福送给重要的人</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="banner-arrow">›</text>
|
<text class="banner-arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -104,8 +104,8 @@
|
|||||||
<text>🖼</text>
|
<text>🖼</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="banner-content">
|
<view class="banner-content">
|
||||||
<text class="banner-title">去挑选新年头像</text>
|
<text class="banner-title">换个好看头像吧</text>
|
||||||
<text class="banner-desc">精选新年头像,让手机也过年</text>
|
<text class="banner-desc">精选头像合集,找到你的专属风格</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="banner-arrow">›</text>
|
<text class="banner-arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
<text class="footer-text">2026 HAPPY NEW YEAR</text>
|
<text class="footer-text">2026 HAPPY NEW YEAR</text>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="footer-sub">新春祝福 · 传递温情</view>
|
<view class="footer-sub">精美壁纸 · 传递温情</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -152,7 +152,7 @@ onShareAppMessage(async () => {
|
|||||||
const token = await getShareToken("wallpaper_download", detailData.value?.id);
|
const token = await getShareToken("wallpaper_download", detailData.value?.id);
|
||||||
getShareReward({ scene: "wallpaper_download" });
|
getShareReward({ scene: "wallpaper_download" });
|
||||||
return {
|
return {
|
||||||
title: "快来看看我刚领到的新年精美壁纸 🖼",
|
title: "快来看看我刚领到的精美壁纸 🖼",
|
||||||
path: `/pages/wallpaper/detail?shareToken=${token || ""}`,
|
path: `/pages/wallpaper/detail?shareToken=${token || ""}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
detailData.value?.imageUrl ||
|
detailData.value?.imageUrl ||
|
||||||
@@ -163,7 +163,7 @@ onShareAppMessage(async () => {
|
|||||||
onShareTimeline(async () => {
|
onShareTimeline(async () => {
|
||||||
const token = await getShareToken("wallpaper_download", detailData.value?.id);
|
const token = await getShareToken("wallpaper_download", detailData.value?.id);
|
||||||
return {
|
return {
|
||||||
title: "快来看看我刚领到的新年精美壁纸 🖼",
|
title: "快来看看我刚领到的精美壁纸 🖼",
|
||||||
query: `shareToken=${token}`,
|
query: `shareToken=${token}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
detailData.value?.imageUrl ||
|
detailData.value?.imageUrl ||
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ export const useUserStore = defineStore("user", {
|
|||||||
},
|
},
|
||||||
async fetchUserAssets() {
|
async fetchUserAssets() {
|
||||||
try {
|
try {
|
||||||
|
console.log("fetchUserAssets userInfo", this.userInfo);
|
||||||
if (!this?.userInfo?.id) return;
|
if (!this?.userInfo?.id) return;
|
||||||
const res = await getUserAsset();
|
const res = await getUserAsset();
|
||||||
if (res) {
|
if (res) {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { abilityCheck } from "@/api/system";
|
import { abilityCheck } from "@/api/system";
|
||||||
|
import adManager from "@/utils/adManager";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a user has the ability to perform an action (e.g., download).
|
* Checks if a user has the ability to perform an action (e.g., download).
|
||||||
* Handles common blocking scenarios like "need_share" or "need_ad".
|
* Handles common blocking scenarios like "need_share" or "need_ad".
|
||||||
*
|
*
|
||||||
* @param {string} scene - The scene identifier for the ability check (e.g., "wallpaper_download").
|
* @param {string} scene - The scene identifier for the ability check (e.g., "wallpaper_download").
|
||||||
* @param {Object} rewardAdRef - The ref to the RewardAd component (must have a .value.show() method or be the instance itself).
|
|
||||||
* @returns {Promise<boolean>} - Returns true if the action can proceed, false otherwise.
|
* @returns {Promise<boolean>} - Returns true if the action can proceed, false otherwise.
|
||||||
*/
|
*/
|
||||||
export const checkAbilityAndHandle = async (scene, rewardAdRef) => {
|
export const checkAbilityAndHandle = async (scene) => {
|
||||||
try {
|
try {
|
||||||
const abilityRes = await abilityCheck(scene);
|
const abilityRes = await abilityCheck(scene);
|
||||||
if (abilityRes.canUse) {
|
if (abilityRes.canUse) {
|
||||||
@@ -35,19 +35,7 @@ export const checkAbilityAndHandle = async (scene, rewardAdRef) => {
|
|||||||
content: "观看广告可获得50积分,继续下载",
|
content: "观看广告可获得50积分,继续下载",
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
// Check if rewardAdRef is a ref (has .value) or the component instance itself
|
adManager.showVideoAd();
|
||||||
if (
|
|
||||||
rewardAdRef &&
|
|
||||||
rewardAdRef.value &&
|
|
||||||
typeof rewardAdRef.value.show === "function"
|
|
||||||
) {
|
|
||||||
rewardAdRef.value.show();
|
|
||||||
} else if (rewardAdRef && typeof rewardAdRef.show === "function") {
|
|
||||||
rewardAdRef.show();
|
|
||||||
} else {
|
|
||||||
console.error("RewardAd component reference is invalid");
|
|
||||||
uni.showToast({ title: "广告加载失败", icon: "none" });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -80,3 +68,26 @@ export const checkAbilityAndHandle = async (scene, rewardAdRef) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the display label for an unlock type.
|
||||||
|
* @param {string} unlockType - The unlock type identifier.
|
||||||
|
* @returns {string} - The display label.
|
||||||
|
*/
|
||||||
|
export const getUnlockLabel = (unlockType) => {
|
||||||
|
if (!unlockType) return "解锁";
|
||||||
|
switch (unlockType) {
|
||||||
|
case "sing3":
|
||||||
|
return "连续签到3天";
|
||||||
|
case "sing5":
|
||||||
|
return "连续签到5天";
|
||||||
|
case "sing7":
|
||||||
|
return "连续签到7天";
|
||||||
|
case "ad":
|
||||||
|
return "广告";
|
||||||
|
case "vip":
|
||||||
|
return "VIP";
|
||||||
|
default:
|
||||||
|
return "解锁";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
107
utils/adManager.js
Normal file
107
utils/adManager.js
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
import { watchAdStart, watchAdReward } from "@/api/system.js";
|
||||||
|
import { useUserStore } from "@/stores/user";
|
||||||
|
|
||||||
|
class AdManager {
|
||||||
|
constructor() {
|
||||||
|
this.videoAd = null;
|
||||||
|
this.rewardToken = "";
|
||||||
|
this.isLoaded = false;
|
||||||
|
this.adUnitId = "adunit-d7a28e0357d98947"; // Default ID from RewardAd.vue
|
||||||
|
this._init();
|
||||||
|
}
|
||||||
|
|
||||||
|
_init() {
|
||||||
|
if (uni.createRewardedVideoAd) {
|
||||||
|
this.videoAd = uni.createRewardedVideoAd({
|
||||||
|
adUnitId: this.adUnitId,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.videoAd.onLoad(() => {
|
||||||
|
console.log("Ad Manager: Ad Loaded");
|
||||||
|
this.isLoaded = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.videoAd.onError((err) => {
|
||||||
|
console.error("Ad Manager: Ad Load Error", err);
|
||||||
|
this.isLoaded = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the rewarded video ad.
|
||||||
|
* Handles the full flow: start session -> show ad -> verify completion -> claim reward -> refresh assets.
|
||||||
|
* @returns {Promise<boolean>} Resolves with true if reward was claimed, false otherwise.
|
||||||
|
*/
|
||||||
|
async showVideoAd() {
|
||||||
|
if (!this.videoAd) {
|
||||||
|
uni.showToast({ title: "当前环境不支持广告", icon: "none" });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Step 1: Start Ad Session
|
||||||
|
const startRes = await watchAdStart();
|
||||||
|
if (!startRes || !startRes.rewardToken) {
|
||||||
|
uni.showToast({ title: "广告启动失败,请稍后再试", icon: "none" });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.rewardToken = startRes.rewardToken;
|
||||||
|
|
||||||
|
// Step 2: Show Ad
|
||||||
|
try {
|
||||||
|
await this.videoAd.show();
|
||||||
|
} catch (e) {
|
||||||
|
// Retry load and show
|
||||||
|
await this.videoAd.load();
|
||||||
|
await this.videoAd.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 3: Wait for Close
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
const onCloseHandler = async (res) => {
|
||||||
|
this.videoAd.offClose(onCloseHandler); // Clean up listener
|
||||||
|
|
||||||
|
if (res && res.isEnded) {
|
||||||
|
// Step 4: Claim Reward
|
||||||
|
await this._claimReward(this.rewardToken);
|
||||||
|
resolve(true);
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: "观看完整广告才能获取奖励哦", icon: "none" });
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.videoAd.onClose(onCloseHandler);
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Ad Manager: Show failed", e);
|
||||||
|
uni.showToast({ title: "广告加载失败,请稍后再试", icon: "none" });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async _claimReward(token) {
|
||||||
|
try {
|
||||||
|
uni.showLoading({ title: "发放奖励中..." });
|
||||||
|
const res = await watchAdReward(token);
|
||||||
|
if (res) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "获得50积分",
|
||||||
|
icon: "success",
|
||||||
|
});
|
||||||
|
// Refresh user assets
|
||||||
|
const userStore = useUserStore();
|
||||||
|
await userStore.fetchUserAssets();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Ad Manager: Reward claim failed", e);
|
||||||
|
uni.showToast({ title: "奖励发放失败", icon: "none" });
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new AdManager();
|
||||||
Reference in New Issue
Block a user