Home.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <template>
  2. <div class="home">
  3. <swiper id="swiperBox"
  4. v-bind:options="swiperOption"
  5. ref="mySwiper">
  6. <swiper-slide class="swiper-slide slide-one"></swiper-slide>
  7. <swiper-slide class="swiper-slide slide-two"></swiper-slide>
  8. <swiper-slide class="swiper-slide slide-three"></swiper-slide>
  9. </swiper>
  10. <div class="common-container">
  11. <el-container>
  12. <!-- <header>
  13. <ul>
  14. <li>
  15. <img src=""
  16. alt="">
  17. <div>
  18. <p>1280</p>
  19. <span>仪器总数</span>
  20. </div>
  21. </li>
  22. <li>
  23. <img src=""
  24. alt="">
  25. <div>
  26. <p>1280</p>
  27. <span>仪器总数</span>
  28. </div>
  29. </li>
  30. <li>
  31. <img src=""
  32. alt="">
  33. <div>
  34. <p>1280</p>
  35. <span>仪器总数</span>
  36. </div>
  37. </li>
  38. </ul>
  39. </header> -->
  40. <el-row :gutter="12"
  41. class="mt12">
  42. <el-col :span="8">
  43. <el-card>
  44. <div slot="header"
  45. class="header">
  46. <h4>通知公告</h4>
  47. <el-link @click="toRouter('/news')" type="primary" style="float: right">查看更多>>></el-link>
  48. </div>
  49. <div class="link-list">
  50. <ul>
  51. <li v-for="item in noticeList"
  52. :key="item.id">
  53. <div>
  54. <img v-if="item.isTop === '10'" src="@/assets/img/isTop.png" alt />
  55. 【{{ item.noticeType === '10' ? '公告' : '通知' }}】{{ item.noticeTitle }}
  56. </div>
  57. <span>{{ parseTime(item.noticeTime, "{y}-{m}-{d}") }}</span>
  58. </li>
  59. </ul>
  60. </div>
  61. </el-card>
  62. </el-col>
  63. <el-col :span="8">
  64. <el-card>
  65. <div slot="header"
  66. class="header">
  67. <h4>新闻动态</h4>
  68. <el-link @click="toRouter('/news')" type="primary" style="float: right">查看更多>>></el-link>
  69. </div>
  70. <div class="link-list">
  71. <ul>
  72. <li v-for="item in newsInfoList"
  73. :key="item.id">
  74. <div>
  75. {{ item.newsTitle }}
  76. </div>
  77. <span>{{ parseTime(item.createdTime, "{y}-{m}-{d}") }}</span>
  78. </li>
  79. </ul>
  80. </div>
  81. </el-card>
  82. </el-col>
  83. <el-col :span="8">
  84. <el-card>
  85. <div slot="header"
  86. class="header">
  87. <h4>技术服务</h4>
  88. </div>
  89. <div class="link-list">
  90. <ul>
  91. <li v-for="item in noticeList"
  92. :key="item.id">
  93. <div>
  94. {{ item.noticeTitle }}
  95. </div>
  96. <span>{{ parseTime(item.noticeTime, "{y}-{m}-{d}") }}</span>
  97. </li>
  98. </ul>
  99. </div>
  100. </el-card>
  101. </el-col>
  102. </el-row>
  103. </el-container>
  104. <div class="equip">
  105. <el-container>
  106. <h2>主要设备</h2>
  107. <p>中心集中了学校大型贵重仪器设备,实现实验设施、仪器设备、实验方法和实验技术的优势互补、资源共享。拥有各类仪器设备240余台件,价值省内同类科研领域领先水平。</p>
  108. <ul>
  109. <li>
  110. <img src="../assets/img/equip-1.jpg" />
  111. <span>超敏多因子电化学发光分析仪</span>
  112. </li>
  113. <li>
  114. <img src="../assets/img/equip-2.jpg" />
  115. <span>多功能酶标仪</span>
  116. </li>
  117. <li>
  118. <img src="../assets/img/equip-3.png" />
  119. <span>微流控毛细管电泳系统</span>
  120. </li>
  121. <li>
  122. <img src="../assets/img/equip-4.jpg" />
  123. <span>全自动核酸提取纯化仪</span>
  124. </li>
  125. </ul>
  126. </el-container>
  127. </div>
  128. <el-container class="mb12">
  129. <el-row :gutter="12">
  130. <el-col :span="9">
  131. <el-card>
  132. <div slot="header"
  133. class="header">
  134. <h4>规章制度</h4>
  135. <el-link @click="toRouter('/introduce')" type="primary" style="float: right">查看更多>>></el-link>
  136. </div>
  137. <div class="link-list">
  138. <ul>
  139. <li v-for="item in institutionList"
  140. :key="item.id">
  141. <div>
  142. {{ item.docName }}
  143. </div>
  144. <span>{{ parseTime(item.createdTime, "{y}-{m}-{d}") }}</span>
  145. </li>
  146. </ul>
  147. </div>
  148. </el-card>
  149. </el-col>
  150. <el-col :span="9">
  151. <el-card>
  152. <div slot="header"
  153. class="header">
  154. <h4>下载专区</h4>
  155. <el-link @click="toRouter('/case')" type="primary" style="float: right">查看更多>>></el-link>
  156. </div>
  157. <div class="link-list">
  158. <ul>
  159. <li v-for="item in downloadList"
  160. :key="item.id">
  161. <div>
  162. {{ item.docName }}
  163. </div>
  164. <span>{{ parseTime(item.createdTime, "{y}-{m}-{d}") }}</span>
  165. </li>
  166. </ul>
  167. </div>
  168. </el-card>
  169. </el-col>
  170. <el-col :span="6">
  171. <ul class="btn-list">
  172. <li>大型仪器共享平台</li>
  173. <li>安全准入考试系统</li>
  174. <li>图书馆</li>
  175. <li>教务管理</li>
  176. </ul>
  177. </el-col>
  178. </el-row>
  179. </el-container>
  180. </div>
  181. </div>
  182. </template>
  183. <script>
  184. import { swiper, swiperSlide } from "vue-awesome-swiper";
  185. import { getNoticeList, getNewsInformationList } from "@/api/news";
  186. import to from "await-to-js";
  187. import {
  188. getEntityByClassName,
  189. } from "@/api/document";
  190. import { parseTime } from "@/utils/ruoyi";
  191. export default {
  192. name: "HelloWorld",
  193. components: {
  194. swiper,
  195. swiperSlide,
  196. },
  197. data() {
  198. return {
  199. loading: true,
  200. caseList: [],
  201. newsList: [],
  202. swiperOption: {
  203. notNextTick: true, //notNextTick是一个组件自有属性,如果notNextTick设置为true,组件则不会通过NextTick来实例化swiper,也就意味着你可以在第一时间获取到swiper对象,假如你需要刚加载遍使用获取swiper对象来做什么事,那么这个属性一定要是true
  204. direction: "horizontal", //水平方向移动
  205. grabCursor: true, //鼠标覆盖Swiper时指针会变成手掌形状,拖动时指针会变成抓手形状
  206. setWrapperSize: true, //Swiper使用flexbox布局(display: flex),开启这个设定会在Wrapper上添加等于slides相加的宽或高,在对flexbox布局的支持不是很好的浏览器中可能需要用到。
  207. autoHeight: false, //自动高度。设置为true时,wrapper和container会随着当前slide的高度而发生变化
  208. slidesPerView: 1, //设置slider容器能够同时显示的slides数量(carousel模式)。可以设置为数字(可为小数,小数不可loop),或者 'auto'则自动根据slides的宽度来设定数量。loop模式下如果设置为'auto'还需要设置另外一个参数loopedSlides。
  209. mousewheel: true, //开启鼠标滚轮控制Swiper切换。可设置鼠标选项,默认值false
  210. mousewheelControl: true, //同上
  211. height: 450, // 高度设置,占满设备高度
  212. resistanceRatio: 0, //抵抗率。边缘抵抗力的大小比例。值越小抵抗越大越难将slide拖离边缘,0时完全无法拖离。本业务需要
  213. observeParents: true, //将observe应用于Swiper的父元素。当Swiper的父元素变化时,例如window.resize,Swiper更新
  214. // 如果自行设计了插件,那么插件的一些配置相关参数,也应该出现在这个对象中,如下debugger
  215. //debugger: true,
  216. // swiper的各种回调函数也可以出现在这个对象中,和swiper官方一样
  217. on: {
  218. //监听滑动切换事件,返回swiper对象
  219. // slideChange: () => {
  220. // let swiper = this.$refs.mySwiper.swiper;
  221. // //console.log(swiper.activeIndex); //滑动打印当前索引
  222. // if (swiper.activeIndex === this.list.length - 1) {
  223. // //到最后一个加载更多数据
  224. // let newList = [];
  225. // let listLength = this.list.length;
  226. // for (let i = 0; i < 10; i++) {
  227. // newList.push(listLength + i);
  228. // }
  229. // this.list = this.list.concat(newList);
  230. // }
  231. // }
  232. },
  233. },
  234. noticeList: [],
  235. newsInfoList: [],
  236. institutionList: [],
  237. downloadList: []
  238. };
  239. },
  240. created() {},
  241. // 如果你需要得到当前的swiper对象来做一些事情,你可以像下面这样定义一个方法属性来获取当前的swiper对象,同时notNextTick必须为true
  242. computed: {
  243. swiper() {
  244. return this.$refs.mySwiper.swiper;
  245. },
  246. },
  247. mounted() {
  248. this.getNotice();
  249. this.getNewsInfoList(); // 新闻动态
  250. this.getInstitutionList()
  251. this.getDownloadList()
  252. },
  253. methods: {
  254. parseTime,
  255. async getNotice() {
  256. const [err, res] = await to(getNoticeList());
  257. if (err) return;
  258. this.noticeList = res.data.list || [];
  259. },
  260. async getNewsInfoList() {
  261. const [err, res] = await to(getNewsInformationList());
  262. if (err) return;
  263. this.newsInfoList = res.data.list || [];
  264. },
  265. async getInstitutionList() {
  266. const [err, res] = await to(getEntityByClassName({ docClassName: '规章制度' }));
  267. if (err) return;
  268. this.institutionList = res.data.list || [];
  269. },
  270. async getDownloadList() {
  271. const [err, res] = await to(getEntityByClassName({ noPage: true }));
  272. if (err) return;
  273. this.downloadList = res.data.list || [];
  274. },
  275. // 路由跳转
  276. toRouter(router) {
  277. this.$router.push({ path: router });
  278. }
  279. },
  280. };
  281. </script>
  282. <style lang="scss" scoped>
  283. .slide-one {
  284. height: 320px;
  285. background: url(../assets/img/home.png) no-repeat center;
  286. background-size: cover;
  287. }
  288. .slide-two {
  289. height: 320px;
  290. background: url(../assets/img/home.png) no-repeat center;
  291. background-size: cover;
  292. }
  293. .slide-three {
  294. height: 320px;
  295. background: url(../assets/img/home.png) no-repeat center;
  296. background-size: cover;
  297. }
  298. .common-container {
  299. padding: 0;
  300. .el-container {
  301. flex-direction: column;
  302. }
  303. header {
  304. height: 100px;
  305. width: 1200px;
  306. margin-top: -50px;
  307. background: #ffffff;
  308. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  309. border-radius: 16px;
  310. position: relative;
  311. z-index: 999;
  312. ul {
  313. display: flex;
  314. align-items: center;
  315. height: 100px;
  316. li {
  317. flex: 1;
  318. display: flex;
  319. justify-content: center;
  320. > div {
  321. p {
  322. font-weight: bold;
  323. font-size: 32px;
  324. color: #323232;
  325. }
  326. span {
  327. font-weight: 400;
  328. font-size: 14px;
  329. color: #323232;
  330. }
  331. }
  332. }
  333. }
  334. }
  335. }
  336. .link-list {
  337. height: 272px;
  338. overflow: hidden;
  339. }
  340. .equip {
  341. width: 100%;
  342. height: 350px;
  343. background: url(../assets/img/home-equip.jpg) center;
  344. background-size: cover;
  345. margin: 12px auto;
  346. padding-top: 20px;
  347. h2 {
  348. color: #0066cc;
  349. font-size: 28px;
  350. line-height: 60px;
  351. height: 60px;
  352. display: block;
  353. text-align: center;
  354. }
  355. p {
  356. color: #0066cc;
  357. font-size: 14px;
  358. line-height: 24px;
  359. text-align: center;
  360. }
  361. ul {
  362. height: 220px;
  363. display: flex;
  364. li {
  365. flex: 1;
  366. margin: 10px;
  367. position: relative;
  368. overflow: hidden;
  369. transition: all 0.3s;
  370. cursor: pointer;
  371. &:hover {
  372. img {
  373. transform: scale(1.2);
  374. }
  375. span {
  376. background-color: #ea6914;
  377. }
  378. }
  379. img {
  380. width: 100%;
  381. height: 200px;
  382. transition: all 0.3s;
  383. }
  384. span {
  385. position: absolute;
  386. bottom: 0;
  387. left: 0;
  388. right: 0;
  389. height: 40px;
  390. line-height: 40px;
  391. background: #0066cc;
  392. opacity: 0.8;
  393. text-align: center;
  394. color: #fff;
  395. }
  396. }
  397. }
  398. }
  399. .btn-list {
  400. height: 374px;
  401. display: flex;
  402. flex-direction: column;
  403. li {
  404. flex: 1;
  405. display: flex;
  406. align-items: center;
  407. justify-content: center;
  408. color: #ffffff;
  409. font-size: 20px;
  410. font-weight: bold;
  411. border-radius: 6px;
  412. background: #11a0ac;
  413. user-select: none;
  414. cursor: pointer;
  415. transition: all .3s;
  416. &:hover {
  417. opacity: .7;
  418. }
  419. & + li {
  420. margin-top: 15px;
  421. }
  422. &:nth-child(2) {
  423. background-color: #df9514;
  424. }
  425. &:nth-child(3) {
  426. background-color: #1675d4;
  427. }
  428. &:nth-child(4) {
  429. background-color: #cc1355;
  430. }
  431. }
  432. }
  433. </style>