分享图兼容性修复

This commit is contained in:
kron
2025-11-17 12:02:07 +08:00
parent 046d1a7c9e
commit d9563a25c6
4 changed files with 544 additions and 410 deletions

View File

@@ -7,7 +7,8 @@ import ScreenHint2 from "@/components/ScreenHint2.vue";
import RingBarChart from "@/components/RingBarChart.vue";
import { getPointBookDetailAPI, addNoteAPI } from "@/apis";
import { wxShare, generateShareCard, generateShareImage } from "@/util";
import { wxShare, generateShareCard } from "@/util";
import { generateShareImage } from "@/canvas";
import useStore from "@/store";
import { storeToRefs } from "pinia";
@@ -23,6 +24,7 @@ const targetId = ref(0);
const targetSrc = ref("");
const arrows = ref([]);
const notes = ref("");
const hasPoint = ref(false);
const record = ref({
groups: [],
user: {},
@@ -94,6 +96,11 @@ onLoad(async (options) => {
if (options.id) {
const result = await getPointBookDetailAPI(options.id || 243);
record.value = result;
const arrowData =
record.value.groups && record.value.groups[0]
? record.value.groups[0]
: {};
hasPoint.value = (arrowData.list || []).some((arrow) => arrow.x && arrow.y);
notes.value = result.remark || "";
const config = uni.getStorageSync("point-book-config");
config.targetOption.some((item) => {
@@ -170,8 +177,9 @@ onShareTimeline(async () => {
></canvas>
<canvas
class="share-canvas"
canvas-id="shareImageCanvas"
style="width: 375px; height: 860px"
id="shareImageCanvas"
type="2d"
:style="`width: 375px; height: ${hasPoint ? 800 : 440}px`"
></canvas>
<view class="detail-data">
<view>
@@ -216,7 +224,7 @@ onShareTimeline(async () => {
<text>{{ notes ? "我的备注" : "添加备注" }}</text>
</button>
</view>
<view class="title-bar">
<view class="title-bar" v-if="hasPoint">
<view />
<text>落点分布</text>
<!-- <button hover-class="none" @click="() => openTip(2)">
@@ -227,7 +235,10 @@ onShareTimeline(async () => {
/>
</button> -->
</view>
<view :style="{ transform: 'translateY(-64rpx) scale(0.9)' }">
<view
:style="{ transform: 'translateY(-64rpx) scale(0.9)' }"
v-if="hasPoint"
>
<BowTargetEdit
:id="targetId"
:src="targetSrc"
@@ -235,7 +246,7 @@ onShareTimeline(async () => {
:scroll="false"
/>
</view>
<view :style="{ transform: 'translateY(-100rpx)' }">
<view :style="{ transform: hasPoint ? 'translateY(-100rpx)' : 'none' }">
<!-- <view class="title-bar">
<view />
<text>环值分布</text>