diff --git a/src/apis.js b/src/apis.js
index d257042..edf3cf0 100644
--- a/src/apis.js
+++ b/src/apis.js
@@ -78,8 +78,11 @@ export const createPractiseAPI = (arrows) => {
});
};
-export const getPractiseAPI = (id) => {
- return request("GET", `/user/practice/get?id=${id}`);
+export const getPractiseAPI = async (id) => {
+ const result = await request("GET", `/user/practice/get?id=${id}`);
+ const data = { ...(result.UserPracticeRound || {}) };
+ if (data.arrows) data.arrows = JSON.parse(data.arrows);
+ return data;
};
export const createRoomAPI = (gameType, teamSize) => {
diff --git a/src/components/Container.vue b/src/components/Container.vue
index 52cc24a..30c7327 100644
--- a/src/components/Container.vue
+++ b/src/components/Container.vue
@@ -48,5 +48,6 @@ onMounted(() => {
flex-direction: column;
align-items: center;
justify-content: space-between;
+ overflow-x: hidden;
}
diff --git a/src/components/ScorePanel2.vue b/src/components/ScorePanel2.vue
index 28ac59a..df3596a 100644
--- a/src/components/ScorePanel2.vue
+++ b/src/components/ScorePanel2.vue
@@ -20,7 +20,6 @@ const roundsName = ["第一轮", "第二轮", "第三轮", "第四轮"];
{{ roundsName[index] }}
{{
@@ -47,8 +46,8 @@ const roundsName = ["第一轮", "第二轮", "第三轮", "第四轮"];
.container {
width: 100vw;
display: flex;
- flex-wrap: wrap;
- justify-content: flex-start;
+ flex-direction: column;
+ overflow-x: hidden;
}
.container > view {
width: calc(100% - 30px);
diff --git a/src/components/ScoreResult.vue b/src/components/ScoreResult.vue
index cd75482..78b0555 100644
--- a/src/components/ScoreResult.vue
+++ b/src/components/ScoreResult.vue
@@ -2,7 +2,6 @@
import { ref } from "vue";
import IconButton from "@/components/IconButton.vue";
import SButton from "@/components/SButton.vue";
-import ImageShare from "@/components/ImageShare.vue";
import ScreenHint from "@/components/ScreenHint.vue";
import BowData from "@/components/BowData.vue";
const props = defineProps({
@@ -26,10 +25,13 @@ const props = defineProps({
type: Object,
default: () => ({}),
},
+ dataType: {
+ type: Number,
+ default: 0,
+ },
});
const showPanel = ref(true);
const showComment = ref(false);
-const showShare = ref(false);
const showBowData = ref(false);
const closePanel = () => {
showPanel.value = false;
@@ -40,6 +42,11 @@ const closePanel = () => {
setTimeout(() => {
showPanel.value = true;
}, 300);
+const toSharePage = () => {
+ uni.navigateTo({
+ url: `image-share?id=${props.result.id}&type=${props.dataType}`,
+ });
+};
@@ -89,7 +96,7 @@ setTimeout(() => {
{
完成
-
{{ result.adjustmentHint }}
diff --git a/src/pages/first-try.vue b/src/pages/first-try.vue
index a575400..5c0cf91 100644
--- a/src/pages/first-try.vue
+++ b/src/pages/first-try.vue
@@ -220,6 +220,7 @@ const onClose = () => {
v-if="step === 4"
:onClose="onClose"
:result="practiseResult"
+ :dataType="1"
/>
diff --git a/src/pages/image-share.vue b/src/pages/image-share.vue
index f91d280..21aa371 100644
--- a/src/pages/image-share.vue
+++ b/src/pages/image-share.vue
@@ -1,58 +1,55 @@
-
+
+
+
diff --git a/src/static/practise-one-title.png b/src/static/practise-one-title.png
new file mode 100644
index 0000000..43ea0ae
Binary files /dev/null and b/src/static/practise-one-title.png differ
diff --git a/src/static/practise-two-title.png b/src/static/practise-two-title.png
new file mode 100644
index 0000000..5c935d2
Binary files /dev/null and b/src/static/practise-two-title.png differ
diff --git a/src/store.js b/src/store.js
index 0f40a5f..612fc74 100644
--- a/src/store.js
+++ b/src/store.js
@@ -5,6 +5,7 @@ const defaultUser = {
nickName: "游客",
avatar: "../static/avatar.png",
trio: 0, // 大于1表示完成了新手引导
+ lvlName: "砖石1级",
};
// 定义游戏相关的 store
diff --git a/src/util.js b/src/util.js
index ad227cf..95cab41 100644
--- a/src/util.js
+++ b/src/util.js
@@ -1,3 +1,48 @@
+export function renderScores(ctx, arrows = []) {
+ let rowIndex = 0;
+ arrows.forEach((item, i) => {
+ rowIndex = i;
+ if (arrows.length === 12) {
+ if (i > 5) rowIndex = i - 6;
+ ctx.drawImage(
+ "../static/score-bg.png",
+ 16 + rowIndex * 46,
+ i > 5 ? 366 : 320,
+ 40,
+ 40
+ );
+ renderText(
+ ctx,
+ item.ring,
+ 25,
+ "#fed847",
+ 36 + rowIndex * 46,
+ i > 5 ? 395 : 349,
+ "center"
+ );
+ }
+ if (arrows.length === 36) {
+ ctx.drawImage(
+ "../static/score-bg.png",
+ 18 + (i % 9) * 30,
+ 290 + Math.ceil((i + 1) / 9) * 30,
+ 27,
+ 27,
+ "center"
+ );
+ renderText(
+ ctx,
+ item.ring,
+ 18,
+ "#fed847",
+ 31 + (i % 9) * 30,
+ 310 + Math.ceil((i + 1) / 9) * 30,
+ "center"
+ );
+ }
+ });
+}
+
export function renderLine(ctx, from) {
ctx.beginPath();
ctx.lineWidth = 1;
@@ -8,9 +53,10 @@ export function renderLine(ctx, from) {
ctx.stroke();
}
-export function renderText(ctx, text, size, color, x, y) {
+export function renderText(ctx, text, size, color, x, y, textAlign = "left") {
ctx.setFontSize(size);
ctx.setFillStyle(color);
+ ctx.setTextAlign(textAlign);
ctx.fillText(text, x, y);
}
@@ -19,11 +65,11 @@ export function renderRankTitle(ctx, text) {
const textWidth = ctx.measureText(text).width;
const padding = 8; // 文字与背景边缘的间距
const radius = 10; // 圆角半径
- const textX = 75;
+ const textX = 85;
const textY = 55;
- const x = textX - padding; // 文字 x 坐标减去内边距
+ const x = textX - padding - 15; // 文字 x 坐标减去内边距
const y = textY - fontSize - padding / 2 + 1; // 文字 y 坐标减去字体大小和内边距
- const width = textWidth + padding * 2 - 15; // 背景宽度
+ const width = textWidth + padding * 2 - 19; // 背景宽度
const height = fontSize + padding + 1; // 背景高度
// 开始绘制圆角矩形
@@ -49,3 +95,39 @@ export function renderRankTitle(ctx, text) {
ctx.setFillStyle("rgba(255, 255, 255, 0.9)");
ctx.fillText(text, textX, textY); // 绘制文字
}
+
+export const drawRoundImage = async (
+ ctx,
+ imgPath,
+ x,
+ y,
+ width,
+ height,
+ radius
+) => {
+ ctx.save();
+ // 创建圆角路径
+ ctx.beginPath();
+ ctx.moveTo(x + radius, y);
+
+ // 右上角
+ ctx.lineTo(x + width - radius, y);
+ ctx.arcTo(x + width, y, x + width, y + radius, radius);
+
+ // 右下角
+ ctx.lineTo(x + width, y + height - radius);
+ ctx.arcTo(x + width, y + height, x + width - radius, y + height, radius);
+
+ // 左下角
+ ctx.lineTo(x + radius, y + height);
+ ctx.arcTo(x, y + height, x, y + height - radius, radius);
+
+ // 左上角
+ ctx.lineTo(x, y + radius);
+ ctx.arcTo(x, y, x + radius, y, radius);
+
+ ctx.clip();
+ // 绘制图片
+ ctx.drawImage(imgPath, x, y, width, height);
+ ctx.restore();
+};