|
@@ -72,7 +72,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { onMounted, ref, computed } from "vue";
|
|
|
+import { onMounted, ref, computed, onUnmounted } from "vue";
|
|
|
import { Menu, FullScreen } from "@element-plus/icons-vue";
|
|
|
import { Swiper, SwiperSlide } from "swiper/vue";
|
|
|
import "swiper/css";
|
|
@@ -114,6 +114,22 @@ function refresh() {
|
|
|
}
|
|
|
}
|
|
|
const changeList = async (list) => {
|
|
|
+ //同步数据
|
|
|
+ if (!loadedDrawData.value) {
|
|
|
+ const res = await getCaseImgTagData(caseId.value);
|
|
|
+ if (res.data) {
|
|
|
+ if (res.data.data) {
|
|
|
+ loadedDrawData.value = res.data.data;
|
|
|
+ }
|
|
|
+ if ("isHorizontal" in res.data) {
|
|
|
+ console.error("sortType.value", sortType.value, !res.data.isHorizontal);
|
|
|
+ sortType.value = !res.data.isHorizontal;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ loadedDrawData.value = [];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
let newList = [];
|
|
|
list.map((item, index) => {
|
|
|
if (sortType.value) {
|
|
@@ -129,20 +145,8 @@ const changeList = async (list) => {
|
|
|
const arr = [];
|
|
|
newList.map((i) => arr.push(JSON.parse(JSON.stringify(i))));
|
|
|
|
|
|
- if (!loadedDrawData.value) {
|
|
|
- const res = await getCaseImgTagData(caseId.value);
|
|
|
- if (res.data) {
|
|
|
- if (res.data.data) {
|
|
|
- loadedDrawData.value = res.data.data;
|
|
|
- }
|
|
|
- if ("isHorizontal" in res.data) {
|
|
|
- sortType.value = !res.data.isHorizontal;
|
|
|
- }
|
|
|
- } else {
|
|
|
- loadedDrawData.value = [];
|
|
|
- }
|
|
|
- }
|
|
|
- let type = sortType.value ? 2 : 1;
|
|
|
+ const type = sortType.value ? 2 : 1;
|
|
|
+
|
|
|
if (scene) {
|
|
|
scene.load(arr, type, loadedDrawData.value || []);
|
|
|
console.log("changeList", arr, type, loadedDrawData.value);
|
|
@@ -229,15 +233,17 @@ const handleClear = () => {
|
|
|
window.scene.player.clear();
|
|
|
}
|
|
|
};
|
|
|
+onUnmounted(() => {});
|
|
|
|
|
|
-onMounted(async () => {
|
|
|
+onMounted(() => {
|
|
|
renderCanvas();
|
|
|
- try {
|
|
|
- const res = await getCaseImgTagData(caseId.value);
|
|
|
- const { isHorizontal, data } = res.data;
|
|
|
- sortType.value = !isHorizontal;
|
|
|
- data && (loadedDrawData.value = data);
|
|
|
- } catch (error) {}
|
|
|
+ console.warn("renderCanvas");
|
|
|
+ // try {
|
|
|
+ // const res = await getCaseImgTagData(caseId.value);
|
|
|
+ // const { isHorizontal, data } = res.data;
|
|
|
+ // sortType.value = !isHorizontal;
|
|
|
+ // data && (loadedDrawData.value = data);
|
|
|
+ // } catch (error) {}
|
|
|
});
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|