|
@@ -0,0 +1,136 @@
|
|
|
+<template>
|
|
|
+ <ElDialog
|
|
|
+ v-model="show"
|
|
|
+ append-to-body
|
|
|
+ class="classification"
|
|
|
+ modal-class="classification-modal"
|
|
|
+ :show-close="false"
|
|
|
+ >
|
|
|
+ <img
|
|
|
+ class="classification__close"
|
|
|
+ src="@/assets/images/close.png"
|
|
|
+ @click="handleClose"
|
|
|
+ />
|
|
|
+
|
|
|
+ <div v-loading="loading" class="classification-main">
|
|
|
+ <ul class="classification-tabs">
|
|
|
+ <li
|
|
|
+ v-for="item in NAV_TABS"
|
|
|
+ :key="item.id"
|
|
|
+ :class="{ active: item.label === checkedClass }"
|
|
|
+ @click="checkedClass = item.label"
|
|
|
+ >
|
|
|
+ <p>{{ item.label }}</p>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+
|
|
|
+ <ElScrollbar class="classification-list">
|
|
|
+ <div class="classification-list-wrap">
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in list"
|
|
|
+ :key="item.id"
|
|
|
+ class="classification-item"
|
|
|
+ :class="{ active: activeIndex === index }"
|
|
|
+ @click="handleDetail(index)"
|
|
|
+ >
|
|
|
+ <img :src="`${baseUrl}${item.thumb}`" />
|
|
|
+ <div class="classification-item-footer">
|
|
|
+ <p>{{ item.name }}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </ElScrollbar>
|
|
|
+
|
|
|
+ <div
|
|
|
+ v-if="list[activeIndex] && detail?.video.length"
|
|
|
+ class="classification-container"
|
|
|
+ >
|
|
|
+ <video autoplay controls :src="baseUrl + detail?.video[0].filePath" />
|
|
|
+
|
|
|
+ <p class="classification-label">
|
|
|
+ <span>{{ list[activeIndex].name }}</span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </ElDialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { computed, watch, ref } from "vue";
|
|
|
+import { NAV_TABS } from "@bj/base";
|
|
|
+import { getBridgeListApi, getBridgeDetailApi } from "@/api";
|
|
|
+
|
|
|
+const baseUrl = import.meta.env.VITE_BASE_URL;
|
|
|
+const props = defineProps(["visible", "checked"]);
|
|
|
+const emits = defineEmits(["update:visible", "update:checked"]);
|
|
|
+const activeIndex = ref(0);
|
|
|
+const loading = ref(false);
|
|
|
+const list = ref([]);
|
|
|
+const detail = ref(null);
|
|
|
+
|
|
|
+const checkedClass = computed({
|
|
|
+ get() {
|
|
|
+ return props.checked;
|
|
|
+ },
|
|
|
+ set(v) {
|
|
|
+ emits("update:checked", v);
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+const show = computed({
|
|
|
+ get() {
|
|
|
+ return props.visible;
|
|
|
+ },
|
|
|
+ set(v) {
|
|
|
+ emits("update:visible", v);
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+const handleClose = () => {
|
|
|
+ show.value = false;
|
|
|
+ checkedClass.value = null;
|
|
|
+};
|
|
|
+
|
|
|
+const getBridgeList = async () => {
|
|
|
+ try {
|
|
|
+ loading.value = true;
|
|
|
+ const data = await getBridgeListApi({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 999,
|
|
|
+ type: checkedClass.value,
|
|
|
+ });
|
|
|
+ list.value = data.records;
|
|
|
+
|
|
|
+ if (list.value.length > 0) {
|
|
|
+ getBridgeDetail();
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const getBridgeDetail = async () => {
|
|
|
+ if (!list.value[activeIndex.value]) return;
|
|
|
+
|
|
|
+ try {
|
|
|
+ loading.value = true;
|
|
|
+ const data = await getBridgeDetailApi(list.value[activeIndex.value].id);
|
|
|
+ detail.value = data;
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const handleDetail = (index) => {
|
|
|
+ activeIndex.value = index;
|
|
|
+ getBridgeDetail();
|
|
|
+};
|
|
|
+
|
|
|
+watch(checkedClass, (v) => {
|
|
|
+ v && getBridgeList();
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+@use "./index.scss";
|
|
|
+</style>
|