From f7f62cebb596eace23e955a0a71ef6a8375a4394 Mon Sep 17 00:00:00 2001 From: zzc <1761997216@qq.com> Date: Thu, 22 Jan 2026 08:40:37 +0800 Subject: [PATCH] feat: make gpage tpl --- pages/make/index.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pages/make/index.vue b/pages/make/index.vue index 9813736..47b0d6c 100644 --- a/pages/make/index.vue +++ b/pages/make/index.vue @@ -214,12 +214,13 @@ const userAvatar = ref( "https://file.lihailezzc.com/resource/b48c41054c2633c478463ac1b1f1ca23.png", ); -const blessingText = ref(); +const blessingText = ref(""); const textColors = ["#ffffff", "#ff3b30", "#F5A623", "#8B572A", "#000000"]; const selectedColor = ref("#ffffff"); -const greetingLib = []; +const greetingLib = ref([]); +const greetingIndex = ref(0); onLoad((options) => { cardId.value = "69674f307307beac4519025f"; @@ -317,11 +318,14 @@ onShareAppMessage(async () => { const displayedGreetings = ref([]); const refreshGreetings = () => { - const start = Math.floor(Math.random() * (greetingLib.length - 1)); - // 简单随机逻辑,实际可优化 - let next = greetingLib.slice(start, start + 2); + 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.slice(0, 2 - next.length)]; + next = [...next, ...greetingLib.value.slice(0, 2 - next.length)]; } displayedGreetings.value = next; };