index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <view class="container">
  3. <page-title>现场影像</page-title>
  4. <!-- <view class="list-tip">
  5. <view class="tip-item">
  6. <image src="@/static/images/yearPlan.png" mode=""></image>
  7. <text>年度计划</text>
  8. </view>
  9. <view class="tip-item">
  10. <image src="@/static/images/problem.png" mode=""></image>
  11. <text>问题督办</text>
  12. </view>
  13. <view class="tip-item">
  14. <image src="@/static/images/qianqi.png" mode=""></image>
  15. <text>前期手续</text>
  16. </view>
  17. <view class="tip-item">
  18. <image src="@/static/images/leaderAndDepart.png" mode=""></image>
  19. <text>领导及部门</text>
  20. </view>
  21. <view class="tip-item">
  22. <image src="@/static/images/videoImage.png" mode=""></image>
  23. <text class="light">现场影像</text>
  24. <view class="saniao"></view>
  25. </view>
  26. </view> -->
  27. <view class="tabs">
  28. <u-tabs :list="list1" @click="changeTabs" activeStyle='color:#222222' :scrollable='false' lineWidth='0'></u-tabs>
  29. </view>
  30. <view class="cards-list marginTop" v-if="tabFlag == 0">
  31. <view class="card" v-for="(item,index) in iamgetList" :key="index">
  32. <view class="card-box1">
  33. <view class="fileAddre-image">
  34. <image :src="item.fileAddre" alt="" class="" @click='viewImg(item.fileAddre)' v-if="item.fileAddre"></image>
  35. <image src="@/static/images/noImgVideo.svg" alt="" class="no-image-video" @click='viewImg(item.fileAddre)'
  36. v-else></image>
  37. </view>
  38. <view class="text-box">
  39. <text class="name">{{item.kind}}</text>
  40. <!-- <text class="time">时间:</text> -->
  41. <text class="timeValue">{{item.time}}</text>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- <empty-show v-if="iamgetList.length===0" showText='暂无图片'></empty-show> -->
  46. </view>
  47. <view class="cards-list marginTop" v-if="tabFlag == 1">
  48. <view class="card" v-for="(item,index) in videoList" :key="index">
  49. <view class="card-box1">
  50. <view class="fileAddre-image">
  51. <video :src="item.fileAddre" class="" :show-fullscreen-btn='false' v-if="item.fileAddre"></video>
  52. <image src="@/static/images/noImgVideo.svg" alt="" class="no-image-video" v-else></image>
  53. </view>
  54. <view class="text-box">
  55. <text class="name">{{item.kind}}</text>
  56. <text class="timeValue">{{item.time}}</text>
  57. </view>
  58. </view>
  59. <div class="videoClick" @click="videoClick(item)"></div>
  60. </view>
  61. </view>
  62. <u-loading-page :loading="loading"></u-loading-page>
  63. </view>
  64. </template>
  65. <script setup>
  66. import {
  67. ref
  68. } from 'vue';
  69. import {
  70. onLoad,
  71. onUnload,
  72. onPullDownRefresh,
  73. onReachBottom,
  74. onPageScroll
  75. } from "@dcloudio/uni-app";
  76. import {
  77. getPageMediaOfSub,
  78. } from "@/api/work/projectInfo.js";
  79. import {
  80. addFocus,
  81. cancelFocus
  82. } from "@/api/work/focus.js";
  83. function backToBefore() {
  84. uni.reLaunch({
  85. url: "/pages/index"
  86. });
  87. };
  88. let scrollTop = ref(0)
  89. let loading = ref(true)
  90. // 参数
  91. let searchInfo = ref({
  92. pageNo: 1,
  93. pageSize: 10,
  94. subId: '',
  95. type: ""
  96. })
  97. let list1 = [{
  98. name: '现场图片',
  99. }, {
  100. name: '现场视频',
  101. }]
  102. //图片预览
  103. function viewImg(e) {
  104. let imglist = [e]
  105. uni.previewImage({
  106. longPressActions: true,
  107. urls: imglist
  108. })
  109. }
  110. // 播放文件--视频
  111. function videoClick(event) {
  112. showFile(event.fileType, event.fileAddre)
  113. }
  114. // 文件预览
  115. function showFile(type, filePath) {
  116. uni.navigateTo({
  117. url: `/pages/projectInfo/media/index?type=${type}&filePath=${filePath}`
  118. })
  119. }
  120. //切换tab
  121. let tabFlag = 0
  122. function changeTabs(e) {
  123. tabFlag = e.index
  124. searchInfo.value.pageNo = 1;
  125. iamgetList.value = [];
  126. videoList.value = [];
  127. getList()
  128. }
  129. // 触底加载flag
  130. let moreListFlag = true
  131. // 获取列表
  132. let iamgetList = ref([]);
  133. let videoList = ref([]);
  134. let listTotal = ref(0);
  135. function getList() {
  136. if (searchInfo.value.pageNo == 1) {
  137. loading.value = true
  138. }
  139. if (tabFlag === 0) {
  140. searchInfo.value.type = 'IMAGE'
  141. getPageMediaOfSub(searchInfo.value).then(res => {
  142. loading.value = false
  143. iamgetList.value = iamgetList.value.concat(res.data.list);
  144. listTotal.value = res.data.total;
  145. if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list
  146. .length)) moreListFlag = false;
  147. }).catch(() => {
  148. loading.value = false
  149. })
  150. } else if (tabFlag === 1) {
  151. searchInfo.value.type = 'VEDIO'
  152. getPageMediaOfSub(searchInfo.value).then(res => {
  153. loading.value = false
  154. videoList.value = videoList.value.concat(res.data.list);
  155. listTotal.value = res.data.total;
  156. if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list
  157. .length)) moreListFlag = false;
  158. }).catch(() => {
  159. loading.value = false
  160. })
  161. }
  162. }
  163. // function goToDetail(id, subName) {
  164. // uni.navigateTo({
  165. // url: `/pages/projectInfo/detail/index?id=${id}&subName=${subName}`
  166. // })
  167. // }
  168. // function goToPage(url) {
  169. // uni.navigateTo({
  170. // url
  171. // })
  172. // }
  173. // function goToReport(type, subId, subName) {
  174. // uni.navigateTo({
  175. // url: `/pages/projectInfo/report/index?type=${type}&subId=${subId}&subName=${subName}`
  176. // })
  177. // }
  178. onLoad((options) => {
  179. // uni.$on('projectInfoSearch', resolve => {
  180. // searchInfo.value = Object.assign(searchInfo.value, resolve);
  181. // searchInfo.value.pageNo = 1;
  182. // projectList.value = [];
  183. // listTotal.value = 0;
  184. // moreListFlag = true;
  185. // getList();
  186. // });
  187. console.log(options);
  188. searchInfo.value.subId = options.subId
  189. getList();
  190. });
  191. onUnload(() => {
  192. // uni.$off('projectInfoSearch');
  193. })
  194. onPageScroll((e) => {
  195. scrollTop.value = e.scrollTop
  196. })
  197. onPullDownRefresh(() => {
  198. searchInfo.value.pageNo = 1;
  199. iamgetList.value = [];
  200. videoList.value = [];
  201. moreListFlag = true;
  202. try {
  203. getList();
  204. } finally {
  205. uni.stopPullDownRefresh()
  206. }
  207. })
  208. onReachBottom(() => {
  209. if (!moreListFlag) {
  210. return uni.showToast({
  211. title: "已经到底了。",
  212. icon: "none",
  213. duration: 2000
  214. })
  215. }
  216. searchInfo.value.pageNo++;
  217. getList();
  218. })
  219. </script>
  220. <style lang="scss" scoped>
  221. .tabs {
  222. position: absolute;
  223. top: 140rpx;
  224. left: 50%;
  225. transform: translate(-50%);
  226. z-index: 100;
  227. width: 92%;
  228. border-radius: 20rpx 20rpx 20rpx 20rpx;
  229. height: 90rpx;
  230. background: #FFFFFF;
  231. }
  232. .u-tabs__wrapper__nav__item__text[data-v-5012af6c] {
  233. font-weight: 500;
  234. font-size: 32rpx;
  235. color: #B5B5B5;
  236. }
  237. .marginTop {
  238. margin-top: 190rpx;
  239. }
  240. .videoSize {
  241. position: absolute;
  242. z-index: 0;
  243. width: 100%;
  244. height: 364rpx;
  245. border-radius: 20rpx 20rpx 0 0;
  246. }
  247. .card {
  248. .videoClick {
  249. position: absolute;
  250. top: -20rpx;
  251. z-index: 100;
  252. width: 100%;
  253. height: 100%;
  254. overflow: hidden;
  255. }
  256. }
  257. .card-box1 {
  258. // padding-top: 40rpx;
  259. padding-bottom: 24rpx;
  260. display: flex;
  261. justify-content: flex-start;
  262. align-items: center;
  263. .fileAddre-image {
  264. width: 304rpx;
  265. height: 172rpx;
  266. background: #F6F6F6;
  267. border-radius: 4rpx;
  268. border: 2rpx solid #EBEBEB;
  269. display: flex;
  270. justify-content: center;
  271. align-items: center;
  272. image {
  273. width: 100%;
  274. height: 100%;
  275. }
  276. video {
  277. width: 100%;
  278. height: 100%;
  279. }
  280. .no-image-video {
  281. width: 80rpx;
  282. height: 80rpx;
  283. }
  284. }
  285. .text-box {
  286. margin-left: 40rpx;
  287. display: flex;
  288. flex-direction: column;
  289. align-items: flex-start;
  290. justify-content: flex-start;
  291. height: 160rpx;
  292. .name {
  293. font-weight: 500;
  294. font-size: 32rpx;
  295. color: #444444;
  296. }
  297. .time {
  298. padding-top: 20rpx;
  299. font-size: 28rpx;
  300. color: #797F89;
  301. font-weight: 400;
  302. }
  303. .timeValue {
  304. width: 220rpx;
  305. padding-top: 10rpx;
  306. font-weight: 500;
  307. font-size: 28rpx;
  308. color: #999999 !important;
  309. line-height: 28rpx;
  310. }
  311. }
  312. }
  313. .iamgeSize {
  314. width: 272rpx;
  315. height: 222rpx;
  316. box-shadow: 0rpx 8rpx 12rpx 0rpx rgba(0, 0, 0, 0.21);
  317. border-radius: 10rpx 10rpx 10rpx 10rpx;
  318. }
  319. .cards {
  320. position: relative;
  321. margin: auto;
  322. border-radius: 20rpx;
  323. margin-top: 25rpx;
  324. background: #FFFFFF;
  325. height: 470rpx;
  326. overflow: hidden;
  327. display: flex;
  328. .text-box {
  329. position: absolute;
  330. bottom: 0;
  331. display: flex;
  332. justify-content: space-between;
  333. align-items: center;
  334. width: 100%;
  335. height: 106rpx;
  336. padding: 0 40rpx 0 40rpx;
  337. font-family: OPPOSans-R;
  338. font-size: 32rpx;
  339. }
  340. }
  341. .list-tip {
  342. width: 750rpx;
  343. height: 164rpx;
  344. background: #FFFFFF;
  345. box-shadow: 0px 4rpx 8rpx 0px #D8EEFF;
  346. display: flex;
  347. flex-direction: row;
  348. justify-content: space-around;
  349. align-items: center;
  350. .tip-item {
  351. display: flex;
  352. flex-direction: column;
  353. align-items: center;
  354. position: relative;
  355. image {
  356. width: 72rpx;
  357. height: 72rpx;
  358. }
  359. text {
  360. font-weight: 300;
  361. font-size: 24rpx;
  362. color: #666666;
  363. }
  364. .light {
  365. font-weight: 500;
  366. color: #222222 !important;
  367. }
  368. .saniao {
  369. position: absolute;
  370. bottom: -34px;
  371. left: 35%;
  372. width: 0;
  373. height: 0;
  374. border: 10px solid #FFFFFF;
  375. border-bottom-color: transparent;
  376. border-left-color: transparent;
  377. border-right-color: transparent;
  378. }
  379. }
  380. }
  381. .container {
  382. padding-top: calc(var(--status-bar-height) + 50px);
  383. }
  384. </style>