WordType.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <div>
  3. <el-container>
  4. <el-main style="padding: 0">
  5. <!-- 主题导航-->
  6. <el-row >
  7. <el-col :span="18" offset="3">
  8. <el-row class="nav_tap" :gutter="20" style="padding: 10px;margin-left: 0;margin-right:0;margin-top: 25px " >
  9. <el-col :span="6"><span class="nav_title" @click="changeType(1)">动态要闻</span></el-col>
  10. <el-col :span="6"><span class="nav_title" @click="changeType(2)">数据发布</span></el-col>
  11. <el-col :span="6"><span class="nav_title" @click="changeType(3)">产品服务</span></el-col>
  12. <el-col :span="6"><span class="nav_title" @click="changeType(4)">研究成果</span></el-col>
  13. </el-row>
  14. </el-col>
  15. </el-row>
  16. <!-- 主要列表-->
  17. <el-row>
  18. <el-col :span="18" offset="3">
  19. <el-row>
  20. <el-col v-for="item in news_list" :key="item" >
  21. <el-row class="word_item" style="margin-bottom: 20px">
  22. <el-col :span="8">
  23. <div>
  24. <span class="type_flag" v-for="type in wordType" v-if="type.dictValue==item.newsInfoType">
  25. {{type.dictLabel}}
  26. </span>
  27. </div>
  28. <el-image
  29. style="width: 100%; height: 300px"
  30. lazy
  31. v-if="item.newsInfoUrl "
  32. :src="item.newsInfoUrl "
  33. ></el-image>
  34. </el-col>
  35. <el-col class="word_info" :span="16">
  36. <div >
  37. <h4>
  38. <nuxt-link :to="{name:'info-id',params:{id:item.newsInfoId,title:item.newsInfoTitle}}">
  39. {{item.newsInfoTitle.length>25?item.newsInfoTitle.substr(1,25)+"...":item.newsInfoTitle}}
  40. </nuxt-link>
  41. <!-- <n-link style="text-decoration: none; font-size: 1.3rem;font-weight: 400;color: black" :to="{name:'info-id'}"> {{item.newsInfoTitle}}</n-link>-->
  42. </h4>
  43. <div v-html="item.newsInfoContent.replace(/<[^>]+>/g,'').length>100?item.newsInfoContent.replace(/<[^>]+>/g,'').substr(1,
  44. 100)+'...':item.newsInfoContent.replace(/<[^>]+>/g,'')">
  45. </div>
  46. <span class="info_span"><i class="el-icon-s-custom"></i>{{item.newsInfoAuthor}} 时间:{{item.newsInfoTime}}</span>
  47. </div>
  48. <div></div>
  49. </el-col>
  50. </el-row>
  51. </el-col>
  52. </el-row>
  53. </el-col>
  54. </el-row>
  55. <!-- 分页-->
  56. <el-row>
  57. <el-col :span="18" offset="3">
  58. <el-row>
  59. <el-col :span="18" offset="7">
  60. <pagination
  61. v-show="total>0"
  62. :total="total"
  63. :page.sync="queryParams.pageNum"
  64. :limit.sync="queryParams.pageSize"
  65. @pagination="getSearchList"
  66. />
  67. </el-col>
  68. </el-row>
  69. </el-col>
  70. </el-row>
  71. </el-main>
  72. </el-container>
  73. </div>
  74. </template>
  75. <script>
  76. import {navList,newsList,dictList,listWordPost} from "../static/js/index"
  77. export default {
  78. name: "WordType",
  79. head(){
  80. return{
  81. title:"中关村公共资源论坛|"+ this.type_name
  82. }
  83. },
  84. data(){
  85. return{
  86. check_type:1,
  87. type_name:"动态新闻",
  88. value1: '',
  89. value2: '',
  90. queryParams: {
  91. pageNum: 1,
  92. pageSize: 10,
  93. title: null,
  94. type: null,
  95. author: null,
  96. releaseTime: null,
  97. word: null,
  98. coverUrl: null
  99. },
  100. news_list:null,
  101. total:0,
  102. wordType:null,
  103. timer_picker:null,
  104. s_type:null,
  105. s_key:null
  106. }
  107. },
  108. created() {
  109. this.getSearchList()
  110. this.getDictType()
  111. },
  112. methods:{
  113. getDictType(){
  114. dictList({"dictType":"sys_info_word_type"}).then(response=>{
  115. this.wordType=response.rows;
  116. })
  117. },
  118. s_click(){
  119. console.log(this.timer_picker)
  120. listWordPost({"newsInfoTitle": this.s_key,"pageNum":1,"newsInfoType":this.s_type,
  121. "beginNewsInfoTime":this.timer_picker[0],
  122. "endNewsInfoTime":this.timer_picker[1],
  123. // "params":[
  124. // { },
  125. // {},
  126. // ] ,
  127. "pageSize":5}).then(response=>{
  128. this.queryParams.pageNum=1
  129. this.news_list=response.rows;
  130. this.total=response.total;
  131. })
  132. },
  133. changeType(changeId){
  134. this.check_type=changeId;
  135. this.queryParams.pageNum=1;
  136. this.getSearchList();
  137. },
  138. getSearchList(){
  139. newsList({"newsInfoType": this.check_type,"pageNum":this.queryParams.pageNum,"pageSize":this.queryParams.pageSize}).then(response=>{
  140. this.news_list=response.rows;
  141. this.total=response.total;
  142. })
  143. }
  144. }
  145. }
  146. </script>
  147. <style scoped>
  148. .nav_tap{
  149. background-color: #f0f0f0;
  150. text-align: center;
  151. margin-bottom: 30px;
  152. }
  153. .nav_tap span{
  154. background-color: #b11116;
  155. -webkit-text-size-adjust: 100%;
  156. letter-spacing: 1px;
  157. text-rendering: optimizeLegibility;
  158. font-family: "PingFang SC", "Microsoft YaHei", "STHeiti", "sans-serif";
  159. line-height: 38px;
  160. font-size: 22px;
  161. box-sizing: border-box;
  162. background-size: contain;
  163. background-position: center;
  164. background-repeat: no-repeat;
  165. vertical-align: middle;
  166. text-align: center;
  167. cursor: pointer;
  168. border-radius: 6px;
  169. padding: 0 20px;
  170. color: white;
  171. }
  172. .type_flag{
  173. position: absolute;
  174. z-index: 2;
  175. padding: 7px;
  176. margin: 10px;
  177. color: white;
  178. background-color: rgba(0,0,0,0.5);
  179. border-radius: 20px;
  180. }
  181. .word_item{
  182. background-color: #f0f0f0;
  183. }
  184. .word_info{
  185. padding: 0 20px;
  186. }
  187. .info_span{
  188. position: absolute;
  189. bottom: 10px;
  190. }
  191. </style>
  192. <style>
  193. /*带背景的分页按钮背景色begin*/
  194. .el-pagination.is-background .el-pager li:not(.disabled).active {
  195. background-color: #b11116;
  196. color: #FFF;
  197. }
  198. .el-pagination.is-background .el-pager li.active {
  199. color: #fff;
  200. cursor: default;
  201. }
  202. .el-pagination.is-background .el-pager li:hover {
  203. color: #b11116;
  204. }
  205. .el-pagination.is-background .el-pager li:not(.disabled):hover {
  206. color: #b11116;
  207. }
  208. .el-pagination.is-background .el-pager li:not(.disabled).active:hover {
  209. background-color: #b11116;
  210. color: #FFF;
  211. }
  212. /*带背景的分页按钮背景色end*/
  213. /*不带背景的分页按钮背景色begin*/
  214. .el-pager li.active {
  215. color: #b11116;
  216. cursor: default;
  217. }
  218. .el-pagination .el-pager li:hover {
  219. color: #b11116;
  220. }
  221. .el-pagination .el-pager li:not(.disabled):hover {
  222. color: #b11116;
  223. }
  224. /*不带背景的分页按钮背景色end*/
  225. </style>