feat: make gpage tpl
This commit is contained in:
@@ -214,12 +214,13 @@ const userAvatar = ref(
|
|||||||
"https://file.lihailezzc.com/resource/b48c41054c2633c478463ac1b1f1ca23.png",
|
"https://file.lihailezzc.com/resource/b48c41054c2633c478463ac1b1f1ca23.png",
|
||||||
);
|
);
|
||||||
|
|
||||||
const blessingText = ref();
|
const blessingText = ref("");
|
||||||
|
|
||||||
const textColors = ["#ffffff", "#ff3b30", "#F5A623", "#8B572A", "#000000"];
|
const textColors = ["#ffffff", "#ff3b30", "#F5A623", "#8B572A", "#000000"];
|
||||||
const selectedColor = ref("#ffffff");
|
const selectedColor = ref("#ffffff");
|
||||||
|
|
||||||
const greetingLib = [];
|
const greetingLib = ref([]);
|
||||||
|
const greetingIndex = ref(0);
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
cardId.value = "69674f307307beac4519025f";
|
cardId.value = "69674f307307beac4519025f";
|
||||||
@@ -317,11 +318,14 @@ onShareAppMessage(async () => {
|
|||||||
const displayedGreetings = ref([]);
|
const displayedGreetings = ref([]);
|
||||||
|
|
||||||
const refreshGreetings = () => {
|
const refreshGreetings = () => {
|
||||||
const start = Math.floor(Math.random() * (greetingLib.length - 1));
|
if (!greetingLib.value.length) return;
|
||||||
// 简单随机逻辑,实际可优化
|
|
||||||
let next = greetingLib.slice(start, start + 2);
|
const nextIndex = (greetingIndex.value + 2) % greetingLib.value.length;
|
||||||
|
greetingIndex.value = nextIndex;
|
||||||
|
|
||||||
|
let next = greetingLib.value.slice(nextIndex, nextIndex + 2);
|
||||||
if (next.length < 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;
|
displayedGreetings.value = next;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user