feat:选择20cm、40cm全环靶
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, onBeforeUnmount } from "vue";
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import Container from "@/components/Container.vue";
|
||||
import ShootProgress from "@/components/ShootProgress.vue";
|
||||
import BowTarget from "@/components/BowTarget.vue";
|
||||
@@ -35,6 +35,13 @@ const practiseResult = ref({});
|
||||
const practiseId = ref("");
|
||||
const showGuide = ref(false);
|
||||
const tips = ref("");
|
||||
const targetType = ref(1);
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.target) {
|
||||
targetType.value = Number(options.target);
|
||||
}
|
||||
});
|
||||
|
||||
const onReady = async () => {
|
||||
await startPractiseAPI();
|
||||
@@ -84,7 +91,7 @@ onMounted(async () => {
|
||||
});
|
||||
uni.$on("socket-inbox", onReceiveMessage);
|
||||
uni.$on("share-image", onClickShare);
|
||||
const result = await createPractiseAPI(total, 120);
|
||||
const result = await createPractiseAPI(total, 120, targetType.value);
|
||||
if (result) practiseId.value = result.id;
|
||||
});
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import { MESSAGETYPESV2 } from "@/constants";
|
||||
|
||||
import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
import {onLoad} from "@dcloudio/uni-app";
|
||||
const store = useStore();
|
||||
const { user } = storeToRefs(store);
|
||||
|
||||
@@ -33,6 +34,13 @@ const total = 36;
|
||||
const practiseResult = ref({});
|
||||
const practiseId = ref("");
|
||||
const showGuide = ref(false);
|
||||
const targetType = ref(1);
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.target) {
|
||||
targetType.value = Number(options.target);
|
||||
}
|
||||
});
|
||||
|
||||
const onReady = async () => {
|
||||
await startPractiseAPI();
|
||||
@@ -97,7 +105,7 @@ onMounted(async () => {
|
||||
});
|
||||
uni.$on("socket-inbox", onReceiveMessage);
|
||||
uni.$on("share-image", onClickShare);
|
||||
const result = await createPractiseAPI(total, 360);
|
||||
const result = await createPractiseAPI(total, 360, targetType.value);
|
||||
if (result) practiseId.value = result.id;
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { onShow } from "@dcloudio/uni-app";
|
||||
import Container from "@/components/Container.vue";
|
||||
import Guide from "@/components/Guide.vue";
|
||||
import Avatar from "@/components/Avatar.vue";
|
||||
import TargetPicker from "@/components/TargetPicker.vue";
|
||||
import { getPractiseDataAPI } from "@/apis";
|
||||
import { canEenter } from "@/util";
|
||||
|
||||
@@ -12,12 +13,20 @@ import { storeToRefs } from "pinia";
|
||||
const store = useStore();
|
||||
const { user, device, online } = storeToRefs(store);
|
||||
const data = ref({});
|
||||
const showTargetPicker = ref(false);
|
||||
const pendingPractiseType = ref("");
|
||||
|
||||
const goPractise = async (type) => {
|
||||
if (!canEenter(user.value, device.value, online.value)) return;
|
||||
// await uni.$checkAudio();
|
||||
pendingPractiseType.value = type;
|
||||
showTargetPicker.value = true;
|
||||
};
|
||||
|
||||
const handleTargetConfirm = (target) => {
|
||||
showTargetPicker.value = false;
|
||||
const type = pendingPractiseType.value;
|
||||
uni.navigateTo({
|
||||
url: `/pages/practise-${type}`,
|
||||
url: `/pages/practise-${type}?target=${target}`,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -88,6 +97,11 @@ onShow(async () => {
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<TargetPicker
|
||||
:show="showTargetPicker"
|
||||
:onClose="() => (showTargetPicker = false)"
|
||||
:onConfirm="handleTargetConfirm"
|
||||
/>
|
||||
</Container>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user