Home.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <div class="home">
  3. <el-carousel height="100px" class="hfbox" direction="vertical" autoplay :interval="3000">
  4. <el-carousel-item>
  5. <a class="hf" href="http://www.news.cn/zt/djxxjy/index.html">
  6. <img src="../assets/hf1.jpg" class="hfimg">
  7. </a>
  8. </el-carousel-item>
  9. <el-carousel-item>
  10. <a class="hf" href="http://www.gov.cn/zhuanti/zggcddescqgdbdh/index.htm">
  11. <img src="../assets/hf2.jpg" class="hfimg">
  12. </a>
  13. </el-carousel-item>
  14. <el-carousel-item>
  15. <a class="hf" href="http://www.news.cn/zt/djxxjy/index.html">
  16. <img src="../assets/hf1.jpg" class="hfimg">
  17. </a>
  18. </el-carousel-item>
  19. <el-carousel-item>
  20. <a class="hf" href="http://www.gov.cn/zhuanti/zggcddescqgdbdh/index.htm">
  21. <img src="../assets/hf2.jpg" class="hfimg">
  22. </a>
  23. </el-carousel-item>
  24. </el-carousel>
  25. <div class="listBox">
  26. <banner class="lists"></banner>
  27. <threeList parentCode="02" class="listItem" :imgUrl="newsImgUrl" :data="news" :isImg="false" title="社科要闻" code="ztjy1"></threeList>
  28. <threeList parentCode="10" :imgUrl="threeImggg" :data="threeDatagg" :isImg="false" title="通知公告" code="101"></threeList>
  29. </div>
  30. <div class="listBox">
  31. <lists parentCode="03" title="社会组织建设" code="031" :imgUrl="corporationimgUrl" :tabsList="corporationList" :tabsType="null" :data="corporation" isImg @tabClick="btnClick({ ...$event, type: 'corporation' })"></lists>
  32. <lists parentCode="04" title="社会科学普及" class="listItem" :imgUrl="prizeImgUrl" :tabsList="prizeList" :tabsType="null" :data="prize" isImg @tabClick="btnClick({ ...$event, type: 'prize' })"></lists>
  33. <threeList parentCode="07" :imgUrl="threeImg" :data="threeData" code="07"></threeList>
  34. </div>
  35. <div class="listBox">
  36. <lists parentCode="05" title="智库基金项目" :imgUrl="buildsImgUrl" :tabsList="buildsList" tabsType="border-card" :data="builds" @tabClick="btnClick({ ...$event, type: 'builds', limit: 6 })"></lists>
  37. <lists parentCode="06" title="社会科学评奖" class="listItem" :imgUrl="universalImgUrl" :tabsList="universalList" tabsType="border-card" :data="universal" @tabClick="btnClick({ ...$event, type: 'universal', limit: 6 })"></lists>
  38. <div class="xzbox">
  39. <threeList code="09" parentCode="09" class="three" :imgUrl="threeImgzc" :data="threeDatazc"></threeList>
  40. <el-image :src="xzUrl" class="xz" @click="imgClick('111', '11')"></el-image>
  41. </div>
  42. </div>
  43. <div class="listBox">
  44. <el-image :src="sknj" class="sknj"></el-image>
  45. <el-image :src="szsklUrl" class="szskl" @click="imgClick('08', '08')"></el-image>
  46. </div>
  47. <links class="links"></links>
  48. </div>
  49. </template>
  50. <script>
  51. import { mapState, mapActions } from 'vuex';
  52. import banner from '../components/banner/banner.vue';
  53. import lists from '../components/list/index';
  54. import threeList from '../components/list/threeList';
  55. import links from '../components/link/index';
  56. export default {
  57. name: 'Home',
  58. components: {
  59. banner,
  60. lists,
  61. threeList,
  62. links
  63. },
  64. computed: {
  65. ...mapState(['menusall'])
  66. },
  67. data() {
  68. return {
  69. sknj: require('../assets/sknj.jpg'),
  70. xzUrl: require('../assets/xz.jpg'),
  71. szsklUrl: require('../assets/szskl.jpg'),
  72. // 社团
  73. corporation: [],
  74. corporationimgUrl: require('../assets/icon1.png'),
  75. corporationList: [
  76. { title: '社会组织党建', code: '031' },
  77. { title: '社会组织活动', code: '032' },
  78. { title: '社会组织简介', code: '033' }
  79. ],
  80. // 社科普及
  81. prize: [],
  82. prizeImgUrl: require('../assets/icon3.png'),
  83. prizeList: [
  84. { title: '科普讲座', code: '041', parentCode: true },
  85. { title: '科普活动', code: '042', parentCode: true },
  86. { title: '科普周', code: '043', parentCode: true },
  87. { title: '科普基地', code: '044', parentCode: true },
  88. { title: '科普园地', code: '045', parentCode: true },
  89. { title: '交流培训', code: '046', parentCode: true }
  90. ],
  91. // 社科奖项
  92. universal: [],
  93. universalImgUrl: require('../assets/icon2.png'),
  94. universalList: [
  95. { title: '评奖信息', code: '061' },
  96. { title: '获奖成果', code: '062' },
  97. { title: '网上申报', code: '063' }
  98. ],
  99. // 智库建设
  100. builds: [],
  101. buildsImgUrl: require('../assets/icon4.png'),
  102. buildsList: [
  103. { title: '申报评审', code: '051' },
  104. { title: '立项管理', code: '052' },
  105. { title: '服务平台', code: '053', parentCode: true }
  106. ],
  107. // 社科要闻
  108. news: [],
  109. newsImgUrl: require('../assets/icon5.png'),
  110. // 成果发布
  111. threeImg: require('../assets/cg.jpg'),
  112. threeData: [],
  113. // 政策法规
  114. threeImgzc: require('../assets/zc.jpg'),
  115. threeDatazc: [],
  116. // 通知公告
  117. threeImggg: require('../assets/gg.png'),
  118. threeDatagg: []
  119. };
  120. },
  121. async mounted() {
  122. // 字典
  123. await this.sourceQuery();
  124. // 科学评奖
  125. await this.btnClick({ name: '061', type: 'universal', limit: 6 });
  126. // 智库基金
  127. await this.btnClick({ name: '051', type: 'builds', limit: 6 });
  128. // 社科要闻
  129. await this.btnClick({ name: '02', type: 'news', limit: 6, parentCode: true });
  130. // 成果发布
  131. await this.btnClick({ name: '07', type: 'threeData', limit: 5, parentCode: true });
  132. // 政策法规
  133. await this.btnClick({ name: '09', type: 'threeDatazc', limit: 3, parentCode: true });
  134. // 通知公告
  135. await this.btnClick({ name: '10', type: 'threeDatagg', limit: 6, parentCode: true });
  136. // 所有菜单
  137. await this.menusQueryAll();
  138. },
  139. methods: {
  140. ...mapActions(['contentsQuery', 'menusQueryAll', 'sourceQuery']),
  141. async btnClick(e) {
  142. const filter = { bind: e?.name };
  143. if (e?.parentCode) filter.parentCode = e?.name;
  144. if (e?.limit) filter.limit = e?.limit;
  145. const res = await this.contentsQuery({ ...filter });
  146. if (res.errcode == 0) {
  147. switch (e?.type) {
  148. case 'prize':
  149. this.prize = res.data;
  150. break;
  151. case 'corporation':
  152. this.corporation = res.data;
  153. break;
  154. case 'universal':
  155. this.universal = res.data;
  156. break;
  157. case 'builds':
  158. this.builds = res.data;
  159. break;
  160. case 'news':
  161. this.news = res.data;
  162. break;
  163. case 'threeData':
  164. this.threeData = res.data;
  165. break;
  166. case 'threeDatazc':
  167. this.threeDatazc = res.data;
  168. break;
  169. case 'threeDatagg':
  170. this.threeDatagg = res.data;
  171. break;
  172. }
  173. }
  174. },
  175. // 图片点击
  176. imgClick(code, parentCode) {
  177. if (code == 'ztjy') {
  178. const routeUrl = this.$router.resolve(`/templates/ztjy/${code}`);
  179. window.open(routeUrl.href, '_blank');
  180. return;
  181. }
  182. const item = this.$last({ menus: this.menusall, code: code });
  183. this.$setParentsetSession({ menus: this.menusall, iscode: item });
  184. this.$router.push(`/list/${code}?parentCode=${parentCode}`);
  185. }
  186. }
  187. };
  188. </script>
  189. <style lang="scss" scoped>
  190. .home {
  191. width: 100%;
  192. // background: #f5f9ff;
  193. .top {
  194. width: 100%;
  195. }
  196. .hfbox {
  197. width: 68%;
  198. margin: 0.5% auto;
  199. .hf {
  200. width: 100%;
  201. height: 100px;
  202. cursor: pointer;
  203. .hfimg {
  204. width: 100%;
  205. height: 100px;
  206. }
  207. }
  208. }
  209. .listBox {
  210. width: 68%;
  211. margin: 0.5% auto;
  212. display: flex;
  213. .listItem {
  214. margin: 0 0.5%;
  215. }
  216. }
  217. .links {
  218. width: 68%;
  219. }
  220. .sknj {
  221. width: 66%;
  222. display: block;
  223. margin-right: 1%;
  224. }
  225. .szskl {
  226. width: 33%;
  227. display: block;
  228. }
  229. .xzbox {
  230. width: 33%;
  231. position: relative;
  232. .three {
  233. width: 100%;
  234. height: 74%;
  235. }
  236. .xz {
  237. width: 100%;
  238. position: absolute;
  239. bottom: 0;
  240. height: 85px;
  241. }
  242. }
  243. }
  244. </style>