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

@@ -290,7 +290,7 @@ import {
getCardTemplateList,
getCardTemplateContentList,
} from "@/api/make";
import { createShareToken } from "@/api/system";
import { createShareToken, saveRecord } from "@/api/system";
import {
onShareAppMessage,
onLoad,
@@ -299,6 +299,7 @@ import {
} from "@dcloudio/uni-app";
import { useUserStore } from "@/stores/user";
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
import { uploadImage } from "@/utils/common.js";
const userStore = useUserStore();
const loginPopupRef = ref(null);
@@ -563,11 +564,28 @@ const toggleAvatarDecor = () => {
uni.showToast({ title: "挂饰功能即将上线~", icon: "none" });
};
const preview = () => {
saveByCanvas();
const preview = async () => {
if (!isLoggedIn.value) {
loginPopupRef.value.open();
return;
}
const tempPath = await saveByCanvas(true);
createSaveRecord(tempPath);
// 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 () => {
if (!isLoggedIn.value) {
loginPopupRef.value.open();