123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- <template>
- <div>
- <el-container>
- <el-main style="padding: 0">
- <!-- 导航头部-->
- <!-- 主题导航-->
- <el-row >
- <el-col :span="18" offset="3">
- <el-row class="nav_tap" :gutter="34" style="padding: 10px;margin-left: 0;margin-right:0;margin-top: 25px " >
- <p v-show="search_key!=null&&search_key!=''" style="text-align: left">以下是关键词: <span v-html="search_key" class="nav_title"></span> 的检索内容:</p>
- <el-col :span="18" style="margin-bottom: 15px">
- <span class="nav_title">按关键词:</span>
- <el-input
- type="textarea"
- :autosize="{ minRows: 1, maxRows: 2}"
- placeholder="请输入内容"
- v-model="s_key">
- </el-input>
- </el-col>
- <el-col :span="8" ><span class="nav_title">按照类型:</span>
- <el-select v-model="s_type" clearable placeholder="请选择">
- <el-option
- v-for="item in wordType"
- :key="item.dictCode"
- :label="item.dictLabel"
- :value="item.dictValue">
- </el-option>
- </el-select>
- </el-col>
- <el-col :span="11">
- <div class="block">
- <span class="nav_title">按照时段:</span>
- <el-date-picker
- v-model="timer_picker"
- type="daterange"
- align="right"
- unlink-panels
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- :picker-options="pickerOptions">
- </el-date-picker>
- </div>
- </el-col>
- <el-col :span="5"><span @click="getSearchList()" class="nav_title"> 搜索 </span></el-col>
- </el-row>
- </el-col>
- </el-row>
- <!-- 主要列表-->
- <el-row>
- <el-col :span="18" offset="3">
- <el-row>
- <el-col v-for="item in news_list" :key="item" >
- <el-row class="word_item" style="margin-bottom: 20px">
- <el-col :span="8">
- <div>
- <span class="type_flag" v-for="type in wordType" v-if="type.dictValue==item.newsInfoType">
- {{type.dictLabel}}
- </span>
- </div>
- <el-image
- style="width: 100%; height: 300px"
- lazy
- v-if="item.newsInfoUrl "
- :src="item.newsInfoUrl "
- ></el-image>
- </el-col>
- <el-col class="word_info" :span="16">
- <div >
- <h4>
- <nuxt-link :to="{name:'info-id',params:{id:item.newsInfoId,title:item.newsInfoTitle}}">
- {{item.newsInfoTitle.length>25?item.newsInfoTitle.substr(1,25)+"...":item.newsInfoTitle}}
- </nuxt-link>
- <!-- <n-link style="text-decoration: none; font-size: 1.3rem;font-weight: 400;color: black" :to="{name:'info-id'}"> {{item.newsInfoTitle}}</n-link>-->
- </h4>
- <div v-html="item.newsInfoContent.replace(/<[^>]+>/g,'').length>100?item.newsInfoContent.replace(/<[^>]+>/g,'').substr(1,
- 100)+'...':item.newsInfoContent.replace(/<[^>]+>/g,'')">
- </div>
- <span class="info_span"><i class="el-icon-s-custom"></i>{{item.newsInfoAuthor}} 时间:{{item.newsInfoTime}}</span>
- </div>
- <div></div>
- </el-col>
- </el-row>
- </el-col>
- </el-row>
- </el-col>
- </el-row>
- <!-- 分页-->
- <el-row>
- <el-col :span="18" offset="3">
- <el-row>
- <el-col :span="18" offset="7">
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getSearchList"
- />
- </el-col>
- </el-row>
- </el-col>
- </el-row>
- </el-main>
- </el-container>
- </div>
- </template>
- <script>
- import {navList,newsList,dictList,listWordPost} from "../static/js/index"
- import axios from "axios";
- export default {
- name: "SearchList",
- head(){
- return{
- title:"中关村公共资源论坛|文章检索"
- }
- },
- data(){
- return{
- pickerOptions: {
- shortcuts: [{
- text: '最近一周',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
- picker.$emit('pick', [start, end]);
- }
- }, {
- text: '最近一个月',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
- picker.$emit('pick', [start, end]);
- }
- }, {
- text: '最近三个月',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
- picker.$emit('pick', [start, end]);
- }
- }]
- },
- value1: '',
- value2: '',
- search_key:null,
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- title: null,
- type: null,
- author: null,
- releaseTime: null,
- word: null,
- coverUrl: null
- },
- news_list:null,
- total:0,
- wordType:null,
- timer_picker:[],
- s_type:null,
- s_key:null
- }
- },
- created() {
- this.getSearchList()
- this.getDictType()
- },
- methods:{
- getDictType(){
- dictList({"dictType":"sys_info_word_type"}).then(response=>{
- this.wordType=response.rows;
- })
- },
- s_click(){
- console.log(this.timer_picker)
- // axios({
- // method: 'post',
- // url: 'http://localhost:7070/website/news/listPost',
- // data: {
- // newsInfoTitle: this.s_key,
- // pageNum: 1,
- // newsInfoType: this.s_type,
- // 'params[beginNewsInfoTime]': this.timer_picker[0],
- // 'params[endNewsInfoTime]': this.timer_picker[1],
- // pageSize: 5,
- //
- // },
- // headers: {
- // 'Content-Type': 'application/x-www-form-urlencoded'
- // }
- // }).then(response=>{
- // this.queryParams.pageNum=1
- // this.news_list=response.rows;
- // this.total=response.total;
- // })
- listWordPost({"newsInfoTitle": this.s_key,"pageNum":1,"newsInfoType":this.s_type,
- "beginNewsInfoTime":this.timer_picker[0],
- "endNewsInfoTime":this.timer_picker[1],
- "pageSize":this.queryParams.pageSize}).then(response=>{
- this.queryParams.pageNum=1
- this.news_list=response.rows;
- this.total=response.total;
- })
- },
- getSearchList(){
- if(this.timer_picker.length>0){
- listWordPost({"newsInfoTitle": this.s_key,"pageNum":this.queryParams.pageNum,"newsInfoType":this.s_type,
- "beginNewsInfoTime":this.timer_picker[0],
- "endNewsInfoTime":this.timer_picker[1],
- "pageSize":this.queryParams.pageSize}).then(response=>{
- this.news_list=response.rows;
- this.total=response.total;
- this.search_key=this.s_key;
- })
- }else {
- newsList({"newsInfoTitle": this.s_key,"pageNum":this.queryParams.pageNum,"newsInfoType":this.s_type,
- // "beginNewsInfoTime":this.timer_picker[0],
- // "endNewsInfoTime":this.timer_picker[1],
- "pageSize":this.queryParams.pageSize}).then(response=>{
- this.news_list=response.rows;
- this.total=response.total;
- this.search_key=this.s_key;
- })
- }
- if (this.$route.params.key!=null){
- this.search_key=this.$route.params.key;
- this.$route.params.key=null;
- }
- }
- }
- }
- </script>
- <style scoped>
- .nav_tap{
- background-color: #f0f0f0;
- text-align: left;
- margin-bottom: 30px;
- }
- .nav_tap span{
- background-color: #b11116;
- -webkit-text-size-adjust: 100%;
- letter-spacing: 1px;
- text-rendering: optimizeLegibility;
- font-family: "PingFang SC", "Microsoft YaHei", "STHeiti", "sans-serif";
- line-height: 38px;
- font-size: 22px;
- box-sizing: border-box;
- background-size: contain;
- background-position: center;
- background-repeat: no-repeat;
- vertical-align: middle;
- text-align: center;
- cursor: pointer;
- border-radius: 6px;
- padding: 0 20px;
- color: white;
- }
- .type_flag{
- position: absolute;
- z-index: 2;
- padding: 7px;
- margin: 10px;
- color: white;
- background-color: rgba(0,0,0,0.5);
- border-radius: 20px;
- }
- .word_item{
- background-color: #f0f0f0;
- }
- .word_info{
- padding: 0 20px;
- }
- .info_span{
- position: absolute;
- bottom: 10px;
- }
- </style>
- <style>
- /*带背景的分页按钮背景色begin*/
- .el-pagination.is-background .el-pager li:not(.disabled).active {
- background-color: #b11116;
- color: #FFF;
- }
- .el-pagination.is-background .el-pager li.active {
- color: #fff;
- cursor: default;
- }
- .el-pagination.is-background .el-pager li:hover {
- color: #b11116;
- }
- .el-pagination.is-background .el-pager li:not(.disabled):hover {
- color: #b11116;
- }
- .el-pagination.is-background .el-pager li:not(.disabled).active:hover {
- background-color: #b11116;
- color: #FFF;
- }
- /*带背景的分页按钮背景色end*/
- /*不带背景的分页按钮背景色begin*/
- .el-pager li.active {
- color: #b11116;
- cursor: default;
- }
- .el-pagination .el-pager li:hover {
- color: #b11116;
- }
- .el-pagination .el-pager li:not(.disabled):hover {
- color: #b11116;
- }
- /*不带背景的分页按钮背景色end*/
- </style>
|