index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <Dialog custom-show type="lg" :title="!!title ? title : '附近视频'" height="720px" draggable hide-footer @close="handleClose">
  3. <div class="flex-box">
  4. <div>附近距离</div>
  5. <el-select v-model="queryParams.radius" class="custom-select" popper-class="custom-popper" :teleported="false" @change="initData">
  6. <el-option v-for="item in radiusOption" :key="item.value" :label="item.label" :value="item.value" />
  7. </el-select>
  8. </div>
  9. <div class="video-box">
  10. <video-container2 v-show="!loading" :video-data="videoMonitorData" />
  11. </div>
  12. <div v-if="!!getDataMethod" class="footer">
  13. <el-pagination
  14. background
  15. :hide-on-single-page="true"
  16. layout="total, prev, pager, next"
  17. :total="total"
  18. :page-size="queryParams2.pageSize"
  19. :current-page="queryParams2.page"
  20. @current-change="initData2"
  21. />
  22. </div>
  23. </Dialog>
  24. </template>
  25. <script lang="ts" setup name="NearbyVideos">
  26. // 请求参数
  27. import { getVideoInfo } from '@/api/globalMap';
  28. interface Props {
  29. modelValue: boolean;
  30. location?: string | number[];
  31. getDataMethod?: Function;
  32. title?: string;
  33. }
  34. const props = withDefaults(defineProps<Props>(), {});
  35. const emits = defineEmits(['update:modelValue']);
  36. const total = ref(0);
  37. const queryParams = reactive({
  38. location: '',
  39. radius: '500'
  40. });
  41. const queryParams2 = reactive({
  42. page: 1,
  43. pageSize: 9
  44. });
  45. let videoMonitorData = ref([]);
  46. const radiusOption = reactive([
  47. { label: '500米', value: '500' },
  48. { label: '1000米', value: '1000' },
  49. { label: '1500米', value: '1500' },
  50. { label: '2000米', value: '2000' }
  51. ]);
  52. let loading = ref(false);
  53. const initData = () => {
  54. loading.value = true;
  55. getVideoInfo(queryParams)
  56. .then((res) => {
  57. res.data?.list.forEach((item) => {
  58. item.video_code = item.indexcode;
  59. });
  60. videoMonitorData.value = res.data?.list;
  61. })
  62. .finally(() => {
  63. loading.value = false;
  64. });
  65. };
  66. const initData2 = () => {
  67. loading.value = true;
  68. props
  69. .getDataMethod({ page: queryParams2.page, pageSize: queryParams2.pageSize, radius: queryParams.radius })
  70. .then((res) => {
  71. total.value = res.totalPages;
  72. res.data?.list.forEach((item) => {
  73. item.video_code = item.indexcode;
  74. });
  75. videoMonitorData.value = res.data?.list;
  76. })
  77. .finally(() => {
  78. loading.value = false;
  79. });
  80. };
  81. watch(
  82. () => props.location,
  83. () => {
  84. if (props.location && props.location.length === 2) {
  85. queryParams.location = `POINT(${props.location[0]} ${props.location[1]})`;
  86. initData();
  87. }
  88. },
  89. {
  90. immediate: true,
  91. deep: true
  92. }
  93. );
  94. watch(
  95. () => props.getDataMethod,
  96. () => {
  97. if (!!props.getDataMethod) {
  98. initData2();
  99. }
  100. },
  101. {
  102. immediate: true,
  103. deep: true
  104. }
  105. );
  106. const handleClose = () => {
  107. emits('update:modelValue', false);
  108. };
  109. </script>
  110. <style lang="scss" scoped>
  111. .dialog-container {
  112. position: fixed;
  113. top: 50%;
  114. left: 50%;
  115. transform: translate(-50%, -50%);
  116. z-index: 9;
  117. width: 2000px;
  118. height: 1562px;
  119. background: url('@/assets/images/nearbyVideos/dialog.png') no-repeat;
  120. padding: 160px 30px 20px 40px;
  121. font-size: 36px;
  122. color: #ffffff;
  123. display: flex;
  124. flex-direction: column;
  125. }
  126. .flex-box {
  127. display: flex;
  128. align-items: center;
  129. color: #eaf3fc;
  130. font-size: 14px;
  131. .custom-select {
  132. width: 140px;
  133. margin-left: 20px;
  134. }
  135. }
  136. .video-box {
  137. margin-top: 5px;
  138. flex: 1;
  139. display: flex;
  140. flex-wrap: wrap;
  141. overflow: hidden;
  142. margin-bottom: 10px;
  143. }
  144. .close-btn {
  145. position: absolute;
  146. top: 0px;
  147. right: 0px;
  148. width: 75px;
  149. height: 70px;
  150. background: url('@/assets/images/map/rightMenu/close.png') no-repeat;
  151. background-size: 100% 100%;
  152. cursor: pointer;
  153. }
  154. .footer {
  155. display: flex;
  156. justify-content: flex-end;
  157. margin-top: 10px;
  158. padding-right: 20px;
  159. :deep(.el-pagination__total) {
  160. color: #a7ccdf !important;
  161. }
  162. :deep(.el-pagination) {
  163. .btn-next,
  164. .btn-prev {
  165. background-color: transparent !important;
  166. border: none !important;
  167. .el-icon {
  168. color: #a7ccdf !important;
  169. }
  170. }
  171. .btn-prev:disabled,
  172. .btn-next:disabled {
  173. background-color: transparent !important;
  174. border: none !important;
  175. }
  176. .el-pager li {
  177. text-align: center;
  178. color: #a7ccdf !important;
  179. background-color: #0e3064 !important;
  180. border: 1px solid #0c57a7 !important;
  181. &:hover {
  182. background-color: #038dff !important;
  183. border: 1px solid #038dff !important;
  184. }
  185. }
  186. .el-pager li.is-active {
  187. background-color: #038dff !important;
  188. border: 1px solid #038dff !important;
  189. }
  190. }
  191. }
  192. </style>