H5端齐采药项目,uniapp框架
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

199 lines
3.8 KiB

<template>
<page-meta :page-style="themeColor"></page-meta>
<view>
<view class="content">
<z-paging ref="paging" v-model="dataList" @query="queryList" :auto="true" :auto-show-back-to-top="true">
<view class="cate-search" slot="top">
<view class="search-box">
<input class="uni-input" maxlength="50" v-model="keywords" confirm-type="search"
@confirm="search()" placeholder="请输入视频名称" />
<text class="iconfont icon-sousuo3" @click="search()"></text>
</view>
</view>
<view class="list">
<view class="item" v-for="(item,index) in dataList" :key="index" @click="toDetails(item)">
<image class="cover" :src="item.cover" mode="aspectFit"></image>
<view class="textBox">
<view class="title">
{{item.title}}
</view>
<view class="num">
<u-icon name="play-right" size="28rpx"></u-icon>
<view class="view_num">
{{item.view_num}}
</view>
</view>
</view>
</view>
</view>
</z-paging>
</view>
</view>
</template>
<script>
export default {
data() {
return {
keywords: '', //搜索框的值
dataList: [],
};
},
onLoad(options) {},
onShow() {
},
methods: {
//搜索
search() {
if (this.keywords == '') {
this.$util.showToast({
title: '搜索内容不能为空哦'
});
} else {
this.$refs.paging.reload();
}
},
queryList(pageNo, pageSize) {
this.$api.sendRequest({
url: '/api/video/getList',
data: {
keywords: this.keywords,
page: pageNo,
page_size: pageSize,
},
success: res => {
this.$refs.paging.complete(res.data.list);
}
})
},
toDetails(item) {
this.$util.redirectTo('/page_video/videoList/videoDetails', {
id: item.id
})
}
}
};
</script>
<style lang="scss" scoped>
/deep/ .fixed {
position: relative;
top: 0;
}
/deep/ .empty {
margin-top: 0 !important;
}
.cart-empty {
padding-top: 54px;
}
.content {
// overflow: hidden;
width: 100vw;
/* #ifdef MP */
height: 100vh;
/* #endif */
/* #ifdef H5 */
height: calc(100vh - env(safe-area-inset-bottom) - var(--status-bar-height));
/* #endif */
/* #ifdef APP-PLUS */
height: calc(100vh - 44px - env(safe-area-inset-bottom));
/* #endif */
background: #ffffff;
}
.cate-search {
width: 100%;
height: 100rpx;
background: #ffffff;
padding: 10rpx 30rpx;
box-sizing: border-box;
box-shadow: 0 0 12rpx rgba(100, 100, 100, 0.3);
/* #ifdef H5 */
padding-top: 30rpx;
/* #endif */
input {
font-size: $font-size-base;
height: 60rpx;
padding: 15rpx 25rpx 15rpx 30rpx;
line-height: 60rpx;
width: calc(100% - 120rpx);
}
text {
font-size: 32rpx;
color: $color-tip;
width: 120rpx;
text-align: center;
}
.search-box {
width: 100%;
height: 100%;
background: $color-bg;
display: flex;
justify-content: center;
align-items: center;
border-radius: 40rpx;
}
}
.list {
width: calc(100% - 60rpx);
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 0 auto;
padding: 20rpx 0;
.item {
width: 48%;
height: 400rpx;
margin: 10rpx 0;
box-shadow: 0 0 12rpx rgba(100, 100, 100, 0.3);
border-radius: 10rpx;
padding: 10rpx 0;
.cover {
width: 100%;
height: 320rpx;
}
.textBox {
width: calc(100% - 20rpx);
height: 40rpx;
line-height: 40rpx;
margin: 0 auto;
display: flex;
justify-content: space-between;
.title {
/*1. 先强制一行内显示文本*/
white-space: nowrap;
/*2. 超出的部分隐藏*/
overflow: hidden;
/*3. 文字用省略号替代超出的部分*/
text-overflow: ellipsis;
}
.num {
display: flex;
align-items: center;
.view_num {
margin-left: 10rpx;
}
}
}
}
}
</style>