index.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <div>
  3. <div class="auto lists">
  4. <Row>
  5. <Col :span="15">
  6. <div class="lists-item" v-for="item in listData">
  7. <nuxt-link class="img-a" :to="{path: '/content', query:{id:item.infoId}}" tag="a" target="_blank"><img v-lazy="picPath+item.infoimg" alt="" :key="item.infoId"></nuxt-link>
  8. <div class="content-text">
  9. <nuxt-link style="-webkit-box-orient: vertical;" :to="{path: '/content', query:{id:item.infoId}}" tag="a" target="_blank">{{item.title}}</nuxt-link>
  10. <p style="-webkit-box-orient: vertical;">{{item.summary}}</p>
  11. <div class="source" v-if="item.columnname?item.columnname.includes('—'):false">
  12. <nuxt-link :to="{path: '/lists', query:{id:item.parentcolumnId}}" style="-webkit-box-orient: vertical;" tag="a" target="_blank">{{item.columnname.split('—')[0]}}</nuxt-link>
  13. <span>—</span>
  14. <nuxt-link :to="{path: '/lists', query:{id:item.columnId}}" style="-webkit-box-orient: vertical;" tag="a" target="_blank">{{item.columnname.split('—')[1]}}</nuxt-link>
  15. <span>/{{item.uptimeStr}}</span>
  16. </div>
  17. <div class="source" v-else>
  18. <nuxt-link v-if="item.columnname" :to="{path: '/lists', query:{id:item.columnId}}" style="-webkit-box-orient: vertical;" tag="a" target="_blank">{{item.columnname}}/</nuxt-link>
  19. <span>{{item.uptimeStr}}</span>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="page-nation">
  24. <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"/>
  25. </div>
  26. </Col>
  27. <Col :span="1" style="height:100px"></Col>
  28. <Col :span="8">
  29. <div>
  30. <!-- <a v-if="imgTo" :href="imgTo">
  31. <img style="width:333px" v-lazy="'http://pic-asean2.oss-cn-hongkong.aliyuncs.com/'+imgPath" alt="">
  32. </a>
  33. <img v-else style="width:333px" v-lazy="'http://pic-asean2.oss-cn-hongkong.aliyuncs.com/'+imgPath" alt=""> -->
  34. </div>
  35. </Col>
  36. </Row>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import {getColumnInfoList,getColumnAd,search,listKeywordInfo} from '~/api/lists'
  42. import {listFocusInfo} from '~/api/homePage'
  43. import {formatTime} from '~/common/publicFun'
  44. import Bus from "~/common/bus";
  45. import { mapState } from 'vuex'
  46. export default {
  47. data(){
  48. return {
  49. picPath: 'http://pic-asean2.oss-cn-hongkong.aliyuncs.com/',
  50. suffix:'?x-oss-process=image/watermark,image_d2F0ZXJtYXJrL3dtMS5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8zMA==,g_se,x_10,y_10,t_70',
  51. listData:[],
  52. pageNation:{
  53. "page": 1,
  54. "rows": 20
  55. },
  56. total:0,
  57. imgPath:'',
  58. imgTo:'',
  59. id:'',
  60. fromSearch:false,
  61. // keyword:this.$store.getters.keyword,
  62. }
  63. },
  64. async asyncData ({query}) {
  65. let params={
  66. "page": 1,
  67. "rows": 20,
  68. "reqdata":{}
  69. }
  70. let fun='';
  71. if(query.id=='search'){
  72. params.reqdata.title=query.id;
  73. fun=search;
  74. }else if(['focus','recommend'].includes(query.id)){
  75. params.reqdata.type=query.id;
  76. fun=listFocusInfo;
  77. }else if(parseInt(query.id)){
  78. params.reqdata.columnId=parseInt(query.id);
  79. fun=getColumnInfoList;
  80. }else{
  81. params.reqdata.keyword=query.id;
  82. fun=listKeywordInfo;
  83. }
  84. let [dataObj,imgObj] = await Promise.all([
  85. fun(params),
  86. getColumnAd({ "reqdata": { "adPosition": "column" }})
  87. ]);
  88. let page=dataObj.currpage;
  89. return{
  90. listData:dataObj.list,
  91. total:dataObj.totalrecords,
  92. pageNation:{page},
  93. imgPath:imgObj.object?imgObj.object.adimg:'',
  94. imgTo:imgObj.object?imgObj.object.adurl:''
  95. }
  96. },
  97. mounted(){
  98. this.id=this.$route.query.id;
  99. console.log(this.id,'this.id')
  100. // this.getData();
  101. Bus.$emit("columnId", this.id);
  102. },
  103. computed:{
  104. searchVal:function() { //通过方法访问
  105. return this.$store.getters.searchVal;
  106. },
  107. // keyword:function() { //关键字
  108. // return this.$store.getters.keyword;
  109. // },
  110. },
  111. watch:{
  112. // $route(){
  113. // if(['focus','recommend'].includes(this.$route.params.id)){
  114. // this.id = this.$route.params.id
  115. // }else{
  116. // this.id = this.$route.params.id
  117. // }
  118. // },
  119. // searchVal(){
  120. // this.fromSearch=true;
  121. // this.getData()
  122. // },
  123. // keyword(){
  124. // this.fromSearch=false;
  125. // this.id = this.keyword
  126. // this.getData()
  127. // },
  128. // id() {
  129. // this.fromSearch=false;
  130. // this.getData()
  131. // },
  132. },
  133. head() {
  134. return {
  135. title: '东盟头条—聚焦东盟 关注中国 放眼世界',
  136. meta: [{
  137. name: 'keywords',
  138. content: '东盟头条,aseantop,柬埔寨,文莱,印尼,新加坡,越南,缅甸,菲律宾,老挝,泰国,马来西亚'
  139. },{
  140. name: 'description',
  141. content: '东盟头条新闻社(ASEAN TOP NEWS)旗下另一个重要媒体平台东盟头条新闻网(www.aseantop.com;www.aseantop.net)。东盟头条新闻网设有要闻聚焦、东盟动态、中国政情、环球瞭望、头条观察、高端访谈、看中国、华侨华人、文化生活等多个特色板块,网站秉持“独立、客观、公正、专业”的新闻理念,平实报道和评论东盟各国以及中国的重要动态,为各界人士提供可靠可信可读的有价值信息。'
  142. }],
  143. }
  144. },
  145. methods:{
  146. getData(){
  147. let params={
  148. "page": this.pageNation.page,
  149. "rows": this.pageNation.rows,
  150. "reqdata":{}
  151. }
  152. if(this.fromSearch){
  153. params.reqdata.title=this.searchVal
  154. search(params).then(res=>{
  155. if(res.status==100){
  156. this.listData=res.list;
  157. this.total=res.totalrecords
  158. this.pageNation.page=res.currpage;
  159. }
  160. })
  161. }else if(['focus','recommend'].includes(this.id)){
  162. params.reqdata.type=this.id
  163. listFocusInfo(params).then(res=>{
  164. if(res.status==100){
  165. this.listData=res.list;
  166. this.total=res.totalrecords
  167. this.pageNation.page=res.currpage;
  168. }
  169. });
  170. }else if(parseInt(this.id)){
  171. params.reqdata.columnId=parseInt(this.id)
  172. getColumnInfoList(params).then(res=>{
  173. if(res.status==100){
  174. this.listData=res.list;
  175. this.total=res.totalrecords
  176. this.pageNation.page=res.currpage;
  177. }
  178. });
  179. }else{
  180. params.reqdata.keyword=this.id;
  181. listKeywordInfo(params).then(res=>{
  182. if(res.status==100){
  183. this.listData=res.list;
  184. this.total=res.totalrecords
  185. this.pageNation.page=res.currpage;
  186. }
  187. })
  188. }
  189. },
  190. pageChange(page){
  191. this.pageNation.page=page;
  192. this.getData();
  193. },
  194. pageSizeChange(pageSize){
  195. this.pageNation.rows=pageSize;
  196. this.getData();
  197. },
  198. }
  199. }
  200. </script>
  201. <style lang="scss" scoped>
  202. .lists{
  203. padding-top: 15px;
  204. margin-bottom: 123px;
  205. .lists-item{
  206. display: inline-flex;
  207. padding: 19px 0;
  208. border-bottom: 1px solid #ccc;
  209. width: 100%;
  210. .img-a{
  211. width: 35%;
  212. img{
  213. height: 150px;
  214. border-radius: 10px;
  215. margin-right: 10px;
  216. }
  217. }
  218. .content-text{
  219. position: relative;
  220. margin-left: 10px;
  221. width: 62%;
  222. a{
  223. font-size: 20px;
  224. float: left;
  225. width: 100%;
  226. margin-bottom:4px;
  227. }
  228. p{
  229. font-size: 14px;
  230. margin: 0 0 10px 0;
  231. color: #aaaaaa;
  232. width: 100%;
  233. height: 95px;
  234. overflow: hidden;
  235. text-overflow: ellipsis;
  236. display: -webkit-box;
  237. -webkit-line-clamp: 4;
  238. }
  239. span{
  240. float: left;
  241. font-size: 12px;
  242. margin-top: 15px;
  243. }
  244. .source{
  245. position: absolute;
  246. bottom: 0px;
  247. left: 0px;
  248. width: 100%;
  249. a{
  250. font-size: 13px;
  251. width: auto;
  252. color: #515a6e;
  253. margin: auto;
  254. }
  255. span{
  256. float: left;
  257. font-size: 12px;
  258. margin: auto;
  259. }
  260. }
  261. }
  262. }
  263. .page-nation{
  264. height: 50px;
  265. line-height: 50px;
  266. input{
  267. height: 2px;
  268. }
  269. }
  270. }
  271. </style>