feat: make gpage tpl

This commit is contained in:
zzc
2026-01-22 08:28:34 +08:00
parent 083d52a5d7
commit da194c920c
2 changed files with 25 additions and 13 deletions

View File

@@ -22,3 +22,10 @@ export const getCardTemplateList = async (page = 1) => {
method: "GET",
});
};
export const getCardTemplateContentList = async () => {
return request({
url: "/api/blessing/card/template-content/list",
method: "GET",
});
};

View File

@@ -192,7 +192,11 @@
<script setup>
import { ref, onMounted } from "vue";
import { getBavBarHeight, getDeviceInfo } from "@/utils/system";
import { createCardTmp, getCardTemplateList } from "@/api/make";
import {
createCardTmp,
getCardTemplateList,
getCardTemplateContentList,
} from "@/api/make";
import { createCardShareToken } from "@/api/card";
import { onShareAppMessage, onLoad, onReachBottom } from "@dcloudio/uni-app";
import { useUserStore } from "@/stores/user";
@@ -210,26 +214,18 @@ const userAvatar = ref(
"https://file.lihailezzc.com/resource/b48c41054c2633c478463ac1b1f1ca23.png",
);
const blessingText = ref(
"岁末将至敬颂冬绥。平安喜乐万事胜意。祝您2026年大吉大利一马当先前程似锦龙马精神阖家安康",
);
const blessingText = ref();
const textColors = ["#ffffff", "#ff3b30", "#F5A623", "#8B572A", "#000000"];
const selectedColor = ref("#ffffff");
const greetingLib = [
"在新的一年里身体健康,万事如意!马到成功,财源广进!",
"岁末将至敬颂冬绥。平安喜乐万事胜意。祝您2026年大吉大利一马当先前程似锦龙马精神阖家安康",
"一马当先,前程似锦!龙马精神,阖家安康!",
"骏马奔腾,福运常在!策马扬鞭,步步高升!",
"新春快乐,阖家幸福!愿您在新的一年里,所有的希望都能如愿,所有的梦想都能实现。",
"马年大吉!愿您事业如骏马奔腾,生活如春风得意!",
];
const greetingLib = [];
onLoad((options) => {
cardId.value = "69674f307307beac4519025f";
// createCard();
getTemplateList();
getTemplateContentList();
});
onReachBottom(() => {
@@ -292,6 +288,15 @@ const getTemplateList = async (isLoadMore = false) => {
}
};
const getTemplateContentList = async () => {
const res = await getCardTemplateContentList();
if (res.length) {
greetingLib.value = res.map((item) => item.content);
displayedGreetings.value = greetingLib.value.slice(0, 2);
blessingText.value = greetingLib.value[0] || "";
}
};
const loadMoreTemplates = () => {
getTemplateList(true);
};
@@ -309,7 +314,7 @@ onShareAppMessage(async () => {
};
});
const displayedGreetings = ref(greetingLib.slice(0, 2));
const displayedGreetings = ref([]);
const refreshGreetings = () => {
const start = Math.floor(Math.random() * (greetingLib.length - 1));