Compare commits
11 Commits
02c3fe1b12
...
30d7a74fb5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30d7a74fb5 | ||
|
|
7e0ba078b0 | ||
|
|
1476ceed51 | ||
|
|
2437ed9d2f | ||
|
|
8fd18b6d8b | ||
|
|
0f5bfebcd1 | ||
|
|
c0aa29f2c6 | ||
|
|
5d209f8d06 | ||
|
|
920816152b | ||
|
|
f4d6a5fcf3 | ||
|
|
ade79f62f9 |
@@ -66,3 +66,10 @@ export const getRandomGreeting = async () => {
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
export const getTipsList = async () => {
|
||||
return request({
|
||||
url: `/api/blessing/tips/list`,
|
||||
method: "get",
|
||||
});
|
||||
};
|
||||
|
||||
@@ -97,6 +97,13 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/webview/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "加载中...",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/fortune/index",
|
||||
"style": {
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import { getPageDetail } from "@/api/system.js";
|
||||
import { getAvatarRecommendList } from "@/api/avatar.js";
|
||||
import { saveViewRequest } from "@/utils/common.js";
|
||||
@@ -145,6 +145,26 @@ onLoad((options) => {
|
||||
fetchFrames();
|
||||
});
|
||||
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: "快来看看我刚领到的新年专属头像 🎊",
|
||||
path: `/pages/avatar/detail?shareToken=${shareToken.value}`,
|
||||
imageUrl:
|
||||
detailData.value?.imageUrl ||
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: "快来看看我刚领到的新年专属头像 🎊",
|
||||
query: `shareToken=${shareToken.value}`,
|
||||
imageUrl:
|
||||
detailData.value?.imageUrl ||
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
const fetchDetail = async () => {
|
||||
try {
|
||||
// uni.showLoading({ title: "加载中..." });
|
||||
|
||||
@@ -180,7 +180,12 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from "vue";
|
||||
import { onShareAppMessage, onLoad, onReachBottom } from "@dcloudio/uni-app";
|
||||
import {
|
||||
onShareAppMessage,
|
||||
onShareTimeline,
|
||||
onLoad,
|
||||
onReachBottom,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { getShareReward, abilityCheck } from "@/api/system.js";
|
||||
import {
|
||||
@@ -676,7 +681,7 @@ onShareAppMessage(async () => {
|
||||
title: "新春祝福",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
}
|
||||
uni.showLoading({ title: "分享中...", mask: true });
|
||||
@@ -693,13 +698,13 @@ onShareAppMessage(async () => {
|
||||
};
|
||||
});
|
||||
|
||||
// onShareTimeline(() => {
|
||||
// return {
|
||||
// title: "制作我的新春头像",
|
||||
// imageUrl:
|
||||
// "https://file.lihailezzc.com/resource/b48c41054c2633c478463ac1b1f1ca23.png",
|
||||
// };
|
||||
// });
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: "快来定制你的新年专属头像 🎊",
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import { getPageDetail } from "@/api/system.js";
|
||||
import { saveViewRequest } from "@/utils/common.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
@@ -132,6 +132,26 @@ onLoad(async (options) => {
|
||||
}
|
||||
});
|
||||
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: "送你一张精美的新春祝福卡片 🎊",
|
||||
path: `/pages/detail/index?shareToken=${cardDetail.value?.shareToken || ""}`,
|
||||
imageUrl:
|
||||
cardDetail.value?.imageUrl ||
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: "送你一张精美的新春祝福卡片 🎊",
|
||||
query: `shareToken=${cardDetail.value?.shareToken || ""}`,
|
||||
imageUrl:
|
||||
cardDetail.value?.imageUrl ||
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
const makeGreeting = () => {
|
||||
uni.switchTab({ url: "/pages/make/index" });
|
||||
};
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
<NavBar title="意见反馈" />
|
||||
|
||||
<view class="content-wrap">
|
||||
<!-- Top Tip -->
|
||||
<view class="top-notice">
|
||||
<text class="notice-text">此投诉为本小程序自有投诉渠道,非微信官方投诉渠道</text>
|
||||
</view>
|
||||
|
||||
<!-- Type Selector -->
|
||||
<view class="form-item">
|
||||
<view class="label">反馈类型</view>
|
||||
@@ -203,6 +208,29 @@ const submitFeedback = async () => {
|
||||
padding: 32rpx;
|
||||
}
|
||||
|
||||
.top-notice {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
padding: 20rpx 24rpx;
|
||||
background-color: #fff7e6;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 40rpx;
|
||||
border: 1rpx solid #ffe7ba;
|
||||
}
|
||||
|
||||
.notice-icon {
|
||||
font-size: 28rpx;
|
||||
margin-right: 12rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.notice-text {
|
||||
font-size: 24rpx;
|
||||
color: #fa8c16;
|
||||
line-height: 1.4;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 48rpx;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,12 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onUnmounted, computed } from "vue";
|
||||
import { onLoad, onShow, onShareAppMessage } from "@dcloudio/uni-app";
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onShareAppMessage,
|
||||
onShareTimeline,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { abilityCheck } from "@/api/system.js";
|
||||
import { drawFortune } from "@/api/fortune.js";
|
||||
import { getShareReward } from "@/api/system.js";
|
||||
@@ -167,7 +172,15 @@ onShareAppMessage(async () => {
|
||||
title: "马年运势我已经抽过了,你的会是什么?",
|
||||
path: `${cardId.value ? `/pages/fortune/detail?shareToken=${shareToken}` : `/pages/fortune/index?shareToken=${shareToken}`}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: "新春到,抽灵签!快来测测你的新年运势 🏮",
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -14,6 +14,31 @@
|
||||
<!-- <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
|
||||
@@ -104,12 +129,13 @@ import { ref } from "vue";
|
||||
import {
|
||||
onPullDownRefresh,
|
||||
onShareAppMessage,
|
||||
onShareTimeline,
|
||||
onReachBottom,
|
||||
onLoad,
|
||||
onShow,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { getBavBarHeight } from "@/utils/system";
|
||||
import { getRecommendList, getRandomGreeting } from "@/api/system";
|
||||
import { getRecommendList, getRandomGreeting, getTipsList } from "@/api/system";
|
||||
import { getShareToken, saveViewRequest } from "@/utils/common.js";
|
||||
|
||||
const countdownText = ref("");
|
||||
@@ -151,6 +177,7 @@ const dailyGreeting = ref("");
|
||||
|
||||
onShow(() => {
|
||||
updateCountdown();
|
||||
getIndexTips();
|
||||
const date = new Date();
|
||||
todayDate.value = `${date.getMonth() + 1}月${date.getDate()}日`;
|
||||
});
|
||||
@@ -178,10 +205,24 @@ onShareAppMessage(async () => {
|
||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
||||
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 =
|
||||
@@ -195,6 +236,23 @@ const useGreeting = () => {
|
||||
});
|
||||
};
|
||||
|
||||
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: "新春祝福卡片",
|
||||
@@ -265,7 +323,7 @@ const fetchRecommendList = async (isRefresh = false) => {
|
||||
const getTagText = (tag) => {
|
||||
const map = {
|
||||
hot: "热门",
|
||||
new: "新款",
|
||||
new: "新品",
|
||||
featured: "精选",
|
||||
hot2: "爆款",
|
||||
};
|
||||
@@ -409,6 +467,62 @@ onPullDownRefresh(async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 新春提示栏 */
|
||||
.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;
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
fontFamily: selectedFont.family,
|
||||
fontSize: fontSize + 'rpx',
|
||||
lineHeight: fontSize * 1.5 + 'rpx',
|
||||
fontWeight: fontWeight,
|
||||
}"
|
||||
>{{
|
||||
(targetName || "") + "\n " + (blessingText.content || "")
|
||||
@@ -84,10 +85,14 @@
|
||||
>
|
||||
<image class="avatar" :src="userAvatar" mode="aspectFill" />
|
||||
<view class="user-info">
|
||||
<text class="user-name" :style="{ color: signatureColor }">{{
|
||||
signatureName
|
||||
}}</text>
|
||||
<text class="user-desc" :style="{ color: signatureColor }"
|
||||
<text
|
||||
class="user-name"
|
||||
:style="{ color: signatureColor, fontWeight: fontWeight }"
|
||||
>{{ signatureName }}</text
|
||||
>
|
||||
<text
|
||||
class="user-desc"
|
||||
:style="{ color: signatureColor, fontWeight: fontWeight }"
|
||||
>送上祝福</text
|
||||
>
|
||||
</view>
|
||||
@@ -182,7 +187,7 @@
|
||||
@tap="applyTemplate(tpl)"
|
||||
>
|
||||
<image
|
||||
:src="tpl.imageUrl"
|
||||
:src="getThumbUrl(tpl.imageUrl)"
|
||||
class="tpl-cover"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
@@ -287,6 +292,27 @@
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 字体粗细 -->
|
||||
<view class="form-item">
|
||||
<text class="label">字体粗细</text>
|
||||
<view class="weight-options">
|
||||
<view
|
||||
class="weight-btn"
|
||||
:class="{ active: fontWeight === 'normal' }"
|
||||
@tap="fontWeight = 'normal'"
|
||||
>
|
||||
<text>常规</text>
|
||||
</view>
|
||||
<view
|
||||
class="weight-btn"
|
||||
:class="{ active: fontWeight === 'bold' }"
|
||||
@tap="fontWeight = 'bold'"
|
||||
>
|
||||
<text style="font-weight: bold">加粗</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="label">祝福语宽窄</text>
|
||||
<slider
|
||||
@@ -420,6 +446,7 @@ import {
|
||||
import { abilityCheck, getShareReward, msgCheckApi } from "@/api/system";
|
||||
import {
|
||||
onShareAppMessage,
|
||||
onShareTimeline,
|
||||
onLoad,
|
||||
onReachBottom,
|
||||
onShow,
|
||||
@@ -622,9 +649,12 @@ const handleSignatureBlur = async () => {
|
||||
const userAvatar = ref(userStore?.userInfo?.avatarUrl || DEFAULT_AVATAR);
|
||||
|
||||
const blessingText = ref({});
|
||||
const fontSize = ref(32);
|
||||
const fontSize = ref(38);
|
||||
const fontWeight = ref("normal"); // 默认加粗
|
||||
|
||||
const textColors = [
|
||||
'#F8DA84',
|
||||
'#B4802C',
|
||||
"#000000",
|
||||
"#ffffff",
|
||||
"#ff3b30",
|
||||
@@ -843,9 +873,6 @@ const getTemplateList = async (isLoadMore = false) => {
|
||||
console.error("加载模板失败:", error);
|
||||
} finally {
|
||||
loadingTemplates.value = false;
|
||||
if (!isLoadMore && hasMoreTemplates.value) {
|
||||
getTemplateList(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -894,6 +921,10 @@ const loadMoreTitles = () => {
|
||||
getTemplateTitleList(true);
|
||||
};
|
||||
|
||||
const getThumbUrl = (url) => {
|
||||
return `${url}?imageView2/1/w/340/h/600/q/80`;
|
||||
};
|
||||
|
||||
const getTemplateContentList = async (isLoadMore = false) => {
|
||||
if (loadingBlessings.value || (!hasMoreBlessings.value && isLoadMore)) return;
|
||||
|
||||
@@ -929,9 +960,6 @@ const getTemplateContentList = async (isLoadMore = false) => {
|
||||
console.error("加载祝福语失败:", error);
|
||||
} finally {
|
||||
loadingBlessings.value = false;
|
||||
if (!isLoadMore && hasMoreBlessings.value) {
|
||||
getTemplateContentList(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -962,7 +990,7 @@ onShareAppMessage(async (options) => {
|
||||
title: "新春祝福",
|
||||
path: "/pages/index/index?shareToken=" + shareToken,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
}
|
||||
// 1. 确保有 cardId (如果内容有变动,最好是新建)
|
||||
@@ -974,7 +1002,7 @@ onShareAppMessage(async (options) => {
|
||||
title: "我刚做了一张祝福卡片,送给你",
|
||||
path: "/pages/detail/index?shareToken=" + shareToken,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/13ec1134e6614feadeeaaa9ef21ea96e.png",
|
||||
"https://file.lihailezzc.com/resource/bf9faeddb7ff55a5cd3d435779d56556.png",
|
||||
};
|
||||
} else {
|
||||
const shareToken = await getShareToken("card_generate_index", "");
|
||||
@@ -982,11 +1010,19 @@ onShareAppMessage(async (options) => {
|
||||
title: "新春祝福",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: "送你一张精美的新春祝福卡片 🎊",
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
const selectGreeting = (text) => {
|
||||
blessingText.value = text;
|
||||
};
|
||||
@@ -1122,17 +1158,19 @@ const saveByCanvas = async (save = true) => {
|
||||
const ctx = canvas.getContext("2d");
|
||||
|
||||
// 初始化画布尺寸
|
||||
const dpr = uni.getSystemInfoSync().pixelRatio;
|
||||
// 保持 540x960 的逻辑尺寸,为了清晰度可以考虑 * dpr,
|
||||
// 但为了保持和原来一致的输出尺寸,这里先固定物理尺寸
|
||||
// 如果要高清,可以 set width = 540 * dpr,然后 scale(dpr, dpr)
|
||||
// 这里为了简单兼容原逻辑,我们让物理尺寸等于逻辑尺寸
|
||||
canvas.width = 540;
|
||||
canvas.height = 960;
|
||||
const dpr = uni.getSystemInfoSync().pixelRatio || 2;
|
||||
// 为了高清画质,将物理像素设置为逻辑像素的 dpr 倍
|
||||
const baseW = 540;
|
||||
const baseH = 960;
|
||||
canvas.width = baseW * dpr;
|
||||
canvas.height = baseH * dpr;
|
||||
|
||||
// 画布尺寸(rpx 转 px)
|
||||
const W = 540;
|
||||
const H = 960;
|
||||
// 缩放上下文,使得后续绘制指令依然可以使用逻辑坐标 (baseW, baseH)
|
||||
ctx.scale(dpr, dpr);
|
||||
|
||||
// 画布尺寸(逻辑像素)
|
||||
const W = baseW;
|
||||
const H = baseH;
|
||||
|
||||
// 辅助函数:加载图片为 Image 对象
|
||||
const loadCanvasImage = (url) => {
|
||||
@@ -1145,7 +1183,7 @@ const saveByCanvas = async (save = true) => {
|
||||
};
|
||||
|
||||
// 辅助函数:rpx 转 px (基于预览容器宽度 506rpx 对应 Canvas 540px)
|
||||
const r2p = (rpx) => (rpx * 540) / 506;
|
||||
const r2p = (rpx) => (rpx * baseW) / 506;
|
||||
|
||||
try {
|
||||
// 1️⃣ 画背景
|
||||
@@ -1187,6 +1225,7 @@ const saveByCanvas = async (save = true) => {
|
||||
maxWidth: r2p(bubbleMaxWidth.value), // 预览中 bubble-text 的宽度
|
||||
canvasWidth: W,
|
||||
fontSize: r2p(fontSize.value),
|
||||
fontWeight: fontWeight.value,
|
||||
lineHeight: r2p(fontSize.value * 1.6), // 预览中是 1.6
|
||||
padding: r2p(40 + 30), // 内部 padding 40 + 容器 padding 30
|
||||
backgroundColor: "transparent",
|
||||
@@ -1204,6 +1243,7 @@ const saveByCanvas = async (save = true) => {
|
||||
username: signatureName.value,
|
||||
desc: "送上祝福",
|
||||
textColor: signatureColor.value,
|
||||
fontWeight: fontWeight.value,
|
||||
avatarSize: r2p(64),
|
||||
padding: r2p(15),
|
||||
fontSizeName: r2p(24),
|
||||
@@ -1213,10 +1253,12 @@ const saveByCanvas = async (save = true) => {
|
||||
// 6️⃣ 输出
|
||||
uni.canvasToTempFilePath({
|
||||
canvas: canvas, // Canvas 2D 必须传 canvas 实例
|
||||
width: W,
|
||||
height: H,
|
||||
destWidth: W,
|
||||
destHeight: H,
|
||||
width: canvas.width,
|
||||
height: canvas.height,
|
||||
destWidth: canvas.width,
|
||||
destHeight: canvas.height,
|
||||
fileType: "jpg", // 使用 PNG 避免 JPG 压缩损耗
|
||||
quality: 0.85, // 最高质量
|
||||
success: (res) => {
|
||||
if (save) saveImage(res.tempFilePath);
|
||||
resolve(res.tempFilePath);
|
||||
@@ -1273,13 +1315,14 @@ function drawBubbleText(ctx, options) {
|
||||
backgroundColor = "rgba(255,255,255,0.9)",
|
||||
textColor = "#fff",
|
||||
fontSize = 32,
|
||||
fontWeight = "normal",
|
||||
fontFamily = "PingFang SC",
|
||||
canvasWidth, // 新增:画布宽度,用于居中计算
|
||||
} = options;
|
||||
if (!text) return;
|
||||
|
||||
ctx.fillStyle = textColor;
|
||||
ctx.font = `${fontSize}px '${fontFamily}'`;
|
||||
ctx.font = `${fontWeight === "bold" ? "bold " : ""}${fontSize}px '${fontFamily}'`;
|
||||
ctx.textAlign = "left";
|
||||
ctx.textBaseline = "top";
|
||||
|
||||
@@ -1341,15 +1384,16 @@ function drawUserBubble(ctx, options) {
|
||||
fontSizeDesc = 20,
|
||||
bubbleColor = "rgba(255,255,255,0.18)",
|
||||
textColor = "#000000",
|
||||
fontWeight = "normal",
|
||||
} = options;
|
||||
|
||||
// 设置字体
|
||||
ctx.textBaseline = "top";
|
||||
ctx.font = `${fontSizeName}px 'PingFang SC'`;
|
||||
ctx.font = `${fontWeight === "bold" ? "bold " : ""}${fontSizeName}px 'PingFang SC'`;
|
||||
|
||||
// 测量文字宽度
|
||||
const nameWidth = ctx.measureText(username).width;
|
||||
ctx.font = `${fontSizeDesc}px 'PingFang SC'`;
|
||||
ctx.font = `${fontWeight === "bold" ? "bold " : ""}${fontSizeDesc}px 'PingFang SC'`;
|
||||
const descWidth = ctx.measureText(desc).width;
|
||||
|
||||
// 计算气泡宽度和高度
|
||||
@@ -1400,11 +1444,11 @@ function drawUserBubble(ctx, options) {
|
||||
const textStartY = drawY + (bubbleHeight - totalTextHeight) / 2;
|
||||
|
||||
ctx.fillStyle = textColor;
|
||||
ctx.font = `${fontSizeName}px 'PingFang SC'`;
|
||||
ctx.font = `${fontWeight === "bold" ? "bold " : ""}${fontSizeName}px 'PingFang SC'`;
|
||||
ctx.fillText(username, textX, textStartY);
|
||||
|
||||
ctx.font = `${fontSizeDesc}px 'PingFang SC'`;
|
||||
ctx.globalAlpha = 0.6;
|
||||
ctx.font = `${fontWeight === "bold" ? "bold " : ""}${fontSizeDesc}px 'PingFang SC'`;
|
||||
ctx.globalAlpha = 0.8;
|
||||
ctx.fillText(desc, textX, textStartY + fontSizeName + 4);
|
||||
ctx.globalAlpha = 1;
|
||||
}
|
||||
@@ -1935,6 +1979,30 @@ function drawRoundRect(ctx, x, y, w, h, r, color) {
|
||||
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.weight-options {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
flex: 1;
|
||||
}
|
||||
.weight-btn {
|
||||
flex: 1;
|
||||
height: 70rpx;
|
||||
background: #f5f5f5;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
border: 2rpx solid transparent;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.weight-btn.active {
|
||||
background: #fff5f5;
|
||||
color: #ff3b30;
|
||||
border-color: #ff3b30;
|
||||
}
|
||||
|
||||
/* 按钮区 */
|
||||
.main-actions {
|
||||
display: flex;
|
||||
|
||||
@@ -232,7 +232,7 @@ const getDefaultName = (item) => {
|
||||
}
|
||||
|
||||
.current-card {
|
||||
margin: 60px 20px 20px;
|
||||
margin: 12rpx 20px 20px;
|
||||
background: #fff;
|
||||
border-radius: 24px;
|
||||
padding: 24px;
|
||||
|
||||
@@ -99,6 +99,7 @@ import {
|
||||
onPullDownRefresh,
|
||||
onReachBottom,
|
||||
onShareAppMessage,
|
||||
onShareTimeline,
|
||||
} from "@dcloudio/uni-app";
|
||||
import { getMyCard } from "@/api/mine.js";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
@@ -134,7 +135,7 @@ onShareAppMessage(async (options) => {
|
||||
title: "我刚做了一张祝福卡片,送给你",
|
||||
path: "/pages/detail/index?shareToken=" + shareToken,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/13ec1134e6614feadeeaaa9ef21ea96e.png",
|
||||
"https://file.lihailezzc.com/resource/bf9faeddb7ff55a5cd3d435779d56556.png",
|
||||
};
|
||||
} else {
|
||||
const shareToken = await getShareToken("greeting_page", "");
|
||||
@@ -142,11 +143,19 @@ onShareAppMessage(async (options) => {
|
||||
title: "新春祝福",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: "送你一张精美的新春祝福卡片 🎊",
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
const fetchList = async (reset = false) => {
|
||||
if (loading.value) return;
|
||||
if (reset) {
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from "vue";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { onShareAppMessage } from "@dcloudio/uni-app";
|
||||
import { onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
|
||||
|
||||
const userStore = useUserStore();
|
||||
@@ -172,7 +172,15 @@ onShareAppMessage(() => {
|
||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
||||
path: "/pages/index/index",
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: "新年好运已送达 🎊|祝福卡·头像·壁纸",
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ const onPreview = (item) => {
|
||||
.header-stats {
|
||||
padding: 20px;
|
||||
background: #f9f9f9;
|
||||
margin-top: 44px; // Initial offset for fixed nav
|
||||
margin-top: 0; // Initial offset for fixed nav
|
||||
|
||||
.stats-card {
|
||||
background: #fff;
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { onPullDownRefresh } from '@dcloudio/uni-app'
|
||||
import { onPullDownRefresh, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
|
||||
import { getBavBarHeight } from '@/utils/system'
|
||||
|
||||
const features = ref([
|
||||
@@ -171,6 +171,23 @@ const share = () => {
|
||||
uni.showShareMenu && uni.showShareMenu()
|
||||
}
|
||||
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: "2026 丙午马年,送你一份新春祝福 🎊",
|
||||
path: "/pages/spring/index",
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: "2026 丙午马年,送你一份新春祝福 🎊",
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
const createGreeting = () => {
|
||||
uni.showToast({ title: '去发布祝福~', icon: 'none' })
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import { getBavBarHeight } from "@/utils/system";
|
||||
import { getPageDetail } from "@/api/system";
|
||||
import { getWallpaperRecommendList } from "@/api/wallpaper";
|
||||
@@ -148,6 +148,26 @@ onLoad(async (options) => {
|
||||
fetchRecommend();
|
||||
});
|
||||
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: "快来看看我刚领到的新年精美壁纸 🖼",
|
||||
path: `/pages/wallpaper/detail?shareToken=${shareToken.value}`,
|
||||
imageUrl:
|
||||
detailData.value?.imageUrl ||
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: "快来看看我刚领到的新年精美壁纸 🖼",
|
||||
query: `shareToken=${shareToken.value}`,
|
||||
imageUrl:
|
||||
detailData.value?.imageUrl ||
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
const fetchDetail = async () => {
|
||||
try {
|
||||
const res = await getPageDetail(shareToken.value);
|
||||
|
||||
@@ -86,7 +86,7 @@ import {
|
||||
saveRecordRequest,
|
||||
getShareToken,
|
||||
} from "@/utils/common.js";
|
||||
import { onShareAppMessage } from "@dcloudio/uni-app";
|
||||
import { onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import { getShareReward, abilityCheck } from "@/api/system.js";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
@@ -104,6 +104,15 @@ const hasMore = ref(true);
|
||||
const isRefreshing = ref(false);
|
||||
|
||||
onShareAppMessage(async (options) => {
|
||||
if(!isLoggedIn.value) {
|
||||
const shareToken = await getShareToken("wallpaper_download_index", "");
|
||||
return {
|
||||
title: "新春祝福",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
}
|
||||
getShareReward({ scene: "wallpaper_download" });
|
||||
if (options.from === "button") {
|
||||
const shareToken = await getShareToken(
|
||||
@@ -120,11 +129,19 @@ onShareAppMessage(async (options) => {
|
||||
title: "新春祝福",
|
||||
path: `/pages/index/index?shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/cfed2edbfa19250b836a87a4bbf0d5ad.png",
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: "精选新年壁纸,让手机也过年 🖼",
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchCategories();
|
||||
});
|
||||
|
||||
21
pages/webview/index.vue
Normal file
21
pages/webview/index.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<view>
|
||||
<web-view :src="url"></web-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
|
||||
const url = ref("");
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.url) {
|
||||
url.value = decodeURIComponent(options.url);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
Reference in New Issue
Block a user