case.vue 5.68 KB
<template>
  <view class="container">
    <view class="bg"></view>
    <view class="box">
      <view class="input-box">
        <input
          type="text"
          class="input"
          :value="name"
          maxlength="50"
          @blur="input($event)"
          @focus="focus"
        />
        <view class="input-tips" v-if="!isSearch"
          >搜索图片/视频名称<uni-icons
            type="search"
            class="icon"
            color="#999"
            size="20"
          ></uni-icons
        ></view>
      </view>

      <scroll-view
        class="record-box"
        scroll-y
        @scrolltolower="pageonReachBottom"
        @scroll="scroll"
      >
        <view class="list">
          <template v-if="list.length">
            <template v-for="item in list">
              <view class="item" :key="item.id">
                <view class="item-autio" @click="playVideo(item)">
                  <image :src="item.coverUrl" class="cover-box"></image>
                  <image
                    v-if="item.sourceType == 2"
                    src="../../assets/images/boutique/play.png"
                    class="play-box"
                  ></image>
                </view>
                <view class="item-desc">{{ item.tabName }}</view>
              </view>
            </template>
          </template>
          <template v-else>
            <view class="nothing flex">
              <image class="icon" src="../../assets/images/home/nothing.webp" />
              暂无数据
            </view>
          </template>
        </view>
      </scroll-view>
    </view>
    <view class="popup-box" v-if="popupShow">
      <view class="nav-bar">
        <view class="back" @click="back">
          <uni-icons type="left" :size="24" color="#fff"></uni-icons>
        </view>
        <view class="title">{{ title }}</view>
      </view>
      <view class="popup-body">
        <video ref="videoPlayer" :src="videoSrc" controls></video>
      </view>
    </view>
  </view>
</template>
<script type="text/ecmascript-6">
import utils from "@/utils/utils";
export default {
  name: '',
  data () {
    return {
      name:'',
      list: [],
      popupShow:false,
      isSearch:false,
      videoSrc: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4',
    }
  },
  props: {
    views: {
      type: Array,
      default: () => []
    }
  },
  beforeDestroy() {
    this.popupShow  = false
  },
  mounted() {
    // this.list = utils.deepClone(this.views)
    console.log(this.views)
    this.list = this.views
  },
  methods: {
    playVideo(item) {
    const {tabName,sourceType,detailUrl} = item
    uni.navigateTo({
        url: `/pages/boutique/preview?tabName=${tabName}&sourceType=${sourceType}&detailUrl=${detailUrl}`
      })
    },
    focus() {
      this.isSearch = true

    },
    input(e) {
        this.name = e.detail.value
        if(this.name == '')
        this.isSearch = false
        this.list = this.views.filter(i=>i.tabName.includes(this.name))
    },
  },
}
</script>
<style scoped lang="scss">
.container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-image: linear-gradient(180deg, #f2f6ff 0%, #f7f9ff 100%);
  overflow: hidden;
  .bg {
    width: 100%;
    height: 800rpx;
    position: absolute;
    left: 0;
    background-image: url("../../assets/images/boutique/record-bg.png");
    background-size: 100% 100%;
    top: 0;
  }
  .box {
    padding: 64rpx;
    margin-top: 120rpx;
    .input-box {
      position: relative;
      .input {
        padding-left: 30rpx;
        text-align: center;
        height: 80rpx;
        background: #ffffff;
        border: 3rpx solid #a8c1ff;
        border-radius: 16rpx;
        width: 100%;
        line-height: 80rpx;
        z-index: 1;
      }
      .input-tips {
        color: #999999;
        position: absolute;
        left: 0;
        top: 0;
        height: 80rpx;
        width: 100%;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        pointer-events: none;
        .icon {
          margin-left: 12rpx;
        }
      }
    }
    .list {
      display: flex;
      flex-wrap: wrap;
      gap: 48rpx 60rpx;
      padding-top: 48rpx;
      .item {
        width: 404rpx;
        height: 544rpx;
        background: #ffffff;
        box-shadow: 0 8rpx 24rpx 0 #4673ff1a;
        border-radius: 48rpx;
        .item-autio {
          height: 404rpx;
          position: relative;
          .cover-box {
            width: 100%;
            height: 100%;
          }
          .play-box {
            width: 48rpx;
            height: 48rpx;
            position: absolute;
            left: 32rpx;
            bottom: 32rpx;
          }
        }
        .item-desc {
          height: 140rpx;
          padding: 28rpx 32rpx;
          font-size: 32rpx;
          color: #333333;
        }
      }
    }
  }
}
.popup-box {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  padding: 100rpx 0rpx;
  z-index: 100;
  .nav-bar {
    width: 100%;
    height: 96rpx;
    .back {
      height: 100%;
      aspect-ratio: 1/1;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .title {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      font-weight: 500;
      font-size: 32rpx;
      color: #ffffff;
    }
  }
  .popup-body {
    width: 100%;
    height: 100%;
    video {
      width: 100%;
      height: 100%;
    }
  }
}
.nothing {
  width: 100vw;
  flex-direction: column;
  margin-top: 112rpx;
  font-size: 28rpx;
  color: #999999;
  .icon {
    width: 676rpx;
    height: 284rpx;
    margin-bottom: 24rpx;
  }
}
</style>