|
@@ -0,0 +1,205 @@
|
|
|
+<template>
|
|
|
+ <view class="searchType" style="background: #fff;height: 100vh;">
|
|
|
+ <van-cell value-class="searchclass">
|
|
|
+ <template slot="title">
|
|
|
+ <view class="input-view">
|
|
|
+ <uni-icon type="search" size="22" color="#666666" />
|
|
|
+ <input confirm-type="search" class="input" type="text" placeholder="输入搜索关键词"
|
|
|
+ @input="confirm" />
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ <template>
|
|
|
+ <view @click="search">搜索</view>
|
|
|
+ </template>
|
|
|
+ </van-cell>
|
|
|
+
|
|
|
+ <view v-for="(item,indedx) in acrelist" :key="indedx" @click="goIndex(item)">
|
|
|
+ <view class="hotelList">
|
|
|
+ <view class="hotleLeft">
|
|
|
+ <image style="width: 214upx;height: 152upx;" :src=" pictureUrl + '/' + item.article_thumb"/>
|
|
|
+ </view>
|
|
|
+ <view class="hotelright">
|
|
|
+ <view style="font-size: 28upx;color: #303133;">{{item.article_title}}</view>
|
|
|
+ <view>
|
|
|
+ {{item.article_time}}
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import uniIcon from '@/component/uni-icon/uni-icon.vue'
|
|
|
+ import Gobacktop from '@/component/Gobacktop.vue'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ uniIcon,
|
|
|
+ Gobacktop
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ pictureUrl: this.pictureUrl,
|
|
|
+ page: 1,
|
|
|
+ page_size: 10,
|
|
|
+ ac_id:'',
|
|
|
+ keyword:'',
|
|
|
+ active: 0,
|
|
|
+ scrollTop: 0,
|
|
|
+ old: {
|
|
|
+ scrollTop: 0
|
|
|
+ },
|
|
|
+ isTop: false,
|
|
|
+ typelist:[],
|
|
|
+ acrelist:[],
|
|
|
+ ispull: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad() {
|
|
|
+ //this.getype(); // 获取文章分类
|
|
|
+ ///this.getlist(); // 获取文章列表
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+
|
|
|
+ goIndex(items) {
|
|
|
+ let article_id = items.article_id;
|
|
|
+ let ac_id = items.ac_id;
|
|
|
+ let name = '';
|
|
|
+ this.typelist.forEach((item, index) => {
|
|
|
+ if(item.ac_id == ac_id) {
|
|
|
+ name = item.ac_name;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/myone/onedetail?id=${article_id}&name=${name}`
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ getlist() {
|
|
|
+ this.request({
|
|
|
+ url: '/v1/entry/news',
|
|
|
+ method:'POST',
|
|
|
+ data: {
|
|
|
+ page: this.page,
|
|
|
+ page_size: this.page_size,
|
|
|
+ keyword: this.keyword
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ let { data } = res.data;
|
|
|
+ if(data.total_page == data.current_page) {
|
|
|
+ this.ispull = false;
|
|
|
+ }
|
|
|
+ this.acrelist = this.acrelist.concat(data.new_list);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ confirm(e) {
|
|
|
+ this.acrelist = [];
|
|
|
+ this.keyword = e.detail.value;
|
|
|
+ this.getlist();
|
|
|
+ },
|
|
|
+ search() {
|
|
|
+ if(this.keyword == '') {
|
|
|
+ this.$msg("关键字不能为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.acrelist = [];
|
|
|
+ this.getlist();
|
|
|
+ },
|
|
|
+ // 滚动到顶部
|
|
|
+ upper(e) {
|
|
|
+ console.log(e)
|
|
|
+ console.log("顶部")
|
|
|
+ },
|
|
|
+
|
|
|
+ // 滚到底部
|
|
|
+ lower(e) {
|
|
|
+ this.page = this.page + 1;
|
|
|
+ if(this.ispull) {
|
|
|
+ this.getlist();
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 滚动时触发
|
|
|
+ scroll(e) {
|
|
|
+ if(e.detail.scrollTop > 400) {
|
|
|
+ this.isTop = true;
|
|
|
+ }else{ //当距离小于500时显示回到顶部按钮
|
|
|
+ this.isTop = false;
|
|
|
+ }
|
|
|
+ this.old.scrollTop = e.detail.scrollTop
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+ .searchType .input-view {
|
|
|
+ width: 80%;
|
|
|
+ display: flex;
|
|
|
+ background-color: #e7e7e7;
|
|
|
+ height: 30px;
|
|
|
+ border-radius: 15px;
|
|
|
+ padding: 0 4%;
|
|
|
+ flex-wrap: nowrap;
|
|
|
+ margin: 7px 0;
|
|
|
+ line-height: 30px;
|
|
|
+ margin: 24upx 0 24upx 32upx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .searchType .input-view .uni-icon {
|
|
|
+ line-height: 30px !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .searchType .input-view .input {
|
|
|
+ height: 30px;
|
|
|
+ line-height: 30px;
|
|
|
+ width: 94%;
|
|
|
+ padding: 0 3%;
|
|
|
+ }
|
|
|
+ .van-cell__title {
|
|
|
+ flex: 6!important;
|
|
|
+ }
|
|
|
+ .searchclass {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ }
|
|
|
+ .van-cell {
|
|
|
+ padding: 15upx 32upx 0 32upx!important;
|
|
|
+ }
|
|
|
+ .hotelList {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ padding: 24upx 32upx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .hotleLeft {
|
|
|
+ width: 214upx;
|
|
|
+ height: 152upx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .hotelright {
|
|
|
+ padding-left: 16upx;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .undertip {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+ .tipsTop {
|
|
|
+ border: 2upx solid #BBBBBB;
|
|
|
+ margin-right: 14upx;
|
|
|
+ color: #BBBBBB;
|
|
|
+ padding: 4upx;
|
|
|
+ }
|
|
|
+ /* .van-cell__title {
|
|
|
+ flex: 6!important;
|
|
|
+ } */
|
|
|
+</style>
|