细节完善
This commit is contained in:
@@ -37,6 +37,7 @@ const data = ref({
|
||||
|
||||
const list = ref([]);
|
||||
const bowTargetSrc = ref("");
|
||||
const heatMapImageSrc = ref(""); // 存储热力图图片地址
|
||||
|
||||
const toListPage = () => {
|
||||
uni.navigateTo({
|
||||
@@ -71,8 +72,18 @@ const loadData = async () => {
|
||||
uni.$emit("update-hot", hot);
|
||||
const rect = await getElementRect(".heat-map");
|
||||
// 延迟绘制热力图确保Canvas准备就绪
|
||||
setTimeout(() => {
|
||||
drawHeatMap(rect.width, rect.height, result2.weekArrows);
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
const imagePath = await drawHeatMap(
|
||||
rect.width,
|
||||
rect.height,
|
||||
result2.weekArrows
|
||||
);
|
||||
heatMapImageSrc.value = imagePath; // 存储生成的图片地址
|
||||
console.log("热力图图片地址:", imagePath);
|
||||
} catch (error) {
|
||||
console.error("生成热力图图片失败:", error);
|
||||
}
|
||||
}, 500);
|
||||
};
|
||||
|
||||
@@ -235,6 +246,7 @@ onShareTimeline(() => {
|
||||
:src="bowTargetSrc || '../static/bow-target.png'"
|
||||
mode="widthFix"
|
||||
/>
|
||||
<image v-if="heatMapImageSrc" :src="heatMapImageSrc" mode="widthFix" />
|
||||
<canvas canvas-id="heatMapCanvas" style="width: 100%; height: 100%" />
|
||||
</view>
|
||||
<view class="reward" v-if="data.totalArrow">
|
||||
@@ -373,12 +385,15 @@ onShareTimeline(() => {
|
||||
|
||||
.heat-map > image {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.heat-map > canvas {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
left: -1000px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2;
|
||||
|
||||
Reference in New Issue
Block a user