123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <template>
- <Dialog custom-show type="lg" :title="!!title ? title : '附近视频'" height="720px" draggable hide-footer @close="handleClose">
- <div class="flex-box">
- <div>附近距离</div>
- <el-select v-model="queryParams.radius" class="custom-select" popper-class="custom-popper" :teleported="false" @change="initData">
- <el-option v-for="item in radiusOption" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </div>
- <div class="video-box">
- <video-container2 v-show="!loading" :video-data="videoMonitorData" />
- </div>
- <div v-if="!!getDataMethod" class="footer">
- <el-pagination
- background
- :hide-on-single-page="true"
- layout="total, prev, pager, next"
- :total="total"
- :page-size="queryParams2.pageSize"
- :current-page="queryParams2.page"
- @current-change="initData2"
- />
- </div>
- </Dialog>
- </template>
- <script lang="ts" setup name="NearbyVideos">
- // 请求参数
- import { getVideoInfo } from '@/api/globalMap';
- interface Props {
- modelValue: boolean;
- location?: string | number[];
- getDataMethod?: Function;
- title?: string;
- }
- const props = withDefaults(defineProps<Props>(), {});
- const emits = defineEmits(['update:modelValue']);
- const total = ref(0);
- const queryParams = reactive({
- location: '',
- radius: '500'
- });
- const queryParams2 = reactive({
- page: 1,
- pageSize: 9
- });
- let videoMonitorData = ref([]);
- const radiusOption = reactive([
- { label: '500米', value: '500' },
- { label: '1000米', value: '1000' },
- { label: '1500米', value: '1500' },
- { label: '2000米', value: '2000' }
- ]);
- let loading = ref(false);
- const initData = () => {
- loading.value = true;
- getVideoInfo(queryParams)
- .then((res) => {
- res.data?.list.forEach((item) => {
- item.video_code = item.indexcode;
- });
- videoMonitorData.value = res.data?.list;
- })
- .finally(() => {
- loading.value = false;
- });
- };
- const initData2 = () => {
- loading.value = true;
- props
- .getDataMethod({ page: queryParams2.page, pageSize: queryParams2.pageSize, radius: queryParams.radius })
- .then((res) => {
- total.value = res.totalPages;
- res.data?.list.forEach((item) => {
- item.video_code = item.indexcode;
- });
- videoMonitorData.value = res.data?.list;
- })
- .finally(() => {
- loading.value = false;
- });
- };
- watch(
- () => props.location,
- () => {
- if (props.location && props.location.length === 2) {
- queryParams.location = `POINT(${props.location[0]} ${props.location[1]})`;
- initData();
- }
- },
- {
- immediate: true,
- deep: true
- }
- );
- watch(
- () => props.getDataMethod,
- () => {
- if (!!props.getDataMethod) {
- initData2();
- }
- },
- {
- immediate: true,
- deep: true
- }
- );
- const handleClose = () => {
- emits('update:modelValue', false);
- };
- </script>
- <style lang="scss" scoped>
- .dialog-container {
- position: fixed;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- z-index: 9;
- width: 2000px;
- height: 1562px;
- background: url('@/assets/images/nearbyVideos/dialog.png') no-repeat;
- padding: 160px 30px 20px 40px;
- font-size: 36px;
- color: #ffffff;
- display: flex;
- flex-direction: column;
- }
- .flex-box {
- display: flex;
- align-items: center;
- color: #eaf3fc;
- font-size: 14px;
- .custom-select {
- width: 140px;
- margin-left: 20px;
- }
- }
- .video-box {
- margin-top: 5px;
- flex: 1;
- display: flex;
- flex-wrap: wrap;
- overflow: hidden;
- margin-bottom: 10px;
- }
- .close-btn {
- position: absolute;
- top: 0px;
- right: 0px;
- width: 75px;
- height: 70px;
- background: url('@/assets/images/map/rightMenu/close.png') no-repeat;
- background-size: 100% 100%;
- cursor: pointer;
- }
- .footer {
- display: flex;
- justify-content: flex-end;
- margin-top: 10px;
- padding-right: 20px;
- :deep(.el-pagination__total) {
- color: #a7ccdf !important;
- }
- :deep(.el-pagination) {
- .btn-next,
- .btn-prev {
- background-color: transparent !important;
- border: none !important;
- .el-icon {
- color: #a7ccdf !important;
- }
- }
- .btn-prev:disabled,
- .btn-next:disabled {
- background-color: transparent !important;
- border: none !important;
- }
- .el-pager li {
- text-align: center;
- color: #a7ccdf !important;
- background-color: #0e3064 !important;
- border: 1px solid #0c57a7 !important;
- &:hover {
- background-color: #038dff !important;
- border: 1px solid #038dff !important;
- }
- }
- .el-pager li.is-active {
- background-color: #038dff !important;
- border: 1px solid #038dff !important;
- }
- }
- }
- </style>
|