123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- <template>
- <view class="container">
- <page-title>现场影像</page-title>
- <view class="tabs">
- <u-tabs :list="list1" @click="changeTabs" activeStyle='color:#1763E7' :scrollable='false'
- lineWidth='174rpx'></u-tabs>
- </view>
- <view class="cards-list marginTop" v-if="tabFlag == 0">
- <view class="card" v-for="(item,index) in iamgetList" :key="index">
- <view class="card-box1">
- <image :src="item.fileAddre" alt="" class="iamgeSize" @click='viewImg(item.fileAddre)'></image>
- <view class="text-box">
- <text class="name">{{item.kind}}</text>
- <text class="time">时间:</text>
- <text class="timeValue">{{item.time}}</text>
- </view>
- </view>
- </view>
- <empty-show v-if="iamgetList.length===0" showText='暂无图片'></empty-show>
- </view>
- <view class="cards-list marginTop" v-if="tabFlag == 1">
- <view class="cards" v-for="(item,index) in videoList" :key="index">
- <video :src="item.fileAddre" class="videoSize" :show-fullscreen-btn='false'></video>
- <view class="text-box">
- <text>{{item.kind}}</text>
- <text>{{item.time}}</text>
- </view>
- <div class="videoClick" @click="videoClick(item)"></div>
- </view>
- <empty-show v-if="videoList.length===0" showText='暂无视频'></empty-show>
- </view>
- <u-loading-page :loading="loading"></u-loading-page>
- </view>
- </template>
- <script setup>
- import {
- ref
- } from 'vue';
- import {
- onLoad,
- onUnload,
- onPullDownRefresh,
- onReachBottom,
- onPageScroll
- } from "@dcloudio/uni-app";
- import {
- getPageMediaOfSub,
- } from "@/api/work/projectInfo.js";
- import {
- addFocus,
- cancelFocus
- } from "@/api/work/focus.js";
- function backToBefore() {
- uni.reLaunch({
- url: "/pages/index"
- });
- };
- let scrollTop = ref(0)
- let loading = ref(true)
- // 参数
- let searchInfo = ref({
- pageNo: 1,
- pageSize: 10,
- subId: '',
- type: ""
- })
- let list1 = [{
- name: '图片',
- }, {
- name: '视频',
- }]
- //图片预览
- function viewImg(e) {
- let imglist = [e]
- uni.previewImage({
- longPressActions: true,
- urls: imglist
- })
- }
- // 播放文件--视频
- function videoClick(event) {
- showFile(event.fileType, event.fileAddre)
- }
- // 文件预览
- function showFile(type, filePath) {
- uni.navigateTo({
- url: `/pages/projectInfo/media/index?type=${type}&filePath=${filePath}`
- })
- }
- //切换tab
- let tabFlag = 0
- function changeTabs(e) {
- tabFlag = e.index
- searchInfo.value.pageNo = 1;
- iamgetList.value = [];
- videoList.value = [];
- getList()
- }
- // 触底加载flag
- let moreListFlag = true
- // 获取列表
- let iamgetList = ref([]);
- let videoList = ref([]);
- let listTotal = ref(0);
- function getList() {
- if (searchInfo.value.pageNo == 1) {
- loading.value = true
- }
- if (tabFlag === 0) {
- searchInfo.value.type = 'IMAGE'
- getPageMediaOfSub(searchInfo.value).then(res => {
- loading.value = false
- iamgetList.value = iamgetList.value.concat(res.data.list);
- listTotal.value = res.data.total;
- if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list
- .length)) moreListFlag = false;
- }).catch(() => {
- loading.value = false
- })
- } else if (tabFlag === 1) {
- searchInfo.value.type = 'VEDIO'
- getPageMediaOfSub(searchInfo.value).then(res => {
- loading.value = false
- videoList.value = videoList.value.concat(res.data.list);
- listTotal.value = res.data.total;
- if (res.data.total == searchInfo.value.pageNo * searchInfo.value.pageSize - (10 - res.data.list
- .length)) moreListFlag = false;
- }).catch(() => {
- loading.value = false
- })
- }
- }
- // function goToDetail(id, subName) {
- // uni.navigateTo({
- // url: `/pages/projectInfo/detail/index?id=${id}&subName=${subName}`
- // })
- // }
- // function goToPage(url) {
- // uni.navigateTo({
- // url
- // })
- // }
- // function goToReport(type, subId, subName) {
- // uni.navigateTo({
- // url: `/pages/projectInfo/report/index?type=${type}&subId=${subId}&subName=${subName}`
- // })
- // }
- onLoad((options) => {
- // uni.$on('projectInfoSearch', resolve => {
- // searchInfo.value = Object.assign(searchInfo.value, resolve);
- // searchInfo.value.pageNo = 1;
- // projectList.value = [];
- // listTotal.value = 0;
- // moreListFlag = true;
- // getList();
- // });
- console.log(options);
- searchInfo.value.subId = options.subId
- getList();
- });
- onUnload(() => {
- // uni.$off('projectInfoSearch');
- })
- onPageScroll((e) => {
- scrollTop.value = e.scrollTop
- })
- onPullDownRefresh(() => {
- searchInfo.value.pageNo = 1;
- iamgetList.value = [];
- videoList.value = [];
- moreListFlag = true;
- try {
- getList();
- } finally {
- uni.stopPullDownRefresh()
- }
- })
- onReachBottom(() => {
- if (!moreListFlag) {
- return uni.showToast({
- title: "已经到底了。",
- icon: "none",
- duration: 2000
- })
- }
- searchInfo.value.pageNo++;
- getList();
- })
- </script>
- <style lang="scss" scoped>
- .tabs {
- position: absolute;
- top: 240rpx;
- left: 50%;
- transform: translate(-50%);
- z-index: 100;
- width: 92%;
- border-radius: 20rpx 20rpx 20rpx 20rpx;
- height: 90rpx;
- background: #FFFFFF;
- }
- .marginTop {
- margin-top: 190rpx;
- }
- .videoSize {
- position: absolute;
- z-index: 0;
- width: 100%;
- height: 364rpx;
- border-radius: 20rpx 20rpx 0 0;
- }
- .card-box1 {
- padding-top: 40rpx;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- .text-box {
- margin-left: 40rpx;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: center;
- .name {
- font-size: 32rpx;
- font-weight: 400;
- font-family: OPPOSans-R;
- }
- .time {
- padding-top: 20rpx;
- font-size: 28rpx;
- color: #797F89;
- font-weight: 400;
- }
- .timeValue {
- padding-top: 10rpx;
- font-family: OPPOSans-R;
- font-size: 32rpx;
- font-weight: 400;
- }
- }
- }
- .iamgeSize {
- width: 272rpx;
- height: 222rpx;
- box-shadow: 0rpx 8rpx 12rpx 0rpx rgba(0, 0, 0, 0.21);
- border-radius: 10rpx 10rpx 10rpx 10rpx;
- }
- .cards {
- position: relative;
- margin: auto;
- border-radius: 20rpx;
- margin-top: 25rpx;
- background: #FFFFFF;
- height: 470rpx;
- overflow: hidden;
- .text-box {
- position: absolute;
- bottom: 0;
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 100%;
- height: 106rpx;
- padding: 0 40rpx 0 40rpx;
- font-family: OPPOSans-R;
- font-size: 32rpx;
- }
- .videoClick {
- position: absolute;
- top: -20rpx;
- z-index: 100;
- width: 100%;
- height: 100%;
- overflow: hidden;
- }
- }
- </style>
|