diff --git a/src/components/Avatar.vue b/src/components/Avatar.vue index 0978caf..c69f52d 100644 --- a/src/components/Avatar.vue +++ b/src/components/Avatar.vue @@ -29,6 +29,7 @@ defineProps({ v-if="frame" src="../static/avatar-frame.png" mode="widthFix" + :style="{ width: Number(size) + 10 + 'px', height: Number(size) + 10 + 'px' }" class="avatar-frame" /> +import useStore from "@/store"; +import Avatar from "@/components/Avatar.vue"; + +import { storeToRefs } from "pinia"; +const store = useStore(); +const { user } = storeToRefs(store); + +const props = defineProps({ + show: { + type: Boolean, + default: false, + }, + type: { + type: String, + default: "", + }, + onClose: { + type: Function, + default: () => {}, + }, +}); + +const saveImage = () => { + // 获取当前页面的节点 + const query = uni.createSelectorQuery(); + query + .select(".content") + .fields({ node: true, size: true }) + .exec((res) => { + // 创建canvas上下文 + const canvas = uni.createCanvasContext("shareCanvas"); + + // 将页面内容绘制到canvas上 + // 这里需要根据实际内容进行绘制 + canvas.draw(false, () => { + // 将画布内容保存为图片 + uni.canvasToTempFilePath({ + canvasId: "shareCanvas", + success: (res) => { + const tempFilePath = res.tempFilePath; + + // 保存图片到相册 + uni.saveImageToPhotosAlbum({ + filePath: tempFilePath, + success: () => { + uni.showToast({ title: "保存成功" }); + }, + fail: () => { + uni.showToast({ title: "保存失败", icon: "error" }); + }, + }); + }, + }); + }); + }); +}; + + + + + diff --git a/src/components/ScoreResult.vue b/src/components/ScoreResult.vue index 4f36de3..f3ea82c 100644 --- a/src/components/ScoreResult.vue +++ b/src/components/ScoreResult.vue @@ -2,6 +2,7 @@ import { ref } from "vue"; import IconButton from "@/components/IconButton.vue"; import SButton from "@/components/SButton.vue"; +import ImageShare from "@/components/ImageShare.vue"; import CoachComment from "@/components/CoachComment.vue"; const props = defineProps({ show: { @@ -27,6 +28,7 @@ const props = defineProps({ }); const showPanel = ref(true); const showComment = ref(false); +const showShare = ref(false); const closePanel = () => { showPanel.value = false; setTimeout(() => { @@ -84,7 +86,11 @@ setTimeout(() => { - + { > + {{ result.adjustmentHint }} diff --git a/src/static/close-white.png b/src/static/close-white.png new file mode 100644 index 0000000..8c963ed Binary files /dev/null and b/src/static/close-white.png differ diff --git a/src/static/download.png b/src/static/download.png new file mode 100644 index 0000000..6f0e3e7 Binary files /dev/null and b/src/static/download.png differ diff --git a/src/static/share-bg.png b/src/static/share-bg.png new file mode 100644 index 0000000..77887b0 Binary files /dev/null and b/src/static/share-bg.png differ diff --git a/src/static/wechat-moment.png b/src/static/wechat-moment.png new file mode 100644 index 0000000..4afbd0b Binary files /dev/null and b/src/static/wechat-moment.png differ diff --git a/src/static/wechat-outline.png b/src/static/wechat-outline.png new file mode 100644 index 0000000..4aeda17 Binary files /dev/null and b/src/static/wechat-outline.png differ