123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- <template>
- <div>
- <div class="auto lists">
- <Row>
- <Col :span="15">
- <div class="lists-item" v-for="item in listData">
- <img v-lazy="picPath+item.infoimg" alt="" :key="item.infoId">
- <div class="content-text">
- <nuxt-link class="line-one" style="-webkit-box-orient: vertical;" :to="{path: '/content', query:{id:item.infoId}}" tag="a" target="_blank">{{item.title}}</nuxt-link>
- <p style="-webkit-box-orient: vertical;">{{item.summary}}</p>
- <div class="source" v-if="item.columnname?item.columnname.includes('—'):false">
- <nuxt-link :to="{path: '/lists', query:{id:item.parentcolumnId}}" class="line-one" style="-webkit-box-orient: vertical;" tag="a" target="_blank">{{item.columnname.split('—')[0]}}</nuxt-link>
- <span>—</span>
- <nuxt-link :to="{path: '/lists', query:{id:item.columnId}}" class="line-one" style="-webkit-box-orient: vertical;" tag="a" target="_blank">{{item.columnname.split('—')[1]}}</nuxt-link>
- <span>/{{item.uptimeStr}}</span>
- </div>
- <div class="source" v-else>
- <nuxt-link v-if="item.columnname" :to="{path: '/lists', query:{id:item.columnId}}" class="line-one" style="-webkit-box-orient: vertical;" tag="a" target="_blank">{{item.columnname}}/</nuxt-link>
- <span>{{item.uptimeStr}}</span>
- </div>
- </div>
- </div>
- <div class="page-nation">
- <Page :total="total" size="small" show-elevator show-sizer show-total :page-size="pageNation.rows" :current="pageNation.page" @on-change="pageChange" @on-page-size-change="pageSizeChange"/>
- </div>
- </Col>
- <Col :span="1" style="height:100px"></Col>
- <Col :span="8">
- <div>
- <!-- <a v-if="imgTo" :href="imgTo">
- <img style="width:333px" v-lazy="'http://pic-asean2.oss-cn-hongkong.aliyuncs.com/'+imgPath" alt="">
- </a>
- <img v-else style="width:333px" v-lazy="'http://pic-asean2.oss-cn-hongkong.aliyuncs.com/'+imgPath" alt=""> -->
- </div>
- </Col>
- </Row>
- </div>
- </div>
- </template>
- <script>
- import {getColumnInfoList,getColumnAd,search,listKeywordInfo} from '~/api/lists'
- import {listFocusInfo} from '~/api/homePage'
- import {formatTime} from '~/common/publicFun'
- import Bus from "~/common/bus";
- import { mapState } from 'vuex'
- export default {
-
- data(){
- return {
- picPath: 'http://pic-asean2.oss-cn-hongkong.aliyuncs.com/',
- suffix:'?x-oss-process=image/watermark,image_d2F0ZXJtYXJrL3dtMS5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8zMA==,g_se,x_10,y_10,t_70',
- listData:[],
- pageNation:{
- "page": 1,
- "rows": 20
- },
- total:0,
- imgPath:'',
- imgTo:'',
- id:'',
- fromSearch:false,
- // keyword:this.$store.getters.keyword,
- }
- },
- async asyncData ({query}) {
- let params={
- "page": 1,
- "rows": 20,
- "reqdata":{}
- }
- let fun='';
- if(query.id=='search'){
- params.reqdata.title=query.id;
- fun=search;
- }else if(['focus','recommend'].includes(query.id)){
- params.reqdata.type=query.id;
- fun=listFocusInfo;
- }else if(parseInt(query.id)){
- params.reqdata.columnId=parseInt(query.id);
- fun=getColumnInfoList;
- }else{
- params.reqdata.keyword=query.id;
- fun=listKeywordInfo;
- }
- let [dataObj,imgObj] = await Promise.all([
- fun(params),
- getColumnAd({ "reqdata": { "adPosition": "column" }})
- ]);
- let page=dataObj.currpage;
- return{
- listData:dataObj.list,
- total:dataObj.totalrecords,
- pageNation:{page},
- imgPath:imgObj.object?imgObj.object.adimg:'',
- imgTo:imgObj.object?imgObj.object.adurl:''
- }
- },
- mounted(){
- this.id=this.$route.query.id;
- console.log(this.id,'this.id')
- // this.getData();
- Bus.$emit("columnId", this.id);
- },
- computed:{
- searchVal:function() { //通过方法访问
- return this.$store.getters.searchVal;
- },
- // keyword:function() { //关键字
- // return this.$store.getters.keyword;
- // },
- },
- watch:{
- // $route(){
- // if(['focus','recommend'].includes(this.$route.params.id)){
- // this.id = this.$route.params.id
- // }else{
- // this.id = this.$route.params.id
- // }
- // },
- // searchVal(){
- // this.fromSearch=true;
- // this.getData()
- // },
- // keyword(){
- // this.fromSearch=false;
- // this.id = this.keyword
- // this.getData()
- // },
- // id() {
- // this.fromSearch=false;
- // this.getData()
- // },
- },
- methods:{
- getData(){
- let params={
- "page": this.pageNation.page,
- "rows": this.pageNation.rows,
- "reqdata":{}
- }
- if(this.fromSearch){
- params.reqdata.title=this.searchVal
- search(params).then(res=>{
- if(res.status==100){
- this.listData=res.list;
- this.total=res.totalrecords
- this.pageNation.page=res.currpage;
- }
- })
- }else if(['focus','recommend'].includes(this.id)){
- params.reqdata.type=this.id
- listFocusInfo(params).then(res=>{
- if(res.status==100){
- this.listData=res.list;
- this.total=res.totalrecords
- this.pageNation.page=res.currpage;
- }
- });
- }else if(parseInt(this.id)){
- params.reqdata.columnId=parseInt(this.id)
- getColumnInfoList(params).then(res=>{
- if(res.status==100){
- this.listData=res.list;
- this.total=res.totalrecords
- this.pageNation.page=res.currpage;
- }
-
- });
- }else{
- params.reqdata.keyword=this.id;
- listKeywordInfo(params).then(res=>{
- if(res.status==100){
- this.listData=res.list;
- this.total=res.totalrecords
- this.pageNation.page=res.currpage;
- }
- })
- }
- },
- pageChange(page){
- this.pageNation.page=page;
- this.getData();
- },
- pageSizeChange(pageSize){
- this.pageNation.rows=pageSize;
- this.getData();
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .lists{
- padding-top: 15px;
- margin-bottom: 123px;
- .lists-item{
- display: inline-flex;
- padding: 19px 0;
- border-bottom: 1px solid #ccc;
- width: 100%;
- img{
- width: 35%;
- height: 150px;
- border-radius: 10px;
- margin-right: 10px;
- }
- .content-text{
- position: relative;
- margin-left: 10px;
- width: 62%;
- a{
- font-size: 20px;
- float: left;
- width: 100%;
- margin-bottom:4px;
- }
- p{
- font-size: 14px;
- margin: 0 0 10px 0;
- color: #aaaaaa;
- width: 100%;
- height: 95px;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 4;
- }
- span{
- float: left;
- font-size: 12px;
- margin-top: 15px;
- }
- .source{
- position: absolute;
- bottom: 0px;
- left: 0px;
- width: 100%;
- a{
- font-size: 13px;
- width: auto;
- color: #515a6e;
- margin: auto;
- }
- span{
- float: left;
- font-size: 12px;
- margin: auto;
- }
- }
- }
- }
- .page-nation{
- height: 50px;
- line-height: 50px;
- input{
- height: 2px;
- }
- }
- }
-
- </style>
|