optimize: make page

This commit is contained in:
zzc
2026-01-27 16:46:39 +08:00
parent ee4f1b85c9
commit ce3a53067b
3 changed files with 38 additions and 4 deletions

View File

@@ -29,3 +29,19 @@ export const getShareReward = async (data) => {
data, data,
}); });
}; };
export const saveRecord = async (data) => {
return request({
url: "/api/blessing/save/record",
method: "POST",
data,
});
};
export const viewRecord = async (data) => {
return request({
url: "/api/blessing/view/record",
method: "POST",
data,
});
};

View File

@@ -193,7 +193,7 @@ onMounted(() => {
const features = ref([ const features = ref([
{ {
title: "新春祝福卡片", title: "新春祝福卡片",
subtitle: "定制专属贺卡", subtitle: "定制专属贺卡",
icon: "/static/icon/celebrate.png", icon: "/static/icon/celebrate.png",
type: "card", type: "card",
}, },

View File

@@ -290,7 +290,7 @@ import {
getCardTemplateList, getCardTemplateList,
getCardTemplateContentList, getCardTemplateContentList,
} from "@/api/make"; } from "@/api/make";
import { createShareToken } from "@/api/system"; import { createShareToken, saveRecord } from "@/api/system";
import { import {
onShareAppMessage, onShareAppMessage,
onLoad, onLoad,
@@ -299,6 +299,7 @@ import {
} 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";
import { uploadImage } from "@/utils/common.js";
const userStore = useUserStore(); const userStore = useUserStore();
const loginPopupRef = ref(null); const loginPopupRef = ref(null);
@@ -563,11 +564,28 @@ const toggleAvatarDecor = () => {
uni.showToast({ title: "挂饰功能即将上线~", icon: "none" }); uni.showToast({ title: "挂饰功能即将上线~", icon: "none" });
}; };
const preview = () => { const preview = async () => {
saveByCanvas(); if (!isLoggedIn.value) {
loginPopupRef.value.open();
return;
}
const tempPath = await saveByCanvas(true);
createSaveRecord(tempPath);
// uni.showToast({ title: '已保存到相册', icon: 'checkmarkempty' }) // uni.showToast({ title: '已保存到相册', icon: 'checkmarkempty' })
}; };
const createSaveRecord = async (path) => {
const imageUrl = await uploadImage(path);
const deviceInfo = getDeviceInfo();
saveRecord({
scene: "card_generate",
targetId: cardId.value || "",
imageUrl,
deviceInfo,
});
};
const shareOrSave = async () => { const shareOrSave = async () => {
if (!isLoggedIn.value) { if (!isLoggedIn.value) {
loginPopupRef.value.open(); loginPopupRef.value.open();