Merge branch 'feature-points-book' into development
This commit is contained in:
@@ -5,11 +5,15 @@ const props = defineProps({
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
bgColor: {
|
||||
type: String,
|
||||
default: "#050b19",
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="background">
|
||||
<view class="background" :style="{ backgroundColor: bgColor }">
|
||||
<image
|
||||
class="bg-image"
|
||||
v-if="type === 0"
|
||||
@@ -22,6 +26,12 @@ const props = defineProps({
|
||||
src="../static/app-bg2.png"
|
||||
mode="widthFix"
|
||||
/>
|
||||
<image
|
||||
class="bg-image"
|
||||
v-if="type === 2"
|
||||
src="../static/app-bg3.png"
|
||||
mode="widthFix"
|
||||
/>
|
||||
<view class="bg-overlay" v-if="type === 0"></view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -34,7 +44,6 @@ const props = defineProps({
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: -1;
|
||||
background-color: #050b19;
|
||||
}
|
||||
|
||||
.bg-image {
|
||||
|
||||
@@ -13,7 +13,7 @@ const props = defineProps({
|
||||
|
||||
const tabs = [
|
||||
{ image: "../static/tab-vip.png" },
|
||||
{ image: "../static/tab-grow.png" },
|
||||
{ image: "../static/tab-point-book.png" },
|
||||
{ image: "../static/tab-mall.png" },
|
||||
];
|
||||
|
||||
@@ -26,7 +26,7 @@ function handleTabClick(index) {
|
||||
}
|
||||
if (index === 1) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/my-growth",
|
||||
url: "/pages/point-book-create",
|
||||
});
|
||||
}
|
||||
if (index === 2) {
|
||||
@@ -45,14 +45,11 @@ function handleTabClick(index) {
|
||||
:key="index"
|
||||
class="tab-item"
|
||||
@click="handleTabClick(index)"
|
||||
:style="{
|
||||
width: index === 1 ? '32%' : '10%',
|
||||
}"
|
||||
>
|
||||
<image
|
||||
:src="tab.image"
|
||||
:style="{
|
||||
width: index === 1 ? '100px' : '40px',
|
||||
}"
|
||||
mode="widthFix"
|
||||
/>
|
||||
<image :src="tab.image" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -76,10 +73,16 @@ function handleTabClick(index) {
|
||||
.tab-item {
|
||||
z-index: 1;
|
||||
}
|
||||
.tab-item > image {
|
||||
width: 88%;
|
||||
}
|
||||
.tab-item:nth-child(2) {
|
||||
transform: translateY(10px);
|
||||
transform: translateY(20%) translateX(25%);
|
||||
}
|
||||
.tab-item:nth-child(3) {
|
||||
transform: translateY(-10%) translateX(5%);
|
||||
}
|
||||
.tab-item:nth-child(4) {
|
||||
transform: translateY(10px) translateX(-10px);
|
||||
transform: translateY(20%) translateX(-25%);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -249,6 +249,7 @@ const simulShoot2 = async () => {
|
||||
text-align: center;
|
||||
line-height: 10px;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
.hit > text {
|
||||
transform: scaleX(0.7);
|
||||
|
||||
260
src/components/BowTargetEdit.vue
Normal file
260
src/components/BowTargetEdit.vue
Normal file
@@ -0,0 +1,260 @@
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import { getElementRect, calcRing } from "@/util";
|
||||
|
||||
const props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
src: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
arrows: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
onChange: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const rect = ref({});
|
||||
const arrow = ref(null);
|
||||
const isDragging = ref(false);
|
||||
const dragStartPos = ref({ x: 0, y: 0 });
|
||||
|
||||
// 点击靶纸创建新的点
|
||||
const onClick = async (e) => {
|
||||
if (arrow.value !== null || !props.onChange) return;
|
||||
const newArrow = {
|
||||
x: e.detail.x - (rect.value.width * 0.1) / 2,
|
||||
y: e.detail.y - rect.value.top - 10,
|
||||
};
|
||||
newArrow.ring = calcRing(
|
||||
props.id,
|
||||
newArrow.x,
|
||||
newArrow.y,
|
||||
rect.value.width * 0.9,
|
||||
rect.value.height - rect.value.top
|
||||
);
|
||||
arrow.value = newArrow;
|
||||
};
|
||||
|
||||
// 确认添加箭矢
|
||||
const confirmAdd = () => {
|
||||
if (props.onChange)
|
||||
props.onChange({ ...arrow.value, ring: arrow.value.ring || "M" });
|
||||
arrow.value = null;
|
||||
};
|
||||
|
||||
// 删除箭矢
|
||||
const deleteArrow = () => {
|
||||
arrow.value = null;
|
||||
};
|
||||
|
||||
// 开始拖拽 - 同样修复坐标获取
|
||||
const startDrag = async (e, index) => {
|
||||
if (!e.touches[0]) return;
|
||||
isDragging.value = true;
|
||||
dragStartPos.value = {
|
||||
x: e.touches[0].clientX,
|
||||
y: e.touches[0].clientY,
|
||||
};
|
||||
};
|
||||
|
||||
// 拖拽移动 - 同样修复坐标获取
|
||||
const onDrag = async (e) => {
|
||||
if (!isDragging.value || !e.touches[0] || !arrow.value) return;
|
||||
|
||||
let clientX = e.touches[0].clientX;
|
||||
let clientY = e.touches[0].clientY;
|
||||
|
||||
// 计算移动距离
|
||||
const deltaX = clientX - dragStartPos.value.x;
|
||||
const deltaY = clientY - dragStartPos.value.y;
|
||||
|
||||
const width = rect.value.width * 0.9;
|
||||
const height = rect.value.height - rect.value.top;
|
||||
|
||||
// 更新坐标
|
||||
arrow.value.x = Math.max(0, Math.min(width, arrow.value.x + deltaX));
|
||||
arrow.value.y = Math.max(0, Math.min(height, arrow.value.y + deltaY));
|
||||
arrow.value.ring = calcRing(
|
||||
props.id,
|
||||
arrow.value.x,
|
||||
arrow.value.y,
|
||||
width,
|
||||
height
|
||||
);
|
||||
|
||||
// 更新拖拽起始位置
|
||||
dragStartPos.value = { x: clientX, y: clientY };
|
||||
};
|
||||
|
||||
// 结束拖拽
|
||||
const endDrag = () => {
|
||||
isDragging.value = false;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
const result = await getElementRect();
|
||||
rect.value = result;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view
|
||||
class="container"
|
||||
@click="onClick"
|
||||
@touchmove="onDrag"
|
||||
@touchend="endDrag"
|
||||
>
|
||||
<image :src="src" mode="widthFix" />
|
||||
<view
|
||||
v-for="(arrow, index) in arrows"
|
||||
:key="index"
|
||||
class="arrow-point"
|
||||
:style="{
|
||||
left: (arrow.x !== undefined ? arrow.x : 0) + 'px',
|
||||
top: (arrow.y !== undefined ? arrow.y : 0) + 'px',
|
||||
}"
|
||||
>
|
||||
<view v-if="arrow.x !== undefined && arrow.y !== undefined" class="point"
|
||||
><text>{{ index + 1 }}</text></view
|
||||
>
|
||||
</view>
|
||||
<!-- 渲染所有箭矢点 -->
|
||||
<view
|
||||
v-if="arrow"
|
||||
class="arrow-point"
|
||||
:style="{
|
||||
left: arrow.x + 'px',
|
||||
top: arrow.y + 'px',
|
||||
}"
|
||||
>
|
||||
<!-- 箭矢点 -->
|
||||
<view class="point"> </view>
|
||||
<!-- 编辑按钮组(只在编辑状态下显示) -->
|
||||
<view class="edit-buttons" @click.stop>
|
||||
<text
|
||||
>{{ arrow.ring === 0 ? "未上靶" : arrow.ring
|
||||
}}<text
|
||||
:style="{
|
||||
fontSize: '20px',
|
||||
marginLeft: arrow.ring > 0 ? '5px' : 0,
|
||||
}"
|
||||
>{{ arrow.ring > 0 ? "环" : "" }}</text
|
||||
></text
|
||||
>
|
||||
<view class="edit-btn confirm-btn" @click.stop="confirmAdd(index)">
|
||||
<image src="../static/arrow-edit-save.png" mode="widthFix" />
|
||||
</view>
|
||||
<view class="edit-btn delete-btn" @click.stop="deleteArrow(index)">
|
||||
<image src="../static/arrow-edit-delete.png" mode="widthFix" />
|
||||
</view>
|
||||
<view
|
||||
class="edit-btn drag-btn"
|
||||
@touchstart.stop="startDrag($event, index)"
|
||||
>
|
||||
<image src="../static/arrow-edit-move.png" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
width: 90%;
|
||||
margin: 10px auto;
|
||||
position: relative;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.container > image {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.arrow-point {
|
||||
position: absolute;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.point {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid #fff;
|
||||
z-index: 1;
|
||||
color: #fff;
|
||||
font-size: 8px;
|
||||
text-align: center;
|
||||
line-height: 10px;
|
||||
box-sizing: border-box;
|
||||
background-color: #ff4444;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.point > text {
|
||||
transform: scaleX(0.7);
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.edit-buttons {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
background: #18ff6899;
|
||||
width: 88px;
|
||||
height: 88px;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.edit-buttons > text {
|
||||
width: 100%;
|
||||
display: block;
|
||||
line-height: 50px;
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.edit-btn > image {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
left: 50%;
|
||||
bottom: -24px;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
right: -24px;
|
||||
bottom: -24px;
|
||||
}
|
||||
|
||||
.drag-btn {
|
||||
left: 50%;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -32,6 +32,14 @@ defineProps({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
bgColor: {
|
||||
type: String,
|
||||
default: "#050b19",
|
||||
},
|
||||
whiteBackArrow: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
const isIos = ref(true);
|
||||
const showHint = ref(false);
|
||||
@@ -67,8 +75,13 @@ const goBack = () => {
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<AppBackground :type="bgType" />
|
||||
<Header v-if="!isHome" :title="title" :onBack="onBack" />
|
||||
<AppBackground :type="bgType" :bgColor="bgColor" />
|
||||
<Header
|
||||
v-if="!isHome"
|
||||
:title="title"
|
||||
:onBack="onBack"
|
||||
:whiteBackArrow="whiteBackArrow"
|
||||
/>
|
||||
<BackToGame v-if="showBackToGame" />
|
||||
<view
|
||||
class="content"
|
||||
|
||||
325
src/components/EditOption.vue
Normal file
325
src/components/EditOption.vue
Normal file
@@ -0,0 +1,325 @@
|
||||
<script setup>
|
||||
import { ref, watch, onMounted, onUnmounted } from "vue";
|
||||
const props = defineProps({
|
||||
itemIndex: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
expand: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
onExpand: {
|
||||
type: Function,
|
||||
default: () => {},
|
||||
},
|
||||
onSelect: {
|
||||
type: Function,
|
||||
default: () => {},
|
||||
},
|
||||
noArrow: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
const itemTexts = ["选择弓种", "选择练习距离", "选择靶纸", "选择组/箭数"];
|
||||
const distances = [5, 8, 10, 18, 25, 30, 50, 60, 70];
|
||||
const groupArrows = [3, 6, 12, 18];
|
||||
|
||||
const data = ref([]);
|
||||
const selectedIndex = ref(-1);
|
||||
const secondSelectIndex = ref(-1);
|
||||
const onSelectItem = (index) => {
|
||||
selectedIndex.value = index;
|
||||
if (props.itemIndex === 0) {
|
||||
props.onSelect(props.itemIndex, data.value[index]);
|
||||
} else if (props.itemIndex === 1) {
|
||||
props.onSelect(props.itemIndex, distances[index]);
|
||||
} else if (props.itemIndex === 2) {
|
||||
props.onSelect(props.itemIndex, data.value[index]);
|
||||
} else if (props.itemIndex === 3 && secondSelectIndex.value !== -1) {
|
||||
props.onSelect(
|
||||
props.itemIndex,
|
||||
`${selectedIndex.value}/${groupArrows[secondSelectIndex.value]}`
|
||||
);
|
||||
}
|
||||
};
|
||||
const onSelectSecondItem = (index) => {
|
||||
secondSelectIndex.value = index;
|
||||
if (selectedIndex.value !== -1) {
|
||||
props.onSelect(
|
||||
props.itemIndex,
|
||||
`${selectedIndex.value}/${groupArrows[secondSelectIndex.value]}`
|
||||
);
|
||||
}
|
||||
};
|
||||
const meter = ref("");
|
||||
const onMeterChange = (e) => {
|
||||
meter.value = e.detail.value;
|
||||
props.onSelect(props.itemIndex, e.detail.value);
|
||||
};
|
||||
watch(
|
||||
() => props.value,
|
||||
(newValue) => {
|
||||
if (!newValue) {
|
||||
selectedIndex.value = -1;
|
||||
return;
|
||||
}
|
||||
if (props.itemIndex === 0 || props.itemIndex === 2) {
|
||||
data.value.forEach((item, index) => {
|
||||
if (item.name === newValue) {
|
||||
selectedIndex.value = index;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (props.itemIndex === 1) {
|
||||
distances.forEach((item, index) => {
|
||||
if (item == newValue) {
|
||||
selectedIndex.value = index;
|
||||
}
|
||||
if (selectedIndex.value === -1) {
|
||||
meter.value = newValue;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
onMounted(() => {
|
||||
const config = uni.getStorageSync("point-book-config");
|
||||
if (config) {
|
||||
if (props.itemIndex === 0) {
|
||||
data.value = config.bowOption;
|
||||
} else if (props.itemIndex === 2) {
|
||||
data.value = config.targetOption;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view
|
||||
class="container"
|
||||
:style="{
|
||||
maxHeight: expand ? '500px' : '50px',
|
||||
marginTop: noArrow ? '0' : '10px',
|
||||
}"
|
||||
>
|
||||
<view @click="() => onExpand(itemIndex, !expand)">
|
||||
<text :style="{ opacity: expand ? 1 : 0 }">{{
|
||||
itemIndex !== 3 ? itemTexts[itemIndex] : "选择组"
|
||||
}}</text>
|
||||
<block>
|
||||
<text :style="{ opacity: expand ? 0 : 1 }" v-if="itemIndex === 0">{{
|
||||
value || itemTexts[itemIndex]
|
||||
}}</text>
|
||||
<text :style="{ opacity: expand ? 0 : 1 }" v-if="itemIndex === 1">{{
|
||||
value ? value + "米" : itemTexts[itemIndex]
|
||||
}}</text>
|
||||
<text :style="{ opacity: expand ? 0 : 1 }" v-if="itemIndex === 2">{{
|
||||
value || itemTexts[itemIndex]
|
||||
}}</text>
|
||||
<text :style="{ opacity: expand ? 0 : 1 }" v-if="itemIndex === 3">{{
|
||||
selectedIndex !== -1 && secondSelectIndex !== -1
|
||||
? `${selectedIndex + 1}组/${groupArrows[secondSelectIndex]}箭`
|
||||
: itemTexts[itemIndex]
|
||||
}}</text>
|
||||
</block>
|
||||
<button hover-class="none">
|
||||
<image
|
||||
v-if="!noArrow"
|
||||
src="../static/arrow-grey.png"
|
||||
mode="widthFix"
|
||||
:style="{ transform: expand ? 'rotateX(180deg)' : 'rotateX(0deg)' }"
|
||||
/>
|
||||
</button>
|
||||
</view>
|
||||
<view v-if="itemIndex === 0" class="bow-items">
|
||||
<view
|
||||
v-for="(item, index) in data"
|
||||
:key="index"
|
||||
:style="{
|
||||
borderColor: selectedIndex === index ? '#fed847' : '#eeeeee',
|
||||
}"
|
||||
@click="onSelectItem(index)"
|
||||
>
|
||||
<image :src="item.icon" mode="widthFix" />
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="itemIndex === 1" class="distance-items">
|
||||
<view
|
||||
v-for="(item, index) in distances"
|
||||
:key="index"
|
||||
:style="{
|
||||
borderColor: selectedIndex === index ? '#fed847' : '#eeeeee',
|
||||
}"
|
||||
@click="onSelectItem(index)"
|
||||
>
|
||||
<text>{{ item }}</text>
|
||||
<text>米</text>
|
||||
</view>
|
||||
<view
|
||||
:style="{
|
||||
borderColor: selectedIndex === 9 ? '#fed847' : '#eeeeee',
|
||||
}"
|
||||
>
|
||||
<input
|
||||
v-model="meter"
|
||||
placeholder="自定义"
|
||||
placeholder-style="color: #DDDDDD"
|
||||
@focus="() => (selectedIndex = 9)"
|
||||
@change="onMeterChange"
|
||||
/>
|
||||
<text>米</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="itemIndex === 2" class="bowtarget-items">
|
||||
<view
|
||||
v-for="(item, index) in data"
|
||||
:key="index"
|
||||
:style="{
|
||||
borderColor: selectedIndex === index ? '#fed847' : '#eeeeee',
|
||||
}"
|
||||
@click="onSelectItem(index)"
|
||||
>
|
||||
<text>{{ item.name.substring(0, item.name.length - 3) }}</text>
|
||||
<text>{{ item.name.substring(item.name.length - 3) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="itemIndex === 3">
|
||||
<view class="amount-items">
|
||||
<view
|
||||
v-for="i in 12"
|
||||
:key="i"
|
||||
:style="{
|
||||
borderColor: selectedIndex === i ? '#fed847' : '#eeeeee',
|
||||
}"
|
||||
@click="onSelectItem(i)"
|
||||
>
|
||||
<text>{{ i }}</text>
|
||||
<text>组</text>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
:style="{ marginTop: '5px', marginBottom: '10px', color: '#999999' }"
|
||||
>选择每组的箭数</view
|
||||
>
|
||||
<view class="amount-items">
|
||||
<view
|
||||
v-for="(item, index) in groupArrows"
|
||||
:key="index"
|
||||
:style="{
|
||||
borderColor: secondSelectIndex === index ? '#fed847' : '#eeeeee',
|
||||
}"
|
||||
@click="onSelectSecondItem(index)"
|
||||
>
|
||||
<text>{{ item }}</text>
|
||||
<text>箭</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
width: calc(100% - 20px);
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 0 10px;
|
||||
font-size: 14px;
|
||||
overflow: hidden;
|
||||
transition: all 0.3s ease;
|
||||
color: #333;
|
||||
}
|
||||
.container > view:first-child {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 50px;
|
||||
}
|
||||
.container > view:first-child > text:first-child {
|
||||
width: 85px;
|
||||
color: #999999;
|
||||
}
|
||||
.container > view:first-child > button {
|
||||
width: 85px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.container > view:first-child > button > image {
|
||||
transition: all 0.5s ease;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
.bow-items {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
column-gap: 2vw;
|
||||
}
|
||||
.bow-items > view {
|
||||
width: 27vw;
|
||||
height: 27vw;
|
||||
border-radius: 10px;
|
||||
border: 2px solid #eeeeee;
|
||||
margin-bottom: 2vw;
|
||||
}
|
||||
.bow-items > view > image {
|
||||
width: 100%;
|
||||
}
|
||||
.bow-items > view > text {
|
||||
width: 100%;
|
||||
display: block;
|
||||
text-align: center;
|
||||
transform: translateY(-30px);
|
||||
}
|
||||
.distance-items,
|
||||
.bowtarget-items,
|
||||
.amount-items {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
column-gap: 2vw;
|
||||
position: relative;
|
||||
}
|
||||
.distance-items > view,
|
||||
.bowtarget-items > view,
|
||||
.amount-items > view {
|
||||
width: 20vw;
|
||||
height: 14vw;
|
||||
border-radius: 10px;
|
||||
border: 2px solid #eeeeee;
|
||||
margin-bottom: 2vw;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.distance-items > view > text:first-child,
|
||||
.amount-items > view > text:first-child {
|
||||
width: 25px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
.distance-items > view:last-child {
|
||||
width: 65.5vw;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
.distance-items > view:last-child > input {
|
||||
width: 80%;
|
||||
text-align: center;
|
||||
}
|
||||
.bowtarget-items > view {
|
||||
flex-direction: column;
|
||||
height: 16vw;
|
||||
}
|
||||
.bowtarget-items > view > text {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -11,6 +11,10 @@ const props = defineProps({
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
whiteBackArrow: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
const onClick = () => {
|
||||
@@ -20,6 +24,7 @@ const onClick = () => {
|
||||
|
||||
const loading = ref(false);
|
||||
const showLoader = ref(false);
|
||||
const pointBook = ref(null);
|
||||
const updateLoading = (value) => {
|
||||
loading.value = value;
|
||||
};
|
||||
@@ -29,6 +34,9 @@ onMounted(() => {
|
||||
isIos.value = deviceInfo.osName === "ios";
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
if (currentPage.route === "pages/point-book-edit") {
|
||||
pointBook.value = uni.getStorageSync("point-book");
|
||||
}
|
||||
if (
|
||||
currentPage.route === "pages/battle-room" ||
|
||||
currentPage.route === "pages/team-match" ||
|
||||
@@ -46,9 +54,14 @@ onUnmounted(() => {
|
||||
<template>
|
||||
<view class="container" :style="{ paddingTop: isIos ? '80rpx' : '50rpx' }">
|
||||
<view class="back-btn" @click="onClick">
|
||||
<image src="../static/back.png" mode="widthFix" />
|
||||
<image v-if="whiteBackArrow" src="../static/back.png" mode="widthFix" />
|
||||
<image
|
||||
v-if="!whiteBackArrow"
|
||||
src="../static/back-black.png"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
<view>
|
||||
<view :style="{ color: whiteBackArrow ? '#fff' : '#000' }">
|
||||
<block
|
||||
v-if="
|
||||
'-凹造型-感知距离-小试牛刀'.indexOf(title) === -1 ||
|
||||
@@ -83,6 +96,21 @@ onUnmounted(() => {
|
||||
mode="widthFix"
|
||||
class="loading"
|
||||
/>
|
||||
<view v-if="pointBook" class="point-book-info">
|
||||
<text>{{ pointBook.bowType.name }}</text>
|
||||
<text>{{ pointBook.distance }} 米</text>
|
||||
<text
|
||||
>{{
|
||||
pointBook.bowtargetType.name.substring(
|
||||
0,
|
||||
pointBook.bowtargetType.name.length - 3
|
||||
)
|
||||
}}
|
||||
{{
|
||||
pointBook.bowtargetType.name.substring(pointBook.bowtargetType.name.length - 3)
|
||||
}}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -95,7 +123,8 @@ onUnmounted(() => {
|
||||
height: 100rpx;
|
||||
/* margin-top: var(--status-bar-height); */
|
||||
padding-left: 15px;
|
||||
color: #fff;
|
||||
}
|
||||
.container > view:nth-child(2) {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -104,8 +133,8 @@ onUnmounted(() => {
|
||||
align-items: center;
|
||||
}
|
||||
.back-btn > image {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.first-try-steps {
|
||||
@@ -133,4 +162,19 @@ onUnmounted(() => {
|
||||
background-blend-mode: darken;
|
||||
animation: rotate 2s linear infinite;
|
||||
}
|
||||
.point-book-info {
|
||||
color: #333;
|
||||
position: fixed;
|
||||
width: 60%;
|
||||
left: 20%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.point-book-info > text {
|
||||
border-radius: 6px;
|
||||
background-color: #fff;
|
||||
font-size: 10px;
|
||||
padding: 5px 10px;
|
||||
margin: 3px;
|
||||
}
|
||||
</style>
|
||||
|
||||
109
src/components/PointRecord.vue
Normal file
109
src/components/PointRecord.vue
Normal file
@@ -0,0 +1,109 @@
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
const bowOptions = ref({});
|
||||
const targetOptions = ref({});
|
||||
|
||||
onMounted(() => {
|
||||
const result = uni.getStorageSync("point-book-config");
|
||||
(result.bowOption || []).forEach((item) => {
|
||||
bowOptions.value[item.id] = item;
|
||||
});
|
||||
(result.targetOption || []).forEach((item) => {
|
||||
targetOptions.value[item.id] = item;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<view>
|
||||
<view class="labels">
|
||||
<text>{{
|
||||
bowOptions[data.bowType] ? bowOptions[data.bowType].name : ""
|
||||
}}</text>
|
||||
<text>{{ data.distance }} 米</text>
|
||||
<text>{{
|
||||
targetOptions[data.targetType]
|
||||
? targetOptions[data.targetType].name
|
||||
: ""
|
||||
}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>{{ data.createAt }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<image src="../static/bow-target.png" mode="widthFix" />
|
||||
<view class="aroow-amount">
|
||||
<text>共</text>
|
||||
<text>{{ data.arrows * data.groups }}</text>
|
||||
<text>箭</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
background-color: #fff;
|
||||
border-radius: 15px;
|
||||
display: flex;
|
||||
margin-bottom: 15px;
|
||||
height: 24vw;
|
||||
}
|
||||
.container > view {
|
||||
position: relative;
|
||||
margin-left: 15px;
|
||||
}
|
||||
.container > view:first-child {
|
||||
width: calc(100% - 5vw);
|
||||
}
|
||||
.container > view:first-child > view {
|
||||
width: 100%;
|
||||
height: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.labels {
|
||||
align-items: flex-end !important;
|
||||
}
|
||||
.labels > text {
|
||||
font-size: 12px;
|
||||
color: #333333;
|
||||
border: 1px solid #eee;
|
||||
margin-right: 10px;
|
||||
border-radius: 10px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
.container > view:last-child {
|
||||
margin-right: 1vw;
|
||||
}
|
||||
.container > view:last-child > image {
|
||||
width: 24vw;
|
||||
}
|
||||
.aroow-amount {
|
||||
position: absolute;
|
||||
background-color: #0009;
|
||||
border-radius: 10px;
|
||||
color: #fffc;
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
width: 60px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
top: calc(50% - 11px);
|
||||
left: calc(50% - 30px);
|
||||
}
|
||||
.aroow-amount > text:nth-child(2) {
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
margin: 0 3px;
|
||||
}
|
||||
</style>
|
||||
@@ -26,6 +26,10 @@ const props = defineProps({
|
||||
type: String,
|
||||
default: "#000",
|
||||
},
|
||||
disabledColor:{
|
||||
type: String,
|
||||
default: "#757575",
|
||||
}
|
||||
});
|
||||
|
||||
const loading = ref(false);
|
||||
@@ -55,7 +59,7 @@ const onBtnClick = debounce(async () => {
|
||||
:style="{
|
||||
width: width,
|
||||
borderRadius: rounded + 'px',
|
||||
backgroundColor: disabled ? '#757575' : backgroundColor,
|
||||
backgroundColor: disabled ? disabledColor : backgroundColor,
|
||||
color,
|
||||
}"
|
||||
open-type="getUserInfo"
|
||||
|
||||
@@ -9,32 +9,50 @@ const props = defineProps({
|
||||
type: Function,
|
||||
default: () => {},
|
||||
},
|
||||
noBg: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
const showContainer = ref(false);
|
||||
const showContent = ref(false);
|
||||
watch(
|
||||
() => props.show,
|
||||
(newValue) => {
|
||||
setTimeout(() => {
|
||||
showContent.value = newValue;
|
||||
}, 100);
|
||||
}
|
||||
if (newValue) {
|
||||
showContainer.value = true;
|
||||
setTimeout(() => {
|
||||
showContent.value = true;
|
||||
}, 100);
|
||||
} else {
|
||||
showContent.value = false;
|
||||
setTimeout(() => {
|
||||
showContainer.value = false;
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
{}
|
||||
);
|
||||
const closeModal = () => {
|
||||
showContent.value = false;
|
||||
setTimeout(() => {
|
||||
props.onClose();
|
||||
}, 300);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="container" v-if="show" :style="{ opacity: show ? 1 : 0 }">
|
||||
<view
|
||||
class="container"
|
||||
v-if="showContainer"
|
||||
:style="{ opacity: show ? 1 : 0 }"
|
||||
@click="onClose"
|
||||
>
|
||||
<view
|
||||
class="modal-content"
|
||||
:style="{ transform: `translateY(${showContent ? '0%' : '100%'})` }"
|
||||
:style="{ transform: `translateY(${showContent ? '0%' : '100%'})`, height: !noBg ? '260px' : 'auto' }"
|
||||
@click.stop=""
|
||||
>
|
||||
<image src="../static/modal-content-bg.png" mode="widthFix" />
|
||||
<view class="close-btn" @click="closeModal">
|
||||
<image
|
||||
v-if="!noBg"
|
||||
src="../static/modal-content-bg.png"
|
||||
mode="widthFix"
|
||||
/>
|
||||
<view class="close-btn" @click="onClose">
|
||||
<image src="../static/close-yellow.png" mode="widthFix" />
|
||||
</view>
|
||||
<slot></slot>
|
||||
@@ -60,7 +78,6 @@ const closeModal = () => {
|
||||
}
|
||||
.modal-content {
|
||||
width: 100%;
|
||||
height: 260px;
|
||||
transform: translateY(100%);
|
||||
transition: all 0.3s ease;
|
||||
position: relative;
|
||||
|
||||
66
src/components/ScreenHint2.vue
Normal file
66
src/components/ScreenHint2.vue
Normal file
@@ -0,0 +1,66 @@
|
||||
<script setup>
|
||||
import IconButton from "./IconButton.vue";
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
onClose: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 100,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="container" :style="{ display: show ? 'flex' : 'none' }">
|
||||
<view class="scale-in">
|
||||
<image src="../static/point-book-tip-bg.png" mode="widthFix" />
|
||||
<slot />
|
||||
</view>
|
||||
<IconButton
|
||||
v-if="!!onClose"
|
||||
src="../static/close-white-outline.png"
|
||||
:width="30"
|
||||
:onClick="onClose"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 999;
|
||||
}
|
||||
.container > view:first-child {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
width: 75vw;
|
||||
margin-bottom: 15px;
|
||||
border-radius: 20px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
}
|
||||
.container > view:first-child > image {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
z-index: -1;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user