index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <script setup>
  2. import {
  3. ref,
  4. reactive,
  5. nextTick,
  6. onMounted,
  7. computed,
  8. getCurrentInstance,
  9. } from "vue";
  10. import { onLoad, onShow, onTabItemTap } from "@dcloudio/uni-app";
  11. import { getSubInfoList, getCameraList } from "@/api/work/video.js";
  12. let subId = ref("");
  13. let videoList = ref([]);
  14. let openVideoUrl = ref("");
  15. function list() {
  16. getCameraList({
  17. subId: subId.value,
  18. }).then(async (res) => {
  19. videoList.value = res.data.list;
  20. const item = res.data.list[0];
  21. openVideoUrl.value = item.code;
  22. title.value = item.subName;
  23. });
  24. }
  25. let selectedItem = ref({});
  26. let activeIndex = ref(0);
  27. const title = ref("");
  28. function openUrl(item, index) {
  29. openVideoUrl.value = item.code;
  30. title.value = item.subName;
  31. activeIndex.value = index;
  32. }
  33. const screenWidth = ref(375);
  34. const statusBarHeight = ref(22);
  35. onLoad((option) => {
  36. const systemInfo = uni.getSystemInfoSync();
  37. screenWidth.value = systemInfo.screenWidth;
  38. statusBarHeight.value = systemInfo.statusBarHeight;
  39. selectedItem.value = option;
  40. subId.value = option.id;
  41. list();
  42. });
  43. const webviewStyles = computed(() => {
  44. const videoHeight = screenWidth.value * 0.5625;
  45. return {
  46. width: screenWidth.value + "px",
  47. height: videoHeight + "px",
  48. top: statusBarHeight.value + 50 + "px",
  49. };
  50. });
  51. const webviewBoxStyle = computed(() => {
  52. const style = webviewStyles.value;
  53. return {
  54. width: style.width,
  55. height: style.height,
  56. marginTop: style.top,
  57. };
  58. });
  59. </script>
  60. <template>
  61. <view class="container">
  62. <page-title>现场影像</page-title>
  63. <view :style="webviewBoxStyle">
  64. <web-view
  65. :webview-styles="webviewStyles"
  66. :style="webviewBoxStyle"
  67. :src="`/hybrid/html/video.html?src=${openVideoUrl}&title=${title}`"
  68. :fullscreen="false"
  69. ></web-view>
  70. </view>
  71. <!-- <cover-view class="srceenBtn" @click="onScreenFull()">
  72. <cover-image
  73. class="iamge"
  74. src="@/static/images/fullWatch.png"
  75. ></cover-image>
  76. <cover-view class="full-watch">全屏观看</cover-view>
  77. </cover-view> -->
  78. <view class="video-pro-list">
  79. <view class="xmmc"> 项目名称 </view>
  80. <view class="video-bg">
  81. <view class="video-pro-title">
  82. {{ selectedItem.subName }}
  83. </view>
  84. <view class="line"> </view>
  85. <view class="video-pro-time">
  86. <view>
  87. 开工日期:
  88. <text class="start-end">{{ selectedItem.beginDate }}</text>
  89. </view>
  90. <view>
  91. 预计竣工日期:
  92. <text class="start-end">{{ selectedItem.endDate }}</text>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="no-img-video" v-if="videoList.length === 0">
  97. <image src="@/static/images/noImgVideo.svg" mode=""></image>
  98. <text>暂无视频</text>
  99. </view>
  100. <view class="video-list" v-if="videoList.length > 0">
  101. <view
  102. class="video-item"
  103. :class="activeIndex === index ? 'item-active' : ''"
  104. v-for="(item, index) in videoList"
  105. :key="item.videoId"
  106. @click="openUrl(item, index)"
  107. >
  108. <!-- <view class="item-num" :class="activeIndex===index?'num-active':''">
  109. {{(1+index)<10?'0'+(1+index):(1+index)}}
  110. </view>
  111. <view class="item-num" :class="activeIndex===index?'num-active':''">
  112. {{(1+index)<10?'0'+(1+index):(1+index)}}
  113. </view> -->
  114. <view class="item-no"
  115. >{{ 1 + index < 10 ? "0" + (1 + index) : 1 + index }}
  116. </view>
  117. <view>{{ item.title }}</view>
  118. </view>
  119. </view>
  120. </view>
  121. <view class="footer">
  122. <view class="footer-word"> 新疆维吾尔自治区 </view>
  123. <view class="footer-word"> 哈密市发展和改革委员会 </view>
  124. </view>
  125. </view>
  126. </template>
  127. <style lang="scss" scoped>
  128. .no-img-video {
  129. display: flex;
  130. flex-direction: column;
  131. align-items: center;
  132. margin-top: 50rpx;
  133. image {
  134. width: 200rpx;
  135. height: 200rpx;
  136. }
  137. text {
  138. margin-top: 20rpx;
  139. font-size: 32rpx;
  140. color: #999999;
  141. }
  142. }
  143. .container {
  144. display: flex;
  145. flex-direction: column;
  146. align-items: center;
  147. justify-content: flex-start;
  148. padding-top: calc(var(--status-bar-height) + 50px);
  149. position: relative;
  150. overflow: scroll;
  151. background-color: #ffffff;
  152. .search-box {
  153. position: relative;
  154. display: flex;
  155. justify-content: center;
  156. align-items: center;
  157. // margin-top: calc(var(--status-bar-height) + 50px);
  158. width: 100%;
  159. padding: 0 28rpx;
  160. background-color: #002f69;
  161. // background-color: #fff;
  162. height: 150rpx;
  163. .search-icon {
  164. position: absolute;
  165. top: 50%;
  166. left: 80rpx;
  167. z-index: 20;
  168. transform: translate(0, -50%);
  169. width: 40rpx;
  170. height: 40rpx;
  171. // background-image: url('@/static/images/search.png');
  172. // background-size: 100% 100%;
  173. .iamge {
  174. width: 40rpx;
  175. height: 40rpx;
  176. }
  177. }
  178. }
  179. .srceenBtn {
  180. position: relative;
  181. position: absolute;
  182. top: calc(var(--status-bar-height) + 420rpx);
  183. margin-top: 50rpx;
  184. display: flex;
  185. justify-content: center;
  186. align-items: center;
  187. gap: 10rpx;
  188. width: 268rpx;
  189. height: 80rpx;
  190. background: #c2e1fb;
  191. border-radius: 40rpx;
  192. .full-watch {
  193. font-weight: 500;
  194. font-size: 28rpx;
  195. color: #002f69;
  196. }
  197. .video {
  198. position: absolute;
  199. z-index: 0 !important;
  200. }
  201. .iamge {
  202. width: 40rpx;
  203. height: 40rpx;
  204. }
  205. }
  206. .xmmc {
  207. position: relative;
  208. top: 0rpx;
  209. left: 0rpx;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. width: 176rpx;
  214. height: 56rpx;
  215. background: #d3f4ff;
  216. border-radius: 0px 32rpx 0px 0px;
  217. font-weight: 500;
  218. font-size: 28rpx;
  219. color: #002f69;
  220. }
  221. .video-pro-list {
  222. width: 100%;
  223. padding: 10rpx 28rpx;
  224. .video-bg {
  225. padding: 34rpx;
  226. width: 100%;
  227. height: auto;
  228. background: #f5f5f5;
  229. border-radius: 0px 12rpx 0px 0px;
  230. }
  231. .video-pro-title {
  232. font-weight: 500;
  233. font-size: 28rpx;
  234. color: #222222;
  235. line-height: 40rpx;
  236. text-align: left;
  237. }
  238. .line {
  239. width: 100%;
  240. border-top: 2rpx dashed #b5b5b5;
  241. margin: 18rpx auto;
  242. }
  243. .video-pro-time {
  244. width: 100%;
  245. display: flex;
  246. justify-content: space-evenly;
  247. font-weight: 500;
  248. font-size: 24rpx;
  249. color: #999999;
  250. }
  251. .video-list {
  252. margin-top: 50rpx;
  253. width: 100%;
  254. display: grid;
  255. grid-template-columns: 100%;
  256. gap: 10rpx;
  257. .item-active {
  258. border: 4rpx solid #32c5ff !important;
  259. }
  260. .video-item {
  261. border: 4rpx solid transparent;
  262. box-sizing: border-box;
  263. height: 50rpx;
  264. display: flex;
  265. justify-content: left;
  266. uni-image {
  267. width: 100%;
  268. height: 100%;
  269. }
  270. .item-no {
  271. background-color: #c2e1fb;
  272. width: 42rpx;
  273. height: 42rpx;
  274. margin-right: 5px;
  275. text-align: center;
  276. }
  277. .num-active {
  278. background: #32c5ff !important;
  279. }
  280. .item-num {
  281. width: 20px;
  282. height: 16px;
  283. background: #0035a9;
  284. border-radius: 0px 0px 4px 0px;
  285. font-size: 10px;
  286. color: #ffffff;
  287. line-height: 16px;
  288. text-align: center;
  289. position: absolute;
  290. z-index: 1;
  291. }
  292. }
  293. }
  294. }
  295. .footer {
  296. width: 100%;
  297. display: flex;
  298. flex-direction: column;
  299. justify-content: center;
  300. align-items: center;
  301. padding-bottom: 32rpx;
  302. margin-top: 40rpx;
  303. .footer-word {
  304. font-weight: 500;
  305. font-size: 24rpx;
  306. color: #dddddd;
  307. line-height: 44rpx;
  308. letter-spacing: 4rpx;
  309. }
  310. }
  311. }
  312. </style>