feat:修改关卡

This commit is contained in:
lixg
2023-02-27 17:52:56 +08:00
parent 6d458db4c6
commit 3c6482534c
7 changed files with 72 additions and 23 deletions

View File

@@ -1,12 +1,12 @@
<template>
<div class="pathDetail pathDetailback">
<div
v-for="(item, i) in data"
v-for="(item, i) in data?.list"
:key="i"
class="cha"
:style="{
top: `${imgAttr.positions[i]?.top - (current === i ? 5 : 0)}px`,
left: `${imgAttr.positions[i]?.left - (current === i ? 10 : 0)}px`,
top: `${imgAttr.positions[i]?.top - (current === i ? 1 : 0)}px`,
left: `${imgAttr.positions[i]?.left - (current === i ? 11 : 0)}px`,
}"
>
<div
@@ -31,7 +31,7 @@ import { computed, defineProps, ref, watch } from "vue";
import { useRouter } from "vue-router/dist/vue-router";
import { ElLoading } from "element-plus";
import { ROUTERTASK_LIST } from "@/api/api";
import { usePage } from "@/api/request";
import { usePage, useRequest } from "@/api/request";
const listheight = document.body.clientHeight - 300 + "px";
console.log("listheight", listheight);
const props = defineProps({
@@ -99,15 +99,20 @@ const closeLoading = () => {
// },
// ]);
// closeLoading();
const { data } = usePage(ROUTERTASK_LIST, { routerId: props.routerId }, (e) => {
console.log("我请求成功了吗", e);
e.data.rows.reverse();
const { data } = useRequest(ROUTERTASK_LIST, { routerId: props.routerId });
console.log("data", data);
let current = ref(null);
watch(data, () => {
data.value.list.reverse();
current.value = data.value.list.findIndex(
(e) => e.id === data.value.currentChapterId
);
closeLoading();
});
const current = computed(() =>
data.value.findIndex((e) => e.chapterId === props.currentStageId)
);
console.log("data", data);
// const current = computed(() => {
// data.value.list.findIndex((e) => e.id === data.value.currentChapterId);
// });
console.log("current", current);
function show() {
visiable.value = true;
@@ -115,9 +120,10 @@ function show() {
function toDetail(i) {
// console.log("import.meta.env.MODE", import.meta.env.MODE);
// if (current.value !== i) {
// return;
// }
console.log("current.value !== i", current, i);
if (current.value !== i) {
return;
}
import.meta.env.MODE === "development" || import.meta.env.MODE === "test"
? router.push({
path: "/pathmappage",