123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- <template>
- <view class="container">
- <div class="top">
- <div class="header">
- <img class="logo" src="/static/logo_big.png" alt="">
- <u--image
- class="border"
- :showLoading="true"
- :src="info.avatar || '/static/image/match/teams_avatar_ico@2x.png'"
- @click="go('/pages/Match/member/usermanger', true)"
- width="24px"
- height="24px"
- shape="circle"
- ></u--image>
- </div>
- <div class="title-box">
- <!-- Videos -->
- {{ $t('video.lab') }}
- </div>
- </div>
-
- <view class="" style="padding: 20rpx 18rpx;">
- <view class="left">
- <view class="waterfall-item" @click="onTap(params,index)" v-for="(params,index) in leftList" :key="index">
- <view class="waterfall-item-img">
- <u--image
- :showLoading="true"
- radius="12"
- :src="params.flie[0].img"
- width="100%"
- mode="aspectFill"
- height="404rpx"
- >
- <template v-slot:loading>
- <image class="loading-banner-img" src="/static/image/common/video-list-bg.png" mode="aspectFill"></image>
- </template>
- </u--image>
- <view class="content">
- <view class="flex-end">
- <!-- <view class="flex-start">
- <image src="/static/image/videos/video6.png" mode=""></image>
- <u--text color="#fff" margin="0 12rpx" :text="numberToK(params.click)"></u--text>
- </view> -->
- <view class="flex-start">
- <image src="/static/image/videos/video5.png" mode=""></image>
- <u--text color="#fff" margin="0 12rpx" :text="numberToK(params.likes)"></u--text>
- </view>
- </view>
- </view>
- </view>
- <view class="c3 waterfall-title"><text class="text-clamp2">{{params.title}}</text></view>
- </view>
- </view>
- <view class="right">
- <view class="waterfall-item" @click="onTap(params,index)" v-for="(params,index) in rightList" :key="index">
- <view class="waterfall-item-img">
- <image class="cover" :src="params.flie[0].img" mode="widthFix"></image>
- <view class="content">
- <view class="flex-end">
- <!-- <view class="flex-start">
- <image src="/static/image/videos/video6.png" mode=""></image>
- <u--text color="#fff" margin="0 12rpx" :text="numberToK(params.click)"></u--text>
- </view> -->
- <view class="flex-start">
- <image src="/static/image/videos/video5.png" mode=""></image>
- <u--text color="#fff" margin="0 12rpx" :text="numberToK(params.likes)"></u--text>
- </view>
- </view>
- </view>
- </view>
- <view class="c3 waterfall-title"><text class="text-clamp2">{{params.title}}</text></view>
- </view>
- <image src="/static/image/videos/add.png" @click="toUrl()" class="publishicon"></image>
- </view>
- </view>
- <view class="load-txt" v-if="obj.total != 0">{{status}}</view>
- <u-empty v-if="obj.total == 0" mode="data" width="474" height="312" textSize="28" marginTop="100"
- :text="$t('common.nodata')" icon="/static/image/common/nodata.png">
- </u-empty>
- <div class="news-install">
- <install></install>
- </div>
- </view>
- </template>
- <script>
- import { numberToK } from '@/utils/util'
- import install from '@/components/install/install.vue'
- export default {
- components: {
- install
- },
- data() {
- return {
- // 初始化左右盒子
- leftList: [],
- rightList: [],
- // 初始化左右盒子高度
- leftH: 0,
- rightH: 0,
- obj: {
- total: 1
- },
- page: 1,
- status: 'loadmore'
- }
- },
- computed: {
- info() {
- return this.$store.state.info;
- },
- isLogin() {
- return this.$store.state.isLogin;
- },
- },
- onReady() {
- this.getList();
- },
- // 触底触发
- onReachBottom() {
- if (this.status == 'loadmore') {
- this.page++;
- this.getList();
- }
- },
- // 下拉刷新
- onPullDownRefresh() {
- // 正常情况下接口返回应该很会很快。故意延迟调用,让用户有在刷新的体验感
- this.page = 1;
- this.rightList = [];
- this.leftList = [];
- this.getList();
- },
- methods: {
- onTap(data,index) {
- let videoList_index =Number(index)
- this.$toUrl('./live?id=' + data.id+'&index='+videoList_index)
- },
- toUrl() {
- this.$toUrl('./publish')
- },
- // 获取数据
- getList() {
- // 设置状态为加载中
- this.status = 'loading';
- uni.$u.http.get('/api/Video/getList', {
- params: {
- page: this.page,
- type: 1
- }
- }).then(res => {
- // 获取到的数据,请注意数据结构
- // 第一页数据执行以下代码
- if (this.page == 1) {
- // 关闭下拉
- this.leftList=res.data
- // uni.stopPullDownRefresh();
- // 设置组件状态为 重置,可供下拉刷新这类需要重置列表功能时使用
- } else {
- this.leftList = this.leftList.concat(res.data || [])
- }
- this.obj = res;
- this.setList(res)
- }).catch(res => {})
- },
- numberToK(v) {
- return numberToK(v)
- },
- setList(obj) {
- let that = this;
- // obj.data.forEach(res => {
- // // 获取图片宽高
- // // console.log(res.flie[0].img);
- // uni.getImageInfo({
- // src: res.flie[0].img,
- // success: (image) => {
- // // console.log(res.src)
- // // 计算图片渲染高度
- // let showH = (50 * image.height) / image.width
- // // 判断左右盒子高度
- // if (that.leftH <= that.rightH) {
- // that.leftList.push(res)
- // that.leftH += showH
- // } else {
- // that.rightList.push(res)
- // that.rightH += showH
- // }
- // }
- // })
- // })
- let total = this.leftList.length + this.rightList.length;
- if (obj.total > total) {
- this.status = 'loadmore'
- } else {
- this.status = 'No more data'
- }
- },
- go(url, login) {
- if (this.isLogin == 2 && login) {
- this.$toUrl('/pages/login/login')
- return
- }
- this.$toUrl(url)
- },
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: #f3f3f3;
- }
- .container {
- padding-bottom: 140rpx;
- }
- .top {
- position: sticky;
- top: 0;
- z-index: 999;
- .header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 8rpx 16px 16rpx;
- background-color: #10044A;
- }
- .logo {
- height: 24px;
- }
- .border {
- border: 1px solid #CC2900;
- border-radius: 50%;
- }
- .title-box {
- height: 40px;
- background-color: #262E4A;
- padding: 0 16px;
- display: flex;
- align-items: center;
- color: #fff;
- font-weight: 500;
- font-size: 16px;
- }
- }
- .waterfall-item {
- background-color: #fff;
- border-radius: 12rpx;
- overflow: hidden;
- font-size: 28rpx;
- color: #666;
- margin-bottom: 20rpx;
- .waterfall-title {
- padding: 20rpx 10rpx;
- font-weight: 700;
- }
- .waterfall-item-img {
- position: relative;
- .loading-banner-img {
- width: 100%;
- height: 404rpx;
- }
- .content {
- color: #fff;
- font-size: 24rpx;
- position: absolute;
- bottom: 16rpx;
- right: 16rpx;
- left: 16rpx;
- image {
- width: 24rpx;
- height: 24rpx;
- }
- }
- }
- .cover {
- display: block;
- width: 100%;
- border-radius: 12rpx 12rpx 0 0;
- // 默认设置一个图片的大约值
- // height: 450rpx;
- // min-height: 600rpx;
- }
- }
- .load-txt {
- padding: 0 0 20rpx 0;
- text-align: center;
- color: #999;
- font-size: 24rpx;
- }
- .publishicon {
- position: fixed;
- right: 32rpx;
- bottom: 220rpx;
- width: 94rpx;
- height: 94rpx;
- z-index: 99;
- }
- .news-install {
- position: fixed;
- left: 0;
- right: 0;
- bottom: var(--window-bottom);
- z-index: 200;
- }
- </style>
|