123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451 |
- <template>
- <view class="content">
- <view class="one">
- <view class="one_1">
- <input type="text" v-model="searchInfo.title" @blur="toInput" placeholder="请输入视频名称">
- </view>
- <view class="one_2">
- <button size="mini" @tap="toFilter()">筛选</button>
- </view>
- </view>
- <view class="two">
- <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
- <view class="list-scroll-view">
- <view class="two_1">
- <view class="list" v-for="(item,index) in list" :key="index" @tap="videoView(item)">
- <image class="image" :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''"
- mode="">
- </image>
- <view class="name textOver">
- {{item.title}}
- </view>
- <view class="other">
- <view class="other_1">
- <uni-icons type="eye" color="var(--rgbfff)" size="12"></uni-icons>
- {{item.view_num}}
- </view>
- <view class="other_2">
- {{item.time_num}}
- </view>
- </view>
- <view class="vip" v-if="item.is_vip=='1'">
- <span>VIP</span>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- <c-drawer :drawer="drawer" @toClose="toClose">
- <view class="drawer_one">
- <view class="drawer_one_1">
- <uni-forms ref="searchInfo" :model="searchInfo" label-width="auto">
- <uni-forms-item>
- <template>
- <view class="label">是否VIP</view>
- <view class="value">
- <uni-data-checkbox mode="tag" v-model="searchInfo.is_vip" :localdata="isnoList"
- :map="{text:'label',value:'value'}"></uni-data-checkbox>
- </view>
- </template>
- </uni-forms-item>
- <uni-forms-item>
- <template>
- <view class="label">是否热推</view>
- <view class="value">
- <uni-data-checkbox mode="tag" v-model="searchInfo.is_hot" :localdata="isnoList"
- :map="{text:'label',value:'value'}"></uni-data-checkbox>
- </view>
- </template>
- </uni-forms-item>
- <uni-forms-item>
- <template>
- <view class="label">厂商</view>
- <view class="value">
- <uni-data-checkbox mode="tag" v-model="searchInfo.firm_id" :localdata="firmList"
- :map="{text:'title',value:'id'}"></uni-data-checkbox>
- </view>
- </template>
- </uni-forms-item>
- <uni-forms-item>
- <template>
- <view class="label">类型</view>
- <view class="value">
- <uni-data-checkbox mode="tag" v-model="searchInfo.type_id" :localdata="typeList"
- :map="{text:'title',value:'id'}"></uni-data-checkbox>
- </view>
- </template>
- </uni-forms-item>
- <uni-forms-item>
- <template>
- <view class="label">产地</view>
- <view class="value">
- <uni-data-checkbox mode="tag" v-model="searchInfo.place_id" :localdata="placeList"
- :map="{text:'title',value:'id'}"></uni-data-checkbox>
- </view>
- </template>
- </uni-forms-item>
- <uni-forms-item>
- <template>
- <view class="label">年份</view>
- <view class="value">
- <uni-data-checkbox mode="tag" v-model="searchInfo.year" :localdata="yearList"
- :map="{text:'title',value:'id'}"></uni-data-checkbox>
- </view>
- </template>
- </uni-forms-item>
- <uni-forms-item>
- <template>
- <view class="label">领衔演员</view>
- <view class="value">
- <uni-data-checkbox mode="tag" v-model="searchInfo.head_actor" :localdata="actorList"
- :map="{text:'title',value:'id'}"></uni-data-checkbox>
- </view>
- </template>
- </uni-forms-item>
- </uni-forms>
- </view>
- <view class="drawer_one_2">
- <button size="mini" @tap="toReset()">重置</button>
- <button size="mini" @tap="toSave()">确认</button>
- </view>
- </view>
- </c-drawer>
- </view>
- </template>
- <script>
- import cDrawer from "../components/c-drawer.vue";
- export default {
- components: {
- cDrawer
- },
- data() {
- return {
- searchInfo: {},
- list: [],
- total: 0,
- page: 0,
- skip: 0,
- limit: 10,
- // 数据是否触底
- is_bottom: false,
- scrollTop: 0,
- drawer: {
- title: '筛选',
- show: false,
- mode: 'right'
- },
- // 字典表
- isnoList: [],
- firmList: [],
- typeList: [],
- placeList: [],
- yearList: [],
- actorList: [],
- }
- },
- async onLoad() {
- const that = this;
- await that.searchOther();
- await that.search();
- },
- onHide() {
- const that = this;
- // that.clearPage()
- },
- onPullDownRefresh: async function() {
- const that = this;
- that.clearPage();
- await that.search();
- uni.stopPullDownRefresh();
- },
- methods: {
- async search() {
- const that = this;
- let info = {
- skip: that.skip,
- limit: that.limit,
- }
- let res = await that.$api('videos', 'GET', {
- ...info,
- ...that.searchInfo,
- })
- if (res.errcode == '0') {
- let list = [...that.list, ...res.data]
- that.$set(that, `list`, list);
- that.$set(that, `total`, res.total);
- }
- },
- toInput(e) {
- const that = this;
- let title = e.detail.value;
- if (title) that.$set(that.searchInfo, `title`, title);
- else delete that.searchInfo.title;
- that.clearPage();
- that.search()
- },
- toPage() {
- const that = this;
- let list = that.list;
- let limit = that.limit;
- if (that.total > list.length) {
- uni.showLoading({
- title: '加载中',
- mask: true
- })
- let page = that.page + 1;
- that.$set(that, `page`, page)
- let skip = page * limit;
- that.$set(that, `skip`, skip)
- that.search();
- uni.hideLoading();
- } else that.$set(that, `is_bottom`, true)
- },
- toScroll(e) {
- const that = this;
- let up = that.scrollTop;
- that.$set(that, `scrollTop`, e.detail.scrollTop);
- let num = Math.sign(up - e.detail.scrollTop);
- if (num == 1) that.$set(that, `is_bottom`, false);
- },
- // 打开弹框
- toFilter() {
- const that = this;
- that.$set(that, `drawer`, {
- title: '筛选',
- show: true,
- mode: 'right'
- })
- },
- // 重置
- toReset() {
- const that = this;
- that.$set(that, `searchInfo`, {})
- that.clearPage();
- that.search()
- },
- toSave() {
- const that = this;
- that.clearPage();
- that.toClose();
- that.search()
- },
- // 关闭弹框
- toClose() {
- const that = this;
- that.$set(that, `drawer`, {
- title: '筛选',
- show: false,
- mode: 'right'
- })
- },
- // 视频查看
- videoView(e) {
- uni.navigateTo({
- url: `/pagesVideo/video/index?id=${e._id}`
- })
- },
- // 查询其他信息
- async searchOther() {
- const that = this;
- let res;
- // 是否
- res = await that.$api('dictdata', 'GET', {
- type: 'is_no'
- })
- if (res.errcode == '0') {
- that.$set(that, `isnoList`, res.data)
- }
- res = await that.$api('scenetype', 'GET', {
- is_use: '0'
- })
- if (res.errcode == '0') {
- for (const val of res.data) {
- let arr;
- let type = '';
- if (val.title == '厂商') type = 'firm';
- else if (val.title == '类型') type = 'type';
- else if (val.title == '产地') type = 'place';
- else if (val.title == '年份') type = 'year';
- else if (val.title == '演员') type = 'actor';
- arr = await that.$api('scenedata', 'GET', {
- is_use: '0',
- type_id: val._id
- })
- if (arr.errcode == '0') {
- that.$set(that, `${type}List`, arr.data);
- }
- }
- }
- },
- // 清空列表
- clearPage() {
- const that = this;
- that.$set(that, `list`, [])
- that.$set(that, `skip`, 0)
- that.$set(that, `limit`, 10)
- that.$set(that, `page`, 0)
- if (!that.searchInfo.title) delete that.searchInfo.title;
- },
- }
- }
- </script>
- <style lang="scss">
- .content {
- background-color: var(--rgb111);
- .one {
- background-color: var(--rgb111);
- display: flex;
- padding: 2vw;
- .one_1 {
- flex-grow: 1;
- input {
- border: 1px solid var(--rgbf1f);
- height: 30px;
- border-radius: 2px;
- padding: 0 5px;
- font-size: 12px;
- color: var(--rgbfff);
- }
- }
- .one_2 {
- button {
- height: 100%;
- background-color: var(--rgbfa4);
- color: var(--rgbfff);
- }
- }
- }
- .two {
- flex-grow: 1;
- position: relative;
- .two_1 {
- display: flex;
- flex-wrap: wrap;
- .list {
- position: relative;
- width: 48%;
- margin: 0 10px 10px 0;
- .image {
- width: 100%;
- height: 100px;
- overflow: hidden;
- border-radius: 5px;
- box-shadow: 0 0 5px var(--rgbf1f);
- margin: 0 0 5px 0;
- }
- .name {
- font-size: 14px;
- color: var(--rgbfff);
- margin: 0 0 5px 0;
- }
- .other {
- display: flex;
- color: var(--rgbfff);
- font-size: 12px;
- justify-content: space-between;
- }
- .vip {
- position: absolute;
- top: 0;
- left: 1vw;
- span {
- font-size: 14px;
- font-weight: bold;
- color: var(--rgbffd);
- }
- }
- }
- .list:nth-child(2n) {
- margin: 0 0 10px 0;
- }
- }
- }
- }
- .scroll-view {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- .list-scroll-view {
- display: flex;
- flex-direction: column;
- padding: 0 2vw;
- }
- }
- .is_bottom {
- text-align: center;
- text {
- padding: 2vw 0;
- display: inline-block;
- color: #858585;
- font-size: 14px;
- }
- }
- .drawer_one {
- display: flex;
- flex-direction: column;
- width: 77vw;
- height: 92vh;
- .drawer_one_1 {
- flex-grow: 1;
- overflow-y: auto;
- .uni-forms-item {
- margin: 0;
- }
- .label {
- font-weight: bold;
- margin: 0 0 5px 0;
- }
- .value {}
- }
- .drawer_one_2 {
- text-align: center;
- padding: 2vw 0;
- button {
- width: 30%;
- margin: 0 2vw;
- line-height: 2.5;
- }
- button:nth-child(1) {
- background-color: var(--rgbfa4);
- color: var(--rgbfff);
- }
- button:nth-child(2) {
- background-color: var(--rgb67c);
- color: var(--rgbfff);
- }
- }
- }
- </style>
|