Compare commits
11 Commits
cc8fcf802f
...
88f06d0b42
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88f06d0b42 | ||
|
|
27fe2e5a52 | ||
|
|
b3de7defdc | ||
|
|
dced5471c5 | ||
|
|
068391269e | ||
|
|
d5d60b8d5d | ||
|
|
d76269b154 | ||
|
|
3f764693c1 | ||
|
|
931ede6f8a | ||
|
|
c0e7ce069e | ||
|
|
b0cc473a78 |
@@ -23,9 +23,9 @@ export const getCardTemplateList = async (page = 1) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCardTemplateContentList = async () => {
|
export const getCardTemplateContentList = async (page = 1) => {
|
||||||
return request({
|
return request({
|
||||||
url: "/api/blessing/card/template-content/list",
|
url: "/api/blessing/card/template-content/list?page=" + page,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -36,4 +36,3 @@ export const getCardTemplateTitleList = async (page = 1) => {
|
|||||||
method: "GET",
|
method: "GET",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -59,3 +59,10 @@ export const msgCheckApi = async (content) => {
|
|||||||
method: "get",
|
method: "get",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getRandomGreeting = async () => {
|
||||||
|
return request({
|
||||||
|
url: "/api/blessing/random/greeting",
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"path": "pages/make/index",
|
"path": "pages/make/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "讨论",
|
"navigationBarTitleText": "讨论",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": true,
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -119,10 +119,14 @@ import { getDeviceInfo } from "@/utils/system";
|
|||||||
import { onLoad, onShow, onShareAppMessage } from "@dcloudio/uni-app";
|
import { onLoad, onShow, onShareAppMessage } from "@dcloudio/uni-app";
|
||||||
import { abilityCheck } from "@/api/system.js";
|
import { abilityCheck } from "@/api/system.js";
|
||||||
import { drawFortune } from "@/api/fortune.js";
|
import { drawFortune } from "@/api/fortune.js";
|
||||||
import { createShareToken, getShareReward } from "@/api/system.js";
|
import { getShareReward } from "@/api/system.js";
|
||||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||||
import { useUserStore } from "@/stores/user";
|
import { useUserStore } from "@/stores/user";
|
||||||
import { saveRemoteImageToLocal, saveRecordRequest } from "@/utils/common.js";
|
import {
|
||||||
|
getShareToken,
|
||||||
|
saveRemoteImageToLocal,
|
||||||
|
saveRecordRequest,
|
||||||
|
} from "@/utils/common.js";
|
||||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
@@ -158,16 +162,11 @@ onUnmounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onShareAppMessage(async () => {
|
onShareAppMessage(async () => {
|
||||||
const deviceInfo = getDeviceInfo();
|
const shareToken = await getShareToken("fortune_draw", cardId.value);
|
||||||
const shareTokenRes = await createShareToken({
|
|
||||||
targetId: cardId.value,
|
|
||||||
scene: "fortune_draw",
|
|
||||||
...deviceInfo,
|
|
||||||
});
|
|
||||||
getRewardByShare();
|
getRewardByShare();
|
||||||
return {
|
return {
|
||||||
title: "马年运势我已经抽过了,你的会是什么?",
|
title: "马年运势我已经抽过了,你的会是什么?",
|
||||||
path: `${cardId.value ? `/pages/fortune/detail?shareToken=${shareTokenRes.shareToken}` : `/pages/fortune/index?shareToken=${shareTokenRes.shareToken}`}`,
|
path: `${cardId.value ? `/pages/fortune/detail?shareToken=${shareToken}` : `/pages/fortune/index?shareToken=${shareTokenRes.shareToken}`}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -105,9 +105,11 @@ import {
|
|||||||
onPullDownRefresh,
|
onPullDownRefresh,
|
||||||
onShareAppMessage,
|
onShareAppMessage,
|
||||||
onReachBottom,
|
onReachBottom,
|
||||||
|
onLoad,
|
||||||
} from "@dcloudio/uni-app";
|
} from "@dcloudio/uni-app";
|
||||||
import { getBavBarHeight } from "@/utils/system";
|
import { getBavBarHeight } from "@/utils/system";
|
||||||
import { getRecommendList } from "@/api/system";
|
import { getRecommendList, getRandomGreeting } from "@/api/system";
|
||||||
|
import { getShareToken, saveViewRequest } from "@/utils/common.js";
|
||||||
|
|
||||||
const countdownText = ref("");
|
const countdownText = ref("");
|
||||||
|
|
||||||
@@ -146,31 +148,40 @@ const updateCountdown = () => {
|
|||||||
const todayDate = ref("");
|
const todayDate = ref("");
|
||||||
const dailyGreeting = ref("");
|
const dailyGreeting = ref("");
|
||||||
|
|
||||||
const inspirationList = [
|
onLoad((options) => {
|
||||||
"岁岁常欢愉,年年皆胜意。愿你新的一年,多喜乐,长安宁。",
|
if (options.shareToken) saveViewRequest(options.shareToken, "index");
|
||||||
"新的一年,愿日子如熹光,温柔又安详。你我赤诚且勇敢,欣喜也在望。",
|
|
||||||
"祝你:百事无忌,平安喜乐。万事胜意,得偿所愿。",
|
|
||||||
"凡是过往,皆为序章。愿2026年,烟火向星辰,所愿皆成真。",
|
|
||||||
"愿新的一年,仍有阳光满路,温暖如初。",
|
|
||||||
"辞暮尔尔,烟火年年。朝朝暮暮,岁岁平安。",
|
|
||||||
"愿你即使单枪匹马,也能勇敢无畏。新的一年,万事尽可期待。",
|
|
||||||
"所求皆如愿,所行化坦途。多喜乐,长安宁。",
|
|
||||||
"愿你手握山河,且行且歌。新年快乐,万事大吉。",
|
|
||||||
"长路浩浩荡荡,万物尽可期待。祝你新年好运。",
|
|
||||||
"何其有幸,年岁并进。新的一年,愿你快乐,不止新年。",
|
|
||||||
"愿新年,胜旧年。无病无灾,岁岁平安。",
|
|
||||||
"烟火起,照人间,举杯敬此年。烟花落,看人间,家家户户皆团圆。",
|
|
||||||
"家人闲坐,灯火可亲。新年伊始,喜乐安宁。",
|
|
||||||
"愿今年所有的遗憾,都是明年惊喜的铺垫。",
|
|
||||||
];
|
|
||||||
|
|
||||||
const copyGreeting = () => {
|
updateCountdown();
|
||||||
uni.setClipboardData({
|
getRandomGreetingText();
|
||||||
data: dailyGreeting.value,
|
fetchRecommendList();
|
||||||
success: () => {
|
|
||||||
uni.showToast({ title: "复制成功", icon: "none" });
|
const date = new Date();
|
||||||
},
|
todayDate.value = `${date.getMonth() + 1}月${date.getDate()}日`;
|
||||||
});
|
|
||||||
|
// 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");
|
||||||
|
return {
|
||||||
|
title: "新春祝福",
|
||||||
|
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||||
|
imageUrl:
|
||||||
|
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const getRandomGreetingText = async () => {
|
||||||
|
const content = await getRandomGreeting();
|
||||||
|
dailyGreeting.value =
|
||||||
|
content || "烟火起,照人间,举杯敬此年。烟花落,看人间,家家户户皆团圆。";
|
||||||
};
|
};
|
||||||
|
|
||||||
const useGreeting = () => {
|
const useGreeting = () => {
|
||||||
@@ -180,23 +191,6 @@ const useGreeting = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
updateCountdown();
|
|
||||||
const date = new Date();
|
|
||||||
todayDate.value = `${date.getMonth() + 1}月${date.getDate()}日`;
|
|
||||||
|
|
||||||
// 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];
|
|
||||||
|
|
||||||
fetchRecommendList();
|
|
||||||
});
|
|
||||||
|
|
||||||
const features = ref([
|
const features = ref([
|
||||||
{
|
{
|
||||||
title: "新春祝福卡片",
|
title: "新春祝福卡片",
|
||||||
@@ -342,25 +336,11 @@ onReachBottom(() => {
|
|||||||
fetchRecommendList();
|
fetchRecommendList();
|
||||||
});
|
});
|
||||||
|
|
||||||
const onMore = () => {
|
|
||||||
uni.showToast({ title: "更多模板即将上线~", icon: "none" });
|
|
||||||
};
|
|
||||||
|
|
||||||
onPullDownRefresh(async () => {
|
onPullDownRefresh(async () => {
|
||||||
await fetchRecommendList(true);
|
updateCountdown();
|
||||||
setTimeout(() => {
|
await Promise.all([fetchRecommendList(true), getRandomGreetingText()]);
|
||||||
uni.stopPullDownRefresh();
|
uni.stopPullDownRefresh();
|
||||||
uni.showToast({ title: "已为你更新内容", icon: "success" });
|
uni.showToast({ title: "已为你更新内容", icon: "success" });
|
||||||
}, 600);
|
|
||||||
});
|
|
||||||
|
|
||||||
onShareAppMessage(() => {
|
|
||||||
return {
|
|
||||||
title: "新春祝福",
|
|
||||||
path: "/pages/index/index",
|
|
||||||
imageUrl:
|
|
||||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,9 @@
|
|||||||
<view
|
<view
|
||||||
class="bubble"
|
class="bubble"
|
||||||
@tap="openTool('text')"
|
@tap="openTool('text')"
|
||||||
|
@touchstart.stop="handleBubbleTouchStart"
|
||||||
|
@touchmove.stop="handleBubbleTouchMove"
|
||||||
|
@touchend.stop="handleBubbleTouchEnd"
|
||||||
:style="{
|
:style="{
|
||||||
marginTop: 230 + bubbleOffsetY + 'rpx',
|
marginTop: 230 + bubbleOffsetY + 'rpx',
|
||||||
maxWidth: bubbleMaxWidth + 80 + 'rpx',
|
maxWidth: bubbleMaxWidth + 80 + 'rpx',
|
||||||
@@ -95,7 +98,7 @@
|
|||||||
<view class="tip-line">
|
<view class="tip-line">
|
||||||
<view class="interaction-tip">
|
<view class="interaction-tip">
|
||||||
<uni-icons type="hand-up" size="14" color="#ff3b30"></uni-icons>
|
<uni-icons type="hand-up" size="14" color="#ff3b30"></uni-icons>
|
||||||
<text>点击标题或个人信息可拖动,双指可缩放标题</text>
|
<text>标题、祝福语、个人信息可拖动改变位置,双指可缩放标题</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -120,111 +123,124 @@
|
|||||||
<!-- 弹出编辑面板 -->
|
<!-- 弹出编辑面板 -->
|
||||||
<view class="panel-container" :class="{ show: showPanel }">
|
<view class="panel-container" :class="{ show: showPanel }">
|
||||||
<view class="panel-mask" @tap="closePanel"></view>
|
<view class="panel-mask" @tap="closePanel"></view>
|
||||||
<view
|
<scroll-view
|
||||||
|
scroll-y
|
||||||
class="panel-content"
|
class="panel-content"
|
||||||
:class="{
|
:class="{
|
||||||
'glass-effect': activeTool === 'text' || activeTool === 'position',
|
'glass-effect': activeTool === 'text' || activeTool === 'position',
|
||||||
}"
|
}"
|
||||||
|
@scrolltolower="onPanelScrollToLower"
|
||||||
>
|
>
|
||||||
<view class="panel-handle" @tap="closePanel"></view>
|
<view class="panel-inner">
|
||||||
|
<view class="panel-handle" @tap="closePanel"></view>
|
||||||
|
|
||||||
<!-- 标题选择区 -->
|
<!-- 标题选择区 -->
|
||||||
<view v-if="activeTool === 'title'" class="section">
|
<view v-if="activeTool === 'title'" class="section">
|
||||||
<view class="section-title">
|
<view class="section-title">
|
||||||
<text>选择标题</text>
|
<text>选择标题</text>
|
||||||
</view>
|
|
||||||
<view class="tpl-scroll">
|
|
||||||
<view class="tpl-grid">
|
|
||||||
<view
|
|
||||||
v-for="(title, i) in titles"
|
|
||||||
:key="i"
|
|
||||||
class="tpl-card title-card"
|
|
||||||
:class="{ selected: title?.id === currentTitle?.id }"
|
|
||||||
@tap="selectTitle(title)"
|
|
||||||
>
|
|
||||||
<image
|
|
||||||
:src="title.imageUrl"
|
|
||||||
class="title-cover"
|
|
||||||
mode="aspectFit"
|
|
||||||
/>
|
|
||||||
<view v-if="title?.id === currentTitle?.id" class="tpl-check"
|
|
||||||
>✔</view
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view v-if="loadingTitles" class="loading-more">加载中...</view>
|
<view class="tpl-scroll">
|
||||||
<view
|
<view class="tpl-grid">
|
||||||
v-else-if="!hasMoreTitles && titles.length > 0"
|
|
||||||
class="no-more"
|
|
||||||
>没有更多了</view
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 模板区 -->
|
|
||||||
<view v-if="activeTool === 'template'" class="section">
|
|
||||||
<view class="section-title">
|
|
||||||
<text>热门模板</text>
|
|
||||||
</view>
|
|
||||||
<view class="tpl-scroll">
|
|
||||||
<view class="tpl-grid">
|
|
||||||
<view
|
|
||||||
v-for="(tpl, i) in templates"
|
|
||||||
:key="i"
|
|
||||||
class="tpl-card"
|
|
||||||
:class="{ selected: tpl?.id === currentTemplate?.id }"
|
|
||||||
@tap="applyTemplate(tpl)"
|
|
||||||
>
|
|
||||||
<image
|
|
||||||
:src="tpl.imageUrl"
|
|
||||||
class="tpl-cover"
|
|
||||||
mode="aspectFill"
|
|
||||||
/>
|
|
||||||
<view class="tpl-name">{{ tpl.name }}</view>
|
|
||||||
<view v-if="tpl?.id === currentTemplate?.id" class="tpl-check"
|
|
||||||
>✔</view
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view v-if="loadingTemplates" class="loading-more">加载中...</view>
|
|
||||||
<view
|
|
||||||
v-else-if="!hasMoreTemplates && templates.length > 0"
|
|
||||||
class="no-more"
|
|
||||||
>没有更多了</view
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 文字编辑 -->
|
|
||||||
<view v-if="activeTool === 'text'" class="section text-edit-section">
|
|
||||||
<view class="form-item">
|
|
||||||
<text class="label">祝福对象</text>
|
|
||||||
<input
|
|
||||||
class="input-box"
|
|
||||||
v-model="targetName"
|
|
||||||
placeholder="请输入称呼"
|
|
||||||
placeholder-style="color:#ccc"
|
|
||||||
maxlength="10"
|
|
||||||
@blur="handleTargetNameBlur"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 祝福语库 -->
|
|
||||||
<view class="form-item">
|
|
||||||
<view class="label-row">
|
|
||||||
<text class="label">祝福语库</text>
|
|
||||||
<view class="refresh-btn" @tap="refreshGreetings">
|
|
||||||
<text class="refresh-icon">↻</text> 换一批
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<scroll-view
|
|
||||||
scroll-x
|
|
||||||
class="greeting-scroll"
|
|
||||||
show-scrollbar="false"
|
|
||||||
>
|
|
||||||
<view class="greeting-list">
|
|
||||||
<view
|
<view
|
||||||
v-for="(text, index) in displayedGreetings"
|
v-for="(title, i) in titles"
|
||||||
|
:key="i"
|
||||||
|
class="tpl-card title-card"
|
||||||
|
:class="{ selected: title?.id === currentTitle?.id }"
|
||||||
|
@tap="selectTitle(title)"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
:src="title.imageUrl"
|
||||||
|
class="title-cover"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
<view v-if="title?.id === currentTitle?.id" class="tpl-check"
|
||||||
|
>✔</view
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="loadingTitles" class="loading-more">加载中...</view>
|
||||||
|
<view
|
||||||
|
v-else-if="!hasMoreTitles && titles.length > 0"
|
||||||
|
class="no-more"
|
||||||
|
>没有更多了</view
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 模板区 -->
|
||||||
|
<view v-if="activeTool === 'template'" class="section">
|
||||||
|
<view class="section-title">
|
||||||
|
<text>热门模板</text>
|
||||||
|
</view>
|
||||||
|
<view class="tpl-scroll">
|
||||||
|
<view class="tpl-grid">
|
||||||
|
<view
|
||||||
|
v-for="(tpl, i) in templates"
|
||||||
|
:key="i"
|
||||||
|
class="tpl-card"
|
||||||
|
:class="{ selected: tpl?.id === currentTemplate?.id }"
|
||||||
|
@tap="applyTemplate(tpl)"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
:src="tpl.imageUrl"
|
||||||
|
class="tpl-cover"
|
||||||
|
mode="aspectFill"
|
||||||
|
/>
|
||||||
|
<view class="tpl-name">{{ tpl.name }}</view>
|
||||||
|
<view v-if="tpl?.id === currentTemplate?.id" class="tpl-check"
|
||||||
|
>✔</view
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="loadingTemplates" class="loading-more"
|
||||||
|
>加载中...</view
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
v-else-if="!hasMoreTemplates && templates.length > 0"
|
||||||
|
class="no-more"
|
||||||
|
>没有更多了</view
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 文字编辑 -->
|
||||||
|
<view v-if="activeTool === 'text'" class="section text-edit-section">
|
||||||
|
<view class="form-item">
|
||||||
|
<text class="label">祝福对象</text>
|
||||||
|
<input
|
||||||
|
class="input-box"
|
||||||
|
v-model="targetName"
|
||||||
|
placeholder="请输入称呼"
|
||||||
|
placeholder-style="color:#ccc"
|
||||||
|
maxlength="10"
|
||||||
|
@blur="handleTargetNameBlur"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 署名 -->
|
||||||
|
<view class="form-item">
|
||||||
|
<text class="label">署名</text>
|
||||||
|
<view class="input-wrapper">
|
||||||
|
<input
|
||||||
|
class="input-box"
|
||||||
|
v-model="signatureName"
|
||||||
|
placeholder="请输入署名"
|
||||||
|
placeholder-style="color:#ccc"
|
||||||
|
maxlength="10"
|
||||||
|
@blur="handleSignatureBlur"
|
||||||
|
/>
|
||||||
|
<text class="edit-icon">✎</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 祝福语库 -->
|
||||||
|
<view class="form-item">
|
||||||
|
<view class="label-row">
|
||||||
|
<text class="label">祝福语库</text>
|
||||||
|
</view>
|
||||||
|
<view class="greeting-grid">
|
||||||
|
<view
|
||||||
|
v-for="(text, index) in greetingLib"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="greeting-card"
|
class="greeting-card"
|
||||||
:class="{ active: blessingText.content === text.content }"
|
:class="{ active: blessingText.content === text.content }"
|
||||||
@@ -238,84 +254,107 @@
|
|||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
<view v-if="loadingBlessings" class="loading-more"
|
||||||
</view>
|
>加载中...</view
|
||||||
|
>
|
||||||
<!-- 署名 -->
|
<view
|
||||||
<view class="form-item">
|
v-else-if="!hasMoreBlessings && greetingLib.length > 0"
|
||||||
<text class="label">署名</text>
|
class="no-more"
|
||||||
<view class="input-wrapper">
|
>没有更多了</view
|
||||||
<input
|
>
|
||||||
class="input-box"
|
|
||||||
v-model="signatureName"
|
|
||||||
placeholder="请输入署名"
|
|
||||||
placeholder-style="color:#ccc"
|
|
||||||
maxlength="10"
|
|
||||||
@blur="handleSignatureBlur"
|
|
||||||
/>
|
|
||||||
<text class="edit-icon">✎</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 字体选择 -->
|
<!-- 样式与位置 -->
|
||||||
<view class="form-item">
|
<view
|
||||||
<text class="label">字体样式</text>
|
v-if="activeTool === 'position'"
|
||||||
<scroll-view scroll-x class="font-scroll" show-scrollbar="false">
|
class="section position-section"
|
||||||
<view class="font-list">
|
>
|
||||||
|
<view class="section-title">
|
||||||
|
<text>调整样式与位置</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 字体大小 -->
|
||||||
|
<view class="form-item" style="margin-top: 20rpx">
|
||||||
|
<text class="label">字体大小</text>
|
||||||
|
<slider
|
||||||
|
:value="fontSize"
|
||||||
|
min="24"
|
||||||
|
max="64"
|
||||||
|
show-value
|
||||||
|
@change="(e) => (fontSize = e.detail.value)"
|
||||||
|
activeColor="#ff3b30"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="form-item">
|
||||||
|
<text class="label">祝福语宽窄</text>
|
||||||
|
<slider
|
||||||
|
:value="bubbleMaxWidth"
|
||||||
|
min="200"
|
||||||
|
max="460"
|
||||||
|
show-value
|
||||||
|
@change="(e) => (bubbleMaxWidth = e.detail.value)"
|
||||||
|
activeColor="#ff3b30"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 字体选择 -->
|
||||||
|
<view class="form-item">
|
||||||
|
<text class="label">字体样式</text>
|
||||||
|
<scroll-view scroll-x class="font-scroll" show-scrollbar="false">
|
||||||
|
<view class="font-list">
|
||||||
|
<view
|
||||||
|
v-for="(font, index) in fontList"
|
||||||
|
:key="index"
|
||||||
|
class="font-item"
|
||||||
|
:class="{ active: selectedFont.family === font.family }"
|
||||||
|
@tap="changeFont(font)"
|
||||||
|
>
|
||||||
|
<text :style="{ fontFamily: font.family }">{{
|
||||||
|
font.name
|
||||||
|
}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 文字颜色 -->
|
||||||
|
<view class="form-item">
|
||||||
|
<text class="label">祝福语颜色</text>
|
||||||
|
<view class="color-list">
|
||||||
<view
|
<view
|
||||||
v-for="(font, index) in fontList"
|
v-for="(color, index) in textColors"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="font-item"
|
class="color-item"
|
||||||
:class="{ active: selectedFont.family === font.family }"
|
:style="{ background: color }"
|
||||||
@tap="changeFont(font)"
|
@tap="selectedColor = color"
|
||||||
>
|
>
|
||||||
<text :style="{ fontFamily: font.family }">{{
|
<view v-if="selectedColor === color" class="color-check"
|
||||||
font.name
|
>✔</view
|
||||||
}}</text>
|
>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</view>
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 字体大小 -->
|
<view class="form-item">
|
||||||
<view class="form-item">
|
<text class="label">署名颜色</text>
|
||||||
<text class="label">字体大小</text>
|
<view class="color-list">
|
||||||
<slider
|
<view
|
||||||
:value="fontSize"
|
v-for="(color, index) in textColors"
|
||||||
min="24"
|
:key="index"
|
||||||
max="64"
|
class="color-item"
|
||||||
show-value
|
:style="{ background: color }"
|
||||||
@change="(e) => (fontSize = e.detail.value)"
|
@tap="signatureColor = color"
|
||||||
activeColor="#ff3b30"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 文字颜色 -->
|
|
||||||
<view class="form-item">
|
|
||||||
<text class="label">祝福语颜色</text>
|
|
||||||
<view class="color-list">
|
|
||||||
<view
|
|
||||||
v-for="(color, index) in textColors"
|
|
||||||
:key="index"
|
|
||||||
class="color-item"
|
|
||||||
:style="{ background: color }"
|
|
||||||
@tap="selectedColor = color"
|
|
||||||
>
|
|
||||||
<view v-if="selectedColor === color" class="color-check"
|
|
||||||
>✔</view
|
|
||||||
>
|
>
|
||||||
|
<view v-if="signatureColor === color" class="color-check"
|
||||||
|
>✔</view
|
||||||
|
>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 位置调整 -->
|
<!-- <view class="form-item">
|
||||||
<view v-if="activeTool === 'position'" class="section position-section">
|
|
||||||
<view class="section-title">
|
|
||||||
<text>调整位置</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="form-item" style="margin-top: 20rpx">
|
|
||||||
<text class="label">祝福语气泡 (上下)</text>
|
<text class="label">祝福语气泡 (上下)</text>
|
||||||
<slider
|
<slider
|
||||||
:value="bubbleOffsetY"
|
:value="bubbleOffsetY"
|
||||||
@@ -327,18 +366,6 @@
|
|||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="form-item">
|
|
||||||
<text class="label">祝福语气泡宽度</text>
|
|
||||||
<slider
|
|
||||||
:value="bubbleMaxWidth"
|
|
||||||
min="200"
|
|
||||||
max="460"
|
|
||||||
show-value
|
|
||||||
@change="(e) => (bubbleMaxWidth = e.detail.value)"
|
|
||||||
activeColor="#ff3b30"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<text class="label">个人信息 (上下)</text>
|
<text class="label">个人信息 (上下)</text>
|
||||||
<slider
|
<slider
|
||||||
@@ -361,26 +388,10 @@
|
|||||||
@change="(e) => (userOffsetX = e.detail.value)"
|
@change="(e) => (userOffsetX = e.detail.value)"
|
||||||
activeColor="#ff3b30"
|
activeColor="#ff3b30"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<view class="form-item">
|
|
||||||
<text class="label">署名颜色</text>
|
|
||||||
<view class="color-list">
|
|
||||||
<view
|
|
||||||
v-for="(color, index) in textColors"
|
|
||||||
:key="index"
|
|
||||||
class="color-item"
|
|
||||||
:style="{ background: color }"
|
|
||||||
@tap="signatureColor = color"
|
|
||||||
>
|
|
||||||
<view v-if="signatureColor === color" class="color-check"
|
|
||||||
>✔</view
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<canvas
|
<canvas
|
||||||
@@ -395,7 +406,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from "vue";
|
import { ref, computed, watch } from "vue";
|
||||||
import { getBavBarHeight, getDeviceInfo } from "@/utils/system";
|
import { getBavBarHeight, getDeviceInfo } from "@/utils/system";
|
||||||
import { generateObjectId, getShareToken } from "@/utils/common";
|
import { generateObjectId, getShareToken } from "@/utils/common";
|
||||||
|
|
||||||
@@ -406,17 +417,13 @@ import {
|
|||||||
getCardTemplateContentList,
|
getCardTemplateContentList,
|
||||||
getCardTemplateTitleList,
|
getCardTemplateTitleList,
|
||||||
} from "@/api/make";
|
} from "@/api/make";
|
||||||
import {
|
import { abilityCheck, getShareReward, msgCheckApi } from "@/api/system";
|
||||||
createShareToken,
|
|
||||||
abilityCheck,
|
|
||||||
getShareReward,
|
|
||||||
msgCheckApi,
|
|
||||||
} from "@/api/system";
|
|
||||||
import {
|
import {
|
||||||
onShareAppMessage,
|
onShareAppMessage,
|
||||||
onLoad,
|
onLoad,
|
||||||
onReachBottom,
|
onReachBottom,
|
||||||
onShow,
|
onShow,
|
||||||
|
onPullDownRefresh,
|
||||||
} from "@dcloudio/uni-app";
|
} from "@dcloudio/uni-app";
|
||||||
import { useUserStore } from "@/stores/user";
|
import { useUserStore } from "@/stores/user";
|
||||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||||
@@ -426,6 +433,9 @@ const userStore = useUserStore();
|
|||||||
const loginPopupRef = ref(null);
|
const loginPopupRef = ref(null);
|
||||||
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
const isLoggedIn = computed(() => !!userStore.userInfo.nickName);
|
||||||
|
|
||||||
|
const DEFAULT_AVATAR =
|
||||||
|
"https://file.lihailezzc.com/resource/96023631c6ab9c3496b7620097af3d6f.png";
|
||||||
|
|
||||||
const templatePage = ref(1);
|
const templatePage = ref(1);
|
||||||
const loadingTemplates = ref(false);
|
const loadingTemplates = ref(false);
|
||||||
const hasMoreTemplates = ref(true);
|
const hasMoreTemplates = ref(true);
|
||||||
@@ -512,6 +522,31 @@ const handleUserTouchMove = (e) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 祝福语触摸交互相关
|
||||||
|
let startBubbleTouches = [];
|
||||||
|
let initialBubbleOffsetY = 0;
|
||||||
|
|
||||||
|
const handleBubbleTouchStart = (e) => {
|
||||||
|
startBubbleTouches = e.touches;
|
||||||
|
initialBubbleOffsetY = bubbleOffsetY.value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleBubbleTouchEnd = () => {
|
||||||
|
startBubbleTouches = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleBubbleTouchMove = (e) => {
|
||||||
|
if (!startBubbleTouches.length) return;
|
||||||
|
|
||||||
|
if (e.touches.length === 1 && startBubbleTouches.length === 1) {
|
||||||
|
// 单指拖拽 (仅上下)
|
||||||
|
const moveY = e.touches[0].clientY - startBubbleTouches[0].clientY;
|
||||||
|
let newY = initialBubbleOffsetY + moveY * pxToRpx;
|
||||||
|
// 合理范围限制,参考 slider 的 min/max
|
||||||
|
bubbleOffsetY.value = Math.min(Math.max(newY, -200), 400);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleTitleTouchMove = (e) => {
|
const handleTitleTouchMove = (e) => {
|
||||||
if (!currentTitle.value || !startTouches.length) return;
|
if (!currentTitle.value || !startTouches.length) return;
|
||||||
|
|
||||||
@@ -584,10 +619,7 @@ const handleSignatureBlur = async () => {
|
|||||||
oldSignatureName.value = signatureName.value;
|
oldSignatureName.value = signatureName.value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const userAvatar = ref(
|
const userAvatar = ref(userStore?.userInfo?.avatarUrl || DEFAULT_AVATAR);
|
||||||
userStore?.userInfo?.avatarUrl ||
|
|
||||||
"https://file.lihailezzc.com/resource/96023631c6ab9c3496b7620097af3d6f.png",
|
|
||||||
);
|
|
||||||
|
|
||||||
const blessingText = ref({});
|
const blessingText = ref({});
|
||||||
const fontSize = ref(32);
|
const fontSize = ref(32);
|
||||||
@@ -664,7 +696,9 @@ const changeFont = (font) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const greetingLib = ref([]);
|
const greetingLib = ref([]);
|
||||||
const greetingIndex = ref(0);
|
const blessingPage = ref(1);
|
||||||
|
const loadingBlessings = ref(false);
|
||||||
|
const hasMoreBlessings = ref(true);
|
||||||
|
|
||||||
const bubbleOffsetY = ref(0);
|
const bubbleOffsetY = ref(0);
|
||||||
const bubbleMaxWidth = ref(400); // 默认宽度
|
const bubbleMaxWidth = ref(400); // 默认宽度
|
||||||
@@ -677,7 +711,30 @@ onLoad((options) => {
|
|||||||
getTemplateTitleList();
|
getTemplateTitleList();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const syncUserInfo = () => {
|
||||||
|
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) {
|
||||||
|
userAvatar.value = userStore.userInfo.avatarUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => userStore.userInfo,
|
||||||
|
(newVal) => {
|
||||||
|
if (newVal?.nickName) {
|
||||||
|
syncUserInfo();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true },
|
||||||
|
);
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
|
syncUserInfo();
|
||||||
const recommendData = uni.getStorageSync("RECOMMEND_CARD_DATA");
|
const recommendData = uni.getStorageSync("RECOMMEND_CARD_DATA");
|
||||||
if (recommendData) {
|
if (recommendData) {
|
||||||
uni.removeStorageSync("RECOMMEND_CARD_DATA");
|
uni.removeStorageSync("RECOMMEND_CARD_DATA");
|
||||||
@@ -713,10 +770,31 @@ onReachBottom(() => {
|
|||||||
loadMoreTemplates();
|
loadMoreTemplates();
|
||||||
} else if (activeTool.value === "title") {
|
} else if (activeTool.value === "title") {
|
||||||
loadMoreTitles();
|
loadMoreTitles();
|
||||||
|
} else if (activeTool.value === "text") {
|
||||||
|
loadMoreBlessings();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleLogind = async () => {};
|
onPullDownRefresh(async () => {
|
||||||
|
templatePage.value = 1;
|
||||||
|
hasMoreTemplates.value = true;
|
||||||
|
titlePage.value = 1;
|
||||||
|
hasMoreTitles.value = true;
|
||||||
|
blessingPage.value = 1;
|
||||||
|
hasMoreBlessings.value = true;
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
getTemplateList(),
|
||||||
|
getTemplateTitleList(),
|
||||||
|
getTemplateContentList(),
|
||||||
|
]);
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
uni.showToast({ title: "已为你更新内容", icon: "success" });
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleLogind = async () => {
|
||||||
|
syncUserInfo();
|
||||||
|
};
|
||||||
|
|
||||||
const createCard = () => {
|
const createCard = () => {
|
||||||
const id = generateObjectId();
|
const id = generateObjectId();
|
||||||
@@ -765,6 +843,9 @@ const getTemplateList = async (isLoadMore = false) => {
|
|||||||
console.error("加载模板失败:", error);
|
console.error("加载模板失败:", error);
|
||||||
} finally {
|
} finally {
|
||||||
loadingTemplates.value = false;
|
loadingTemplates.value = false;
|
||||||
|
if (!isLoadMore && hasMoreTemplates.value) {
|
||||||
|
getTemplateList(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -803,6 +884,9 @@ const getTemplateTitleList = async (isLoadMore = false) => {
|
|||||||
console.error("加载标题失败:", error);
|
console.error("加载标题失败:", error);
|
||||||
} finally {
|
} finally {
|
||||||
loadingTitles.value = false;
|
loadingTitles.value = false;
|
||||||
|
if (!isLoadMore && hasMoreTitles.value) {
|
||||||
|
getTemplateTitleList(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -810,21 +894,65 @@ const loadMoreTitles = () => {
|
|||||||
getTemplateTitleList(true);
|
getTemplateTitleList(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTemplateContentList = async () => {
|
const getTemplateContentList = async (isLoadMore = false) => {
|
||||||
const res = await getCardTemplateContentList();
|
if (loadingBlessings.value || (!hasMoreBlessings.value && isLoadMore)) return;
|
||||||
if (res.length) {
|
|
||||||
greetingLib.value = res;
|
loadingBlessings.value = true;
|
||||||
displayedGreetings.value = greetingLib.value.slice(0, 2);
|
try {
|
||||||
if (!blessingText.value.content) {
|
const res = await getCardTemplateContentList(blessingPage.value);
|
||||||
blessingText.value = greetingLib.value[0] || {};
|
const list = Array.isArray(res) ? res : res.list || [];
|
||||||
|
|
||||||
|
if (list.length > 0) {
|
||||||
|
if (isLoadMore) {
|
||||||
|
greetingLib.value = [...greetingLib.value, ...list];
|
||||||
|
} else {
|
||||||
|
greetingLib.value = list;
|
||||||
|
if (list.length > 0 && !blessingText.value.content) {
|
||||||
|
blessingText.value = list[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof res.hasNext !== "undefined") {
|
||||||
|
hasMoreBlessings.value = res.hasNext;
|
||||||
|
} else {
|
||||||
|
hasMoreBlessings.value = list.length >= 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasMoreBlessings.value) {
|
||||||
|
blessingPage.value++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!isLoadMore) greetingLib.value = [];
|
||||||
|
hasMoreBlessings.value = false;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("加载祝福语失败:", error);
|
||||||
|
} finally {
|
||||||
|
loadingBlessings.value = false;
|
||||||
|
if (!isLoadMore && hasMoreBlessings.value) {
|
||||||
|
getTemplateContentList(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const loadMoreBlessings = () => {
|
||||||
|
getTemplateContentList(true);
|
||||||
|
};
|
||||||
|
|
||||||
const loadMoreTemplates = () => {
|
const loadMoreTemplates = () => {
|
||||||
getTemplateList(true);
|
getTemplateList(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onPanelScrollToLower = () => {
|
||||||
|
if (activeTool.value === "template") {
|
||||||
|
loadMoreTemplates();
|
||||||
|
} else if (activeTool.value === "title") {
|
||||||
|
loadMoreTitles();
|
||||||
|
} else if (activeTool.value === "text") {
|
||||||
|
loadMoreBlessings();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onShareAppMessage(async (options) => {
|
onShareAppMessage(async (options) => {
|
||||||
getShareReward({ scene: "card_generate" });
|
getShareReward({ scene: "card_generate" });
|
||||||
if (options.from === "button") {
|
if (options.from === "button") {
|
||||||
@@ -843,45 +971,25 @@ onShareAppMessage(async (options) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const deviceInfo = getDeviceInfo();
|
const shareToken = await getShareToken("card_generate", id);
|
||||||
const shareTokenRes = await createShareToken({
|
|
||||||
scene: "card_generate",
|
|
||||||
targetId: id,
|
|
||||||
...deviceInfo,
|
|
||||||
});
|
|
||||||
shareOrSave(id);
|
shareOrSave(id);
|
||||||
return {
|
return {
|
||||||
title: "我刚做了一张祝福卡片,送给你",
|
title: "我刚做了一张祝福卡片,送给你",
|
||||||
path: "/pages/detail/index?shareToken=" + shareTokenRes.shareToken,
|
path: "/pages/detail/index?shareToken=" + shareToken,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/13ec1134e6614feadeeaaa9ef21ea96e.png",
|
"https://file.lihailezzc.com/resource/13ec1134e6614feadeeaaa9ef21ea96e.png",
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const shareTokenRes = await getShareToken("card_generate_index", "");
|
const shareToken = await getShareToken("card_generate_index", "");
|
||||||
return {
|
return {
|
||||||
title: "新春祝福",
|
title: "新春祝福",
|
||||||
path: `/pages/index/index?shareToken=${shareTokenRes.shareToken}`,
|
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const displayedGreetings = ref([]);
|
|
||||||
|
|
||||||
const refreshGreetings = () => {
|
|
||||||
if (!greetingLib.value.length) return;
|
|
||||||
|
|
||||||
const nextIndex = (greetingIndex.value + 2) % greetingLib.value.length;
|
|
||||||
greetingIndex.value = nextIndex;
|
|
||||||
|
|
||||||
let next = greetingLib.value.slice(nextIndex, nextIndex + 2);
|
|
||||||
if (next.length < 2) {
|
|
||||||
next = [...next, ...greetingLib.value.slice(0, 2 - next.length)];
|
|
||||||
}
|
|
||||||
displayedGreetings.value = next;
|
|
||||||
};
|
|
||||||
|
|
||||||
const selectGreeting = (text) => {
|
const selectGreeting = (text) => {
|
||||||
blessingText.value = text;
|
blessingText.value = text;
|
||||||
};
|
};
|
||||||
@@ -889,8 +997,8 @@ const selectGreeting = (text) => {
|
|||||||
const tools = [
|
const tools = [
|
||||||
{ type: "template", text: "1. 选模板", icon: "🎨", step: 1 },
|
{ type: "template", text: "1. 选模板", icon: "🎨", step: 1 },
|
||||||
{ type: "title", text: "2. 选标题", icon: "🧧", step: 2 },
|
{ type: "title", text: "2. 选标题", icon: "🧧", step: 2 },
|
||||||
{ type: "text", text: "3. 改文字", icon: "✍️", step: 3 },
|
{ type: "text", text: "3. 写祝福", icon: "✍️", step: 3 },
|
||||||
{ type: "position", text: "4. 调位置", icon: "🎯", step: 4 },
|
{ type: "position", text: "4. 设样式", icon: "✨", step: 4 },
|
||||||
];
|
];
|
||||||
const activeTool = ref("template");
|
const activeTool = ref("template");
|
||||||
const showPanel = ref(false);
|
const showPanel = ref(false);
|
||||||
@@ -1521,11 +1629,12 @@ function drawRoundRect(ctx, x, y, w, h, r, color) {
|
|||||||
right: 0;
|
right: 0;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 40rpx 40rpx 0 0;
|
border-radius: 40rpx 40rpx 0 0;
|
||||||
padding: 30rpx 40rpx calc(40rpx + env(safe-area-inset-bottom));
|
|
||||||
transform: translateY(100%);
|
transform: translateY(100%);
|
||||||
transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
|
transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
|
||||||
max-height: 80vh;
|
height: 80vh;
|
||||||
overflow-y: auto;
|
}
|
||||||
|
.panel-inner {
|
||||||
|
padding: 30rpx 40rpx calc(40rpx + env(safe-area-inset-bottom));
|
||||||
}
|
}
|
||||||
.panel-container.show .panel-content {
|
.panel-container.show .panel-content {
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
@@ -1721,22 +1830,19 @@ function drawRoundRect(ctx, x, y, w, h, r, color) {
|
|||||||
margin-right: 6rpx;
|
margin-right: 6rpx;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
}
|
}
|
||||||
.greeting-scroll {
|
.greeting-grid {
|
||||||
width: 100%;
|
display: grid;
|
||||||
}
|
grid-template-columns: repeat(2, 1fr);
|
||||||
.greeting-list {
|
gap: 16rpx;
|
||||||
display: flex;
|
padding-bottom: 20rpx;
|
||||||
padding-bottom: 10rpx;
|
|
||||||
}
|
}
|
||||||
.greeting-card {
|
.greeting-card {
|
||||||
flex-shrink: 0;
|
width: 100%;
|
||||||
width: 320rpx;
|
|
||||||
height: 160rpx;
|
height: 160rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: 2rpx solid #eee;
|
border: 2rpx solid #eee;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
margin-right: 20rpx;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,21 +126,21 @@ onReachBottom(() => {
|
|||||||
|
|
||||||
onShareAppMessage(async (options) => {
|
onShareAppMessage(async (options) => {
|
||||||
if (options.from === "button") {
|
if (options.from === "button") {
|
||||||
const shareTokenRes = await getShareToken(
|
const shareToken = await getShareToken(
|
||||||
"card_generate",
|
"card_generate",
|
||||||
options?.target?.dataset?.item?.id,
|
options?.target?.dataset?.item?.id,
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
title: "我刚做了一张祝福卡片,送给你",
|
title: "我刚做了一张祝福卡片,送给你",
|
||||||
path: "/pages/detail/index?shareToken=" + shareTokenRes.shareToken,
|
path: "/pages/detail/index?shareToken=" + shareToken,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/13ec1134e6614feadeeaaa9ef21ea96e.png",
|
"https://file.lihailezzc.com/resource/13ec1134e6614feadeeaaa9ef21ea96e.png",
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const shareTokenRes = await getShareToken("greeting_page", "");
|
const shareToken = await getShareToken("greeting_page", "");
|
||||||
return {
|
return {
|
||||||
title: "新春祝福",
|
title: "新春祝福",
|
||||||
path: `/pages/index/index?shareToken=${shareTokenRes.shareToken}`,
|
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -106,19 +106,19 @@ const isRefreshing = ref(false);
|
|||||||
onShareAppMessage(async (options) => {
|
onShareAppMessage(async (options) => {
|
||||||
getShareReward({ scene: "wallpaper_download" });
|
getShareReward({ scene: "wallpaper_download" });
|
||||||
if (options.from === "button") {
|
if (options.from === "button") {
|
||||||
const shareTokenRes = await getShareToken(
|
const shareToken = await getShareToken(
|
||||||
"wallpaper_download",
|
"wallpaper_download",
|
||||||
options?.target?.dataset?.item?.id,
|
options?.target?.dataset?.item?.id,
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
title: "快来挑选喜欢的新春壁纸吧",
|
title: "快来挑选喜欢的新春壁纸吧",
|
||||||
path: `/pages/wallpaper/detail?shareToken=${shareTokenRes.shareToken}`,
|
path: `/pages/wallpaper/detail?shareToken=${shareToken}`,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const shareTokenRes = await getShareToken("wallpaper_download", "");
|
const shareToken = await getShareToken("wallpaper_download", "");
|
||||||
return {
|
return {
|
||||||
title: "新春祝福",
|
title: "新春祝福",
|
||||||
path: `/pages/index/index?shareToken=${shareTokenRes.shareToken}`,
|
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export const saveRecordRequest = async (path, targetId, scene, imageUrl) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const saveViewRequest = async (shareToken, scene, targetId) => {
|
export const saveViewRequest = async (shareToken, scene, targetId = "") => {
|
||||||
const deviceInfo = getDeviceInfo();
|
const deviceInfo = getDeviceInfo();
|
||||||
viewRecord({
|
viewRecord({
|
||||||
shareToken,
|
shareToken,
|
||||||
@@ -92,7 +92,12 @@ export const saveRemoteImageToLocal = (imageUrl) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getShareToken = async (scene, targetId) => {
|
export const getShareToken = async (scene, targetId = "") => {
|
||||||
const deviceInfo = getDeviceInfo();
|
const deviceInfo = getDeviceInfo();
|
||||||
return await createShareToken({ scene, targetId, ...deviceInfo });
|
const shareTokenRes = await createShareToken({
|
||||||
|
scene,
|
||||||
|
targetId,
|
||||||
|
...deviceInfo,
|
||||||
|
});
|
||||||
|
return shareTokenRes?.shareToken || "";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const BASE_URL = "https://api.ai-meng.com";
|
// const BASE_URL = "https://api.ai-meng.com";
|
||||||
// const BASE_URL = 'http://127.0.0.1:3999'
|
// 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.3:3999";
|
||||||
// const BASE_URL = "http://192.168.31.253:3999";
|
// const BASE_URL = "http://192.168.31.253:3999";
|
||||||
import { useUserStore } from "@/stores/user";
|
import { useUserStore } from "@/stores/user";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user