Home.vue 13 KB

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