optimize: make page
This commit is contained in:
@@ -29,3 +29,19 @@ export const getShareReward = async (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,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -193,7 +193,7 @@ onMounted(() => {
|
||||
const features = ref([
|
||||
{
|
||||
title: "新春祝福卡片",
|
||||
subtitle: "定制专属贺卡",
|
||||
subtitle: "定制专属贺卡吧",
|
||||
icon: "/static/icon/celebrate.png",
|
||||
type: "card",
|
||||
},
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user