Compare commits
94 Commits
f5841d0934
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
210f913aed | ||
|
|
516063bb14 | ||
|
|
d15012841c | ||
|
|
b39ac7cb24 | ||
|
|
fee3b05c9e | ||
|
|
ab70f7e78f | ||
|
|
63a6ade0d4 | ||
|
|
d5012753c1 | ||
|
|
b9bec457a7 | ||
|
|
f11b48e50a | ||
|
|
033c70962c | ||
|
|
38843473c4 | ||
|
|
f4004da994 | ||
|
|
99cf4249db | ||
|
|
8110e209c7 | ||
|
|
a7cc9babac | ||
|
|
dd4129bb58 | ||
|
|
b302103c15 | ||
|
|
c62e12756b | ||
|
|
bc1b95210a | ||
|
|
dc2be76648 | ||
|
|
3f623ee6ee | ||
|
|
fd5bc9d12c | ||
|
|
3964d33e31 | ||
|
|
bd3185aac3 | ||
|
|
f40c33fa2e | ||
|
|
1d1b49d36e | ||
|
|
ae835bd213 | ||
|
|
5d735736ad | ||
|
|
916c383dd5 | ||
|
|
a883caf981 | ||
|
|
5738464cc8 | ||
|
|
2d178fa470 | ||
|
|
9137a3410b | ||
|
|
fe562ecec9 | ||
|
|
a1658ad0ea | ||
|
|
ff1ce034b4 | ||
|
|
e3c7450d18 | ||
|
|
09defb45e0 | ||
|
|
8c5d693b7a | ||
|
|
c32701abb4 | ||
|
|
51b2a322dc | ||
|
|
c4bbff1260 | ||
|
|
b393cfd67a | ||
|
|
18909f7ce2 | ||
|
|
d974987cff | ||
|
|
c7cd83f3e9 | ||
|
|
24c1cd53d5 | ||
|
|
d5353f4437 | ||
|
|
1bfcfd2dec | ||
|
|
fabc7547ed | ||
|
|
20978b05c6 | ||
|
|
88cd1c2e8f | ||
|
|
756a49bbf5 | ||
|
|
4c53fa9f65 | ||
|
|
5e0da973af | ||
|
|
8dfd7612b1 | ||
|
|
8d47d6d494 | ||
|
|
72eb440504 | ||
|
|
32457aa947 | ||
|
|
a6e9c1c9ce | ||
|
|
1fef1818d8 | ||
|
|
6c1084ef32 | ||
|
|
818e947513 | ||
|
|
19c18b478f | ||
|
|
e5a8f3ca3f | ||
|
|
90e7f000c8 | ||
|
|
59fa05c341 | ||
|
|
39f8b88715 | ||
|
|
aa09652069 | ||
|
|
74679b0407 | ||
|
|
806878fa54 | ||
|
|
5e49b247db | ||
|
|
28f0f83531 | ||
|
|
66e483c315 | ||
|
|
5e8a3db6d9 | ||
|
|
1d84e34cb3 | ||
|
|
5944f8d011 | ||
|
|
6c23726e09 | ||
|
|
b3165a56cf | ||
|
|
633bc1c814 | ||
|
|
b06a69bd33 | ||
|
|
71620d6199 | ||
|
|
313435d13f | ||
|
|
54e8581b81 | ||
|
|
b6d4a8074e | ||
|
|
03fa790ca2 | ||
|
|
1aef7f1c7c | ||
|
|
a787280e6f | ||
|
|
bf9930d4e4 | ||
|
|
1af26efe14 | ||
|
|
123d7521d7 | ||
|
|
f0936ff4f9 | ||
|
|
ce06a317ef |
45
App.vue
45
App.vue
@@ -1,21 +1,40 @@
|
||||
<script>
|
||||
import { useUserStore } from './stores/user'
|
||||
|
||||
export default {
|
||||
onLaunch() {
|
||||
const userStore = useUserStore()
|
||||
userStore.loadFromStorage()
|
||||
}
|
||||
}
|
||||
|
||||
<script>
|
||||
import { useUserStore } from "./stores/user";
|
||||
import { userOpenApp } from "./api/auth";
|
||||
|
||||
const openApp = async () => {
|
||||
try {
|
||||
const res = await userOpenApp();
|
||||
if (res?.points && res.points > 0) {
|
||||
uni.showToast({
|
||||
title: `每日登录 +${res.points} 积分`,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
const userStore = useUserStore();
|
||||
await userStore.fetchUserAssets();
|
||||
} catch (e) {
|
||||
console.error("userOpenApp error", e);
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
onLaunch() {
|
||||
const userStore = useUserStore();
|
||||
userStore.loadFromStorage();
|
||||
if (userStore.userInfo.id) {
|
||||
openApp();
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import url("common/style/common-style.scss");
|
||||
wx-swiper .wx-swiper-dot {
|
||||
position: relative;
|
||||
right: -260rpx;
|
||||
bottom: 110rpx;
|
||||
position: relative;
|
||||
right: -260rpx;
|
||||
bottom: 110rpx;
|
||||
}
|
||||
/* tabBar */
|
||||
.customtabbar {
|
||||
|
||||
14
api/auth.js
14
api/auth.js
@@ -23,6 +23,20 @@ export const updateUserInfo = async (body) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const userOpenApp = async () => {
|
||||
return request({
|
||||
url: "/api/user/open-app",
|
||||
method: "POST",
|
||||
});
|
||||
};
|
||||
|
||||
export const getUserAsset = async () => {
|
||||
return request({
|
||||
url: "/api/user/asset",
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
export const reportPrivacy = async () => {
|
||||
// return request({
|
||||
// url: "/api/common/privacy/report",
|
||||
|
||||
@@ -7,6 +7,20 @@ export const getAvatarSystemList = async (page = 1) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getAvatarSystemCategoryList = async () => {
|
||||
return request({
|
||||
url: `/api/blessing/avatar/category/list`,
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
export const getAvatarSystemListByCategory = async (categoryId, page = 1) => {
|
||||
return request({
|
||||
url: `/api/blessing/avatar/system/list?categoryId=${categoryId}&page=${page}`,
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
export const getAvatarDecorList = async (page = 1) => {
|
||||
return request({
|
||||
url: `/api/blessing/avatar/decor/list?page=${page}`,
|
||||
|
||||
23
api/daily.js
Normal file
23
api/daily.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { request } from "@/utils/request.js";
|
||||
|
||||
export const getDailyInfo = async () => {
|
||||
return request({
|
||||
url: "/api/blessing/daily-greeting/home",
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
export const getDailyRandomGreeting = async (sceneId) => {
|
||||
return request({
|
||||
url: `/api/blessing/daily-greeting/random?sceneId=${sceneId}`,
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
export const saveDailyGreeting = async (data) => {
|
||||
return request({
|
||||
url: "/api/blessing/daily-greeting/send",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
};
|
||||
31
api/make.js
31
api/make.js
@@ -16,23 +16,42 @@ export const updateCard = async (data) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getCardTemplateList = async (page = 1) => {
|
||||
export const getCardTemplateList = async (page = 1, scene = "") => {
|
||||
let url = "/api/blessing/card/template/list?page=" + page;
|
||||
if (scene) {
|
||||
url += "&scene=" + scene;
|
||||
}
|
||||
return request({
|
||||
url: "/api/blessing/card/template/list?page=" + page,
|
||||
url,
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
export const getCardTemplateContentList = async (page = 1) => {
|
||||
export const getCardTemplateContentList = async (page = 1, scene = "") => {
|
||||
let url = "/api/blessing/card/template-content/list?page=" + page;
|
||||
if (scene) {
|
||||
url += "&scene=" + scene;
|
||||
}
|
||||
return request({
|
||||
url: "/api/blessing/card/template-content/list?page=" + page,
|
||||
url,
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
export const getCardTemplateTitleList = async (page = 1) => {
|
||||
export const getCardMusicList = async () => {
|
||||
return request({
|
||||
url: "/api/blessing/card/template-title/list?page=" + page,
|
||||
url: "/api/blessing/card/music/list",
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
export const getCardTemplateTitleList = async (page = 1, scene = "") => {
|
||||
let url = "/api/blessing/card/template-title/list?page=" + page;
|
||||
if (scene) {
|
||||
url += "&scene=" + scene;
|
||||
}
|
||||
return request({
|
||||
url,
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ import { request } from "@/utils/request.js";
|
||||
|
||||
export const abilityCheck = async (scene) => {
|
||||
return request({
|
||||
url: "/api/blessing/ability/check?scene=" + scene,
|
||||
url: "/api/ability/check?scene=" + scene,
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
@@ -24,7 +24,7 @@ export const getPageDetail = async (shareToken) => {
|
||||
|
||||
export const getShareReward = async (data) => {
|
||||
return request({
|
||||
url: "/api/blessing/share/reward",
|
||||
url: "/api/reward/share",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
@@ -53,6 +53,27 @@ export const getRecommendList = async (page = 1) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getRankList = async (scene) => {
|
||||
return request({
|
||||
url: `/api/blessing/rank/resource-list?scene=${scene}`,
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
export const getCardSpecialTopic = async () => {
|
||||
return request({
|
||||
url: `/api/blessing/card/special-topic`,
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
export const getRandomRecommendList = async (scene) => {
|
||||
return request({
|
||||
url: `/api/blessing/random/recommend/list?scene=${scene}`,
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
export const msgCheckApi = async (content) => {
|
||||
return request({
|
||||
url: "/api/common/msg-check?content=" + content,
|
||||
@@ -73,3 +94,31 @@ export const getTipsList = async () => {
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
export const createTracking = async (data) => {
|
||||
return request({
|
||||
url: "/api/common/tracking/create",
|
||||
method: "POST",
|
||||
data,
|
||||
});
|
||||
};
|
||||
|
||||
export const watchAdReward = async (token) => {
|
||||
return request({
|
||||
url: "/api/blessing/ad/reward",
|
||||
method: "POST",
|
||||
data: {
|
||||
rewardToken: token,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const watchAdStart = async () => {
|
||||
return request({
|
||||
url: "/api/blessing/ad/start",
|
||||
method: "POST",
|
||||
data: {
|
||||
adPlacementId: "adunit-d7a28e0357d98947",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
22
api/user.js
Normal file
22
api/user.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import { request } from "@/utils/request.js";
|
||||
|
||||
export const getUserSignInfo = async () => {
|
||||
return request({
|
||||
url: "/api/sign/info",
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
|
||||
export const userSignIn = async () => {
|
||||
return request({
|
||||
url: "/api/sign/in",
|
||||
method: "POST",
|
||||
});
|
||||
};
|
||||
|
||||
export const getUserLuckInfo = async () => {
|
||||
return request({
|
||||
url: "/api/blessing/user/luck-info",
|
||||
method: "GET",
|
||||
});
|
||||
};
|
||||
@@ -20,3 +20,10 @@ export const getWallpaperRecommendList = async () => {
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
export const getWallpaperSameList = async (id) => {
|
||||
return request({
|
||||
url: `/api/blessing/wallpaper/same/list?id=${id}`,
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from "vue";
|
||||
import { ref, computed, onMounted, onUnmounted } from "vue";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { getPlatformProvider, isSinglePageMode } from "@/utils/system";
|
||||
import { uploadImage } from "@/utils/common";
|
||||
@@ -112,6 +112,19 @@ const props = defineProps({
|
||||
|
||||
const emit = defineEmits(["logind"]);
|
||||
|
||||
// 监听全局事件
|
||||
const handleGlobalShow = () => {
|
||||
open();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
uni.$on("show-login-popup", handleGlobalShow);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
uni.$off("show-login-popup", handleGlobalShow);
|
||||
});
|
||||
|
||||
// 是否处于单页模式(朋友圈打开)
|
||||
const isSinglePage = computed(() => isSinglePageMode());
|
||||
|
||||
@@ -197,6 +210,9 @@ const handleAlipayLogin = async () => {
|
||||
id: loginRes?.user?.id,
|
||||
isVip: loginRes?.isVip || false,
|
||||
vipExpireAt: loginRes?.vipExpireAt || null,
|
||||
points: loginRes?.points || 0,
|
||||
exp: loginRes?.exp || 0,
|
||||
level: loginRes?.level || 0,
|
||||
});
|
||||
|
||||
userStore.setToken(loginRes.token);
|
||||
@@ -268,6 +284,9 @@ const confirmLogin = async () => {
|
||||
id: loginRes?.user?.id,
|
||||
isVip: loginRes?.isVip || false,
|
||||
vipExpireAt: loginRes?.vipExpireAt || null,
|
||||
points: loginRes?.points || 0,
|
||||
exp: loginRes?.exp || 0,
|
||||
level: loginRes?.level || 0,
|
||||
});
|
||||
|
||||
userStore.setToken(loginRes.token);
|
||||
|
||||
1034
components/LuckyPopup/LuckyPopup.vue
Normal file
1034
components/LuckyPopup/LuckyPopup.vue
Normal file
File diff suppressed because it is too large
Load Diff
94
components/RewardAd/RewardAd.vue
Normal file
94
components/RewardAd/RewardAd.vue
Normal file
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<view></view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, onUnmounted } from "vue";
|
||||
import { watchAdStart } from "@/api/system.js";
|
||||
|
||||
const props = defineProps({
|
||||
adUnitId: {
|
||||
type: String,
|
||||
default: "adunit-d7a28e0357d98947",
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["onReward", "onError", "onClose"]);
|
||||
|
||||
let videoAd = null;
|
||||
let rewardToken = "";
|
||||
|
||||
const onLoadHandler = () => {
|
||||
console.log("Ad Loaded");
|
||||
};
|
||||
|
||||
const onErrorHandler = (err) => {
|
||||
console.error("Ad Load Error", err);
|
||||
emit("onError", err);
|
||||
};
|
||||
|
||||
const onCloseHandler = (res) => {
|
||||
if (res && res.isEnded) {
|
||||
emit("onReward", rewardToken);
|
||||
} else {
|
||||
uni.showToast({ title: "观看完整广告才能获取奖励哦", icon: "none" });
|
||||
emit("onClose");
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (uni.createRewardedVideoAd) {
|
||||
videoAd = uni.createRewardedVideoAd({
|
||||
adUnitId: props.adUnitId,
|
||||
});
|
||||
|
||||
videoAd.onLoad(onLoadHandler);
|
||||
videoAd.onError(onErrorHandler);
|
||||
videoAd.onClose(onCloseHandler);
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (videoAd) {
|
||||
videoAd.offLoad(onLoadHandler);
|
||||
videoAd.offError(onErrorHandler);
|
||||
videoAd.offClose(onCloseHandler);
|
||||
}
|
||||
});
|
||||
|
||||
const show = async () => {
|
||||
try {
|
||||
// Step 1: Start Ad Session to get Token
|
||||
const res = await watchAdStart();
|
||||
if (res && res.rewardToken) {
|
||||
rewardToken = res.rewardToken;
|
||||
|
||||
// Step 2: Show Ad
|
||||
if (videoAd) {
|
||||
videoAd.show().catch(() => {
|
||||
videoAd
|
||||
.load()
|
||||
.then(() => videoAd.show())
|
||||
.catch((err) => {
|
||||
console.error("Ad show failed", err);
|
||||
uni.showToast({
|
||||
title: "广告加载失败,请稍后再试",
|
||||
icon: "none",
|
||||
});
|
||||
emit("onError", err);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
uni.showToast({ title: "当前环境不支持广告", icon: "none" });
|
||||
}
|
||||
} else {
|
||||
uni.showToast({ title: "广告启动失败,请稍后再试", icon: "none" });
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("watchAdStart failed", e);
|
||||
uni.showToast({ title: "广告启动失败,请稍后再试", icon: "none" });
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({ show });
|
||||
</script>
|
||||
46
pages.json
46
pages.json
@@ -9,10 +9,26 @@
|
||||
"backgroundColor": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/greeting/daily",
|
||||
"style": {
|
||||
"navigationBarTitleText": "每日精选",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/greeting/share",
|
||||
"style": {
|
||||
"navigationBarTitleText": "问候分享",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/make/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "讨论",
|
||||
"navigationBarTitleText": "制作祝福卡",
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
@@ -89,6 +105,22 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/avatar/download",
|
||||
"style": {
|
||||
"navigationBarTitleText": "精选头像",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/creation/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "创作中心",
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "#fbfbfb"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/detail/index",
|
||||
"style": {
|
||||
@@ -151,6 +183,14 @@
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/wallpaper/share",
|
||||
"style": {
|
||||
"navigationBarTitleText": "壁纸分享",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
@@ -176,8 +216,8 @@
|
||||
"selectedIconPath": "static/images/tabBar/home_s.png"
|
||||
},
|
||||
{
|
||||
"text": "定制贺卡",
|
||||
"pagePath": "pages/make/index",
|
||||
"text": "创作",
|
||||
"pagePath": "pages/creation/index",
|
||||
"iconPath": "static/images/tabBar/creation.png",
|
||||
"selectedIconPath": "static/images/tabBar/creation_s.png"
|
||||
},
|
||||
|
||||
@@ -124,9 +124,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import { getPageDetail } from "@/api/system.js";
|
||||
import { getPageDetail, getShareReward } from "@/api/system";
|
||||
import { getAvatarRecommendList } from "@/api/avatar.js";
|
||||
import { getShareToken, saveViewRequest } from "@/utils/common.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
@@ -146,7 +146,8 @@ onLoad((options) => {
|
||||
});
|
||||
|
||||
onShareAppMessage(async () => {
|
||||
const token = await getShareToken("avatar_detail", detailData.value?.id);
|
||||
const token = await getShareToken("avatar_download", detailData.value?.id);
|
||||
getShareReward({ scene: "avatar_download" });
|
||||
return {
|
||||
title: "快来看看我刚领到的新年专属头像 🎊",
|
||||
path: `/pages/avatar/detail?shareToken=${token}`,
|
||||
@@ -157,7 +158,7 @@ onShareAppMessage(async () => {
|
||||
});
|
||||
|
||||
onShareTimeline(async () => {
|
||||
const token = await getShareToken("avatar_timeline", detailData.value?.id);
|
||||
const token = await getShareToken("avatar_download", detailData.value?.id);
|
||||
return {
|
||||
title: "快来看看我刚领到的新年专属头像 🎊",
|
||||
query: `shareToken=${token}`,
|
||||
|
||||
541
pages/avatar/download.vue
Normal file
541
pages/avatar/download.vue
Normal file
@@ -0,0 +1,541 @@
|
||||
<template>
|
||||
<view class="avatar-download-page">
|
||||
<NavBar title="精选头像" />
|
||||
|
||||
<!-- Category Tabs -->
|
||||
<view class="category-tabs">
|
||||
<scroll-view scroll-x class="tabs-scroll" :show-scrollbar="false">
|
||||
<view class="tabs-content">
|
||||
<view
|
||||
v-for="(item, index) in categories"
|
||||
:key="index"
|
||||
class="tab-item"
|
||||
:class="{ active: currentCategoryId === item.id }"
|
||||
@tap="switchCategory(item.id)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- Points Info -->
|
||||
<view class="points-bar">
|
||||
<view class="points-left">
|
||||
<uni-icons type="download" size="14" color="#ff9800" />
|
||||
<text>每次下载消耗 {{ downloadCost }} 积分</text>
|
||||
</view>
|
||||
<view class="points-right">
|
||||
<text>当前积分:</text>
|
||||
<text class="score-val">{{ userPoints }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Avatar Grid -->
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="avatar-scroll"
|
||||
@scrolltolower="loadMore"
|
||||
refresher-enabled
|
||||
:refresher-triggered="isRefreshing"
|
||||
@refresherrefresh="onRefresh"
|
||||
>
|
||||
<view class="grid-container">
|
||||
<view class="grid-item" v-for="(item, index) in avatars" :key="index">
|
||||
<image
|
||||
:src="getThumbUrl(item.imageUrl)"
|
||||
mode="aspectFill"
|
||||
class="avatar-img"
|
||||
@tap="previewImage(index)"
|
||||
/>
|
||||
<view class="action-overlay">
|
||||
<button
|
||||
class="action-btn share"
|
||||
open-type="share"
|
||||
:data-item="item"
|
||||
@tap.stop="shareAvatar(item)"
|
||||
>
|
||||
<text class="icon">➦</text>
|
||||
</button>
|
||||
<view class="action-btn download" @tap.stop="downloadAvatar(item)">
|
||||
<text class="icon">↓</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Loading State -->
|
||||
<view class="loading-state" v-if="loading">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
<view class="empty-state" v-if="!loading && avatars.length === 0">
|
||||
<text>暂无内容</text>
|
||||
</view>
|
||||
<view class="no-more" v-if="!loading && !hasMore && avatars.length > 0">
|
||||
<text>没有更多了</text>
|
||||
</view>
|
||||
|
||||
<!-- Spacer for bottom button -->
|
||||
<view class="bottom-spacer"></view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- Bottom Button -->
|
||||
<view class="bottom-action-bar">
|
||||
<button class="create-btn" @tap="goToMake">
|
||||
<uni-icons
|
||||
type="compose"
|
||||
size="20"
|
||||
color="#fff"
|
||||
style="margin-right: 8rpx"
|
||||
/>
|
||||
去制作专属头像
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<LoginPopup
|
||||
ref="loginPopupRef"
|
||||
@logind="handleLogind"
|
||||
:share-token="shareToken"
|
||||
/>
|
||||
<RewardAd ref="rewardAdRef" @onReward="handleAdReward" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from "vue";
|
||||
import {
|
||||
getAvatarSystemCategoryList,
|
||||
getAvatarSystemListByCategory,
|
||||
avatarDownloadRecord,
|
||||
} from "@/api/avatar.js";
|
||||
import {
|
||||
saveRemoteImageToLocal,
|
||||
saveRecordRequest,
|
||||
getShareToken,
|
||||
trackRecord,
|
||||
saveViewRequest,
|
||||
} from "@/utils/common.js";
|
||||
import { onShareAppMessage, onShareTimeline, onLoad } from "@dcloudio/uni-app";
|
||||
import { getShareReward, watchAdReward } from "@/api/system.js";
|
||||
import { checkAbilityAndHandle } from "@/utils/ability.js";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import RewardAd from "@/components/RewardAd/RewardAd.vue";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const loginPopupRef = ref(null);
|
||||
const rewardAdRef = ref(null);
|
||||
|
||||
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
||||
const userPoints = computed(() => userStore.userInfo.points || 0);
|
||||
const downloadCost = ref(20);
|
||||
|
||||
const categories = ref([]);
|
||||
const currentCategoryId = ref(null);
|
||||
const avatars = ref([]);
|
||||
const page = ref(1);
|
||||
const loading = ref(false);
|
||||
const hasMore = ref(true);
|
||||
const isRefreshing = ref(false);
|
||||
const shareToken = ref("");
|
||||
|
||||
onShareAppMessage(async (options) => {
|
||||
if (!isLoggedIn.value) {
|
||||
const shareToken = await getShareToken("avatar_download_index", "");
|
||||
return {
|
||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
}
|
||||
getShareReward({ scene: "avatar_download" });
|
||||
if (options.from === "button") {
|
||||
const shareToken = await getShareToken(
|
||||
"avatar_download",
|
||||
options?.target?.dataset?.item?.id,
|
||||
);
|
||||
return {
|
||||
title: "快来挑选喜欢的新春头像吧",
|
||||
path: `/pages/avatar/download?shareToken=${shareToken}`,
|
||||
};
|
||||
} else {
|
||||
const shareToken = await getShareToken("avatar_download_index", "");
|
||||
return {
|
||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
onShareTimeline(async () => {
|
||||
const shareToken = await getShareToken("avatar_timeline");
|
||||
return {
|
||||
title: "精选新年头像,定制专属祝福 🧧",
|
||||
query: `shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.shareToken) {
|
||||
shareToken.value = options.shareToken;
|
||||
saveViewRequest(options.shareToken, "avatar_download");
|
||||
}
|
||||
fetchCategories();
|
||||
trackRecord({
|
||||
eventName: "avatar_download_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
});
|
||||
|
||||
const getThumbUrl = (url) => {
|
||||
// Use square thumbnail for avatars
|
||||
return `${url}?imageView2/1/w/340/h/340/q/80`;
|
||||
};
|
||||
|
||||
const fetchCategories = async () => {
|
||||
try {
|
||||
const res = await getAvatarSystemCategoryList();
|
||||
const list = Array.isArray(res) ? res : res?.list || [];
|
||||
if (list.length > 0) {
|
||||
categories.value = list;
|
||||
currentCategoryId.value = list[0].id;
|
||||
loadAvatars(true);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to fetch categories", e);
|
||||
uni.showToast({ title: "获取分类失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
|
||||
const switchCategory = (id) => {
|
||||
if (currentCategoryId.value === id) return;
|
||||
currentCategoryId.value = id;
|
||||
loadAvatars(true);
|
||||
trackRecord({
|
||||
eventName: "avatar_category_click",
|
||||
eventType: `select`,
|
||||
elementId: id || "",
|
||||
});
|
||||
};
|
||||
|
||||
const loadAvatars = async (reset = false) => {
|
||||
if (loading.value) return;
|
||||
if (!currentCategoryId.value) return;
|
||||
if (reset) {
|
||||
page.value = 1;
|
||||
hasMore.value = true;
|
||||
avatars.value = [];
|
||||
}
|
||||
if (!hasMore.value) return;
|
||||
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await getAvatarSystemListByCategory(
|
||||
currentCategoryId.value,
|
||||
page.value,
|
||||
);
|
||||
const list = res?.list || [];
|
||||
hasMore.value = !!res?.hasNext;
|
||||
|
||||
if (reset) {
|
||||
avatars.value = list;
|
||||
} else {
|
||||
avatars.value = [...avatars.value, ...list];
|
||||
}
|
||||
|
||||
if (hasMore.value) {
|
||||
page.value++;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to fetch avatars", e);
|
||||
uni.showToast({ title: "获取列表失败", icon: "none" });
|
||||
} finally {
|
||||
loading.value = false;
|
||||
isRefreshing.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const loadMore = () => {
|
||||
loadAvatars();
|
||||
};
|
||||
|
||||
const handleLogind = async () => {
|
||||
// Logic after successful login if needed
|
||||
};
|
||||
|
||||
const onRefresh = () => {
|
||||
isRefreshing.value = true;
|
||||
loadAvatars(true);
|
||||
};
|
||||
|
||||
const previewImage = (index) => {
|
||||
const urls = avatars.value.map((item) => item.imageUrl);
|
||||
uni.previewImage({
|
||||
urls,
|
||||
current: index,
|
||||
});
|
||||
const item = avatars.value[index];
|
||||
trackRecord({
|
||||
eventName: "avatar_preview_click",
|
||||
eventType: `select`,
|
||||
elementId: item?.id || "",
|
||||
});
|
||||
};
|
||||
|
||||
const handleAdReward = async (token) => {
|
||||
try {
|
||||
const res = await watchAdReward(token);
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
title: "获得50积分",
|
||||
icon: "success",
|
||||
});
|
||||
await userStore.fetchUserAssets();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Reward claim failed", e);
|
||||
uni.showToast({ title: "奖励发放失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
|
||||
const downloadAvatar = async (item) => {
|
||||
trackRecord({
|
||||
eventName: "avatar_download_click",
|
||||
eventType: `click`,
|
||||
elementId: item?.id || "",
|
||||
});
|
||||
if (!isLoggedIn.value) {
|
||||
loginPopupRef.value.open();
|
||||
return;
|
||||
}
|
||||
|
||||
const canProceed = await checkAbilityAndHandle(
|
||||
"avatar_download",
|
||||
rewardAdRef,
|
||||
);
|
||||
if (!canProceed) return;
|
||||
|
||||
uni.showLoading({ title: "下载中..." });
|
||||
try {
|
||||
await Promise.all([
|
||||
saveRemoteImageToLocal(item.imageUrl),
|
||||
avatarDownloadRecord({ id: item.id, url: item.imageUrl }),
|
||||
]);
|
||||
|
||||
await userStore.fetchUserAssets();
|
||||
uni.showToast({ title: "保存成功 消耗 20 积分", icon: "success" });
|
||||
} catch (e) {
|
||||
console.error("Download failed", e);
|
||||
// saveRemoteImageToLocal handles its own error toast usually, but let's be safe
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
};
|
||||
|
||||
const shareAvatar = (item) => {};
|
||||
|
||||
const goToMake = () => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/avatar/index",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.avatar-download-page {
|
||||
height: 100vh;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.category-tabs {
|
||||
padding: 0;
|
||||
background-color: #ffffff;
|
||||
border-bottom: 1rpx solid #eeeeee;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.points-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16rpx 30rpx;
|
||||
background-color: #fffbf0;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.points-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
color: #ff9800;
|
||||
}
|
||||
|
||||
.points-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.score-val {
|
||||
color: #d81e06;
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
margin-left: 4rpx;
|
||||
}
|
||||
|
||||
.tabs-scroll {
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tabs-content {
|
||||
display: inline-flex;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
padding: 24rpx 30rpx;
|
||||
font-size: 30rpx;
|
||||
color: #999999;
|
||||
position: relative;
|
||||
transition: all 0.3s;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
color: #e60012;
|
||||
font-weight: bold;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 80rpx;
|
||||
height: 4rpx;
|
||||
background-color: #e60012;
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-scroll {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.grid-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 30rpx;
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.grid-item {
|
||||
aspect-ratio: 1; /* Make it square */
|
||||
border-radius: 32rpx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.avatar-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.action-overlay {
|
||||
position: absolute;
|
||||
bottom: 20rpx;
|
||||
right: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 50%;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
backdrop-filter: blur(4px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.2);
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
line-height: 1;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
.action-btn.share .icon {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.action-btn .icon {
|
||||
color: #fff;
|
||||
font-size: 36rpx;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.loading-state,
|
||||
.empty-state,
|
||||
.no-more {
|
||||
text-align: center;
|
||||
padding: 40rpx;
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.bottom-spacer {
|
||||
height: 140rpx; /* Space for fixed bottom bar */
|
||||
}
|
||||
|
||||
.bottom-action-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
padding: 20rpx 30rpx calc(20rpx + constant(safe-area-inset-bottom));
|
||||
padding: 20rpx 30rpx calc(20rpx + env(safe-area-inset-bottom));
|
||||
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||
z-index: 200;
|
||||
}
|
||||
|
||||
.create-btn {
|
||||
background: linear-gradient(135deg, #ff3b30, #ff1744);
|
||||
color: #fff;
|
||||
border-radius: 50rpx;
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -70,19 +70,36 @@
|
||||
<!-- 头像选择区 -->
|
||||
<view v-if="activeTool === 'avatar'" class="section">
|
||||
<view class="section-title">选择头像</view>
|
||||
<view class="grid">
|
||||
<view class="grid-item upload-card" @tap="onChooseAlbum">
|
||||
<view class="wechat-avatar-btn">
|
||||
<view class="upload-icon">✨</view>
|
||||
<text class="upload-text">上传头像</text>
|
||||
|
||||
<!-- 新增:醒目的上传头像按钮 -->
|
||||
<view class="upload-area" @tap="onChooseAlbum">
|
||||
<view class="upload-btn-large">
|
||||
<view class="btn-content">
|
||||
<uni-icons
|
||||
type="camera-filled"
|
||||
size="28"
|
||||
color="#fff"
|
||||
></uni-icons>
|
||||
<view class="btn-texts">
|
||||
<text class="btn-title">上传我的照片</text>
|
||||
<text class="btn-sub">制作专属新年头像</text>
|
||||
</view>
|
||||
</view>
|
||||
<uni-icons
|
||||
type="forward"
|
||||
size="20"
|
||||
color="rgba(255,255,255,0.8)"
|
||||
></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="grid">
|
||||
<view
|
||||
v-for="item in systemAvatars"
|
||||
:key="item.id"
|
||||
class="grid-item"
|
||||
:class="{ active: currentAvatar?.id === item.id }"
|
||||
@tap="currentAvatar = item"
|
||||
@tap="toggleAvatar(item)"
|
||||
>
|
||||
<image :src="item.imageUrl" class="grid-img" mode="aspectFill" />
|
||||
<view v-if="currentAvatar?.id === item.id" class="check">✓</view>
|
||||
@@ -147,7 +164,7 @@
|
||||
/>
|
||||
|
||||
<!-- More Avatar Popup -->
|
||||
<uni-popup ref="morePopup" type="bottom" background-color="#fff">
|
||||
<!-- <uni-popup ref="morePopup" type="bottom" background-color="#fff">
|
||||
<view class="popup-content">
|
||||
<view class="popup-header">
|
||||
<text class="popup-title">选择头像</text>
|
||||
@@ -174,7 +191,7 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</uni-popup> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -201,6 +218,7 @@ import {
|
||||
uploadImage,
|
||||
saveViewRequest,
|
||||
} from "@/utils/common.js";
|
||||
import { trackRecord } from "@/utils/common.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
|
||||
@@ -244,8 +262,8 @@ const selectedFrame = ref(null);
|
||||
const selectedDecor = ref(null);
|
||||
|
||||
// More Popup logic
|
||||
const morePopup = ref(null);
|
||||
const moreAvatars = ref([]);
|
||||
// const morePopup = ref(null);
|
||||
// const moreAvatars = ref([]);
|
||||
|
||||
const loadAvatars = async () => {
|
||||
if (avatarLoading.value || !avatarHasNext.value) return;
|
||||
@@ -359,6 +377,10 @@ onLoad((options) => {
|
||||
shareToken.value = options.shareToken;
|
||||
saveViewRequest("avatar_download", options.shareToken);
|
||||
}
|
||||
trackRecord({
|
||||
eventName: "avatar_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
});
|
||||
|
||||
onReachBottom(() => {
|
||||
@@ -369,13 +391,32 @@ onReachBottom(() => {
|
||||
} else if (activeTool.value === "decor") {
|
||||
loadDecors();
|
||||
}
|
||||
trackRecord({
|
||||
eventName: "avatar_load_more",
|
||||
eventType: `load_more`,
|
||||
elementId: activeTool.value,
|
||||
});
|
||||
});
|
||||
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
const toggleAvatar = (avatar) => {
|
||||
currentAvatar.value = avatar;
|
||||
trackRecord({
|
||||
eventName: "avatar_click",
|
||||
eventType: `select`,
|
||||
elementId: avatar?.id || "",
|
||||
});
|
||||
};
|
||||
|
||||
const toggleFrame = (frame) => {
|
||||
trackRecord({
|
||||
eventName: "avatar_frame_click",
|
||||
eventType: `select`,
|
||||
elementId: frame?.id || "",
|
||||
});
|
||||
if (selectedFrame.value === frame) {
|
||||
selectedFrame.value = null;
|
||||
} else {
|
||||
@@ -384,6 +425,11 @@ const toggleFrame = (frame) => {
|
||||
};
|
||||
|
||||
const toggleDecor = (decor) => {
|
||||
trackRecord({
|
||||
eventName: "avatar_decor_click",
|
||||
eventType: `select`,
|
||||
elementId: decor?.id || "",
|
||||
});
|
||||
if (selectedDecor.value === decor) {
|
||||
selectedDecor.value = null;
|
||||
} else {
|
||||
@@ -471,6 +517,7 @@ const handleLogind = async () => {
|
||||
};
|
||||
|
||||
const onChooseAlbum = () => {
|
||||
trackRecord({ eventName: "avatar_choose_album", eventType: "click" });
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ["original", "compressed"],
|
||||
@@ -711,30 +758,36 @@ const completeCardInfo = async (id) => {
|
||||
return imageUrl;
|
||||
};
|
||||
|
||||
onShareAppMessage(async () => {
|
||||
onShareAppMessage(async (options) => {
|
||||
getShareReward({ scene: "avatar_download" });
|
||||
if (!isLoggedIn.value) {
|
||||
if (options.from === "button") {
|
||||
if (!isLoggedIn.value) {
|
||||
loginPopupRef.value.open();
|
||||
return;
|
||||
}
|
||||
uni.showLoading({ title: "分享中...", mask: true });
|
||||
const id = createAvatarId();
|
||||
const [shareToken, imageUrl] = await Promise.all([
|
||||
getShareToken("avatar_download", id),
|
||||
completeCardInfo(id),
|
||||
]);
|
||||
uni.hideLoading();
|
||||
return {
|
||||
title: "3 秒生成新春专属头像,真的好看😆",
|
||||
path: `/pages/avatar/detail?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
imageUrl +
|
||||
"?imageMogr2/thumbnail/!500x400r/gravity/Center/crop/500x400",
|
||||
};
|
||||
} else {
|
||||
const shareToken = await getShareToken("avatar_download_not_login", "");
|
||||
return {
|
||||
title: "新春祝福",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
title: "3 秒生成新春专属头像,真的好看😆",
|
||||
path: `/pages/avatar/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
}
|
||||
uni.showLoading({ title: "分享中...", mask: true });
|
||||
const id = createAvatarId();
|
||||
const [shareToken, imageUrl] = await Promise.all([
|
||||
getShareToken("avatar_download", id),
|
||||
completeCardInfo(id),
|
||||
]);
|
||||
uni.hideLoading();
|
||||
return {
|
||||
title: "我做了一个新头像,真的太好看了",
|
||||
path: `/pages/avatar/detail?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
imageUrl + "?imageMogr2/thumbnail/!500x400r/gravity/Center/crop/500x400",
|
||||
};
|
||||
});
|
||||
|
||||
onShareTimeline(async () => {
|
||||
@@ -755,6 +808,54 @@ onShareTimeline(async () => {
|
||||
padding-bottom: 200rpx;
|
||||
}
|
||||
|
||||
.upload-area {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.upload-btn-large {
|
||||
width: 100%;
|
||||
height: 120rpx;
|
||||
background: linear-gradient(135deg, #ff6b66 0%, #ff3b30 100%);
|
||||
border-radius: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 8rpx 24rpx rgba(255, 59, 48, 0.3);
|
||||
transition: all 0.2s;
|
||||
border: 2rpx solid rgba(255, 255, 255, 0.2);
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
box-shadow: 0 4rpx 12rpx rgba(255, 59, 48, 0.2);
|
||||
}
|
||||
|
||||
.btn-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-texts {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 20rpx;
|
||||
|
||||
.btn-title {
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.btn-sub {
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
font-size: 22rpx;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.top-steps {
|
||||
background: #fff;
|
||||
padding: 30rpx 40rpx;
|
||||
|
||||
472
pages/creation/index.vue
Normal file
472
pages/creation/index.vue
Normal file
@@ -0,0 +1,472 @@
|
||||
<template>
|
||||
<view class="creation-page" :style="{ paddingTop: navBarHeight + 'px' }">
|
||||
<!-- 自定义导航栏 -->
|
||||
<view
|
||||
class="custom-nav"
|
||||
:style="{
|
||||
height: navBarHeight + 'px',
|
||||
paddingTop: statusBarHeight + 'px',
|
||||
}"
|
||||
>
|
||||
<text class="nav-title">创作中心</text>
|
||||
<view class="search-icon" @tap="handleSearch">
|
||||
<uni-icons type="search" size="20" color="#333" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="container">
|
||||
<!-- 今日推荐创作 Banner -->
|
||||
<view class="recommend-banner" @tap="goToMake">
|
||||
<view class="banner-content">
|
||||
<view class="banner-tag">
|
||||
<view class="tag-line"></view>
|
||||
<text>灵感瞬间</text>
|
||||
</view>
|
||||
<view class="banner-title">今日推荐创作</view>
|
||||
<view class="banner-main-title">开启你今日的第一份<br />祝福</view>
|
||||
<view class="go-btn">去制作</view>
|
||||
</view>
|
||||
<image
|
||||
class="banner-decor"
|
||||
src="/static/icon/celebrate.png"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 快捷制作 -->
|
||||
<view class="section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">快捷制作</text>
|
||||
</view>
|
||||
<view class="quick-grid">
|
||||
<view class="quick-item" @tap="handleQuickAction('card')">
|
||||
<view class="icon-box card-bg">
|
||||
<image src="/static/icon/celebrate.png" mode="aspectFit" />
|
||||
</view>
|
||||
<text>祝福贺卡</text>
|
||||
</view>
|
||||
<view class="quick-item" @tap="handleQuickAction('fortune')">
|
||||
<view class="icon-box fortune-bg">
|
||||
<image src="/static/icon/yunshi.png" mode="aspectFit" />
|
||||
</view>
|
||||
<text>今日运势</text>
|
||||
</view>
|
||||
<view class="quick-item" @tap="handleQuickAction('avatar')">
|
||||
<view class="icon-box avatar-bg">
|
||||
<image src="/static/icon/guashi.png" mode="aspectFit" />
|
||||
</view>
|
||||
<text>头像挂饰</text>
|
||||
</view>
|
||||
<view class="quick-item" @tap="handleQuickAction('wallpaper')">
|
||||
<view class="icon-box wallpaper-bg">
|
||||
<image src="/static/icon/bizhi.png" mode="aspectFit" />
|
||||
</view>
|
||||
<text>精美壁纸</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 按心情创作 -->
|
||||
<!-- <view class="section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">按心情创作</text>
|
||||
</view>
|
||||
<scroll-view scroll-x class="mood-scroll" show-scrollbar="false">
|
||||
<view class="mood-list">
|
||||
<view
|
||||
v-for="(mood, index) in moods"
|
||||
:key="index"
|
||||
class="mood-item"
|
||||
@tap="handleMoodClick(mood)"
|
||||
>
|
||||
<text class="mood-emoji">{{ mood.emoji }}</text>
|
||||
<text class="mood-name">{{ mood.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view> -->
|
||||
|
||||
<!-- 编辑精选 -->
|
||||
<view class="section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">编辑精选</text>
|
||||
<!-- <text class="view-all" @tap="viewAll">查看全部</text> -->
|
||||
</view>
|
||||
<view class="featured-grid">
|
||||
<view
|
||||
v-for="(item, index) in featuredList"
|
||||
:key="index"
|
||||
class="featured-item"
|
||||
@tap="onCardClick(item)"
|
||||
>
|
||||
<view class="item-cover-wrap">
|
||||
<image
|
||||
:src="item.imageUrl"
|
||||
mode="aspectFill"
|
||||
class="item-cover"
|
||||
/>
|
||||
<view v-if="item.tag" class="item-tag" :class="item.tag">{{
|
||||
item.tagText
|
||||
}}</view>
|
||||
</view>
|
||||
<text class="item-title">{{ item.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import { getBavBarHeight, getStatusBarHeight } from "@/utils/system";
|
||||
import { getRecommendList } from "@/api/system";
|
||||
import { trackRecord } from "@/utils/common.js";
|
||||
|
||||
const navBarHeight = ref(getBavBarHeight());
|
||||
const statusBarHeight = ref(getStatusBarHeight());
|
||||
|
||||
const moods = ref([
|
||||
{ name: "开心", emoji: "🎉" },
|
||||
{ name: "想念", emoji: "💌" },
|
||||
{ name: "加油", emoji: "💪" },
|
||||
{ name: "好运", emoji: "🧧" },
|
||||
{ name: "暴富", emoji: "💰" },
|
||||
]);
|
||||
|
||||
const featuredList = ref([]);
|
||||
|
||||
onMounted(() => {
|
||||
fetchFeaturedList();
|
||||
trackRecord({
|
||||
eventName: "creation_page_visit",
|
||||
eventType: "visit",
|
||||
});
|
||||
});
|
||||
|
||||
const fetchFeaturedList = async () => {
|
||||
try {
|
||||
const res = await getRecommendList(1);
|
||||
const list = res?.list || [];
|
||||
featuredList.value = list.slice(0, 4).map((item) => ({
|
||||
...item,
|
||||
tag: item.tag === "hot" ? "hot" : item.tag === "new" ? "new" : "",
|
||||
tagText: item.tag === "hot" ? "HOT" : item.tag === "new" ? "NEW" : "",
|
||||
}));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSearch = () => {
|
||||
uni.showToast({ title: "搜索功能开发中", icon: "none" });
|
||||
};
|
||||
|
||||
const goToMake = () => {
|
||||
uni.navigateTo({ url: "/pages/make/index" });
|
||||
};
|
||||
|
||||
const handleQuickAction = (type) => {
|
||||
const map = {
|
||||
card: "/pages/make/index",
|
||||
fortune: "/pages/fortune/index",
|
||||
avatar: "/pages/avatar/index",
|
||||
wallpaper: "/pages/wallpaper/index",
|
||||
};
|
||||
|
||||
uni.navigateTo({ url: map[type] });
|
||||
};
|
||||
|
||||
const handleMoodClick = (mood) => {
|
||||
uni.showToast({ title: `选择了${mood.name}心情`, icon: "none" });
|
||||
};
|
||||
|
||||
const viewAll = () => {
|
||||
uni.switchTab({ url: "/pages/index/index" });
|
||||
};
|
||||
|
||||
const onCardClick = (card) => {
|
||||
const query = `recommendId=${card.recommendId || ""}&type=${card.type || ""}&imageUrl=${encodeURIComponent(card.imageUrl || "")}`;
|
||||
if (card.type === "card") {
|
||||
uni.setStorageSync("RECOMMEND_CARD_DATA", {
|
||||
recommendId: card.recommendId,
|
||||
imageUrl: card.imageUrl,
|
||||
type: card.type,
|
||||
});
|
||||
uni.navigateTo({ url: "/pages/make/index" });
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: `/pages/avatar/index?${query}`,
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.creation-page {
|
||||
min-height: 100vh;
|
||||
background-color: #fbfbfb;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.custom-nav {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
background-color: #fbfbfb;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 32rpx;
|
||||
justify-content: space-between;
|
||||
|
||||
.nav-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 24rpx 32rpx;
|
||||
}
|
||||
|
||||
.recommend-banner {
|
||||
height: 320rpx;
|
||||
background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
|
||||
border-radius: 32rpx;
|
||||
padding: 40rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
box-shadow: 0 8rpx 24rpx rgba(255, 59, 48, 0.05);
|
||||
margin-bottom: 48rpx;
|
||||
|
||||
.banner-content {
|
||||
flex: 1;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.banner-tag {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
.tag-line {
|
||||
width: 32rpx;
|
||||
height: 4rpx;
|
||||
background: #ff3b30;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 24rpx;
|
||||
color: #ff3b30;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.banner-title {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.banner-main-title {
|
||||
font-size: 40rpx;
|
||||
font-weight: 700;
|
||||
color: #000;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.go-btn {
|
||||
display: inline-block;
|
||||
padding: 12rpx 40rpx;
|
||||
background: #ff3b30;
|
||||
color: #fff;
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
border-radius: 32rpx;
|
||||
box-shadow: 0 8rpx 16rpx rgba(255, 59, 48, 0.2);
|
||||
}
|
||||
|
||||
.banner-decor {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
opacity: 0.1;
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
bottom: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.section {
|
||||
margin-bottom: 48rpx;
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.view-all {
|
||||
font-size: 24rpx;
|
||||
color: #ff3b30;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.quick-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 24rpx;
|
||||
|
||||
.quick-item {
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 32rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.02);
|
||||
|
||||
.icon-box {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
image {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
|
||||
&.card-bg {
|
||||
background: #fff1f1;
|
||||
}
|
||||
&.fortune-bg {
|
||||
background: #fff8e6;
|
||||
}
|
||||
&.avatar-bg {
|
||||
background: #f0f7ff;
|
||||
}
|
||||
&.wallpaper-bg {
|
||||
background: #f0fff4;
|
||||
}
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mood-scroll {
|
||||
width: 100%;
|
||||
|
||||
.mood-list {
|
||||
display: flex;
|
||||
padding: 8rpx 0;
|
||||
}
|
||||
|
||||
.mood-item {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
padding: 16rpx 32rpx;
|
||||
border-radius: 40rpx;
|
||||
margin-right: 20rpx;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.02);
|
||||
|
||||
.mood-emoji {
|
||||
font-size: 32rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.mood-name {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.featured-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 24rpx;
|
||||
|
||||
.featured-item {
|
||||
.item-cover-wrap {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 320rpx;
|
||||
border-radius: 24rpx;
|
||||
overflow: hidden;
|
||||
margin-bottom: 16rpx;
|
||||
background: #eee;
|
||||
|
||||
.item-cover {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.item-tag {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 6rpx 16rpx;
|
||||
font-size: 20rpx;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
border-bottom-left-radius: 16rpx;
|
||||
|
||||
&.hot {
|
||||
background: #ff3b30;
|
||||
}
|
||||
&.new {
|
||||
background: #007aff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
padding: 0 8rpx;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -22,6 +22,16 @@
|
||||
{{ cardDetail?.festival || "丙午马年" }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Music Control -->
|
||||
<view
|
||||
v-if="cardDetail?.musicUrl"
|
||||
class="music-control"
|
||||
:class="{ playing: isBgmPlaying }"
|
||||
@tap="toggleBgm"
|
||||
>
|
||||
<text class="music-icon">{{ isBgmPlaying ? "🎵" : "🔇" }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Card Preview Area -->
|
||||
@@ -114,14 +124,50 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import { getPageDetail } from "@/api/system.js";
|
||||
import { ref, onUnmounted } from "vue";
|
||||
import {
|
||||
onLoad,
|
||||
onHide,
|
||||
onUnload,
|
||||
onShareAppMessage,
|
||||
onShareTimeline,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { getPageDetail, getShareReward } from "@/api/system";
|
||||
import { getShareToken, saveViewRequest } from "@/utils/common.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
|
||||
const cardId = ref("");
|
||||
const cardDetail = ref({});
|
||||
const isBgmPlaying = ref(false);
|
||||
const innerAudioContext = uni.createInnerAudioContext();
|
||||
|
||||
const initBgm = (url) => {
|
||||
if (!url) return;
|
||||
innerAudioContext.src = url;
|
||||
innerAudioContext.loop = true;
|
||||
innerAudioContext.autoplay = true;
|
||||
innerAudioContext.onPlay(() => {
|
||||
isBgmPlaying.value = true;
|
||||
});
|
||||
innerAudioContext.onPause(() => {
|
||||
isBgmPlaying.value = false;
|
||||
});
|
||||
innerAudioContext.onStop(() => {
|
||||
isBgmPlaying.value = false;
|
||||
});
|
||||
innerAudioContext.onError((res) => {
|
||||
console.error("BGM播放错误:", res);
|
||||
isBgmPlaying.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const toggleBgm = () => {
|
||||
if (isBgmPlaying.value) {
|
||||
innerAudioContext.pause();
|
||||
} else {
|
||||
innerAudioContext.play();
|
||||
}
|
||||
};
|
||||
|
||||
onLoad(async (options) => {
|
||||
if (options.shareToken) {
|
||||
@@ -129,11 +175,26 @@ onLoad(async (options) => {
|
||||
cardId.value = card.id;
|
||||
cardDetail.value = card;
|
||||
saveViewRequest(options.shareToken, "card_generate", card.id);
|
||||
|
||||
if (card.musicUrl) {
|
||||
initBgm(card.musicUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
onHide(() => {
|
||||
if (isBgmPlaying.value) {
|
||||
innerAudioContext.pause();
|
||||
}
|
||||
});
|
||||
|
||||
onUnload(() => {
|
||||
innerAudioContext.destroy();
|
||||
});
|
||||
|
||||
onShareAppMessage(async () => {
|
||||
const token = await getShareToken("card_detail", cardDetail.value?.id);
|
||||
const token = await getShareToken("card_generate", cardDetail.value?.id);
|
||||
getShareReward({ scene: "card_generate" });
|
||||
return {
|
||||
title: "送你一张精美的新春祝福卡片 🎊",
|
||||
path: `/pages/detail/index?shareToken=${token || ""}`,
|
||||
@@ -144,7 +205,7 @@ onShareAppMessage(async () => {
|
||||
});
|
||||
|
||||
onShareTimeline(async () => {
|
||||
const token = await getShareToken("card_timeline", cardDetail.value?.id);
|
||||
const token = await getShareToken("card_generate", cardDetail.value?.id);
|
||||
return {
|
||||
title: "送你一张精美的新春祝福卡片 🎊",
|
||||
query: `shareToken=${token}`,
|
||||
@@ -246,6 +307,39 @@ const goToWallpaper = () => {
|
||||
padding: 20rpx 30rpx 60rpx;
|
||||
}
|
||||
|
||||
/* Music Control */
|
||||
.music-control {
|
||||
margin-left: auto;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
background: rgba(255, 59, 48, 0.05);
|
||||
border: 2rpx solid rgba(255, 59, 48, 0.1);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&.playing {
|
||||
animation: rotate 3s linear infinite;
|
||||
background: rgba(255, 59, 48, 0.1);
|
||||
border-color: rgba(255, 59, 48, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
.music-icon {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* User Header */
|
||||
.user-header {
|
||||
display: flex;
|
||||
|
||||
@@ -135,6 +135,7 @@ import {
|
||||
saveRemoteImageToLocal,
|
||||
saveRecordRequest,
|
||||
saveViewRequest,
|
||||
trackRecord,
|
||||
} from "@/utils/common.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
|
||||
@@ -166,6 +167,10 @@ onLoad((options) => {
|
||||
shareToken.value = options.shareToken;
|
||||
saveViewRequest(options.shareToken, "fortune_draw");
|
||||
}
|
||||
trackRecord({
|
||||
eventName: "fortune_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
@@ -198,9 +203,6 @@ onShareTimeline(async () => {
|
||||
});
|
||||
|
||||
const handleLogind = async () => {
|
||||
if (shareToken.value) {
|
||||
console.log(11111111, shareToken.value);
|
||||
}
|
||||
checkDrawStatus();
|
||||
};
|
||||
|
||||
|
||||
@@ -89,6 +89,8 @@ import { onLoad } from "@dcloudio/uni-app";
|
||||
import { getList } from "@/api/fortune.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import { formatDate } from "@/utils/date.js";
|
||||
import { trackRecord } from "@/utils/common.js";
|
||||
|
||||
// 状态管理
|
||||
const records = ref([]);
|
||||
const page = ref(1);
|
||||
@@ -160,6 +162,10 @@ const loadData = async () => {
|
||||
|
||||
const loadMore = () => {
|
||||
loadData();
|
||||
trackRecord({
|
||||
eventName: "fortune_record_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
};
|
||||
|
||||
const goDetail = (item) => {
|
||||
|
||||
791
pages/greeting/daily.vue
Normal file
791
pages/greeting/daily.vue
Normal file
@@ -0,0 +1,791 @@
|
||||
<template>
|
||||
<view class="daily-page">
|
||||
<NavBar title="每日精选" color="#333" />
|
||||
|
||||
<!-- Header -->
|
||||
<view class="page-header">
|
||||
<view class="header-left">
|
||||
<uni-icons type="sun-filled" size="24" color="#ff9800" />
|
||||
<text class="header-title">{{ greetingTitle }}</text>
|
||||
</view>
|
||||
<view class="streak-badge">
|
||||
<text>已连续问候</text>
|
||||
<text class="streak-count">{{ streakDays }}</text>
|
||||
<text>天</text>
|
||||
<text class="fire-icon">🔥</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Main Card -->
|
||||
<view class="main-card-container">
|
||||
<view
|
||||
class="quote-card"
|
||||
:style="
|
||||
currentQuote.backgroundUrl
|
||||
? {
|
||||
backgroundImage: `url(${currentQuote.backgroundUrl})`,
|
||||
backgroundSize: 'cover',
|
||||
backgroundPosition: 'center',
|
||||
}
|
||||
: {}
|
||||
"
|
||||
>
|
||||
<view class="quote-icon">❝</view>
|
||||
<view class="quote-content">
|
||||
<text class="quote-text">{{ currentQuote.text }}</text>
|
||||
<text class="quote-highlight" v-if="currentQuote.highlight">{{
|
||||
currentQuote.highlight
|
||||
}}</text>
|
||||
</view>
|
||||
<view class="quote-divider"></view>
|
||||
<view class="quote-author" v-if="authorName">
|
||||
<text>—— {{ authorName }} 的专属问候</text>
|
||||
</view>
|
||||
|
||||
<view class="card-actions">
|
||||
<view class="refresh-btn" @tap="refreshQuote">
|
||||
<uni-icons type="loop" size="16" color="#666" />
|
||||
<text>换一句</text>
|
||||
</view>
|
||||
|
||||
<view class="author-edit-box">
|
||||
<input
|
||||
class="input"
|
||||
type="text"
|
||||
v-model="authorName"
|
||||
placeholder="输入名字生成专属问候"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Categories -->
|
||||
<view class="category-section">
|
||||
<view class="category-grid">
|
||||
<view
|
||||
v-for="(cat, index) in scenes"
|
||||
:key="index"
|
||||
class="category-item"
|
||||
@tap="selectCategory(cat.id)"
|
||||
>
|
||||
<view
|
||||
class="cat-icon-box"
|
||||
:class="{ active: currentCategory === cat.id }"
|
||||
:style="{ background: cat.bg }"
|
||||
>
|
||||
<text class="cat-emoji">{{ cat.icon }}</text>
|
||||
</view>
|
||||
<text
|
||||
class="cat-name"
|
||||
:class="{ active: currentCategory === cat.id }"
|
||||
>{{ cat.name }}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Hot List -->
|
||||
<view class="hot-list-section">
|
||||
<view class="section-title-row">
|
||||
<view class="title-bar"></view>
|
||||
<text class="section-title">今日最热榜单</text>
|
||||
<text class="section-subtitle">REAL-TIME DATA</text>
|
||||
</view>
|
||||
|
||||
<view class="hot-list">
|
||||
<view
|
||||
v-for="(item, index) in hotList"
|
||||
:key="index"
|
||||
class="hot-item"
|
||||
@tap="useHotItem(item)"
|
||||
>
|
||||
<view class="rank-icon">
|
||||
<uni-icons
|
||||
v-if="index === 0"
|
||||
type="vip-filled"
|
||||
size="24"
|
||||
color="#ffbc00"
|
||||
/>
|
||||
<uni-icons
|
||||
v-else-if="index === 1"
|
||||
type="vip-filled"
|
||||
size="24"
|
||||
color="#b0bec5"
|
||||
/>
|
||||
<uni-icons v-else type="vip-filled" size="24" color="#cd7f32" />
|
||||
</view>
|
||||
<view class="hot-content">
|
||||
<text class="hot-text">{{ item.text }}</text>
|
||||
<view class="hot-meta">
|
||||
<text class="fire">🔥</text>
|
||||
<text class="hot-count">{{ item.count }}w 人正在使用</text>
|
||||
</view>
|
||||
</view>
|
||||
<uni-icons type="right" size="16" color="#ccc" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Bottom Actions -->
|
||||
<view class="bottom-actions safe-area-bottom">
|
||||
<view class="action-btn-group">
|
||||
<button class="save-btn" @tap="saveCard">
|
||||
<view class="icon-circle">
|
||||
<uni-icons type="download" size="20" color="#333" />
|
||||
</view>
|
||||
<text class="btn-text">保存</text>
|
||||
</button>
|
||||
<button class="send-btn" open-type="share">
|
||||
<uni-icons type="paperplane-filled" size="20" color="#fff" />
|
||||
<text>立即发送今日问候</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 登录弹窗 -->
|
||||
<LoginPopup />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from "vue";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import { onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import {
|
||||
getDailyInfo,
|
||||
getDailyRandomGreeting,
|
||||
saveDailyGreeting,
|
||||
} from "@/api/daily";
|
||||
import {
|
||||
getShareToken,
|
||||
saveViewRequest,
|
||||
generateObjectId,
|
||||
} from "@/utils/common.js";
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const streakDays = ref(0);
|
||||
|
||||
const greetingTitle = computed(() => {
|
||||
const hour = new Date().getHours();
|
||||
if (hour < 9) return "早安,今天也要好运";
|
||||
if (hour < 12) return "上午好,元气满满";
|
||||
if (hour < 14) return "午安,记得休息";
|
||||
if (hour < 18) return "下午好,继续加油";
|
||||
return "晚安,好梦相伴";
|
||||
});
|
||||
|
||||
const scenes = ref([]);
|
||||
const currentCategory = ref("");
|
||||
|
||||
const currentQuote = ref({
|
||||
text: "",
|
||||
highlight: "",
|
||||
author: "",
|
||||
backgroundUrl: "",
|
||||
id: "",
|
||||
});
|
||||
const authorName = ref("");
|
||||
|
||||
const loadDailyInfo = async () => {
|
||||
try {
|
||||
const res = await getDailyInfo();
|
||||
if (res) {
|
||||
streakDays.value = res.streakDays || 0;
|
||||
if (res.lastSignature && !authorName.value) {
|
||||
authorName.value = res.lastSignature;
|
||||
}
|
||||
|
||||
if (res.scenes && res.scenes.length > 0) {
|
||||
scenes.value = res.scenes;
|
||||
if (!currentCategory.value) {
|
||||
currentCategory.value = res.scenes[0].id;
|
||||
}
|
||||
}
|
||||
|
||||
if (res.mainHero) {
|
||||
const { greetingContent, backgroundUrl, greetingId, greetingScene } =
|
||||
res.mainHero;
|
||||
let text = "";
|
||||
let highlight = "";
|
||||
if (greetingContent) {
|
||||
const parts = greetingContent.split(" ");
|
||||
if (parts.length > 1) {
|
||||
highlight = parts.pop();
|
||||
text = parts.join("\n");
|
||||
} else {
|
||||
text = greetingContent;
|
||||
}
|
||||
}
|
||||
|
||||
currentQuote.value = {
|
||||
text,
|
||||
highlight,
|
||||
author: authorName.value, // Will be reactive in template via authorName ref
|
||||
backgroundUrl: backgroundUrl || "",
|
||||
id: greetingId,
|
||||
content: greetingContent,
|
||||
};
|
||||
|
||||
if (greetingScene) {
|
||||
currentCategory.value = greetingScene;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to load daily info:", e);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadDailyInfo();
|
||||
});
|
||||
|
||||
const hotList = ref([
|
||||
{ text: "新的一年,愿灵马带走烦恼...", count: "2.4" },
|
||||
{ text: "事事顺意,岁岁平安。", count: "1.8" },
|
||||
]);
|
||||
|
||||
const selectCategory = (id) => {
|
||||
currentCategory.value = id;
|
||||
refreshQuote();
|
||||
};
|
||||
|
||||
const refreshQuote = async () => {
|
||||
try {
|
||||
const res = await getDailyRandomGreeting(currentCategory.value);
|
||||
if (res) {
|
||||
const { greetingContent, backgroundUrl, greetingId } = res;
|
||||
let text = "";
|
||||
let highlight = "";
|
||||
if (greetingContent) {
|
||||
const parts = greetingContent.split(" ");
|
||||
if (parts.length > 1) {
|
||||
highlight = parts.pop();
|
||||
text = parts.join("\n");
|
||||
} else {
|
||||
text = greetingContent;
|
||||
}
|
||||
}
|
||||
|
||||
currentQuote.value = {
|
||||
...currentQuote.value,
|
||||
text,
|
||||
highlight,
|
||||
backgroundUrl: backgroundUrl || "",
|
||||
id: greetingId,
|
||||
content: greetingContent,
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to refresh quote:", e);
|
||||
}
|
||||
};
|
||||
|
||||
const useHotItem = (item) => {
|
||||
currentQuote.value = {
|
||||
...currentQuote.value,
|
||||
text: item.text,
|
||||
highlight: "",
|
||||
author: "热榜推荐",
|
||||
};
|
||||
};
|
||||
|
||||
const saveCard = () => {
|
||||
uni.showToast({ title: "保存功能开发中", icon: "none" });
|
||||
};
|
||||
|
||||
// const sendGreeting = () => {
|
||||
// // Use uni.navigateTo for normal flow if not open-type="share"
|
||||
// // But here we might want to trigger share directly or just navigate to make page as before
|
||||
// // Based on user request "share after friend opens page", it implies we need to handle share
|
||||
// // Let's keep the navigation to make page for "Sending" (which usually means making a card first)
|
||||
// // BUT also add onShareAppMessage so the top right menu share works
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/make/index?scene=daily&content=${encodeURIComponent(
|
||||
// currentQuote.value.text,
|
||||
// )}&author=${encodeURIComponent(authorName.value)}`,
|
||||
// });
|
||||
// };
|
||||
|
||||
onShareAppMessage(async (options) => {
|
||||
const id = createGreeting();
|
||||
const shareToken = await getShareToken("daily_greeting", id);
|
||||
|
||||
return {
|
||||
title: `${authorName.value}给你发来了一份今日问候`,
|
||||
path: "/pages/greeting/share?shareToken=" + shareToken,
|
||||
};
|
||||
|
||||
const fromUser = userStore.userInfo?.nickName || "神秘好友";
|
||||
const fromAvatar = userStore.userInfo?.avatarUrl || "";
|
||||
|
||||
// Log the share attempt and path
|
||||
console.log("Sharing daily greeting", {
|
||||
res,
|
||||
fromUser,
|
||||
content: currentQuote.value.text,
|
||||
});
|
||||
|
||||
const path = `/pages/greeting/share?content=${encodeURIComponent(
|
||||
currentQuote.value.text,
|
||||
)}&author=${encodeURIComponent(
|
||||
authorName.value || currentQuote.value.author,
|
||||
)}&fromUser=${encodeURIComponent(fromUser)}&fromAvatar=${encodeURIComponent(
|
||||
fromAvatar,
|
||||
)}`;
|
||||
|
||||
console.log("Share path:", path);
|
||||
|
||||
return {
|
||||
title: `${fromUser}给你发来了一份今日问候`,
|
||||
path: path,
|
||||
};
|
||||
});
|
||||
|
||||
const createGreeting = () => {
|
||||
const id = generateObjectId();
|
||||
saveDailyGreeting({
|
||||
id,
|
||||
greetingId: currentQuote.value.id,
|
||||
content: currentQuote.value.content,
|
||||
signature: authorName.value,
|
||||
imageUrl: currentQuote.value.backgroundUrl,
|
||||
sceneId: currentCategory.value,
|
||||
});
|
||||
return id;
|
||||
};
|
||||
|
||||
onShareTimeline(() => {
|
||||
const fromUser = userStore.userInfo?.nickName || "神秘好友";
|
||||
return {
|
||||
title: `${fromUser}给你发来了一份今日问候`,
|
||||
query: `content=${encodeURIComponent(
|
||||
currentQuote.value.text,
|
||||
)}&author=${encodeURIComponent(
|
||||
authorName.value || currentQuote.value.author,
|
||||
)}`,
|
||||
imageUrl: "", // Optional: add a custom image if needed
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.daily-page {
|
||||
min-height: 100vh;
|
||||
background: #fbfbf9;
|
||||
padding-bottom: 200rpx;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
padding: 0 32rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 800;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.streak-badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
padding: 6rpx 20rpx;
|
||||
border-radius: 30rpx;
|
||||
font-size: 22rpx;
|
||||
color: #666;
|
||||
border: 1rpx solid #eee;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
|
||||
|
||||
.streak-count {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #ff3b30;
|
||||
margin: 0 4rpx;
|
||||
}
|
||||
|
||||
.fire-icon {
|
||||
margin-left: 4rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.sub-header {
|
||||
padding: 0 32rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
/* Main Card */
|
||||
.main-card-container {
|
||||
padding: 0 40rpx;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.quote-card {
|
||||
background: #fff;
|
||||
border-radius: 40rpx;
|
||||
padding: 60rpx 40rpx 40rpx;
|
||||
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.08);
|
||||
border: 4rpx solid #f5e6d3; /* Gold-ish border */
|
||||
position: relative;
|
||||
min-height: 600rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
/* Inner Border Effect */
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 12rpx;
|
||||
border: 2rpx solid #f9f3e8;
|
||||
border-radius: 32rpx;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.quote-icon {
|
||||
font-size: 80rpx;
|
||||
color: #f5e6d3;
|
||||
margin-bottom: 40rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.quote-content {
|
||||
text-align: center;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.quote-text {
|
||||
font-size: 40rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
line-height: 1.6;
|
||||
font-family: "Songti SC", serif;
|
||||
display: block;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.quote-highlight {
|
||||
display: block;
|
||||
font-size: 44rpx;
|
||||
color: #d81e06;
|
||||
font-weight: 800;
|
||||
margin-top: 20rpx;
|
||||
font-family: "Songti SC", serif;
|
||||
}
|
||||
|
||||
.quote-divider {
|
||||
width: 80rpx;
|
||||
height: 2rpx;
|
||||
background: #eee;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.quote-author {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-bottom: 60rpx;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.refresh-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
padding: 16rpx 32rpx;
|
||||
background: #fff;
|
||||
border: 1rpx solid #eee;
|
||||
border-radius: 40rpx;
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
|
||||
|
||||
&:active {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
}
|
||||
|
||||
.author-edit-box {
|
||||
flex: 1;
|
||||
margin-left: 24rpx;
|
||||
background: #f9f9f9;
|
||||
border: 2rpx solid #eee;
|
||||
border-radius: 40rpx;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 24rpx;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:active,
|
||||
&:focus-within {
|
||||
background: #fff;
|
||||
border-color: #ff9800;
|
||||
box-shadow: 0 4rpx 16rpx rgba(255, 152, 0, 0.15);
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-right: 12rpx;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.input {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
/* Categories */
|
||||
.category-section {
|
||||
padding: 0 32rpx;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.category-grid {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.category-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.cat-icon-box {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s;
|
||||
border: 2rpx solid transparent;
|
||||
|
||||
&.active {
|
||||
transform: translateY(-4rpx);
|
||||
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.08);
|
||||
border-color: rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
}
|
||||
|
||||
.cat-emoji {
|
||||
font-size: 48rpx;
|
||||
}
|
||||
|
||||
.cat-name {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
|
||||
&.active {
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hot List */
|
||||
.hot-list-section {
|
||||
padding: 0 32rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.section-title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.title-bar {
|
||||
width: 8rpx;
|
||||
height: 32rpx;
|
||||
background: #d4a017;
|
||||
border-radius: 4rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.section-subtitle {
|
||||
font-size: 20rpx;
|
||||
color: #ccc;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.hot-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24rpx;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 24rpx 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.02);
|
||||
|
||||
&:active {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
}
|
||||
|
||||
.rank-icon {
|
||||
margin-right: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.hot-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.hot-text {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 8rpx;
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 450rpx;
|
||||
}
|
||||
|
||||
.hot-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.fire {
|
||||
color: #ff3b30;
|
||||
margin-right: 4rpx;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
/* Bottom Actions */
|
||||
.bottom-actions {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff; /* Glass effect if supported */
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
backdrop-filter: blur(20rpx);
|
||||
padding: 20rpx 32rpx;
|
||||
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.05);
|
||||
z-index: 100;
|
||||
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.action-btn-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 24rpx;
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
line-height: 1;
|
||||
border: none;
|
||||
width: 100rpx;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.icon-circle {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
background: #f5f5f5;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 8rpx;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
font-size: 20rpx;
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&:active .icon-circle {
|
||||
background: #eee;
|
||||
transform: scale(0.95);
|
||||
}
|
||||
}
|
||||
|
||||
.send-btn {
|
||||
flex: 1;
|
||||
height: 96rpx;
|
||||
border-radius: 48rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 16rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
background: #8e0000; /* Deep Red/Brown */
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, #8e0000 0%, #600000 100%);
|
||||
box-shadow: 0 8rpx 24rpx rgba(142, 0, 0, 0.3);
|
||||
transition: all 0.2s;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
box-shadow: 0 4rpx 12rpx rgba(142, 0, 0, 0.2);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
285
pages/greeting/share.vue
Normal file
285
pages/greeting/share.vue
Normal file
@@ -0,0 +1,285 @@
|
||||
<template>
|
||||
<view class="share-page">
|
||||
<NavBar title="今日问候" :transparent="true" color="#333" />
|
||||
|
||||
<!-- Top User Info -->
|
||||
<view class="user-header" :style="{ paddingTop: navBarHeight + 'px' }">
|
||||
<image
|
||||
class="user-avatar"
|
||||
:src="fromAvatar || defaultAvatar"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view class="user-info">
|
||||
<view class="user-name">
|
||||
<text>你的好友</text>
|
||||
<text class="highlight-name">{{
|
||||
author || fromUser || "神秘好友"
|
||||
}}</text>
|
||||
</view>
|
||||
<text class="user-desc">给你发来了一份今日问候</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Main Card -->
|
||||
<view class="main-card-container">
|
||||
<view
|
||||
class="quote-card"
|
||||
:style="
|
||||
backgroundUrl
|
||||
? {
|
||||
backgroundImage: `url(${backgroundUrl})`,
|
||||
backgroundSize: 'cover',
|
||||
backgroundPosition: 'center',
|
||||
}
|
||||
: {}
|
||||
"
|
||||
>
|
||||
<view class="quote-icon">❝</view>
|
||||
<view class="quote-content">
|
||||
<text class="quote-text">{{ content }}</text>
|
||||
<text class="quote-highlight" v-if="highlight">{{ highlight }}</text>
|
||||
</view>
|
||||
<view class="quote-divider"></view>
|
||||
<view class="quote-author">
|
||||
<text>—— {{ author ? ` ${author} 的专属问候` : "专属问候" }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<view class="action-buttons">
|
||||
<button class="btn primary-btn" @tap="navToMake">
|
||||
<uni-icons type="paperplane-filled" size="20" color="#fff" />
|
||||
<text>我也要送问候</text>
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<view class="footer-tip safe-area-bottom">
|
||||
<text>愿每一天都充满阳光与希望</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { onLoad, onShareAppMessage } from "@dcloudio/uni-app";
|
||||
import { getBavBarHeight } from "@/utils/system";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import { getPageDetail } from "@/api/system";
|
||||
|
||||
const navBarHeight = getBavBarHeight();
|
||||
const defaultAvatar =
|
||||
"https://file.lihailezzc.com/resource/96023631c6ab9c3496b7620097af3d6f.png";
|
||||
|
||||
const fromUser = ref("");
|
||||
const fromAvatar = ref("");
|
||||
const content = ref("万事顺遂\n岁岁平安\n愿你的生活\n日日有小确幸");
|
||||
const author = ref("陈小明");
|
||||
const highlight = ref("");
|
||||
const backgroundUrl = ref("");
|
||||
|
||||
onLoad(async (options) => {
|
||||
if (options.shareToken) {
|
||||
const detail = await getPageDetail(options.shareToken);
|
||||
if (detail) {
|
||||
if (detail.from) {
|
||||
fromUser.value = detail.from.nickname;
|
||||
fromAvatar.value = detail.from.avatar;
|
||||
}
|
||||
if (detail.content) {
|
||||
const parts = detail.content.split(" ");
|
||||
if (parts.length > 1) {
|
||||
highlight.value = parts.pop();
|
||||
content.value = parts.join("\n");
|
||||
} else {
|
||||
content.value = detail.content;
|
||||
highlight.value = "";
|
||||
}
|
||||
}
|
||||
author.value = detail.signature || "专属问候";
|
||||
backgroundUrl.value = detail.imageUrl || "";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const navToMake = () => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/greeting/daily",
|
||||
});
|
||||
};
|
||||
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: `${fromUser.value || "好友"}给你发来了一份今日问候`,
|
||||
path: `/pages/greeting/share?content=${encodeURIComponent(content.value)}&author=${encodeURIComponent(author.value)}&fromUser=${encodeURIComponent(fromUser.value)}&fromAvatar=${encodeURIComponent(fromAvatar.value)}`,
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.share-page {
|
||||
min-height: 100vh;
|
||||
background: #fbfbf9;
|
||||
padding-bottom: 200rpx;
|
||||
}
|
||||
|
||||
.user-header {
|
||||
padding: 20rpx 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
border: 2rpx solid #fff;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 4rpx;
|
||||
|
||||
.highlight-name {
|
||||
color: #d81e06;
|
||||
font-weight: bold;
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.user-desc {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* Greeting Card - Adapted from daily.vue quote-card */
|
||||
.main-card-container {
|
||||
padding: 0 40rpx;
|
||||
margin-bottom: 80rpx;
|
||||
}
|
||||
|
||||
.quote-card {
|
||||
background: #fff;
|
||||
border-radius: 40rpx;
|
||||
padding: 60rpx 40rpx 40rpx;
|
||||
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.08);
|
||||
border: 4rpx solid #f5e6d3; /* Gold-ish border */
|
||||
position: relative;
|
||||
min-height: 700rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
/* Inner Border Effect */
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 12rpx;
|
||||
border: 2rpx solid #f9f3e8;
|
||||
border-radius: 32rpx;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.quote-icon {
|
||||
font-size: 80rpx;
|
||||
color: #f5e6d3;
|
||||
margin-bottom: 40rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.quote-content {
|
||||
text-align: center;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.quote-text {
|
||||
font-size: 40rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
line-height: 1.6;
|
||||
font-family: "Songti SC", serif;
|
||||
display: block;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.quote-highlight {
|
||||
display: block;
|
||||
font-size: 44rpx;
|
||||
color: #d81e06;
|
||||
font-weight: 800;
|
||||
margin-top: 20rpx;
|
||||
font-family: "Songti SC", serif;
|
||||
}
|
||||
|
||||
.quote-divider {
|
||||
width: 80rpx;
|
||||
height: 2rpx;
|
||||
background: #eee;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.quote-author {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
font-style: italic;
|
||||
font-family: "Songti SC", serif;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
padding: 0 60rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 48rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
transition: all 0.2s;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
}
|
||||
|
||||
.primary-btn {
|
||||
background: linear-gradient(135deg, #8e0000 0%, #600000 100%);
|
||||
color: #fff;
|
||||
box-shadow: 0 8rpx 24rpx rgba(142, 0, 0, 0.3);
|
||||
|
||||
&:active {
|
||||
box-shadow: 0 4rpx 12rpx rgba(142, 0, 0, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
.footer-tip {
|
||||
text-align: center;
|
||||
padding: 40rpx 0;
|
||||
|
||||
text {
|
||||
font-size: 24rpx;
|
||||
color: #ccc;
|
||||
letter-spacing: 4rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
835
pages/home/index.vue
Normal file
835
pages/home/index.vue
Normal file
@@ -0,0 +1,835 @@
|
||||
<template>
|
||||
<view class="spring-page" :style="{ paddingTop: getBavBarHeight() + 'px' }">
|
||||
<!-- 顶部 Banner -->
|
||||
<view class="hero">
|
||||
<view class="hero-badge">
|
||||
<text class="badge-dot">•</text>
|
||||
<text class="badge-text">{{ countdownText }}</text>
|
||||
</view>
|
||||
<view class="hero-title">
|
||||
<text class="year">2026</text>
|
||||
<text class="main">新春祝福</text>
|
||||
</view>
|
||||
<text class="hero-sub">新年快乐,万事如意!</text>
|
||||
<!-- <image class="hero-decor" src="https://file.lihailezzc.com/resource/58c8d19e5f2d9c958a7b8b9f44b8c3e3.png" mode="aspectFill" /> -->
|
||||
</view>
|
||||
|
||||
<!-- 新春提示栏 -->
|
||||
<view v-if="noticeList && noticeList.length > 0" class="notice-bar">
|
||||
<view class="notice-left">
|
||||
<swiper
|
||||
class="notice-swiper"
|
||||
vertical
|
||||
autoplay
|
||||
circular
|
||||
interval="3000"
|
||||
duration="500"
|
||||
>
|
||||
<swiper-item
|
||||
v-for="(tip, index) in noticeList"
|
||||
:key="index"
|
||||
class="notice-swiper-item"
|
||||
@tap="onNoticeTap(tip)"
|
||||
>
|
||||
<text v-if="tip.tag" class="notice-tag">{{
|
||||
getTagText(tip.tag)
|
||||
}}</text>
|
||||
<text class="notice-text">{{ tip.text }}</text>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
<text class="notice-arrow">›</text>
|
||||
</view>
|
||||
|
||||
<!-- 功能入口宫格 -->
|
||||
<view class="feature-grid">
|
||||
<view
|
||||
v-for="(item, idx) in features"
|
||||
:key="idx"
|
||||
class="feature-item"
|
||||
@tap="onFeatureTap(item)"
|
||||
>
|
||||
<image
|
||||
class="feature-icon"
|
||||
:src="item.icon"
|
||||
mode="aspectFill"
|
||||
:style="{
|
||||
backgroundColor: idx < 2 ? '#FEF2F2' : '#FFFBEC',
|
||||
}"
|
||||
/>
|
||||
<view class="feature-texts">
|
||||
<text class="feature-title">{{ item.title }}</text>
|
||||
<text class="feature-sub">{{ item.subtitle }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 今日灵感 -->
|
||||
<view class="daily-section">
|
||||
<view class="daily-header">
|
||||
<text class="daily-title">今日灵感</text>
|
||||
<text class="daily-date">{{ todayDate }}</text>
|
||||
</view>
|
||||
<view class="daily-card">
|
||||
<view class="daily-content">
|
||||
<text class="quote-mark">“</text>
|
||||
<text class="daily-text">{{ dailyGreeting }}</text>
|
||||
<text class="quote-mark right">”</text>
|
||||
</view>
|
||||
<view class="daily-actions">
|
||||
<!-- <view class="action-btn copy" @tap="copyGreeting">
|
||||
<text class="icon">❐</text> 复制
|
||||
</view> -->
|
||||
<view class="action-btn use" @tap="useGreeting">
|
||||
<text class="icon">✎</text> 去制作
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 大家都在用(网格布局) -->
|
||||
<view class="section">
|
||||
<view class="section-header">
|
||||
<view class="section-bar"></view>
|
||||
<text class="section-title">大家都在用</text>
|
||||
<!-- <text class="section-more" @tap="onMore('use')">查看更多 ></text> -->
|
||||
</view>
|
||||
<view class="use-grid">
|
||||
<view
|
||||
v-for="(card, i) in recommendList"
|
||||
:key="i"
|
||||
class="use-card"
|
||||
@tap="onCardClick(card)"
|
||||
>
|
||||
<view class="card-cover-wrap">
|
||||
<image :src="card.imageUrl" class="card-cover" mode="aspectFill" />
|
||||
<view v-if="card.tag" class="card-tag" :class="`tag--${card.tag}`">
|
||||
{{ getTagText(card.tag) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-info">
|
||||
<view class="card-title">{{ card.title }}</view>
|
||||
<view class="card-desc">{{ card.content }}</view>
|
||||
<view class="card-footer">
|
||||
<view class="cta-btn" @tap.stop="onCardClick(card)">
|
||||
{{ getCtaText(card.type) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="loading" class="loading-text">加载中...</view>
|
||||
<view v-if="!hasMore && recommendList.length > 0" class="no-more-text"
|
||||
>没有更多了</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
onPullDownRefresh,
|
||||
onShareAppMessage,
|
||||
onShareTimeline,
|
||||
onReachBottom,
|
||||
onLoad,
|
||||
onShow,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { getBavBarHeight } from "@/utils/system";
|
||||
import {
|
||||
getRecommendList,
|
||||
getRandomGreeting,
|
||||
getTipsList,
|
||||
getShareReward,
|
||||
} from "@/api/system";
|
||||
import { getShareToken, saveViewRequest, trackRecord } from "@/utils/common.js";
|
||||
|
||||
const countdownText = ref("");
|
||||
const recommendList = ref([]);
|
||||
const page = ref(1);
|
||||
const hasMore = ref(true);
|
||||
const loading = ref(false);
|
||||
|
||||
const updateCountdown = () => {
|
||||
const now = new Date();
|
||||
const springFestival = new Date("2026-02-17T00:00:00"); // 2026春节
|
||||
|
||||
// 只比较日期,忽略时分秒
|
||||
now.setHours(0, 0, 0, 0);
|
||||
springFestival.setHours(0, 0, 0, 0);
|
||||
|
||||
const diffTime = now.getTime() - springFestival.getTime();
|
||||
const days = Math.floor(diffTime / (1000 * 60 * 60 * 24));
|
||||
|
||||
if (days < 0) {
|
||||
countdownText.value = `距春节还有 ${Math.abs(days)} 天`;
|
||||
} else if (days === 0) {
|
||||
countdownText.value = "大年初一";
|
||||
} else {
|
||||
const cnNums = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"];
|
||||
if (days < 10) {
|
||||
countdownText.value = `大年初${cnNums[days]}`;
|
||||
} else if (days < 15) {
|
||||
const sub = days + 1 - 10;
|
||||
const subCn = ["一", "二", "三", "四", "五"][sub - 1];
|
||||
countdownText.value = `正月十${subCn}`;
|
||||
} else if (days === 14) {
|
||||
// days=14是第15天
|
||||
countdownText.value = "元宵节";
|
||||
} else {
|
||||
countdownText.value = "蛇年大吉";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const todayDate = ref("");
|
||||
const dailyGreeting = ref("");
|
||||
|
||||
onShow(() => {
|
||||
updateCountdown();
|
||||
getIndexTips();
|
||||
const date = new Date();
|
||||
todayDate.value = `${date.getMonth() + 1}月${date.getDate()}日`;
|
||||
});
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.shareToken) saveViewRequest(options.shareToken, "index");
|
||||
|
||||
// updateCountdown();
|
||||
getRandomGreetingText();
|
||||
fetchRecommendList();
|
||||
trackRecord({
|
||||
eventName: "index_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
// Daily Inspiration Logic
|
||||
// const startOfYear = new Date(date.getFullYear(), 0, 0);
|
||||
// const diff = date - startOfYear;
|
||||
// const oneDay = 1000 * 60 * 60 * 24;
|
||||
// const dayOfYear = Math.floor(diff / oneDay);
|
||||
|
||||
// const index = dayOfYear % inspirationList.length;
|
||||
// dailyGreeting.value = inspirationList[index];
|
||||
});
|
||||
|
||||
onShareAppMessage(async () => {
|
||||
const shareToken = await getShareToken("index");
|
||||
getShareReward({ scene: "index" });
|
||||
return {
|
||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
onShareTimeline(async () => {
|
||||
const shareToken = await getShareToken("index_timeline");
|
||||
return {
|
||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
||||
query: `shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
const getIndexTips = async () => {
|
||||
const res = await getTipsList();
|
||||
noticeList.value = res || [];
|
||||
};
|
||||
|
||||
const getRandomGreetingText = async () => {
|
||||
const content = await getRandomGreeting();
|
||||
dailyGreeting.value =
|
||||
content || "烟火起,照人间,举杯敬此年。烟花落,看人间,家家户户皆团圆。";
|
||||
};
|
||||
|
||||
const useGreeting = () => {
|
||||
trackRecord({
|
||||
eventName: "index_goto_make",
|
||||
eventType: "jump",
|
||||
elementId: dailyGreeting.value,
|
||||
});
|
||||
uni.setStorageSync("TEMP_BLESSING_TEXT", dailyGreeting.value);
|
||||
uni.switchTab({
|
||||
url: "/pages/make/index",
|
||||
});
|
||||
};
|
||||
|
||||
const noticeList = ref([]);
|
||||
|
||||
const onNoticeTap = (tip) => {
|
||||
if (!tip.url) return;
|
||||
|
||||
if (tip.type === "path") {
|
||||
uni.navigateTo({ url: tip.url });
|
||||
} else if (tip.type === "switchTab") {
|
||||
uni.switchTab({ url: tip.url });
|
||||
} else {
|
||||
// 默认跳转 webview (公众号文章)
|
||||
uni.navigateTo({
|
||||
url: "/pages/webview/index?url=" + encodeURIComponent(tip.url),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const features = ref([
|
||||
{
|
||||
title: "新春祝福卡片",
|
||||
subtitle: "定制专属贺卡吧",
|
||||
icon: "/static/icon/celebrate.png",
|
||||
type: "card",
|
||||
},
|
||||
{
|
||||
title: "新年运势",
|
||||
subtitle: "抽取新年关键词",
|
||||
icon: "/static/icon/yunshi.png",
|
||||
type: "fortune",
|
||||
},
|
||||
{
|
||||
title: "新春头像",
|
||||
subtitle: "焕上节日新饰",
|
||||
icon: "/static/icon/guashi.png",
|
||||
type: "avatar_decor",
|
||||
},
|
||||
{
|
||||
title: "精美壁纸",
|
||||
subtitle: "获取精美壁纸",
|
||||
icon: "/static/icon/bizhi.png",
|
||||
type: "wallpaper",
|
||||
},
|
||||
]);
|
||||
|
||||
const fetchRecommendList = async (isRefresh = false) => {
|
||||
if (loading.value || (!hasMore.value && !isRefresh)) return;
|
||||
loading.value = true;
|
||||
if (isRefresh) {
|
||||
page.value = 1;
|
||||
hasMore.value = true;
|
||||
}
|
||||
try {
|
||||
const res = await getRecommendList(page.value);
|
||||
const list = res?.list || [];
|
||||
if (isRefresh) {
|
||||
recommendList.value = list;
|
||||
} else {
|
||||
recommendList.value = [...recommendList.value, ...list];
|
||||
}
|
||||
|
||||
if (res.hasNext !== undefined) {
|
||||
hasMore.value = res.hasNext;
|
||||
} else {
|
||||
// Fallback if API doesn't return hasNext
|
||||
if (list.length < 10) hasMore.value = false;
|
||||
}
|
||||
|
||||
if (list.length > 0) {
|
||||
page.value++;
|
||||
} else {
|
||||
hasMore.value = false;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const getTagText = (tag) => {
|
||||
const map = {
|
||||
hot: "热门",
|
||||
new: "新品",
|
||||
featured: "精选",
|
||||
hot2: "爆款",
|
||||
};
|
||||
return map[tag] || tag;
|
||||
};
|
||||
|
||||
const getCtaText = (type) => {
|
||||
const map = {
|
||||
frame: "去制作",
|
||||
decor: "去装饰",
|
||||
avatar: "去查看",
|
||||
card: "去写祝福",
|
||||
fortune: "去抽取",
|
||||
};
|
||||
return map[type] || "立即查看";
|
||||
};
|
||||
|
||||
const onCardClick = (card) => {
|
||||
// 构造传递的数据
|
||||
trackRecord({
|
||||
eventName: "index_recommend_click",
|
||||
eventType: `jump_${card.type}`,
|
||||
elementId: card?.recommendId || "",
|
||||
});
|
||||
const query = `recommendId=${card.recommendId || ""}&type=${card.type || ""}&imageUrl=${encodeURIComponent(card.imageUrl || "")}`;
|
||||
|
||||
if (
|
||||
card.scene === "avatar_download" ||
|
||||
["frame", "decor", "avatar"].includes(card.type)
|
||||
) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/avatar/index?${query}`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Default fallback based on type
|
||||
if (card.type === "card") {
|
||||
// 贺卡制作通常是 Tab 页,通过 Storage 传递参数
|
||||
uni.setStorageSync("RECOMMEND_CARD_DATA", {
|
||||
recommendId: card.recommendId,
|
||||
imageUrl: card.imageUrl,
|
||||
type: card.type,
|
||||
});
|
||||
uni.switchTab({ url: "/pages/make/index" });
|
||||
} else if (card.type === "fortune") {
|
||||
uni.navigateTo({ url: "/pages/fortune/index" });
|
||||
} else {
|
||||
// 默认跳转到头像页
|
||||
uni.navigateTo({
|
||||
url: `/pages/avatar/index?${query}`,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const onFeatureTap = (item) => {
|
||||
trackRecord({
|
||||
eventName: "index_function_select",
|
||||
eventType: "jump",
|
||||
elementId: item.type,
|
||||
});
|
||||
if (item.type === "fortune") {
|
||||
uni.navigateTo({ url: "/pages/fortune/index" });
|
||||
return;
|
||||
}
|
||||
if (item.type === "card") {
|
||||
uni.switchTab({ url: "/pages/make/index" });
|
||||
return;
|
||||
}
|
||||
if (item.type === "avatar_decor" || item.type === "avatar_frame") {
|
||||
uni.navigateTo({ url: "/pages/avatar/index" });
|
||||
return;
|
||||
}
|
||||
if (item.type === "wallpaper") {
|
||||
uni.navigateTo({ url: "/pages/wallpaper/index" });
|
||||
return;
|
||||
}
|
||||
uni.showToast({ title: `进入:${item.title}`, icon: "none" });
|
||||
};
|
||||
|
||||
onReachBottom(() => {
|
||||
fetchRecommendList();
|
||||
});
|
||||
|
||||
onPullDownRefresh(async () => {
|
||||
updateCountdown();
|
||||
await Promise.all([fetchRecommendList(true), getRandomGreetingText()]);
|
||||
uni.stopPullDownRefresh();
|
||||
uni.showToast({ title: "已为你更新内容", icon: "success" });
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.spring-page {
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
background: #f8f6f6;
|
||||
}
|
||||
|
||||
/* 顶部 Banner */
|
||||
.hero {
|
||||
position: relative;
|
||||
margin: 24rpx auto;
|
||||
padding: 32rpx;
|
||||
height: 324rpx;
|
||||
width: 92vw;
|
||||
border-radius: 24rpx;
|
||||
color: #fff;
|
||||
background: url("http://file.lihailezzc.com/77ea2597-569c-4f13-b5af-22606742adcfssss.jpg");
|
||||
background-size: cover;
|
||||
overflow: hidden;
|
||||
|
||||
.hero-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 999rpx;
|
||||
padding: 8rpx 16rpx;
|
||||
font-size: 22rpx;
|
||||
.badge-dot {
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
}
|
||||
.hero-title {
|
||||
margin-top: 24rpx;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
.year {
|
||||
font-size: 44rpx;
|
||||
font-weight: 700;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
.main {
|
||||
font-size: 44rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
.hero-sub {
|
||||
margin-top: 8rpx;
|
||||
font-size: 24rpx;
|
||||
opacity: 0.9;
|
||||
}
|
||||
.hero-decor {
|
||||
position: absolute;
|
||||
right: 12rpx;
|
||||
bottom: 12rpx;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
opacity: 0.3;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
/* 新春提示栏 */
|
||||
.notice-bar {
|
||||
margin: 0 24rpx 20rpx;
|
||||
padding: 16rpx 24rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.03);
|
||||
|
||||
.notice-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
height: 40rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.notice-tag {
|
||||
font-size: 20rpx;
|
||||
color: #ff3b30;
|
||||
background: rgba(255, 59, 48, 0.1);
|
||||
padding: 2rpx 12rpx;
|
||||
border-radius: 6rpx;
|
||||
margin-right: 16rpx;
|
||||
font-weight: 700;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.notice-swiper {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
|
||||
.notice-swiper-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-text {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-arrow {
|
||||
font-size: 32rpx;
|
||||
color: #ccc;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* 功能入口宫格 - 2x2 */
|
||||
.feature-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-gap: 20rpx;
|
||||
padding: 0 24rpx;
|
||||
margin-top: 8rpx;
|
||||
|
||||
.feature-item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: left;
|
||||
flex-direction: column;
|
||||
padding: 20rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
.feature-item::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-bottom-left-radius: 80rpx;
|
||||
z-index: 1;
|
||||
}
|
||||
.feature-item:nth-child(1)::after,
|
||||
.feature-item:nth-child(2)::after {
|
||||
background: #fef2f2; /* 可换成你的主题粉 */
|
||||
}
|
||||
.feature-item:nth-child(3)::after,
|
||||
.feature-item:nth-child(4)::after {
|
||||
background: #fffbec; /* 温柔一点的黄 */
|
||||
}
|
||||
.feature-icon {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50%;
|
||||
padding: 5rpx;
|
||||
}
|
||||
.feature-texts {
|
||||
margin-top: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.feature-title {
|
||||
font-size: 28rpx;
|
||||
color: #222;
|
||||
font-weight: 600;
|
||||
}
|
||||
.feature-sub {
|
||||
font-size: 22rpx;
|
||||
color: #888;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 今日灵感 */
|
||||
.daily-section {
|
||||
margin: 24rpx 24rpx 0;
|
||||
.daily-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16rpx;
|
||||
.daily-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
}
|
||||
.daily-date {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
font-family: monospace;
|
||||
}
|
||||
}
|
||||
.daily-card {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 30rpx;
|
||||
box-shadow: 0 8rpx 24rpx rgba(255, 59, 48, 0.08);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.daily-card::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 8rpx;
|
||||
height: 100%;
|
||||
background: #ff3b30;
|
||||
}
|
||||
.daily-content {
|
||||
position: relative;
|
||||
padding: 10rpx 20rpx;
|
||||
.quote-mark {
|
||||
font-size: 60rpx;
|
||||
color: #ff3b30;
|
||||
opacity: 0.2;
|
||||
position: absolute;
|
||||
line-height: 1;
|
||||
font-family: serif;
|
||||
}
|
||||
.quote-mark:first-child {
|
||||
top: -10rpx;
|
||||
left: -10rpx;
|
||||
}
|
||||
.quote-mark.right {
|
||||
bottom: -20rpx;
|
||||
right: 0;
|
||||
}
|
||||
.daily-text {
|
||||
font-size: 30rpx;
|
||||
color: #444;
|
||||
line-height: 1.8;
|
||||
font-style: italic;
|
||||
display: block;
|
||||
text-align: justify;
|
||||
}
|
||||
}
|
||||
.daily-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 30rpx;
|
||||
gap: 20rpx;
|
||||
.action-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12rpx 24rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 24rpx;
|
||||
transition: all 0.2s;
|
||||
.icon {
|
||||
margin-right: 6rpx;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
.action-btn.copy {
|
||||
background: #f5f5f5;
|
||||
color: #666;
|
||||
}
|
||||
.action-btn.use {
|
||||
background: #ff3b30;
|
||||
color: #fff;
|
||||
box-shadow: 0 4rpx 12rpx rgba(255, 59, 48, 0.3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 通用区块标题 */
|
||||
.section {
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 24rpx;
|
||||
.section-bar {
|
||||
width: 10rpx;
|
||||
height: 30rpx;
|
||||
border-radius: 6rpx;
|
||||
background: #ff3b30;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
color: #222;
|
||||
flex: 1;
|
||||
font-weight: 600;
|
||||
}
|
||||
.section-more {
|
||||
font-size: 24rpx;
|
||||
color: #ff3b30;
|
||||
}
|
||||
}
|
||||
|
||||
/* 大家都在用 - 网格列表 */
|
||||
.use-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 20rpx;
|
||||
padding: 0 24rpx;
|
||||
margin-top: 16rpx;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
.use-card {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.card-cover-wrap {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding-bottom: 120%; /* 竖向卡片 */
|
||||
background: #f5f5f5;
|
||||
}
|
||||
.card-cover {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.card-tag {
|
||||
position: absolute;
|
||||
top: 12rpx;
|
||||
left: 12rpx;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 20rpx;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
&.tag--hot {
|
||||
background: linear-gradient(135deg, #ff3b30, #ff9500);
|
||||
}
|
||||
&.tag--featured {
|
||||
background: linear-gradient(135deg, #007aff, #5ac8fa);
|
||||
}
|
||||
&.tag--hot2 {
|
||||
background: linear-gradient(135deg, #ff2d55, #ff375f);
|
||||
}
|
||||
&.tag--new {
|
||||
background: linear-gradient(135deg, #5856d6, #af52de);
|
||||
}
|
||||
&.tag--default {
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
}
|
||||
.card-info {
|
||||
padding: 16rpx;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.card-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 8rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.card-desc {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 16rpx;
|
||||
/* 限制2行 */
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
.card-footer {
|
||||
margin-top: auto;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.cta-btn {
|
||||
font-size: 22rpx;
|
||||
color: #ff3b30;
|
||||
background: rgba(255, 59, 48, 0.08);
|
||||
padding: 8rpx 20rpx;
|
||||
border-radius: 999rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.loading-text,
|
||||
.no-more-text {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
padding: 20rpx 0;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
1171
pages/index/index_old.vue
Normal file
1171
pages/index/index_old.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<view class="make-page" :style="{ paddingTop: getBavBarHeight() + 'px' }">
|
||||
<view class="make-page">
|
||||
<NavBar title="祝福贺卡" />
|
||||
<!-- 顶部步骤条 -->
|
||||
<view class="top-steps">
|
||||
<view class="step-bar">
|
||||
@@ -26,6 +27,13 @@
|
||||
|
||||
<!-- 预览卡片 -->
|
||||
<view class="card-preview">
|
||||
<view
|
||||
class="music-control"
|
||||
@tap.stop="openBgmList"
|
||||
:class="{ playing: isBgmPlaying }"
|
||||
>
|
||||
<text class="music-icon">{{ isBgmPlaying ? "🎵" : "🔇" }}</text>
|
||||
</view>
|
||||
<view class="premium-tag">
|
||||
<uni-icons type="info" size="12" color="#fff"></uni-icons>
|
||||
<text>分享或保存即可去除水印</text>
|
||||
@@ -55,7 +63,7 @@
|
||||
@touchmove.stop="handleBubbleTouchMove"
|
||||
@touchend.stop="handleBubbleTouchEnd"
|
||||
:style="{
|
||||
marginTop: 230 + bubbleOffsetY + 'rpx',
|
||||
marginTop: 140 + bubbleOffsetY + 'rpx',
|
||||
maxWidth: bubbleMaxWidth + 80 + 'rpx',
|
||||
}"
|
||||
>
|
||||
@@ -195,6 +203,31 @@
|
||||
<view v-if="tpl?.id === currentTemplate?.id" class="tpl-check"
|
||||
>✔</view
|
||||
>
|
||||
<!-- Lock Overlay -->
|
||||
<view
|
||||
v-if="!tpl.isUnlock && tpl.unlockType"
|
||||
class="lock-overlay"
|
||||
>
|
||||
<!-- Badge -->
|
||||
<view class="unlock-badge" :class="tpl.unlockType">
|
||||
{{
|
||||
tpl.unlockType === "sing3"
|
||||
? "登录3天"
|
||||
: tpl.unlockType === "sing1"
|
||||
? "登录1天"
|
||||
: tpl.unlockType === "ad"
|
||||
? "广告"
|
||||
: tpl.unlockType === "vip"
|
||||
? "VIP"
|
||||
: "解锁"
|
||||
}}
|
||||
</view>
|
||||
|
||||
<!-- Center Lock -->
|
||||
<view class="center-lock">
|
||||
<uni-icons type="locked-filled" size="18" color="#fff" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="loadingTemplates" class="loading-more"
|
||||
@@ -432,22 +465,110 @@
|
||||
@logind="handleLogind"
|
||||
:share-token="shareToken"
|
||||
/>
|
||||
|
||||
<!-- Music List Popup -->
|
||||
<uni-popup ref="bgmPopup" type="bottom">
|
||||
<view class="bgm-popup">
|
||||
<view class="bgm-header">
|
||||
<text class="bgm-title">选择背景音乐</text>
|
||||
<view class="bgm-close" @tap="closeBgmList">✕</view>
|
||||
</view>
|
||||
<scroll-view scroll-y class="bgm-scroll">
|
||||
<view
|
||||
v-for="(item, index) in bgms"
|
||||
:key="index"
|
||||
class="bgm-item"
|
||||
:class="{ active: currentBgmIndex === index && isBgmPlaying }"
|
||||
@tap="selectBgm(index)"
|
||||
>
|
||||
<view class="bgm-info">
|
||||
<uni-icons
|
||||
:type="
|
||||
currentBgmIndex === index && isBgmPlaying
|
||||
? 'sound-filled'
|
||||
: 'sound'
|
||||
"
|
||||
size="18"
|
||||
:color="
|
||||
currentBgmIndex === index && isBgmPlaying ? '#ff3b30' : '#333'
|
||||
"
|
||||
></uni-icons>
|
||||
<text class="bgm-name">{{ item.name }}</text>
|
||||
</view>
|
||||
<view
|
||||
v-if="currentBgmIndex === index && isBgmPlaying"
|
||||
class="bgm-playing-icon"
|
||||
>
|
||||
<view class="bar bar1"></view>
|
||||
<view class="bar bar2"></view>
|
||||
<view class="bar bar3"></view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="bgm-footer" @tap="turnOffBgm">
|
||||
<text class="turn-off-text">关闭音乐</text>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
||||
<!-- Scene Selection Popup -->
|
||||
<uni-popup ref="scenePopup" type="center" :is-mask-click="false">
|
||||
<view class="scene-popup">
|
||||
<view class="scene-header">
|
||||
<text class="scene-title">选择祝福场景</text>
|
||||
<text class="scene-subtitle">挑选一个场景,开启专属祝福</text>
|
||||
<view class="scene-divider">
|
||||
<view class="line"></view>
|
||||
<uni-icons
|
||||
type="cloud-upload-filled"
|
||||
size="16"
|
||||
color="#E6B800"
|
||||
></uni-icons>
|
||||
<view class="line"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="scene-grid">
|
||||
<view
|
||||
class="scene-item"
|
||||
v-for="(scene, index) in scenes"
|
||||
:key="index"
|
||||
@tap="selectScene(scene)"
|
||||
>
|
||||
<view class="scene-icon-box" :style="{ background: scene.bgColor }">
|
||||
<uni-icons
|
||||
:type="scene.icon"
|
||||
size="26"
|
||||
:color="scene.color"
|
||||
></uni-icons>
|
||||
</view>
|
||||
<text class="scene-name">{{ scene.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="skip-btn" @tap="skipScene">跳过,直接制作</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
<LoginPopup ref="loginPopupRef" @logind="handleLogind" />
|
||||
<RewardAd ref="rewardAdRef" @onReward="handleAdReward" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, watch } from "vue";
|
||||
import { getBavBarHeight, getDeviceInfo } from "@/utils/system";
|
||||
import { generateObjectId, getShareToken } from "@/utils/common";
|
||||
|
||||
import {
|
||||
createCardTmp,
|
||||
updateCard,
|
||||
getCardTemplateList,
|
||||
getCardTemplateContentList,
|
||||
getCardTemplateTitleList,
|
||||
getCardMusicList,
|
||||
} from "@/api/make";
|
||||
import { abilityCheck, getShareReward, msgCheckApi } from "@/api/system";
|
||||
import {
|
||||
abilityCheck,
|
||||
getShareReward,
|
||||
msgCheckApi,
|
||||
watchAdReward,
|
||||
} from "@/api/system";
|
||||
import {
|
||||
onShareAppMessage,
|
||||
onShareTimeline,
|
||||
@@ -455,13 +576,19 @@ import {
|
||||
onReachBottom,
|
||||
onShow,
|
||||
onPullDownRefresh,
|
||||
onUnload,
|
||||
onHide,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
import { saveRecordRequest, uploadImage } from "@/utils/common.js";
|
||||
import { saveRecordRequest, uploadImage, trackRecord } from "@/utils/common.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
|
||||
import RewardAd from "@/components/RewardAd/RewardAd.vue";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const loginPopupRef = ref(null);
|
||||
const rewardAdRef = ref(null);
|
||||
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
||||
|
||||
const DEFAULT_AVATAR =
|
||||
@@ -484,6 +611,88 @@ const titleState = ref({
|
||||
scale: 1,
|
||||
});
|
||||
|
||||
const bgms = ref([]);
|
||||
const curBgm = ref(null);
|
||||
const currentBgmIndex = ref(0);
|
||||
const isBgmPlaying = ref(false);
|
||||
const innerAudioContext = uni.createInnerAudioContext();
|
||||
const bgmPopup = ref(null);
|
||||
|
||||
const initBgm = () => {
|
||||
if (bgms.value.length > 0) {
|
||||
playBgm(0);
|
||||
}
|
||||
};
|
||||
|
||||
const openBgmList = () => {
|
||||
bgmPopup.value.open();
|
||||
};
|
||||
|
||||
const closeBgmList = () => {
|
||||
bgmPopup.value.close();
|
||||
};
|
||||
|
||||
const selectBgm = (index) => {
|
||||
if (index === currentBgmIndex.value && isBgmPlaying.value) {
|
||||
// 如果点击当前正在播放的,暂停
|
||||
// pauseBgm();
|
||||
// 这里用户可能想重播,或者什么都不做。暂时什么都不做
|
||||
return;
|
||||
}
|
||||
curBgm.value = bgms.value[index];
|
||||
playBgm(index);
|
||||
closeBgmList();
|
||||
};
|
||||
|
||||
const turnOffBgm = () => {
|
||||
stopBgm();
|
||||
currentBgmIndex.value = -1; // -1 表示关闭
|
||||
curBgm.value = null;
|
||||
closeBgmList();
|
||||
uni.showToast({ title: "已关闭音乐", icon: "none" });
|
||||
};
|
||||
|
||||
const playBgm = (index) => {
|
||||
if (index < 0 || index >= bgms.value.length) return;
|
||||
|
||||
// 更新 index
|
||||
currentBgmIndex.value = index;
|
||||
|
||||
innerAudioContext.stop();
|
||||
innerAudioContext.src = bgms.value[index].musicUrl;
|
||||
innerAudioContext.loop = true;
|
||||
innerAudioContext.autoplay = true;
|
||||
innerAudioContext.play();
|
||||
|
||||
// 重新绑定事件(防止丢失)
|
||||
innerAudioContext.onPlay(() => {
|
||||
isBgmPlaying.value = true;
|
||||
});
|
||||
innerAudioContext.onPause(() => {
|
||||
isBgmPlaying.value = false;
|
||||
});
|
||||
innerAudioContext.onStop(() => {
|
||||
isBgmPlaying.value = false;
|
||||
});
|
||||
innerAudioContext.onError((res) => {
|
||||
console.error("BGM Error:", res.errMsg);
|
||||
isBgmPlaying.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const stopBgm = () => {
|
||||
innerAudioContext.stop();
|
||||
isBgmPlaying.value = false;
|
||||
};
|
||||
|
||||
onUnload(() => {
|
||||
innerAudioContext.destroy();
|
||||
});
|
||||
|
||||
onHide(() => {
|
||||
innerAudioContext.stop();
|
||||
});
|
||||
|
||||
const titleStyle = computed(() => {
|
||||
return {
|
||||
transform: `translate(${titleState.value.offsetX}rpx, ${titleState.value.offsetY}rpx) scale(${titleState.value.scale})`,
|
||||
@@ -617,8 +826,8 @@ const handleTitleTouchMove = (e) => {
|
||||
}
|
||||
};
|
||||
|
||||
const targetName = ref("祝您");
|
||||
const oldTargetName = ref("祝您");
|
||||
const targetName = ref("");
|
||||
const oldTargetName = ref("");
|
||||
const signatureName = ref(userStore?.userInfo?.nickName || "xxx");
|
||||
const oldSignatureName = ref(userStore?.userInfo?.nickName || "xxx");
|
||||
|
||||
@@ -741,21 +950,104 @@ const userOffsetY = ref(0);
|
||||
const shareToken = ref("");
|
||||
|
||||
onLoad((options) => {
|
||||
getTemplateList();
|
||||
getTemplateContentList();
|
||||
getTemplateTitleList();
|
||||
if (options.shareToken) {
|
||||
shareToken.value = options.shareToken;
|
||||
}
|
||||
trackRecord({
|
||||
eventName: "make_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
|
||||
if (options.scene) {
|
||||
currentScene.value = options.scene;
|
||||
loadData();
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
scenePopup.value.open();
|
||||
}, 200);
|
||||
}
|
||||
|
||||
if (options.content) {
|
||||
blessingText.value = { content: decodeURIComponent(options.content) };
|
||||
}
|
||||
if (options.author) {
|
||||
signatureName.value = decodeURIComponent(options.author);
|
||||
}
|
||||
});
|
||||
|
||||
const syncUserInfo = () => {
|
||||
const loadData = () => {
|
||||
getTemplateList();
|
||||
getTemplateContentList();
|
||||
getTemplateTitleList();
|
||||
getMusicList();
|
||||
};
|
||||
|
||||
const currentScene = ref("");
|
||||
const scenePopup = ref(null);
|
||||
const scenes = [
|
||||
{
|
||||
name: "节日祝福",
|
||||
value: "holiday",
|
||||
icon: "notification-filled",
|
||||
color: "#FF3B30",
|
||||
bgColor: "#FFF5F5",
|
||||
},
|
||||
{
|
||||
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 selectScene = (scene) => {
|
||||
currentScene.value = scene.value;
|
||||
scenePopup.value.close();
|
||||
loadData();
|
||||
};
|
||||
|
||||
const skipScene = () => {
|
||||
currentScene.value = "";
|
||||
scenePopup.value.close();
|
||||
loadData();
|
||||
};
|
||||
|
||||
const syncUserInfo = (force = false) => {
|
||||
if (isLoggedIn.value) {
|
||||
if (signatureName.value === "xxx" || !signatureName.value) {
|
||||
signatureName.value = userStore.userInfo.nickName;
|
||||
oldSignatureName.value = userStore.userInfo.nickName;
|
||||
}
|
||||
if (userAvatar.value === DEFAULT_AVATAR || !userAvatar.value) {
|
||||
if (force || userAvatar.value === DEFAULT_AVATAR || !userAvatar.value) {
|
||||
userAvatar.value = userStore.userInfo.avatarUrl;
|
||||
}
|
||||
}
|
||||
@@ -765,14 +1057,14 @@ watch(
|
||||
() => userStore.userInfo,
|
||||
(newVal) => {
|
||||
if (newVal?.nickName) {
|
||||
syncUserInfo();
|
||||
syncUserInfo(true);
|
||||
}
|
||||
},
|
||||
{ deep: true },
|
||||
);
|
||||
|
||||
onShow(() => {
|
||||
syncUserInfo();
|
||||
syncUserInfo(true);
|
||||
const recommendData = uni.getStorageSync("RECOMMEND_CARD_DATA");
|
||||
if (recommendData) {
|
||||
uni.removeStorageSync("RECOMMEND_CARD_DATA");
|
||||
@@ -846,7 +1138,10 @@ const getTemplateList = async (isLoadMore = false) => {
|
||||
|
||||
loadingTemplates.value = true;
|
||||
try {
|
||||
const res = await getCardTemplateList(templatePage.value);
|
||||
const res = await getCardTemplateList(
|
||||
templatePage.value,
|
||||
currentScene.value,
|
||||
);
|
||||
|
||||
// 兼容数组或对象列表格式
|
||||
const list = Array.isArray(res) ? res : res.list || [];
|
||||
@@ -884,12 +1179,36 @@ const getTemplateList = async (isLoadMore = false) => {
|
||||
}
|
||||
};
|
||||
|
||||
const getMusicList = async () => {
|
||||
try {
|
||||
const res = await getCardMusicList();
|
||||
if (res && res.length > 0) {
|
||||
bgms.value = res.map((item) => ({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
musicUrl: item.musicUrl,
|
||||
// 兼容旧逻辑
|
||||
url: item.musicUrl,
|
||||
}));
|
||||
if (bgms.value.length > 0) {
|
||||
curBgm.value = bgms.value[0];
|
||||
}
|
||||
initBgm();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("加载音乐列表失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
const getTemplateTitleList = async (isLoadMore = false) => {
|
||||
if (loadingTitles.value || (!hasMoreTitles.value && isLoadMore)) return;
|
||||
|
||||
loadingTitles.value = true;
|
||||
try {
|
||||
const res = await getCardTemplateTitleList(titlePage.value);
|
||||
const res = await getCardTemplateTitleList(
|
||||
titlePage.value,
|
||||
currentScene.value,
|
||||
);
|
||||
const list = Array.isArray(res) ? res : res.list || [];
|
||||
|
||||
if (list.length > 0) {
|
||||
@@ -942,7 +1261,10 @@ const getTemplateContentList = async (isLoadMore = false) => {
|
||||
|
||||
loadingBlessings.value = true;
|
||||
try {
|
||||
const res = await getCardTemplateContentList(blessingPage.value);
|
||||
const res = await getCardTemplateContentList(
|
||||
blessingPage.value,
|
||||
currentScene.value,
|
||||
);
|
||||
const list = Array.isArray(res) ? res : res.list || [];
|
||||
|
||||
if (list.length > 0) {
|
||||
@@ -994,18 +1316,12 @@ const onPanelScrollToLower = () => {
|
||||
};
|
||||
|
||||
onShareAppMessage(async (options) => {
|
||||
if (!isLoggedIn.value) {
|
||||
const shareToken = await getShareToken("card_generate_not_login", "");
|
||||
return {
|
||||
title: "快来制作新春祝福卡片🎉",
|
||||
path: "/pages/make/index?shareToken=" + shareToken,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
}
|
||||
|
||||
getShareReward({ scene: "card_generate" });
|
||||
if (options.from === "button") {
|
||||
if (!isLoggedIn.value) {
|
||||
loginPopupRef.value.open();
|
||||
return;
|
||||
}
|
||||
// 1. 确保有 cardId (如果内容有变动,最好是新建)
|
||||
const id = createCard();
|
||||
|
||||
@@ -1039,6 +1355,11 @@ onShareTimeline(async () => {
|
||||
});
|
||||
|
||||
const selectGreeting = (text) => {
|
||||
trackRecord({
|
||||
eventName: "card_text_choose",
|
||||
eventType: "click",
|
||||
elementId: text?.id,
|
||||
});
|
||||
blessingText.value = text;
|
||||
};
|
||||
|
||||
@@ -1063,13 +1384,88 @@ const closePanel = () => {
|
||||
const templates = ref([]);
|
||||
|
||||
const currentTemplate = ref(templates.value[0]);
|
||||
const currentUnlockTpl = ref(null);
|
||||
|
||||
const applyTemplate = (tpl) => {
|
||||
if (tpl.isUnlock === false) {
|
||||
handleUnlock(tpl);
|
||||
return;
|
||||
}
|
||||
trackRecord({
|
||||
eventName: "card_tpl_choose",
|
||||
eventType: "click",
|
||||
elementId: tpl?.id,
|
||||
});
|
||||
currentTemplate.value = tpl;
|
||||
closePanel();
|
||||
};
|
||||
|
||||
const handleUnlock = (tpl) => {
|
||||
switch (tpl.unlockType) {
|
||||
case "vip":
|
||||
uni.navigateTo({
|
||||
url: "/pages/mine/vip",
|
||||
});
|
||||
break;
|
||||
case "ad":
|
||||
currentUnlockTpl.value = tpl;
|
||||
rewardAdRef.value.showAd();
|
||||
break;
|
||||
case "sing1":
|
||||
uni.showToast({
|
||||
title: "需要连续登录1天解锁",
|
||||
icon: "none",
|
||||
});
|
||||
break;
|
||||
case "sing3":
|
||||
uni.showToast({
|
||||
title: "需要连续登录3天解锁",
|
||||
icon: "none",
|
||||
});
|
||||
break;
|
||||
default:
|
||||
uni.showToast({
|
||||
title: "未满足解锁条件",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleAdReward = async (token) => {
|
||||
try {
|
||||
const res = await watchAdReward(token);
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
title: "解锁成功",
|
||||
icon: "success",
|
||||
});
|
||||
// 解锁成功后,更新本地状态,允许使用
|
||||
if (currentUnlockTpl.value) {
|
||||
currentUnlockTpl.value.isUnlock = true;
|
||||
// 同时更新列表中的状态
|
||||
const index = templates.value.findIndex(
|
||||
(t) => t.id === currentUnlockTpl.value.id,
|
||||
);
|
||||
if (index !== -1) {
|
||||
templates.value[index].isUnlock = true;
|
||||
}
|
||||
|
||||
applyTemplate(currentUnlockTpl.value);
|
||||
currentUnlockTpl.value = null;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Reward claim failed", e);
|
||||
uni.showToast({ title: "奖励发放失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
|
||||
const selectTitle = (title) => {
|
||||
trackRecord({
|
||||
eventName: "card_title_choose",
|
||||
eventType: "click",
|
||||
elementId: title?.id,
|
||||
});
|
||||
if (currentTitle.value?.id === title?.id) {
|
||||
currentTitle.value = null;
|
||||
} else {
|
||||
@@ -1150,6 +1546,7 @@ const shareOrSave = async (id) => {
|
||||
blessingFrom: signatureName.value,
|
||||
templateId: currentTemplate.value?.id || "",
|
||||
titleId: currentTitle?.value?.id || "",
|
||||
musicId: curBgm.value?.id || "",
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1642,6 +2039,56 @@ function drawRoundRect(ctx, x, y, w, h, r, color) {
|
||||
.user-desc {
|
||||
font-size: 20rpx;
|
||||
opacity: 0.6;
|
||||
/* Lock Overlay - Modern Style */
|
||||
.lock-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12rpx;
|
||||
z-index: 5;
|
||||
background: rgba(0, 0, 0, 0.05); /* very subtle dim */
|
||||
}
|
||||
|
||||
.unlock-badge {
|
||||
position: absolute;
|
||||
top: 12rpx;
|
||||
right: 12rpx;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 20rpx;
|
||||
font-size: 18rpx;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);
|
||||
|
||||
&.vip {
|
||||
background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
|
||||
}
|
||||
&.ad {
|
||||
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
||||
}
|
||||
&.sing1,
|
||||
&.sing3 {
|
||||
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
|
||||
}
|
||||
}
|
||||
|
||||
.center-lock {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
backdrop-filter: blur(4px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
/* 顶部步骤条 */
|
||||
@@ -1842,7 +2289,58 @@ function drawRoundRect(ctx, x, y, w, h, r, color) {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
position: relative;
|
||||
}
|
||||
.tpl-card .lock-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12rpx;
|
||||
z-index: 5;
|
||||
background: rgba(0, 0, 0, 0.05); /* very subtle dim */
|
||||
}
|
||||
|
||||
.tpl-card .unlock-badge {
|
||||
position: absolute;
|
||||
top: 12rpx;
|
||||
right: 12rpx;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 20rpx;
|
||||
font-size: 18rpx;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);
|
||||
|
||||
&.vip {
|
||||
background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
|
||||
}
|
||||
&.ad {
|
||||
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
||||
}
|
||||
&.sing1,
|
||||
&.sing3 {
|
||||
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
|
||||
}
|
||||
}
|
||||
|
||||
.tpl-card .center-lock {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
backdrop-filter: blur(4px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.tpl-check {
|
||||
position: absolute;
|
||||
right: 6rpx;
|
||||
@@ -2089,4 +2587,257 @@ function drawRoundRect(ctx, x, y, w, h, r, color) {
|
||||
left: -9999px;
|
||||
top: -9999px;
|
||||
}
|
||||
|
||||
.music-control {
|
||||
position: absolute;
|
||||
top: 24rpx;
|
||||
left: 24rpx;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 20;
|
||||
backdrop-filter: blur(4px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.music-control.playing {
|
||||
background: rgba(255, 59, 48, 0.8);
|
||||
border-color: rgba(255, 59, 48, 0.5);
|
||||
animation: music-rotate 4s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes music-rotate {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.bgm-popup {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #fff;
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
max-height: 60vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.bgm-header {
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
}
|
||||
|
||||
.bgm-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.bgm-close {
|
||||
font-size: 32rpx;
|
||||
color: #999;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.bgm-scroll {
|
||||
max-height: 500rpx;
|
||||
}
|
||||
|
||||
.bgm-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.bgm-item:active {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
|
||||
.bgm-item.active {
|
||||
background: #fff5f5;
|
||||
}
|
||||
|
||||
.bgm-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.bgm-name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.bgm-item.active .bgm-name {
|
||||
color: #ff3b30;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.bgm-playing-icon {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 4rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
|
||||
.bar {
|
||||
width: 4rpx;
|
||||
background: #ff3b30;
|
||||
animation: equalize 1s infinite;
|
||||
}
|
||||
|
||||
.bar1 {
|
||||
animation-delay: 0s;
|
||||
height: 60%;
|
||||
}
|
||||
.bar2 {
|
||||
animation-delay: 0.2s;
|
||||
height: 100%;
|
||||
}
|
||||
.bar3 {
|
||||
animation-delay: 0.4s;
|
||||
height: 80%;
|
||||
}
|
||||
|
||||
@keyframes equalize {
|
||||
0% {
|
||||
height: 40%;
|
||||
}
|
||||
50% {
|
||||
height: 100%;
|
||||
}
|
||||
100% {
|
||||
height: 40%;
|
||||
}
|
||||
}
|
||||
|
||||
.bgm-footer {
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-top: 1rpx solid #eee;
|
||||
}
|
||||
|
||||
.turn-off-text {
|
||||
color: #666;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
/* 场景选择弹窗 */
|
||||
.scene-popup {
|
||||
width: 520rpx;
|
||||
background: #fff;
|
||||
border-radius: 40rpx;
|
||||
padding: 40rpx 30rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
border: 4rpx solid #f8e71c; /* 金色边框 */
|
||||
box-shadow: 0 0 40rpx rgba(248, 231, 28, 0.2);
|
||||
}
|
||||
|
||||
.scene-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.scene-title {
|
||||
font-size: 38rpx;
|
||||
font-weight: bold;
|
||||
color: #d0021b; /* 深红色 */
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.scene-subtitle {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.scene-divider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.scene-divider .line {
|
||||
width: 80rpx;
|
||||
height: 2rpx;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
rgba(230, 184, 0, 0),
|
||||
rgba(230, 184, 0, 0.5),
|
||||
rgba(230, 184, 0, 0)
|
||||
);
|
||||
}
|
||||
|
||||
.scene-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 20rpx;
|
||||
width: 100%;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.scene-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
background: #fff;
|
||||
padding: 24rpx 0;
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.scene-item:active {
|
||||
transform: scale(0.98);
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.scene-icon-box {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.scene-name {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.skip-btn {
|
||||
font-size: 24rpx;
|
||||
color: #bbb;
|
||||
padding: 10rpx;
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/>
|
||||
</view>
|
||||
<view class="status-info">
|
||||
<view class="status-title">当前正在使用</view>
|
||||
<view class="status-title">头像效果预览</view>
|
||||
<view class="decor-name">
|
||||
<text class="star-icon">✪</text>
|
||||
<text>{{ currentAvatar.decorName || "金马贺岁挂饰" }}</text>
|
||||
@@ -93,6 +93,7 @@ import { onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
|
||||
import { getMyAvatar, userAvatarChange } from "@/api/mine.js";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import { trackRecord } from "@/utils/common.js";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const list = ref([]);
|
||||
@@ -115,6 +116,10 @@ const names = [
|
||||
|
||||
onMounted(() => {
|
||||
fetchList(true);
|
||||
trackRecord({
|
||||
eventName: "avatar_record_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
});
|
||||
|
||||
onPullDownRefresh(() => {
|
||||
@@ -174,6 +179,7 @@ const changeUserAvatar = async (imageUrl) => {
|
||||
title: "头像更换成功",
|
||||
icon: "success",
|
||||
});
|
||||
// userStore.fetchUserInfo();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -102,7 +102,8 @@ import {
|
||||
} from "@dcloudio/uni-app";
|
||||
import { getMyCard } from "@/api/mine.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import { getShareToken } from "@/utils/common.js";
|
||||
import { getShareToken, trackRecord } from "@/utils/common.js";
|
||||
import { getShareReward } from "@/api/system";
|
||||
|
||||
const list = ref([]);
|
||||
const page = ref(1);
|
||||
@@ -112,6 +113,10 @@ const totalCount = ref(0);
|
||||
|
||||
onMounted(() => {
|
||||
fetchList(true);
|
||||
trackRecord({
|
||||
eventName: "greeting_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
});
|
||||
|
||||
onPullDownRefresh(() => {
|
||||
@@ -130,6 +135,7 @@ onShareAppMessage(async (options) => {
|
||||
"card_generate",
|
||||
options?.target?.dataset?.item?.id,
|
||||
);
|
||||
getShareReward({ scene: "card_generate" });
|
||||
return {
|
||||
title: "我刚做了一张祝福卡片,送给你",
|
||||
path: "/pages/detail/index?shareToken=" + shareToken,
|
||||
@@ -138,8 +144,9 @@ onShareAppMessage(async (options) => {
|
||||
};
|
||||
} else {
|
||||
const shareToken = await getShareToken("greeting_page", "");
|
||||
getShareReward({ scene: "greeting_page" });
|
||||
return {
|
||||
title: "新春祝福",
|
||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="help-page" >
|
||||
<view class="help-page">
|
||||
<NavBar title="帮助中心" />
|
||||
|
||||
<!-- Search Bar -->
|
||||
@@ -131,8 +131,16 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { ref, onMounted } from "vue";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import { trackRecord } from "@/utils/common.js";
|
||||
|
||||
onMounted(() => {
|
||||
trackRecord({
|
||||
eventName: "help_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
});
|
||||
|
||||
const faqList = ref([
|
||||
{
|
||||
@@ -157,7 +165,7 @@ const faqList = ref([
|
||||
items: [
|
||||
{
|
||||
q: "如何更换新的头像",
|
||||
a: "在头像定制页面,首先选择地图是微信头像或者系统头像,左边选择您喜欢的边框样式,右边选择头像挂饰,可移动位置,缩放大小,点击保存即可。",
|
||||
a: "在头像定制页面,首先选择上传头像或系统头像,左边选择您喜欢的边框样式,右边选择头像挂饰,可移动位置,缩放大小,点击保存即可。",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -137,7 +137,8 @@
|
||||
import { ref, computed, onMounted } from "vue";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { onShareAppMessage } from "@dcloudio/uni-app";
|
||||
import { getShareToken } from "@/utils/common";
|
||||
import { getShareToken, trackRecord } from "@/utils/common";
|
||||
import { getShareReward } from "@/api/system";
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
|
||||
const userStore = useUserStore();
|
||||
@@ -159,17 +160,22 @@ const userInfo = computed(() => ({
|
||||
|
||||
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
||||
|
||||
const isIos = false;
|
||||
const isIos = computed(() => uni.getSystemInfoSync().osName === "ios");
|
||||
|
||||
onMounted(() => {
|
||||
const sysInfo = uni.getSystemInfoSync();
|
||||
navBarTop.value = sysInfo.statusBarHeight;
|
||||
// Assuming standard nav bar height
|
||||
navBarHeight.value = 44;
|
||||
trackRecord({
|
||||
eventName: "mine_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
});
|
||||
|
||||
onShareAppMessage(async () => {
|
||||
const shareToken = await getShareToken("mine");
|
||||
getShareReward({ scene: "mine" });
|
||||
return {
|
||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
||||
path: "/pages/index/index?shareToken=" + shareToken,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="wallpaper-page" >
|
||||
<view class="wallpaper-page">
|
||||
<NavBar title="我的壁纸" />
|
||||
|
||||
<!-- Header Stats -->
|
||||
@@ -24,7 +24,12 @@
|
||||
<!-- List Section -->
|
||||
<view class="list-section">
|
||||
<view class="list-container">
|
||||
<view v-for="item in list" :key="item.id" class="grid-item" @tap="onPreview(item)">
|
||||
<view
|
||||
v-for="item in list"
|
||||
:key="item.id"
|
||||
class="grid-item"
|
||||
@tap="onPreview(item)"
|
||||
>
|
||||
<image :src="item.imageUrl" mode="aspectFill" class="wallpaper-img" />
|
||||
<view class="date-badge">
|
||||
<text>{{ formatDate(item.createdAt) }}</text>
|
||||
@@ -51,6 +56,7 @@ import { ref, onMounted } from "vue";
|
||||
import { onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
|
||||
import { getMyWallpaper } from "@/api/mine.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import { trackRecord } from "@/utils/common.js";
|
||||
|
||||
const list = ref([]);
|
||||
const page = ref(1);
|
||||
@@ -61,6 +67,10 @@ const totalCount = ref(0);
|
||||
|
||||
onMounted(() => {
|
||||
fetchList(true);
|
||||
trackRecord({
|
||||
eventName: "wallpaper_record_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
});
|
||||
|
||||
onPullDownRefresh(() => {
|
||||
@@ -125,7 +135,7 @@ const formatDate = (dateStr) => {
|
||||
const onPreview = (item) => {
|
||||
uni.previewImage({
|
||||
urls: [item.imageUrl],
|
||||
current: item.imageUrl
|
||||
current: item.imageUrl,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -166,7 +176,7 @@ const onPreview = (item) => {
|
||||
.value-wrap {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
|
||||
|
||||
.prefix {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
@@ -198,7 +208,7 @@ const onPreview = (item) => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
|
||||
text {
|
||||
font-size: 24px;
|
||||
}
|
||||
@@ -217,7 +227,7 @@ const onPreview = (item) => {
|
||||
gap: 12px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
|
||||
.grid-item {
|
||||
position: relative;
|
||||
border-radius: 16px;
|
||||
@@ -225,13 +235,13 @@ const onPreview = (item) => {
|
||||
background: #fff;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
|
||||
aspect-ratio: 9/16; // Standard wallpaper ratio
|
||||
|
||||
|
||||
.wallpaper-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.date-badge {
|
||||
position: absolute;
|
||||
bottom: 8px;
|
||||
@@ -240,7 +250,7 @@ const onPreview = (item) => {
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
backdrop-filter: blur(4px);
|
||||
|
||||
|
||||
text {
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
@@ -258,4 +268,4 @@ const onPreview = (item) => {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -119,6 +119,7 @@ import {
|
||||
onShareTimeline,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { getBavBarHeight } from "@/utils/system";
|
||||
import { getShareReward } from "@/api/system";
|
||||
import { getShareToken } from "@/utils/common";
|
||||
|
||||
const features = ref([
|
||||
@@ -230,10 +231,12 @@ const share = () => {
|
||||
uni.showShareMenu && uni.showShareMenu();
|
||||
};
|
||||
|
||||
onShareAppMessage(() => {
|
||||
onShareAppMessage(async () => {
|
||||
const shareToken = await getShareToken("spring_index");
|
||||
getShareReward({ scene: "spring_index" });
|
||||
return {
|
||||
title: "2026 丙午马年,送你一份新春祝福 🎊",
|
||||
path: "/pages/spring/index",
|
||||
path: `/pages/spring/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<view class="preview-card">
|
||||
<view class="preview-badge">PREVIEW</view>
|
||||
<image
|
||||
:src="detailData.imageUrl"
|
||||
:src="getThumbUrl(detailData.imageUrl)"
|
||||
mode="widthFix"
|
||||
class="main-image"
|
||||
@tap="previewImage"
|
||||
@@ -43,16 +43,25 @@
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<view class="action-buttons">
|
||||
<button class="btn primary-btn" @tap="goToIndex">
|
||||
<text class="btn-icon">✨</text>
|
||||
<text>我也要领同款壁纸</text>
|
||||
<view class="points-display" v-if="isLoggedIn">
|
||||
<text class="label">当前积分:</text>
|
||||
<text class="value">{{ userPoints }}</text>
|
||||
</view>
|
||||
<button class="btn primary-btn" @tap="downloadWallpaper">
|
||||
<view class="btn-content">
|
||||
<view class="btn-main">
|
||||
<text class="btn-icon">✨</text>
|
||||
<text>下载高清壁纸</text>
|
||||
</view>
|
||||
<text class="btn-sub">消耗 20 积分</text>
|
||||
</view>
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<!-- More Wallpapers -->
|
||||
<view class="more-section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">我也要领新春壁纸</text>
|
||||
<text class="section-title">更多同款壁纸</text>
|
||||
<view class="more-link" @tap="goToIndex">
|
||||
<text>查看更多</text>
|
||||
<text class="arrow">›</text>
|
||||
@@ -77,39 +86,6 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- Fortune Banner -->
|
||||
<!-- Wallpaper Banner -->
|
||||
<view class="wallpaper-banner" @tap="goToFortune">
|
||||
<view class="banner-icon">
|
||||
<text>🏮</text>
|
||||
</view>
|
||||
<view class="banner-content">
|
||||
<text class="banner-title">去抽取新年运势</text>
|
||||
<text class="banner-desc">每日一签,开启你的新年好运</text>
|
||||
</view>
|
||||
<text class="banner-arrow">›</text>
|
||||
</view>
|
||||
<view class="wallpaper-banner" @tap="goToGreeting">
|
||||
<view class="banner-icon">
|
||||
<text>🧧</text>
|
||||
</view>
|
||||
<view class="banner-content">
|
||||
<text class="banner-title">去制作新年贺卡</text>
|
||||
<text class="banner-desc">定制专属祝福,传递浓浓年味</text>
|
||||
</view>
|
||||
<text class="banner-arrow">›</text>
|
||||
</view>
|
||||
<view class="wallpaper-banner" @tap="goToAvatar">
|
||||
<view class="banner-icon">
|
||||
<text>🖼</text>
|
||||
</view>
|
||||
<view class="banner-content">
|
||||
<text class="banner-title">去挑选新年头像</text>
|
||||
<text class="banner-desc">精选新年头像,让手机也过年</text>
|
||||
</view>
|
||||
<text class="banner-arrow">›</text>
|
||||
</view>
|
||||
|
||||
<!-- Footer -->
|
||||
<view class="footer">
|
||||
<view class="footer-divider">
|
||||
@@ -120,16 +96,35 @@
|
||||
<view class="footer-sub">新春祝福 · 传递温情</view>
|
||||
</view>
|
||||
</view>
|
||||
<LoginPopup ref="loginPopupRef" @logind="handleLogind" />
|
||||
<RewardAd ref="rewardAdRef" @onReward="handleAdReward" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { ref, computed } from "vue";
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import { getBavBarHeight } from "@/utils/system";
|
||||
import { getPageDetail } from "@/api/system";
|
||||
import { getWallpaperRecommendList } from "@/api/wallpaper";
|
||||
import { getShareToken, saveViewRequest } from "@/utils/common.js";
|
||||
import { getPageDetail, getShareReward } from "@/api/system";
|
||||
import { getWallpaperSameList } from "@/api/wallpaper";
|
||||
import {
|
||||
getShareToken,
|
||||
saveViewRequest,
|
||||
saveRemoteImageToLocal,
|
||||
saveRecordRequest,
|
||||
trackRecord,
|
||||
} from "@/utils/common.js";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { watchAdReward } from "@/api/system.js";
|
||||
import { checkAbilityAndHandle } from "@/utils/ability.js";
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
import RewardAd from "@/components/RewardAd/RewardAd.vue";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const loginPopupRef = ref(null);
|
||||
const rewardAdRef = ref(null);
|
||||
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
||||
const userPoints = computed(() => userStore.userInfo.points || 0);
|
||||
|
||||
const navHeight = getBavBarHeight();
|
||||
const statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
@@ -139,17 +134,29 @@ const detailData = ref({
|
||||
});
|
||||
const recommendList = ref([]);
|
||||
const shareToken = ref("");
|
||||
const categoryId = ref("");
|
||||
|
||||
onLoad(async (options) => {
|
||||
if (options.shareToken) {
|
||||
shareToken.value = options.shareToken;
|
||||
await fetchDetail();
|
||||
}
|
||||
fetchRecommend();
|
||||
if (options.id) {
|
||||
detailData.value.id = options.id;
|
||||
}
|
||||
if (options.imageUrl) {
|
||||
detailData.value.imageUrl = decodeURIComponent(options.imageUrl);
|
||||
}
|
||||
|
||||
if (options.categoryId) {
|
||||
categoryId.value = options.categoryId;
|
||||
}
|
||||
fetchRecommend(options.id);
|
||||
});
|
||||
|
||||
onShareAppMessage(async () => {
|
||||
const token = await getShareToken("wallpaper_detail", detailData.value?.id);
|
||||
const token = await getShareToken("wallpaper_download", detailData.value?.id);
|
||||
getShareReward({ scene: "wallpaper_download" });
|
||||
return {
|
||||
title: "快来看看我刚领到的新年精美壁纸 🖼",
|
||||
path: `/pages/wallpaper/detail?shareToken=${token || ""}`,
|
||||
@@ -160,7 +167,7 @@ onShareAppMessage(async () => {
|
||||
});
|
||||
|
||||
onShareTimeline(async () => {
|
||||
const token = await getShareToken("wallpaper_timeline", detailData.value?.id);
|
||||
const token = await getShareToken("wallpaper_download", detailData.value?.id);
|
||||
return {
|
||||
title: "快来看看我刚领到的新年精美壁纸 🖼",
|
||||
query: `shareToken=${token}`,
|
||||
@@ -180,6 +187,7 @@ const fetchDetail = async () => {
|
||||
saveViewRequest(shareToken.value, "wallpaper_detail", res.id);
|
||||
if (res) {
|
||||
detailData.value = res;
|
||||
fetchRecommend(res.id);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to fetch detail", e);
|
||||
@@ -190,10 +198,12 @@ const fetchDetail = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const fetchRecommend = async () => {
|
||||
const fetchRecommend = async (id) => {
|
||||
if (!id && !detailData.value.id) return;
|
||||
try {
|
||||
const res = await getWallpaperRecommendList();
|
||||
const res = await getWallpaperSameList(id || detailData.value.id);
|
||||
recommendList.value = res;
|
||||
// categoryId.value = res[0]?.categoryId || "";
|
||||
} catch (e) {
|
||||
console.error("Failed to fetch recommendations", e);
|
||||
}
|
||||
@@ -212,7 +222,7 @@ const goBack = () => {
|
||||
|
||||
const goToIndex = () => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/wallpaper/index",
|
||||
url: `/pages/wallpaper/index?categoryId=${categoryId.value}`,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -223,26 +233,92 @@ const goToFortune = () => {
|
||||
};
|
||||
|
||||
const previewImage = () => {
|
||||
// if (detailData.value.imageUrl) {
|
||||
// uni.previewImage({
|
||||
// urls: [detailData.value.imageUrl],
|
||||
// });
|
||||
// }
|
||||
if (detailData.value.imageUrl) {
|
||||
uni.previewImage({
|
||||
urls: [detailData.value.imageUrl],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const onRecommendClick = () => {
|
||||
goToIndex();
|
||||
};
|
||||
|
||||
const goToGreeting = () => {
|
||||
uni.switchTab({ url: "/pages/make/index" });
|
||||
};
|
||||
|
||||
const goToAvatar = () => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/avatar/index",
|
||||
const onRecommendClick = (item) => {
|
||||
// Update detailData with new item info
|
||||
detailData.value = {
|
||||
...detailData.value,
|
||||
id: item.id,
|
||||
imageUrl: item.imageUrl,
|
||||
title: item.title,
|
||||
};
|
||||
// Refresh recommendations for the new item
|
||||
fetchRecommend(item.id);
|
||||
// Scroll to top or just update view
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300,
|
||||
});
|
||||
};
|
||||
|
||||
const handleLogind = async () => {
|
||||
// Logic after successful login if needed
|
||||
};
|
||||
|
||||
const handleAdReward = async (token) => {
|
||||
try {
|
||||
const res = await watchAdReward(token);
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
title: "获得50积分",
|
||||
icon: "success",
|
||||
});
|
||||
await userStore.fetchUserAssets();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Reward claim failed", e);
|
||||
uni.showToast({ title: "奖励发放失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
|
||||
const downloadWallpaper = async () => {
|
||||
trackRecord({
|
||||
eventName: "wallpaper_download_click",
|
||||
eventType: `click`,
|
||||
elementId: detailData.value?.id || "",
|
||||
});
|
||||
if (!isLoggedIn.value) {
|
||||
loginPopupRef.value.open();
|
||||
return;
|
||||
}
|
||||
|
||||
const canProceed = await checkAbilityAndHandle(
|
||||
"wallpaper_download",
|
||||
rewardAdRef,
|
||||
);
|
||||
if (!canProceed) return;
|
||||
|
||||
uni.showLoading({ title: "下载中..." });
|
||||
try {
|
||||
// Parallelize save record and download
|
||||
// Wait for saveRecordRequest to ensure backend deducts points
|
||||
await Promise.all([
|
||||
saveRecordRequest(
|
||||
"",
|
||||
detailData.value?.id,
|
||||
"wallpaper_download",
|
||||
detailData.value?.imageUrl,
|
||||
),
|
||||
saveRemoteImageToLocal(detailData.value?.imageUrl),
|
||||
]);
|
||||
|
||||
// Refresh user assets to show updated points
|
||||
await userStore.fetchUserAssets();
|
||||
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "保存成功 消耗 20 积分", icon: "success" });
|
||||
} catch (e) {
|
||||
uni.hideLoading();
|
||||
console.error("Download failed", e);
|
||||
uni.showToast({ title: "下载失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -359,10 +435,12 @@ const goToAvatar = () => {
|
||||
}
|
||||
|
||||
.main-image {
|
||||
width: 100%;
|
||||
width: 460rpx;
|
||||
margin: 0 auto;
|
||||
border-radius: 12px;
|
||||
display: block;
|
||||
background-color: #fafafa; // Placeholder color
|
||||
box-shadow: 0 12rpx 32rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,6 +472,7 @@ const goToAvatar = () => {
|
||||
background: linear-gradient(90deg, #ff3b30 0%, #ff6b6b 100%);
|
||||
color: #fff;
|
||||
box-shadow: 0 8px 20px rgba(255, 59, 48, 0.15);
|
||||
height: 64px; /* Increased height for two lines */
|
||||
}
|
||||
|
||||
&.secondary-btn {
|
||||
@@ -407,6 +486,43 @@ const goToAvatar = () => {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
|
||||
.points-display {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
|
||||
.value {
|
||||
color: #ff5722;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
line-height: 1.2;
|
||||
|
||||
.btn-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.btn-sub {
|
||||
font-size: 12px;
|
||||
opacity: 0.9;
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.more-section {
|
||||
|
||||
@@ -19,6 +19,18 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- Points Info -->
|
||||
<view class="points-bar">
|
||||
<view class="points-left">
|
||||
<uni-icons type="download" size="14" color="#ff9800" />
|
||||
<text>每次下载消耗 {{ downloadCost }} 积分</text>
|
||||
</view>
|
||||
<view class="points-right">
|
||||
<text>当前积分:</text>
|
||||
<text class="score-val">{{ userScore }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Wallpaper Grid -->
|
||||
<scroll-view
|
||||
scroll-y
|
||||
@@ -79,6 +91,7 @@
|
||||
@logind="handleLogind"
|
||||
:share-token="shareToken"
|
||||
/>
|
||||
<RewardAd ref="rewardAdRef" @onReward="handleAdReward" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -91,15 +104,21 @@ import {
|
||||
getShareToken,
|
||||
} from "@/utils/common.js";
|
||||
import { onShareAppMessage, onShareTimeline, onLoad } from "@dcloudio/uni-app";
|
||||
import { getShareReward, abilityCheck } from "@/api/system.js";
|
||||
import { getShareReward, watchAdReward } from "@/api/system.js";
|
||||
import { checkAbilityAndHandle } from "@/utils/ability.js";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { saveViewRequest } from "@/utils/common.js";
|
||||
import { saveViewRequest, trackRecord } from "@/utils/common.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import RewardAd from "@/components/RewardAd/RewardAd.vue";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const loginPopupRef = ref(null);
|
||||
const rewardAdRef = ref(null);
|
||||
|
||||
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
||||
const userScore = computed(() => userStore.userInfo.points || 0);
|
||||
const downloadCost = ref(20);
|
||||
|
||||
const categories = ref([]);
|
||||
const currentCategoryId = ref(null);
|
||||
const wallpapers = ref([]);
|
||||
@@ -113,7 +132,7 @@ onShareAppMessage(async (options) => {
|
||||
if (!isLoggedIn.value) {
|
||||
const shareToken = await getShareToken("wallpaper_download_index", "");
|
||||
return {
|
||||
title: "新春祝福",
|
||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
@@ -132,7 +151,7 @@ onShareAppMessage(async (options) => {
|
||||
} else {
|
||||
const shareToken = await getShareToken("wallpaper_download_index", "");
|
||||
return {
|
||||
title: "新春祝福",
|
||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
@@ -156,6 +175,14 @@ onLoad((options) => {
|
||||
shareToken.value = options.shareToken;
|
||||
saveViewRequest(options.shareToken, "wallpaper_download");
|
||||
}
|
||||
if (options.categoryId) {
|
||||
currentCategoryId.value = options.categoryId;
|
||||
}
|
||||
fetchCategories();
|
||||
trackRecord({
|
||||
eventName: "wallpaper_page_visit",
|
||||
eventType: `visit`,
|
||||
});
|
||||
});
|
||||
|
||||
const getThumbUrl = (url) => {
|
||||
@@ -168,7 +195,9 @@ const fetchCategories = async () => {
|
||||
const list = Array.isArray(res) ? res : res?.list || [];
|
||||
if (list.length > 0) {
|
||||
categories.value = list;
|
||||
currentCategoryId.value = list[0].id;
|
||||
if (!currentCategoryId.value) {
|
||||
currentCategoryId.value = list[0].id;
|
||||
}
|
||||
loadWallpapers(true);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -181,6 +210,11 @@ const switchCategory = (id) => {
|
||||
if (currentCategoryId.value === id) return;
|
||||
currentCategoryId.value = id;
|
||||
loadWallpapers(true);
|
||||
trackRecord({
|
||||
eventName: "wallpaper_category_click",
|
||||
eventType: `select`,
|
||||
elementId: id || "",
|
||||
});
|
||||
};
|
||||
|
||||
const loadWallpapers = async (reset = false) => {
|
||||
@@ -230,41 +264,71 @@ const onRefresh = () => {
|
||||
};
|
||||
|
||||
const previewImage = (index) => {
|
||||
const urls = wallpapers.value.map((item) => item.url);
|
||||
uni.previewImage({
|
||||
urls,
|
||||
current: index,
|
||||
// const urls = wallpapers.value.map((item) => item.url);
|
||||
// uni.previewImage({
|
||||
// urls,
|
||||
// current: index,
|
||||
// });
|
||||
const item = wallpapers.value[index];
|
||||
trackRecord({
|
||||
eventName: "wallpaper_preview_click",
|
||||
eventType: `select`,
|
||||
elementId: item?.id || "",
|
||||
});
|
||||
};
|
||||
|
||||
const handleAdReward = async (token) => {
|
||||
try {
|
||||
const res = await watchAdReward(token);
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
title: "获得50积分",
|
||||
icon: "success",
|
||||
});
|
||||
await userStore.fetchUserAssets();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Reward claim failed", e);
|
||||
uni.showToast({ title: "奖励发放失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
|
||||
const downloadWallpaper = async (item) => {
|
||||
trackRecord({
|
||||
eventName: "wallpaper_download_click",
|
||||
eventType: `click`,
|
||||
elementId: item?.id || "",
|
||||
});
|
||||
if (!isLoggedIn.value) {
|
||||
loginPopupRef.value.open();
|
||||
return;
|
||||
}
|
||||
|
||||
const abilityRes = await abilityCheck("wallpaper_download");
|
||||
if (!abilityRes.canUse) {
|
||||
if (
|
||||
abilityRes?.blockType === "need_share" &&
|
||||
abilityRes?.message === "分享可继续"
|
||||
) {
|
||||
uni.showToast({
|
||||
title: "分享给好友即可下载",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: "您今日壁纸下载次数已用完,明日再试",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const canProceed = await checkAbilityAndHandle(
|
||||
"wallpaper_download",
|
||||
rewardAdRef,
|
||||
);
|
||||
if (!canProceed) return;
|
||||
|
||||
uni.showLoading({ title: "下载中..." });
|
||||
await saveRemoteImageToLocal(item.imageUrl);
|
||||
saveRecordRequest("", item.id, "wallpaper_download", item.imageUrl);
|
||||
try {
|
||||
// Parallelize save record and download
|
||||
// Wait for saveRecordRequest to ensure backend deducts points
|
||||
await Promise.all([
|
||||
saveRecordRequest("", item.id, "wallpaper_download", item.imageUrl),
|
||||
saveRemoteImageToLocal(item.imageUrl),
|
||||
]);
|
||||
|
||||
// Refresh user assets to show updated points
|
||||
await userStore.fetchUserAssets();
|
||||
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "保存成功 消耗 20 积分", icon: "success" });
|
||||
} catch (e) {
|
||||
uni.hideLoading();
|
||||
console.error("Download failed", e);
|
||||
uni.showToast({ title: "下载失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
|
||||
const shareWallpaper = (item) => {};
|
||||
@@ -288,6 +352,35 @@ const shareWallpaper = (item) => {};
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.points-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16rpx 30rpx;
|
||||
background-color: #fffbf0;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.points-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
color: #ff9800;
|
||||
}
|
||||
|
||||
.points-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.score-val {
|
||||
color: #d81e06;
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
margin-left: 4rpx;
|
||||
}
|
||||
|
||||
.tabs-scroll {
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
|
||||
559
pages/wallpaper/share.vue
Normal file
559
pages/wallpaper/share.vue
Normal file
@@ -0,0 +1,559 @@
|
||||
<template>
|
||||
<view class="share-page" :style="{ paddingTop: navHeight + 'px' }">
|
||||
<!-- Navbar -->
|
||||
<view
|
||||
class="nav-bar"
|
||||
:style="{ height: navHeight + 'px', paddingTop: statusBarHeight + 'px' }"
|
||||
>
|
||||
<view class="nav-content">
|
||||
<view class="back" @tap="goBack">
|
||||
<text class="back-icon">‹</text>
|
||||
</view>
|
||||
<text class="title">壁纸详情</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content-container">
|
||||
<!-- Sharer Info -->
|
||||
<view class="sharer-info" v-if="detailData.from">
|
||||
<image
|
||||
:src="detailData.from.avatar || '/static/default-avatar.png'"
|
||||
class="avatar"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view class="info-text">
|
||||
<view class="nickname">{{
|
||||
detailData.from.nickname || "神秘好友"
|
||||
}}</view>
|
||||
<view class="action-text">给你分享了一张2026新春精美壁纸</view>
|
||||
<view class="sub-text">★ 2026 且马贺岁</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Wallpaper Preview -->
|
||||
<view class="preview-card">
|
||||
<view class="preview-badge">PREVIEW</view>
|
||||
<image
|
||||
:src="detailData.imageUrl"
|
||||
mode="widthFix"
|
||||
class="main-image"
|
||||
@tap="previewImage"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<view class="action-buttons">
|
||||
<button class="btn primary-btn" @tap="goToIndex">
|
||||
<text class="btn-icon">✨</text>
|
||||
<text>我也要领同款壁纸</text>
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<!-- More Wallpapers -->
|
||||
<view class="more-section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">我也要领新春壁纸</text>
|
||||
<view class="more-link" @tap="goToIndex">
|
||||
<text>查看更多</text>
|
||||
<text class="arrow">›</text>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view scroll-x class="more-scroll" :show-scrollbar="false">
|
||||
<view class="scroll-inner">
|
||||
<view
|
||||
v-for="(item, index) in recommendList"
|
||||
:key="index"
|
||||
class="scroll-item"
|
||||
@tap="onRecommendClick(item)"
|
||||
>
|
||||
<image
|
||||
:src="getThumbUrl(item.imageUrl)"
|
||||
mode="aspectFill"
|
||||
class="scroll-img"
|
||||
/>
|
||||
<text class="item-title">{{ item.title || "新春壁纸" }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- Fortune Banner -->
|
||||
<!-- Wallpaper Banner -->
|
||||
<view class="wallpaper-banner" @tap="goToFortune">
|
||||
<view class="banner-icon">
|
||||
<text>🏮</text>
|
||||
</view>
|
||||
<view class="banner-content">
|
||||
<text class="banner-title">去抽取新年运势</text>
|
||||
<text class="banner-desc">每日一签,开启你的新年好运</text>
|
||||
</view>
|
||||
<text class="banner-arrow">›</text>
|
||||
</view>
|
||||
<view class="wallpaper-banner" @tap="goToGreeting">
|
||||
<view class="banner-icon">
|
||||
<text>🧧</text>
|
||||
</view>
|
||||
<view class="banner-content">
|
||||
<text class="banner-title">去制作新年贺卡</text>
|
||||
<text class="banner-desc">定制专属祝福,传递浓浓年味</text>
|
||||
</view>
|
||||
<text class="banner-arrow">›</text>
|
||||
</view>
|
||||
<view class="wallpaper-banner" @tap="goToAvatar">
|
||||
<view class="banner-icon">
|
||||
<text>🖼</text>
|
||||
</view>
|
||||
<view class="banner-content">
|
||||
<text class="banner-title">去挑选新年头像</text>
|
||||
<text class="banner-desc">精选新年头像,让手机也过年</text>
|
||||
</view>
|
||||
<text class="banner-arrow">›</text>
|
||||
</view>
|
||||
|
||||
<!-- Footer -->
|
||||
<view class="footer">
|
||||
<view class="footer-divider">
|
||||
<view class="line"></view>
|
||||
<text class="footer-text">2026 HAPPY NEW YEAR</text>
|
||||
<view class="line"></view>
|
||||
</view>
|
||||
<view class="footer-sub">新春祝福 · 传递温情</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import { getBavBarHeight } from "@/utils/system";
|
||||
import { getPageDetail, getShareReward } from "@/api/system";
|
||||
import { getWallpaperRecommendList } from "@/api/wallpaper";
|
||||
import { getShareToken, saveViewRequest } from "@/utils/common.js";
|
||||
|
||||
const navHeight = getBavBarHeight();
|
||||
const statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
const detailData = ref({
|
||||
imageUrl: "",
|
||||
from: null,
|
||||
});
|
||||
const recommendList = ref([]);
|
||||
const shareToken = ref("");
|
||||
|
||||
onLoad(async (options) => {
|
||||
if (options.shareToken) {
|
||||
shareToken.value = options.shareToken;
|
||||
await fetchDetail();
|
||||
}
|
||||
fetchRecommend();
|
||||
});
|
||||
|
||||
onShareAppMessage(async () => {
|
||||
const token = await getShareToken("wallpaper_download", detailData.value?.id);
|
||||
getShareReward({ scene: "wallpaper_download" });
|
||||
return {
|
||||
title: "快来看看我刚领到的新年精美壁纸 🖼",
|
||||
path: `/pages/wallpaper/detail?shareToken=${token || ""}`,
|
||||
imageUrl:
|
||||
detailData.value?.imageUrl ||
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
onShareTimeline(async () => {
|
||||
const token = await getShareToken("wallpaper_download", detailData.value?.id);
|
||||
return {
|
||||
title: "快来看看我刚领到的新年精美壁纸 🖼",
|
||||
query: `shareToken=${token}`,
|
||||
imageUrl:
|
||||
detailData.value?.imageUrl ||
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
const getThumbUrl = (url) => {
|
||||
return `${url}?imageView2/1/w/340/h/600/q/80`;
|
||||
};
|
||||
|
||||
const fetchDetail = async () => {
|
||||
try {
|
||||
const res = await getPageDetail(shareToken.value);
|
||||
saveViewRequest(shareToken.value, "wallpaper_detail", res.id);
|
||||
if (res) {
|
||||
detailData.value = res;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to fetch detail", e);
|
||||
uni.showToast({
|
||||
title: "获取详情失败",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const fetchRecommend = async () => {
|
||||
try {
|
||||
const res = await getWallpaperRecommendList();
|
||||
recommendList.value = res;
|
||||
} catch (e) {
|
||||
console.error("Failed to fetch recommendations", e);
|
||||
}
|
||||
};
|
||||
|
||||
const goBack = () => {
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length > 1) {
|
||||
uni.navigateBack();
|
||||
} else {
|
||||
uni.reLaunch({
|
||||
url: "/pages/index/index",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const goToIndex = () => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/wallpaper/index",
|
||||
});
|
||||
};
|
||||
|
||||
const goToFortune = () => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/fortune/index",
|
||||
});
|
||||
};
|
||||
|
||||
const previewImage = () => {
|
||||
// if (detailData.value.imageUrl) {
|
||||
// uni.previewImage({
|
||||
// urls: [detailData.value.imageUrl],
|
||||
// });
|
||||
// }
|
||||
};
|
||||
|
||||
const onRecommendClick = () => {
|
||||
goToIndex();
|
||||
};
|
||||
|
||||
const goToGreeting = () => {
|
||||
uni.switchTab({ url: "/pages/make/index" });
|
||||
};
|
||||
|
||||
const goToAvatar = () => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/avatar/index",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.share-page {
|
||||
min-height: 100vh;
|
||||
background: #ffffff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.nav-bar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 100;
|
||||
background-color: #ffffff;
|
||||
|
||||
.nav-content {
|
||||
height: 44px; // Standard nav height
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 24rpx;
|
||||
|
||||
.back {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 24rpx;
|
||||
/* 增大点击区域 */
|
||||
padding: 20rpx;
|
||||
margin-left: -20rpx;
|
||||
|
||||
.back-icon {
|
||||
font-size: 50rpx;
|
||||
color: #333;
|
||||
font-weight: 300;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
margin-right: 50rpx; /* Balance back button */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content-container {
|
||||
padding: 20px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.sharer-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 24px;
|
||||
|
||||
.avatar {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
margin-right: 12px;
|
||||
border: 2px solid #fff;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.info-text {
|
||||
.nickname {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.action-text {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.sub-text {
|
||||
font-size: 12px;
|
||||
color: #ff3b30;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.preview-card {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border-radius: 16px;
|
||||
padding: 12px;
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.04);
|
||||
border: 1px solid #f5f5f5;
|
||||
margin-bottom: 24px;
|
||||
|
||||
.preview-badge {
|
||||
position: absolute;
|
||||
top: 24px;
|
||||
right: 24px;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
backdrop-filter: blur(4px);
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.main-image {
|
||||
width: 100%;
|
||||
border-radius: 12px;
|
||||
display: block;
|
||||
background-color: #fafafa; // Placeholder color
|
||||
}
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
margin-bottom: 32px;
|
||||
|
||||
.btn {
|
||||
width: 100%;
|
||||
height: 52px;
|
||||
border-radius: 26px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
border: none;
|
||||
margin: 0;
|
||||
transition: all 0.2s;
|
||||
|
||||
.btn-icon {
|
||||
margin-right: 8px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
&.primary-btn {
|
||||
background: linear-gradient(90deg, #ff3b30 0%, #ff6b6b 100%);
|
||||
color: #fff;
|
||||
box-shadow: 0 8px 20px rgba(255, 59, 48, 0.15);
|
||||
}
|
||||
|
||||
&.secondary-btn {
|
||||
background: #f9f9f9;
|
||||
color: #333;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.more-section {
|
||||
margin-bottom: 32px;
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
|
||||
.section-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.more-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
color: #ff3b30;
|
||||
|
||||
.arrow {
|
||||
margin-left: 2px;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.more-scroll {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.scroll-inner {
|
||||
display: flex;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.scroll-item {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
width: 200rpx;
|
||||
margin-right: 20rpx;
|
||||
flex-shrink: 0;
|
||||
|
||||
.scroll-img {
|
||||
width: 100%;
|
||||
height: 355rpx;
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 12rpx;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fortune-banner-wrap {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.wallpaper-banner {
|
||||
background: #fafafa;
|
||||
border-radius: 24rpx;
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 60rpx;
|
||||
border: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
.banner-icon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.banner-icon text {
|
||||
font-size: 40rpx;
|
||||
color: #ff3b30;
|
||||
}
|
||||
|
||||
.banner-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.banner-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.banner-desc {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.banner-arrow {
|
||||
font-size: 36rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
padding-bottom: 20px;
|
||||
|
||||
.footer-divider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 8px;
|
||||
|
||||
.line {
|
||||
width: 40px;
|
||||
height: 1px;
|
||||
background: #e0e0e0;
|
||||
}
|
||||
|
||||
.footer-text {
|
||||
margin: 0 12px;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
letter-spacing: 1px;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.footer-sub {
|
||||
font-size: 10px;
|
||||
color: #ccc;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
BIN
static/images/qrcode.jpg
Normal file
BIN
static/images/qrcode.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
@@ -1,7 +1,7 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { wxLogin, wxGetUserProfile } from "@/utils/login.js";
|
||||
import { getPlatformProvider } from "@/utils/system";
|
||||
import { getUserInfo } from "@/api/auth.js";
|
||||
import { getUserInfo, getUserAsset } from "@/api/auth.js";
|
||||
|
||||
export const useUserStore = defineStore("user", {
|
||||
state: () => ({
|
||||
@@ -55,6 +55,29 @@ export const useUserStore = defineStore("user", {
|
||||
console.error("fetchUserInfo error", e);
|
||||
}
|
||||
},
|
||||
async fetchUserAssets() {
|
||||
try {
|
||||
if (!this?.userInfo?.id) return;
|
||||
const res = await getUserAsset();
|
||||
if (res) {
|
||||
const newInfo = { ...this.userInfo, ...res };
|
||||
if (res.points !== undefined) {
|
||||
newInfo.points = res.points;
|
||||
}
|
||||
|
||||
if (res.exp !== undefined) {
|
||||
newInfo.exp = res.exp;
|
||||
}
|
||||
|
||||
if (res.level !== undefined) {
|
||||
newInfo.level = res.level;
|
||||
}
|
||||
this.setUserInfo(newInfo);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("fetchUserAssets error", e);
|
||||
}
|
||||
},
|
||||
logout() {
|
||||
this.userInfo = {};
|
||||
this.token = "";
|
||||
|
||||
82
utils/ability.js
Normal file
82
utils/ability.js
Normal file
@@ -0,0 +1,82 @@
|
||||
import { abilityCheck } from "@/api/system";
|
||||
|
||||
/**
|
||||
* Checks if a user has the ability to perform an action (e.g., download).
|
||||
* 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 {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.
|
||||
*/
|
||||
export const checkAbilityAndHandle = async (scene, rewardAdRef) => {
|
||||
try {
|
||||
const abilityRes = await abilityCheck(scene);
|
||||
if (abilityRes.canUse) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
abilityRes?.blockType === "need_share" &&
|
||||
abilityRes?.message === "分享可继续"
|
||||
) {
|
||||
uni.showToast({
|
||||
title: "分享给好友即可下载",
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
abilityRes?.blockType === "need_ad" &&
|
||||
abilityRes?.message === "观看广告可继续"
|
||||
) {
|
||||
uni.showModal({
|
||||
title: "积分不足",
|
||||
content: "观看广告可获得50积分,继续下载",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// Check if rewardAdRef is a ref (has .value) or the component instance itself
|
||||
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" });
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (abilityRes?.blockType === "need_vip") {
|
||||
uni.showModal({
|
||||
title: "会员激活",
|
||||
content: "会员激活即可继续使用该功能,是否前往开通?",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/mine/vip",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
uni.showToast({
|
||||
title: "您今日下载次数已用完,明日再试",
|
||||
icon: "none",
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
console.error("Ability check failed", e);
|
||||
uni.showToast({ title: "系统繁忙,请稍后重试", icon: "none" });
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -1,5 +1,10 @@
|
||||
import { getDeviceInfo } from "@/utils/system";
|
||||
import { saveRecord, viewRecord, createShareToken } from "@/api/system";
|
||||
import {
|
||||
saveRecord,
|
||||
viewRecord,
|
||||
createShareToken,
|
||||
createTracking,
|
||||
} from "@/api/system";
|
||||
|
||||
export const generateObjectId = (
|
||||
m = Math,
|
||||
@@ -65,30 +70,30 @@ export const saveViewRequest = async (shareToken, scene, targetId = "") => {
|
||||
};
|
||||
|
||||
export const saveRemoteImageToLocal = (imageUrl) => {
|
||||
uni.downloadFile({
|
||||
url: imageUrl,
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: res.tempFilePath,
|
||||
success: () => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "已保存到相册" });
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "保存失败", icon: "none" });
|
||||
},
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "下载失败", icon: "none" });
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "下载失败", icon: "none" });
|
||||
},
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.downloadFile({
|
||||
url: imageUrl,
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: res.tempFilePath,
|
||||
success: () => {
|
||||
resolve(true);
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
reject(
|
||||
new Error("Download failed with status code: " + res.statusCode),
|
||||
);
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -101,3 +106,10 @@ export const getShareToken = async (scene, targetId = "") => {
|
||||
});
|
||||
return shareTokenRes?.shareToken || "";
|
||||
};
|
||||
|
||||
export const trackRecord = (event) => {
|
||||
createTracking({
|
||||
...event,
|
||||
page: getCurrentPages().pop()?.route,
|
||||
});
|
||||
};
|
||||
|
||||
178
utils/lunar.js
Normal file
178
utils/lunar.js
Normal file
@@ -0,0 +1,178 @@
|
||||
/**
|
||||
* 农历转换工具
|
||||
* 仅包含简单的公历转农历功能
|
||||
*/
|
||||
|
||||
const calendar = {
|
||||
/**
|
||||
* 农历 1900-2049 的润大小信息表
|
||||
* @Array Of Property
|
||||
* @return Hex
|
||||
*/
|
||||
lunarInfo: [
|
||||
0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0,
|
||||
0x09ad0, 0x055d2, 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540,
|
||||
0x0d6a0, 0x0ada2, 0x095b0, 0x14977, 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50,
|
||||
0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, 0x06566, 0x0d4a0,
|
||||
0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950,
|
||||
0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2,
|
||||
0x0a950, 0x0b557, 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573,
|
||||
0x052d0, 0x0a9a8, 0x0e950, 0x06aa0, 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4,
|
||||
0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, 0x096d0, 0x04dd5,
|
||||
0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0, 0x195a6,
|
||||
0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46,
|
||||
0x0ab60, 0x09570, 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58,
|
||||
0x055c0, 0x0ab60, 0x096d5, 0x092e0, 0x0c960, 0x0d954, 0x0d4a0, 0x0da50,
|
||||
0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0,
|
||||
0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930,
|
||||
0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260,
|
||||
0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0,
|
||||
0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, 0x0b5a0, 0x056d0, 0x055b2, 0x049b0,
|
||||
0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0,
|
||||
],
|
||||
|
||||
/**
|
||||
* 传回农历 y年的总天数
|
||||
* @param y
|
||||
* @return Number
|
||||
*/
|
||||
lYearDays: function (y) {
|
||||
var i,
|
||||
sum = 348;
|
||||
for (i = 0x8000; i > 0x8; i >>= 1)
|
||||
sum += this.lunarInfo[y - 1900] & i ? 1 : 0;
|
||||
return sum + this.leapDays(y);
|
||||
},
|
||||
|
||||
/**
|
||||
* 传回农历 y年闰月的天数
|
||||
* @param y
|
||||
* @return Number
|
||||
*/
|
||||
leapDays: function (y) {
|
||||
if (this.leapMonth(y)) {
|
||||
return this.lunarInfo[y - 1900] & 0x10000 ? 30 : 29;
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* 传回农历 y年闰哪个月 1-12 , 没闰传回 0
|
||||
* @param y
|
||||
* @return Number
|
||||
*/
|
||||
leapMonth: function (y) {
|
||||
return this.lunarInfo[y - 1900] & 0xf;
|
||||
},
|
||||
|
||||
/**
|
||||
* 传回农历 y年m月的总天数
|
||||
* @param y
|
||||
* @param m
|
||||
* @return Number
|
||||
*/
|
||||
monthDays: function (y, m) {
|
||||
return this.lunarInfo[y - 1900] & (0x10000 >> m) ? 30 : 29;
|
||||
},
|
||||
|
||||
/**
|
||||
* 算出农历, 传入日期控件, 传回农历日期对象
|
||||
* @param objDate
|
||||
* @return Object
|
||||
*/
|
||||
solar2lunar: function (objDate) {
|
||||
var i,
|
||||
temp = 0;
|
||||
var baseDate = new Date(1900, 0, 31);
|
||||
var offset = Math.floor(
|
||||
(objDate.getTime() - baseDate.getTime()) / 86400000,
|
||||
);
|
||||
|
||||
var year = 1900;
|
||||
for (i = 1900; i < 2050 && offset > 0; i++) {
|
||||
temp = this.lYearDays(i);
|
||||
if (offset < temp) break;
|
||||
offset -= temp;
|
||||
year = i;
|
||||
}
|
||||
|
||||
// 如果循环结束时 offset 仍大于0 (超出范围),则年份最后一次增加未被撤销?
|
||||
// 不,break时 year=i。 如果没break,year会一直增加。
|
||||
// 修正:循环里 year = i 是对的。
|
||||
// 但是 calendar.js 原版通常是 year++ 在 check 之后?
|
||||
// 这里的逻辑:
|
||||
// offset 是总天数。
|
||||
// 减去1900年的天数,如果 offset > 0,说明在1900之后。
|
||||
// year 变成 1901。
|
||||
// 正确。
|
||||
|
||||
var leapMonth = this.leapMonth(year);
|
||||
var isLeap = false;
|
||||
var month = 1;
|
||||
|
||||
for (i = 1; i < 13; i++) {
|
||||
// 闰月
|
||||
temp = this.monthDays(year, i);
|
||||
if (offset < temp) {
|
||||
month = i;
|
||||
break;
|
||||
}
|
||||
offset -= temp;
|
||||
|
||||
if (leapMonth > 0 && i == leapMonth) {
|
||||
temp = this.leapDays(year);
|
||||
if (offset < temp) {
|
||||
isLeap = true;
|
||||
month = i;
|
||||
break;
|
||||
}
|
||||
offset -= temp;
|
||||
}
|
||||
}
|
||||
|
||||
var day = offset + 1;
|
||||
|
||||
// 格式化输出
|
||||
const monthCn = this.toChinaMonth(month);
|
||||
const dayCn = this.toChinaDay(day);
|
||||
|
||||
return {
|
||||
lYear: year,
|
||||
lMonth: month,
|
||||
lDay: day,
|
||||
isLeap: isLeap,
|
||||
monthCn: monthCn,
|
||||
dayCn: dayCn,
|
||||
lunarDateStr: (isLeap ? "闰" : "") + monthCn + dayCn,
|
||||
};
|
||||
},
|
||||
|
||||
toChinaMonth: function (m) {
|
||||
var s = "正二三四五六七八九十冬腊";
|
||||
var str = s.substring(m - 1, m);
|
||||
return str + "月";
|
||||
},
|
||||
|
||||
toChinaDay: function (d) {
|
||||
var s = "初十廿三";
|
||||
var arr = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"];
|
||||
var str = "";
|
||||
switch (Math.floor(d / 10)) {
|
||||
case 0:
|
||||
str = "初" + arr[d - 1];
|
||||
break;
|
||||
case 1:
|
||||
str = d == 10 ? "初十" : "十" + arr[d - 11];
|
||||
break;
|
||||
case 2:
|
||||
str = d == 20 ? "二十" : "廿" + arr[d - 21];
|
||||
break;
|
||||
case 3:
|
||||
str = d == 30 ? "三十" : "三" + arr[d - 31];
|
||||
break;
|
||||
}
|
||||
return str;
|
||||
},
|
||||
};
|
||||
|
||||
export default calendar;
|
||||
@@ -1,6 +1,6 @@
|
||||
// const BASE_URL = "https://api.ai-meng.com";
|
||||
// const BASE_URL = 'http://127.0.0.1:3999'
|
||||
const BASE_URL = "http://192.168.1.3:3999";
|
||||
const BASE_URL = "http://192.168.1.2:3999";
|
||||
// const BASE_URL = "http://192.168.31.253:3999";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { getPlatform } from "./system.js";
|
||||
|
||||
@@ -39,6 +39,10 @@ export const getLeftIconLeft = () => {
|
||||
// #endif
|
||||
};
|
||||
|
||||
export function getPlatform() {
|
||||
return getPlatformProvider().replace("mp-", "");
|
||||
}
|
||||
|
||||
export function getPlatformProvider() {
|
||||
const platform = process.env.UNI_PLATFORM;
|
||||
return platform || "mp-weixin";
|
||||
@@ -55,10 +59,6 @@ export function getPlatformProvider() {
|
||||
// return typeof tt !== 'undefined' ? 'toutiao' : 'weixin';
|
||||
}
|
||||
|
||||
export function getPlatform() {
|
||||
return getPlatformProvider().replace("mp-", "");
|
||||
}
|
||||
|
||||
export function getDeviceInfo() {
|
||||
const info = uni.getSystemInfoSync();
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user