123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- <template>
- <view class="content">
- <view class="top">
- <!-- 搜索框 -->
- <view class="Search-box">
- <view class="Search-box-size">
- <image class="box-img" src="../../static/images/img01.png"></image>
- <input type="text" class="box-word" placeholder="请输入关键字" v-model="keyword" />
- </view>
- <view class="Search-box-sort" @click="messagesearch">搜索</view>
- </view>
- </view>
- <view class="list-box" v-for="(item,index) in science" :key='index' @click="Jump(item.id)">
- <view class="box-left">
- <image :src="item.image_input[0]" mode="" class="left-img"></image>
- </view>
- <view class="box-right">
- <view class="right-top word1_ellipsis">
- {{item.title}}
- </view>
- <view class="right-center">
- {{item.synopsis}}
- </view>
- <view class="right-foot">
- {{item.visit}}阅读
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { bannerlist} from '@/api/index.js';
- export default{
- data(){
- return{
- keyword:'',
- science:[]
- }
- },
- onLoad() {
- this.loadData();
- },
- methods:{
- //搜索
- // messagesearch(event) {
- // console.log(event.target.value)
- // let arrlist = [];
- // for (let i = 0; i < this.science.length; i++) {
- // if (this.science[i].title.indexOf(event.target.value) != -1) {
- // arrlist.push(this.science[i]);
- // }
- // }
- // this.science = arrlist;
- // if (event.target.value == '') {
- // this.loadData();
- // }
- // },
- messagesearch() {
- let keyword = this.keyword;
- console.log(keyword);
- let arrlist = [];
- for (let i = 0; i < this.science.length; i++) {
- if (this.science[i].title.indexOf(keyword) != -1) {
- arrlist.push(this.science[i]);
- }
- }
- this.science = arrlist;
- if (keyword == '') {
- this.loadData();
- }
- },
- loadData(){
- let obj = this;
- bannerlist().then(({ data }) => {
- console.log(data);
- obj.science = data;
- });
- },
- Jump(id) {
- uni.navigateTo({
- url:"/pages/applic/info?id="+id
- })
- },
- }
- }
- </script>
- <style lang="scss">
- //搜索框
- .Search-box {
- padding-left: 20rpx;
- padding-right: 20rpx;
- height: 100rpx;
- background: #ffffff;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .Search-box-sort {
- font-size: 30rpx;
-
- font-weight: 500;
- color: rgba(102, 102, 102, 1);
-
- .sort-text {
- width: 57rpx;
- height: 29rpx;
- font-size: 30rpx;
- font-weight: 500;
- color: rgba(51, 51, 51, 1);
- line-height: 58rpx;
- margin-right: 19rpx;
- }
- .sort-img {
- width: 21rpx;
- height: 11rpx;
- margin-bottom: 4rpx;
- }
- }
-
- .Search-box-size {
- width: 630rpx;
- height: 65rpx;
- border-radius: 32rpx;
- background-color: #f1f1f1;
- padding-left: 36rpx;
- display: flex;
- align-items: center;
-
- .box-img {
- height: 32rpx;
- width: 32rpx;
- margin-right: 16rpx;
- }
- .box-word {
- width: 100%;
- font-size: 22rpx;
- font-weight: 500;
- color: rgba(205, 203, 203, 1);
- line-height: 55rpx;
- }
- }
- }
- .content{
- line-height: 1;
- .list-box{
- width: 725rpx;
- height: 200rpx;
- margin: 20rpx auto 0;
- background: #FFFFFF;
- box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
- border-radius: 7rpx;
- padding:0 20rpx;
- display: flex;
- align-items: center;
- .box-left{
- width: 230rpx;
- height: 145rpx;
- margin-right: 20rpx;
- .left-img{
- width: 230rpx;
- height: 145rpx;
- }
- }
- .box-right{
- width: 430rpx;
- height: 145rpx;
- .right-top{
- font-size: 25rpx;
- font-weight: bold;
- color: #333333;
- margin-bottom: 24rpx;
- }
- .right-center{
- width: 362rpx;
- // height: 53rpx;
- font-size: 21rpx;
- font-weight: bold;
- color: #999999;
- line-height: 33rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;//在第几行显示...
- -webkit-box-orient: vertical;
- }
- .right-foot{
- font-size: 21rpx;
- font-weight: bold;
- color: #999999;
- line-height: 31rpx;
- text-align: right;
- margin-top: 13rpx;
- }
- }
- }
- }
- </style>
|