|
@@ -0,0 +1,273 @@
|
|
|
+<template>
|
|
|
+ <view class="video-pagesCons">
|
|
|
+ <view class="tab-body">
|
|
|
+ <view>
|
|
|
+ <u-tabs-swiper ref="uTabs" :list="tabList" :offset="[5,40]" bar-width='100' active-color="#1283d4" name="dispName" :current="current" @change="tabsChange" :is-scroll="false"
|
|
|
+ swiperWidth="750"></u-tabs-swiper>
|
|
|
+ </view>
|
|
|
+ <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
|
|
|
+ <swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;" v-for="(tabs, indexs) in tabList" :key="indexs">
|
|
|
+ <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
|
|
|
+ <view
|
|
|
+ class="check-order-list"
|
|
|
+ v-for="(item,index) in list"
|
|
|
+ :key="item.id"
|
|
|
+ @click="viewRow(item)"
|
|
|
+ >
|
|
|
+ <view class="video-item">
|
|
|
+ <view>
|
|
|
+ <view class="play-btn" v-if="!item.showVideo&&item.contentType == 'VIDEO'">
|
|
|
+ <u-icon size="24" color="#fff" name="play-right-fill"></u-icon>
|
|
|
+ </view>
|
|
|
+ <view class="pnums" v-if="!item.showVideo&&item.contentType == 'VIDEO'">
|
|
|
+ <u-icon size="30" color="#fff" name="eye-fill"></u-icon>
|
|
|
+ {{item.viewNum}}
|
|
|
+ </view>
|
|
|
+ <u-image :src="item.imageSet[0]" height="200px" width="100%"></u-image>
|
|
|
+ </view>
|
|
|
+ <view class="ellipsis-two">{{item.titile}}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view style="padding: 20upx;">
|
|
|
+ <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
|
|
|
+ <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
+ </swiper-item>
|
|
|
+ </swiper>
|
|
|
+ </view>
|
|
|
+ <u-tabbar :list="vuex_tabBarList" :before-switch="beforeSwitch" :mid-button="false"></u-tabbar>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ mapState,
|
|
|
+ mapMutations,
|
|
|
+ } from 'vuex'
|
|
|
+ import { getVideoList, videoDetail } from "@/api/video.js"
|
|
|
+ import { openWebView } from "@/utils/index.js"
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ status: 'loading',
|
|
|
+ noDataText: '暂无数据',
|
|
|
+ current: 0,
|
|
|
+ swiperCurrent: 0,
|
|
|
+ // 查询条件
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ videoObj:null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['hasLogin','vuex_vinScanNums','vuex_scanMaxNums','vuex_tabBarList','vuex_videoTypeList']),
|
|
|
+ userInfo(){
|
|
|
+ return this.$store.state.vuex_userInfo
|
|
|
+ },
|
|
|
+ tabList(){
|
|
|
+ return this.$store.state.vuex_videoTypeList
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad() {
|
|
|
+ this.pageInit()
|
|
|
+ },
|
|
|
+ onHide() {
|
|
|
+ this.list.map(item => {
|
|
|
+ item.showVideo = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ pageInit(){
|
|
|
+ this.total = 0
|
|
|
+ this.pageNo = 1
|
|
|
+ this.getRow()
|
|
|
+ },
|
|
|
+ // tabs通知swiper切换
|
|
|
+ tabsChange(index) {
|
|
|
+ this.swiperCurrent = index;
|
|
|
+ },
|
|
|
+ swiperChange(event){
|
|
|
+ console.log(event.detail)
|
|
|
+ this.list = []
|
|
|
+ this.status = "loading"
|
|
|
+ },
|
|
|
+ // swiper-item左右移动,通知tabs的滑块跟随移动
|
|
|
+ transition(e) {
|
|
|
+ let dx = e.detail.dx;
|
|
|
+ this.$refs.uTabs.setDx(dx);
|
|
|
+ },
|
|
|
+ // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
|
|
|
+ // swiper滑动结束,分别设置tabs和swiper的状态
|
|
|
+ animationfinish(e) {
|
|
|
+ let current = e.detail.current;
|
|
|
+ if(current != this.current){
|
|
|
+ this.$refs.uTabs.setFinishCurrent(current);
|
|
|
+ this.swiperCurrent = current;
|
|
|
+ this.current = current;
|
|
|
+ this.pageInit()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // scroll-view到底部加载更多
|
|
|
+ onreachBottom() {
|
|
|
+ console.log(this.list.length, this.total)
|
|
|
+ if(this.list.length < this.total){
|
|
|
+ this.pageNo += 1
|
|
|
+ this.getRow()
|
|
|
+ }else{
|
|
|
+ this.status = "nomore"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 查询列表
|
|
|
+ getRow (pageNo) {
|
|
|
+ let _this = this
|
|
|
+ if (pageNo) {
|
|
|
+ this.pageNo = pageNo
|
|
|
+ }
|
|
|
+ let params = {
|
|
|
+ pageNo: this.pageNo,
|
|
|
+ pageSize: this.pageSize,
|
|
|
+ }
|
|
|
+ params.category = this.tabList ? this.tabList[this.swiperCurrent].code : ''
|
|
|
+ this.status = "loading"
|
|
|
+ getVideoList(params).then(res => {
|
|
|
+ if (res.code == 200 || res.status == 204 || res.status == 200) {
|
|
|
+ const list = res.data.list || []
|
|
|
+ list.map(item => {
|
|
|
+ item.showVideo = false
|
|
|
+ })
|
|
|
+ if(_this.pageNo>1){
|
|
|
+ _this.list = _this.list.concat(list)
|
|
|
+ }else{
|
|
|
+ _this.list = list
|
|
|
+ }
|
|
|
+ _this.total = res.data.count || 0
|
|
|
+ } else {
|
|
|
+ _this.list = []
|
|
|
+ _this.total = 0
|
|
|
+ _this.noDataText = res.message
|
|
|
+ }
|
|
|
+ _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 详细页
|
|
|
+ viewRow(item){
|
|
|
+ if(item.contentType == 'VIDEO' && !item.showVideo){
|
|
|
+ // item.showVideo = true
|
|
|
+ videoDetail({id: item.id}).then(res => {
|
|
|
+ if(res.data){
|
|
|
+ item.viewNum = res.data.viewNum
|
|
|
+ this.list.splice()
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/videos/detail?form=videoList&&title="+item.titile+"&&content="+item.content
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(item.contentType == 'LINK'){
|
|
|
+ openWebView({url:item.content})
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 扫描vin
|
|
|
+ beforeSwitch(index){
|
|
|
+ console.log(index)
|
|
|
+ if(index==1){
|
|
|
+ this.openCamera()
|
|
|
+ }else{
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 去扫描
|
|
|
+ openCamera(){
|
|
|
+ if(this.hasLogin){
|
|
|
+ if(this.userInfo.sysUserFlag == '0'){
|
|
|
+ if(this.vuex_vinScanNums < this.vuex_scanMaxNums){
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/scan-frame/scan-frame"
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '个人用户扫描VIN仅限10次,您的次数已用完!',
|
|
|
+ confirmText: '好的',
|
|
|
+ showCancel: false,
|
|
|
+ success(res) {}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/scan-frame/scan-frame"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/login/login'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less">
|
|
|
+ page{
|
|
|
+ height: 100vh;
|
|
|
+ }
|
|
|
+ .video-pagesCons{
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ .tab-body{
|
|
|
+ .check-list{
|
|
|
+ height: calc(100vh - 126px);
|
|
|
+ }
|
|
|
+ .check-order-list{
|
|
|
+ background: #ffffff;
|
|
|
+ padding: 20upx;
|
|
|
+ margin: 25upx;
|
|
|
+ border-radius: 10upx;
|
|
|
+ box-shadow: 1px 1px 3px #EEEEEE;
|
|
|
+ .video-item{
|
|
|
+ > view{
|
|
|
+ &:first-child{
|
|
|
+ position: relative;
|
|
|
+ .play-btn{
|
|
|
+ width: 40rpx;
|
|
|
+ height: 40rpx;
|
|
|
+ background: rgba(0,0,0,0.35);
|
|
|
+ border-radius: 150rpx;
|
|
|
+ position: absolute;
|
|
|
+ top: 20rpx;
|
|
|
+ right:30rpx;
|
|
|
+ z-index: 100;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ }
|
|
|
+ .pnums{
|
|
|
+ position: absolute;
|
|
|
+ left:20rpx;
|
|
|
+ bottom: 20rpx;
|
|
|
+ background: rgba(0,0,0,0.35);
|
|
|
+ padding: 4rpx 10rpx;
|
|
|
+ border-radius: 50rpx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ color:#fff;
|
|
|
+ z-index: 110;
|
|
|
+ font-size: 24rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &:last-child{
|
|
|
+ text-align: center;
|
|
|
+ font-size: 36rpx;
|
|
|
+ margin: 20rpx 0 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|