index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. <template>
  2. <div>
  3. <head-bar></head-bar>
  4. <el-container>
  5. <el-main style="padding: 0">
  6. <!-- 大轮播-->
  7. <div class="block">
  8. <el-carousel height="500px">
  9. <el-carousel-item v-for="item in c_1" :key="item">
  10. <nuxt-link :to="{name:'info-id',params:{id:item.newsInfoId,title:item.newsInfoTitle}}">
  11. <el-image
  12. style="width: 100%; height: 500px"
  13. v-if="item.newsInfoUrl "
  14. :src="item.newsInfoUrl "
  15. ></el-image>
  16. </nuxt-link>
  17. <h3 class="small">{{ item }}</h3>
  18. </el-carousel-item>
  19. </el-carousel>
  20. </div>
  21. <!--小轮播-->
  22. <el-row style="margin-top:25px">
  23. <el-col :span="18" offset="3">
  24. <div class="block">
  25. <el-carousel :autoplay="false" arrow="always" height="150px">
  26. <el-carousel-item v-for="item in c_2_count" :key="item">
  27. <el-row :gutter="20" >
  28. <el-col v-for="item1 in 5" :span="4" v-if="c_2[((item-1)*5)+(item1-1)]!=null" :offset="(item1-1)==0?2:0" >
  29. <nuxt-link :to="{name:'info-id',params:{id:c_2[((item-1)*5)+(item1-1)].newsInfoId,title:item.newsInfoTitle}}">
  30. <el-image
  31. style="width: 100%; height: 200px"
  32. v-if="c_2[((item-1)*5)+(item1-1)].newsInfoUrl "
  33. :src="c_2[((item-1)*5)+(item1-1)].newsInfoUrl "
  34. ></el-image>
  35. </nuxt-link>
  36. </el-col>
  37. </el-row>
  38. </el-carousel-item>
  39. </el-carousel>
  40. </div>
  41. </el-col>
  42. </el-row>
  43. <!--主题文章-->
  44. <el-row style="margin-top: 30px">
  45. <el-col :span="18" offset="3">
  46. <div class="value" style="">
  47. 新闻动态&nbsp;&nbsp;
  48. <span class="en">NEWS</span>
  49. <nuxt-link :to="{name:'word'}">
  50. <span class="btn btn-more" style="float: right">更多</span>
  51. </nuxt-link>
  52. </div>
  53. </el-col>
  54. </el-row>
  55. <el-row style="margin: 10px">
  56. <el-col :span="18" offset="3">
  57. <el-row :gutter="40">
  58. <el-col :span="8">
  59. <div class="block">
  60. <el-carousel height="300px">
  61. <el-carousel-item v-for="item in newNews" :key="item">
  62. <nuxt-link :to="{name:'info-id',params:{id:item.newsInfoId,title:item.newsInfoTitle}}">
  63. <el-image
  64. style="width: 100%; height: 300px"
  65. v-if="item.newsInfoUrl "
  66. :src="item.newsInfoUrl "
  67. ></el-image>
  68. </nuxt-link>
  69. <h3 class="small">{{ item }}</h3>
  70. </el-carousel-item>
  71. </el-carousel>
  72. </div>
  73. </el-col>
  74. <el-col :span="8">
  75. <div style="height: 300px">
  76. <el-row style="margin-bottom: 30px">
  77. <el-col class="nav-btn" :style="{color:(changeColor_1?Color_1:Color_2)}" style="text-align: right" :span="9">
  78. <span class="change_title" @click="change1(false)">
  79. 动态要闻
  80. </span>
  81. </el-col>
  82. <el-col style="text-align: center" :span="6">|</el-col>
  83. <el-col class="nav-btn" :style="{color:(!changeColor_1?Color_1:Color_2)}" style="text-align:left" :span="9">
  84. <span class="change_title" @click="change1(true)">
  85. 数据发布
  86. </span>
  87. </el-col>
  88. </el-row>
  89. <el-row :style="{display: !changeColor_1?'inline-block':'none'}">
  90. <el-col :span="24" v-for="item in display_news" :key="item">
  91. <nuxt-link :to="{name:'info-id',params:{id:item.newsInfoId,title:item.newsInfoTitle}}">
  92. {{item.newsInfoTitle.length>15?item.newsInfoTitle.substr(1,14)+"...":item.newsInfoTitle}} <span style="float: right">{{item.newsInfoTime}}</span>
  93. </nuxt-link>
  94. </el-col>
  95. </el-row>
  96. <el-row :style="{display: changeColor_1?'inline-block':'none'}">
  97. <el-col :span="24" v-for="item in data_push" :key="item">
  98. <nuxt-link :to="{name:'info-id',params:{id:item.newsInfoId,title:item.newsInfoTitle}}">
  99. {{item.newsInfoTitle.length>15?item.newsInfoTitle.substr(1,14)+"...":item.newsInfoTitle}} <span style="float: right">{{item.newsInfoTime}}</span>
  100. </nuxt-link>
  101. </el-col>
  102. </el-row>
  103. </div>
  104. </el-col>
  105. <el-col :span="8">
  106. <div style="height: 300px">
  107. <el-row style="margin-bottom: 30px">
  108. <el-col class="nav-btn" :style="{color:(changeColor_2?Color_1:Color_2)}" style="text-align: right" :span="9">
  109. <span class="change_title" @click="change2(false)">
  110. 产品服务
  111. </span>
  112. </el-col>
  113. <el-col style="text-align: center" :span="6">|</el-col>
  114. <el-col class="nav-btn" :style="{color:(!changeColor_2?Color_1:Color_2)}" style="text-align:left" :span="9">
  115. <span class="change_title" @click="change2(true)">
  116. 研究成果
  117. </span>
  118. </el-col>
  119. </el-row>
  120. <el-row :style="{display: !changeColor_2?'inline-block':'none'}">
  121. <el-col :span="24" v-for="item in research" :key="item">
  122. <nuxt-link :to="{name:'info-id',params:{id:item.newsInfoId,title:item.newsInfoTitle}}">
  123. {{item.newsInfoTitle.length>15?item.newsInfoTitle.substr(1,14)+"...":item.newsInfoTitle}} <span style="float: right">{{item.newsInfoTime}}</span>
  124. </nuxt-link>
  125. </el-col>
  126. </el-row>
  127. <el-row :style="{display: changeColor_2?'inline-block':'none'}">
  128. <el-col :span="24" v-for="item in product_service" :key="item">
  129. <nuxt-link :to="{name:'info-id',params:{id:item.newsInfoId,title:item.newsInfoTitle}}">
  130. {{item.newsInfoTitle.length>15?item.newsInfoTitle.substr(1,14)+"...":item.newsInfoTitle}} <span style="float: right">{{item.newsInfoTime}}</span>
  131. </nuxt-link>
  132. </el-col>
  133. </el-row>
  134. </div>
  135. </el-col>
  136. </el-row>
  137. </el-col>
  138. </el-row>
  139. <!--编辑精选文章-->
  140. <el-row style="margin-top: 30px">
  141. <el-col :span="18" offset="3">
  142. <div class="value" style="">
  143. 编辑精选&nbsp;&nbsp;
  144. <span class="en">Editor's Picks</span>
  145. <nuxt-link :to="{name:'editor',params:{'type':1}}">
  146. <span class="btn btn-more" style="float: right">更多</span>
  147. </nuxt-link>
  148. <!-- <span style="float: right">更多</span>-->
  149. </div>
  150. </el-col>
  151. </el-row>
  152. <el-row style="margin: 10px">
  153. <el-col :span="18" offset="3">
  154. <el-row :gutter="40">
  155. <el-col :span="6" v-for="item in editor" :key="item" style="margin-bottom: 20px">
  156. <nuxt-link :to="{name:'info-id',params:{id:item.newsInfoId,title:item.newsInfoTitle}}">
  157. <el-card shadow="hover" :body-style="{ padding: '0px' }">
  158. <el-image
  159. style="width: 100%; height: 180px"
  160. lazy
  161. v-if="item.newsInfoUrl "
  162. :src="item.newsInfoUrl "
  163. ></el-image>
  164. <span v-else>{{item.newsInfoUrl}}</span>
  165. <div style="padding: 14px;">
  166. <span class="item_title">{{item.newsInfoTitle.length>13?item.newsInfoTitle.substr(1,13)+"...":item.newsInfoTitle}}</span><br>
  167. <span class="item_type" v-for="type in wordType" v-if="type.dictValue==item.newsInfoType">
  168. {{type.dictLabel}}
  169. </span>
  170. <el-divider></el-divider>
  171. <el-row>
  172. <el-col :span="6">
  173. <el-avatar size="15" >{{item.newsInfoAuthor}}</el-avatar>
  174. </el-col>
  175. <el-col :span="18">
  176. <div style="line-height: 40px;vertical-align: center">
  177. <span style=""> {{item.newsInfoAuthor}} </span>
  178. </div>
  179. </el-col>
  180. </el-row>
  181. </div>
  182. </el-card>
  183. </nuxt-link>
  184. </el-col>
  185. </el-row>
  186. </el-col>
  187. </el-row>
  188. <!-- 典型案例-->
  189. <el-row style="margin-top: 30px">
  190. <el-col :span="18" offset="3">
  191. <div class="value" style="">
  192. 经典案例&nbsp;&nbsp;
  193. <span class="en">Classic Case</span>
  194. <nuxt-link :to="{name:'classic',params:{'type':5}}">
  195. <span class="btn btn-more" style="float: right">更多</span>
  196. </nuxt-link>
  197. <!-- <span style="float: right">更多</span>-->
  198. </div>
  199. </el-col>
  200. </el-row>
  201. <el-row style="margin: 10px">
  202. <el-col :span="18" offset="3">
  203. <el-row :gutter="40" >
  204. <el-col :span="6" v-for="item in classic_case" :key="item" style="margin-bottom: 20px">
  205. <nuxt-link :to="{name:'info-id',params:{id:item.newsInfoId,title:item.newsInfoTitle}}">
  206. <el-card shadow="hover" :body-style="{ padding: '0px' }">
  207. <el-image
  208. style="width: 100%; height: 180px"
  209. lazy
  210. v-if="item.newsInfoUrl "
  211. :src="item.newsInfoUrl "
  212. ></el-image>
  213. <div style="padding: 14px;">
  214. <span class="item_title">{{item.newsInfoTitle.length>13?item.newsInfoTitle.substr(1,13)+"...":item.newsInfoTitle}}</span><br>
  215. <span class="item_type" v-for="type in wordType" v-if="type.dictValue==item.newsInfoType">
  216. {{type.dictLabel}}
  217. </span>
  218. <el-divider></el-divider>
  219. <el-row>
  220. <el-col :span="6">
  221. <el-avatar size="15" >{{item.newsInfoAuthor}}</el-avatar>
  222. </el-col>
  223. <el-col :span="18">
  224. <div style="line-height: 40px;vertical-align: center">
  225. <span style=""> {{item.newsInfoAuthor}} </span>
  226. </div>
  227. </el-col>
  228. </el-row>
  229. </div>
  230. </el-card>
  231. </nuxt-link>
  232. </el-col>
  233. </el-row>
  234. </el-col>
  235. </el-row>
  236. </el-main>
  237. </el-container>
  238. <!-- 测试-->
  239. <!-- <LTInfo></LTInfo>-->
  240. <!-- <LTProgress></LTProgress>-->
  241. <!--<WordType></WordType>-->
  242. <!--<SearchList></SearchList>-->
  243. <!-- 底部-->
  244. <foot-bar>
  245. </foot-bar>
  246. </div>
  247. </template>
  248. <script>
  249. import {navList,newsList,dictList} from "../static/js/index"
  250. import axios from 'axios';
  251. export default {
  252. name: 'IndexPage',
  253. head(){
  254. return{
  255. title:"中关村公共资源论坛"
  256. }
  257. },
  258. data(){
  259. return{
  260. Color_1: "black",
  261. Color_2: "#c1272d",
  262. changeColor_1:true,
  263. changeColor_2:true,
  264. nav_list:null,
  265. c_1:null,
  266. c_2:null,
  267. c_2_count:null,
  268. display_news:null,
  269. data_push:null,
  270. product_service:null,
  271. research:null,
  272. editor:null,
  273. classic_case:null,
  274. wordType:null,
  275. newNews:null
  276. }
  277. },created() {
  278. this.nav_list=this.getNavList();
  279. this.getNewsList();
  280. this. getDictType();
  281. this.$forceUpdate();
  282. },methods: {
  283. change1(flag){
  284. this.changeColor_1=flag
  285. },
  286. change2(){
  287. this.changeColor_2=!this.changeColor_2
  288. },
  289. getNavList(){
  290. navList().then(response=>{
  291. this.typeList=response.rows;
  292. })
  293. },
  294. getDictType(){
  295. dictList({"dictType":"sys_info_word_type"}).then(response=>{
  296. this.wordType=response.rows;
  297. })
  298. },
  299. getNewsList(){
  300. newsList({"newsInfoCarousel":1}).then(response=>{
  301. this.c_1=response.rows;
  302. })
  303. newsList({"newsInfoSc":1}).then(response=>{
  304. this.c_2=response.rows;
  305. let i=response.total;
  306. this.c_2_count= parseInt(i%5==0?(i/5):((i/5)+1))
  307. console.log(this.c_2_count)
  308. })
  309. newsList({"newsInfoType":1,"pageNum":1,"pageSize":10}).then(response=>{
  310. this.display_news=response.rows;
  311. })
  312. newsList({"newsInfoType":2,"pageNum":1,"pageSize":10}).then(response=>{
  313. this.data_push=response.rows;
  314. })
  315. newsList({"newsInfoType":4,"pageNum":1,"pageSize":10}).then(response=>{
  316. this.product_service=response.rows;
  317. })
  318. newsList({"newsInfoType":3,"pageNum":1,"pageSize":10}).then(response=>{
  319. this.research=response.rows;
  320. })
  321. newsList({"newsInfoType":5,"pageNum":1,"pageSize":4}).then(response=>{
  322. this.classic_case=response.rows;
  323. })
  324. newsList({"pageNum":1,"pageSize":5}).then(response=>{
  325. this.newNews=response.rows;
  326. })
  327. newsList({"newsInfoRecommend":1,"pageNum":1,"pageSize":8}).then(response=>{
  328. this.editor=response.rows;
  329. })
  330. },
  331. }
  332. }
  333. </script>
  334. <style >
  335. html,body{
  336. padding: 0;
  337. margin: 0;
  338. }
  339. /*.el-carousel__item h3 {*/
  340. /* color: #475669;*/
  341. /* font-size: 14px;*/
  342. /* opacity: 0.75;*/
  343. /* line-height: 150px;*/
  344. /* margin: 0;*/
  345. /*}*/
  346. /*.el-carousel__item:nth-child(2n) {*/
  347. /* background-color: #99a9bf;*/
  348. /*}*/
  349. /*.el-carousel__item:nth-child(2n+1) {*/
  350. /* background-color: #d3dce6;*/
  351. /*}*/
  352. .value{
  353. -webkit-text-size-adjust: 100%;
  354. letter-spacing: 1px;
  355. text-rendering: optimizeLegibility;
  356. font-family: "PingFang SC", "Microsoft YaHei", "STHeiti", "sans-serif";
  357. font-size: 28px;
  358. font-weight: bold;
  359. }
  360. .en{
  361. -webkit-text-size-adjust: 100%;
  362. letter-spacing: 1px;
  363. text-rendering: optimizeLegibility;
  364. font-family: "PingFang SC", "Microsoft YaHei", "STHeiti", "sans-serif";
  365. font-size: 28px;
  366. font-weight: 300;
  367. }
  368. .btn-more{
  369. -webkit-text-size-adjust: 100%;
  370. letter-spacing: 1px;
  371. text-rendering: optimizeLegibility;
  372. font-family: "PingFang SC", "Microsoft YaHei", "STHeiti", "sans-serif";
  373. font-weight: bold;
  374. position: relative;
  375. cursor: pointer;
  376. font-size: 16px;
  377. }
  378. .nav-btn{
  379. -webkit-text-size-adjust: 100%;
  380. letter-spacing: 1px;
  381. text-rendering: optimizeLegibility;
  382. font-family: "PingFang SC", "Microsoft YaHei", "STHeiti", "sans-serif";
  383. border-spacing: 0;
  384. font-size: 22px;
  385. font-weight: bold;
  386. }
  387. .item_title{
  388. font-weight: 700;
  389. }
  390. .item_title:hover{
  391. color: #b11116;
  392. }
  393. .item_type{
  394. margin-top: 15px;
  395. color: dimgray;
  396. }
  397. </style>