index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. <template>
  2. <custom-layout v-loading="loading" :is_carousel="true" :carouselList="carouselList">
  3. <el-col :span="24" class="two">
  4. <div class="two_left">
  5. <div class="left_more left_1" @click="toComon('/nine')">
  6. <div class="name">成果中心</div>
  7. <div class="english">ACHIEVEMENT CENTER</div>
  8. <div class="remark">成果征集入口</div>
  9. </div>
  10. <div class="left_more left_2" @click="toComon('/two')">
  11. <div class="name">信息发布</div>
  12. <div class="english">INFORMATION RELEASE</div>
  13. <div class="remark">需求供给发布入口</div>
  14. </div>
  15. <div class="left_more left_3" @click="toComon('/four')">
  16. <div class="name">信息检索</div>
  17. <div class="english">INFORMATION RETRIEVAL</div>
  18. <div class="remark">信息检索入口</div>
  19. </div>
  20. </div>
  21. <div class="two_center">
  22. <div class="center_1">
  23. <div class="center_left">新闻资讯</div>
  24. <div class="center_right" @click="toMore">更多>></div>
  25. </div>
  26. <div class="center_2">
  27. <vue3-seamless-scroll :list="newsList" :hover="true" :step="0.5" :wheel="true" :isWatch="true">
  28. <div class="center_list" v-for="(item, index) in newsList" :key="index">
  29. <div class="center_left textOne">{{ item.title || '暂无' }}</div>
  30. <div class="center_right">{{ moment(item.time).format('YYYY-MM-DD') || '暂无' }}</div>
  31. </div>
  32. </vue3-seamless-scroll>
  33. </div>
  34. </div>
  35. <div class="two_right">
  36. <div class="right_more right_1" @click="toComon('/expert')">
  37. <div class="right_left">
  38. <el-image class="image" :src="home_1" fit="fill" />
  39. <div class="right_name">
  40. <div class="name">专家库</div>
  41. <div class="english">EXPERT LIBRARY</div>
  42. </div>
  43. </div>
  44. <div class="right_right">点击进入>></div>
  45. </div>
  46. <div class="right_more right_2" @click="toComon('/company')">
  47. <div class="right_left">
  48. <el-image class="image" :src="home_2" fit="fill" />
  49. <div class="right_name">
  50. <div class="name">企业库</div>
  51. <div class="english">ENTERPRISE LIBRARY</div>
  52. </div>
  53. </div>
  54. <div class="right_right">点击进入>></div>
  55. </div>
  56. <div class="right_more right_3" @click="toComon('/project')">
  57. <div class="right_left">
  58. <el-image class="image" :src="home_3" fit="fill" />
  59. <div class="right_name">
  60. <div class="name">项目库</div>
  61. <div class="english">PROJECT LIBRARY</div>
  62. </div>
  63. </div>
  64. <div class="right_right">点击进入>></div>
  65. </div>
  66. </div>
  67. </el-col>
  68. <el-col :span="24" class="thr">
  69. <div class="thr_1">
  70. <div class="title">赛事推广</div>
  71. </div>
  72. <div class="thr_2">
  73. <div class="left">
  74. <el-image v-if="matchInfo.file && matchInfo.file.length > 0" class="image" :src="getUrl(matchInfo.file, 'array')" fit="cover">
  75. <template v-slot:error>
  76. <el-image class="image" :src="match_3" fit="fill" />
  77. </template>
  78. </el-image>
  79. <el-image v-else class="image" :src="match_3" fit="fill" />
  80. <div class="name textMore">{{ matchInfo.name || '暂无' }}</div>
  81. <div class="brief">{{ removeHtmlStyle(matchInfo.brief) }}</div>
  82. <div class="other">
  83. <div class="time">
  84. <el-image class="image" :src="time1" fit="fill" />
  85. <div>{{ matchInfo.start_time || '暂无' }}~{{ matchInfo.end_time || '暂无' }}</div>
  86. </div>
  87. <div class="button" @click="toView(matchInfo, '2')">查看 ></div>
  88. </div>
  89. </div>
  90. <div class="right">
  91. <div class="list" v-for="(item, index) in matchList" :key="index">
  92. <el-image v-if="item.file && item.file.length > 0" class="image" :src="getUrl(item.file, 'array')" fit="cover">
  93. <template v-slot:error>
  94. <el-image class="image" :src="match_3" fit="fill" />
  95. </template>
  96. </el-image>
  97. <el-image v-else class="image" :src="match_3" fit="fill" />
  98. <div class="name textMore">{{ item.name }}</div>
  99. <div class="other">
  100. <div class="time">
  101. <el-image class="image" :src="time1" fit="fill" />
  102. <div>{{ item.start_time || '暂无' }}~{{ item.end_time || '暂无' }}</div>
  103. </div>
  104. <div class="button" @click="toView(item, '2')">查看 ></div>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </el-col>
  110. <el-col :span="24" class="four">
  111. <div class="four_1">
  112. <div class="title">合作伙伴</div>
  113. </div>
  114. <div class="four_2">
  115. <div class="list" v-for="(item, index) in friendList" :key="index">
  116. <el-image class="image" :src="getUrl(item.url, 'array')" fit="fill"></el-image>
  117. </div>
  118. </div>
  119. </el-col>
  120. <el-col :span="24" class="five">
  121. <div class="five_1">
  122. <div class="title">友情链接</div>
  123. </div>
  124. <div class="five_2">
  125. <el-col :span="8" class="list" v-for="(item, index) in typeList" :key="index">
  126. <div class="list_1">
  127. <div class="title">{{ item.title }}</div>
  128. </div>
  129. <div class="list_2" v-for="(tag, indexx) in item.list" :key="indexx" @click="toLink(tag)">
  130. {{ tag.name }}
  131. </div>
  132. </el-col>
  133. </div>
  134. </el-col>
  135. </custom-layout>
  136. </template>
  137. <script setup>
  138. import moment from 'moment'
  139. // 图片引入
  140. import home_1 from '/images/home_1.png'
  141. import home_2 from '/images/home_2.png'
  142. import home_3 from '/images/home_3.png'
  143. import time1 from '/images/time-dary.png'
  144. import match_3 from '/images/match_3.jpg'
  145. const $checkRes = inject('$checkRes')
  146. // 接口
  147. import { NewsStore } from '@/store/api/platform/news'
  148. import { MatchStore } from '@/store/api/platform/match'
  149. import { DesignStore } from '@/store/api/platform/design'
  150. const newsStore = NewsStore()
  151. const matchStore = MatchStore()
  152. const designStore = DesignStore()
  153. // 加载中
  154. const loading = ref(false)
  155. // 路由
  156. const router = useRouter()
  157. const carouselList = ref([])
  158. const friendList = ref([])
  159. // 新闻
  160. const newsList = ref([])
  161. // 比赛
  162. const matchList = ref([])
  163. const matchInfo = ref({})
  164. // 分类
  165. const typeList = ref([
  166. {
  167. title: '热门高校',
  168. list: []
  169. },
  170. {
  171. title: '政府部门',
  172. list: []
  173. },
  174. {
  175. title: '科研机构',
  176. list: []
  177. }
  178. ])
  179. // 请求
  180. onMounted(async () => {
  181. loading.value = true
  182. await searchOther()
  183. await searchMatch()
  184. loading.value = false
  185. })
  186. const searchOther = async () => {
  187. const info = {
  188. skip: 0,
  189. limit: 10,
  190. is_use: '0',
  191. status: '1'
  192. }
  193. let res
  194. // 政策新闻
  195. res = await newsStore.query({ ...info })
  196. if (res.errcode == '0') newsList.value = res.data
  197. // 基础设置
  198. res = await designStore.query({})
  199. if ($checkRes(res)) {
  200. carouselList.value = res.data[0].carouselUrl || []
  201. friendList.value = res.data[0].friend || []
  202. const friendship = res.data[0].friendship || []
  203. for (const val of friendship) {
  204. for (const tag of typeList.value) {
  205. if (val.type == tag.title) {
  206. tag.list.push(val)
  207. }
  208. }
  209. }
  210. }
  211. }
  212. const searchMatch = async () => {
  213. const info = {
  214. skip: 0,
  215. limit: 5,
  216. is_use: '0',
  217. status: '1'
  218. }
  219. const res = await matchStore.query(info)
  220. if (res.errcode == '0') {
  221. matchList.value = res.data.slice(1, 5)
  222. matchInfo.value = res.data[0]
  223. }
  224. }
  225. // 查看详情
  226. const toView = (item, type) => {
  227. if (type == '0') router.push({ path: '/news/detail', query: { id: item.id || item._id } })
  228. else if (type == '1') router.push({ path: '/achievement/detail', query: { id: item.id || item._id } })
  229. else router.push({ path: '/match/detail', query: { id: item.id || item._id } })
  230. }
  231. // 查看更多
  232. const toMore = () => {
  233. router.push({ path: '/news' })
  234. }
  235. // 查看
  236. const toComon = (route) => {
  237. router.push({ path: route })
  238. }
  239. const removeHtmlStyle = (html) => {
  240. let relStyle = /style\s*?=\s*?([‘"])[\s\S]*?\1/g //去除样式
  241. let relTag = /<.+?>/g //去除标签
  242. let relClass = /class\s*?=\s*?([‘"])[\s\S]*?\1/g // 清除类名
  243. let newHtml = ''
  244. if (html) {
  245. newHtml = html.replace(relStyle, '')
  246. newHtml = newHtml.replace(relTag, '')
  247. newHtml = newHtml.replace(relClass, '')
  248. }
  249. return newHtml
  250. }
  251. const toLink = (item) => {
  252. window.open(item.href, '_blank') // 在新标签页中打开URL
  253. }
  254. const getUrl = (item, type) => {
  255. if (item) {
  256. if (type == 'array') return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
  257. else return `${import.meta.env.VITE_APP_HOST}${item.uri}`
  258. }
  259. }
  260. </script>
  261. <style scoped lang="scss">
  262. .one {
  263. .image {
  264. width: 100%;
  265. height: 100%;
  266. }
  267. }
  268. .two {
  269. width: 1300px;
  270. margin: 20px auto;
  271. display: flex;
  272. justify-content: space-between;
  273. .two_left {
  274. width: 327px;
  275. .left_more {
  276. width: 327px;
  277. padding-left: 45px;
  278. height: 127px;
  279. border-radius: 2px;
  280. color: #fff;
  281. margin-bottom: 9px;
  282. position: relative;
  283. cursor: default;
  284. .name {
  285. font-size: $global-font-size-26;
  286. font-weight: 700;
  287. line-height: 30px;
  288. padding-top: 20px;
  289. }
  290. .english {
  291. font-size: $global-font-size-14;
  292. padding: 7px 0;
  293. }
  294. .remark {
  295. font-size: $global-font-size-14;
  296. padding: 0 10px;
  297. height: 30px;
  298. display: block;
  299. border: 1px solid hsla(0, 0%, 100%, 0.5);
  300. text-align: center;
  301. line-height: 30px;
  302. float: left;
  303. }
  304. }
  305. .left_1 {
  306. background: linear-gradient(90deg, #6a8df3, #119eee);
  307. }
  308. .left_2 {
  309. background: linear-gradient(90deg, #ef7d2b, #fcaa64);
  310. }
  311. .left_3 {
  312. background: linear-gradient(90deg, #22b9c7, #32cfc6);
  313. }
  314. }
  315. .two_center {
  316. margin: 0 10px;
  317. width: 635px;
  318. .center_1 {
  319. display: flex;
  320. justify-content: space-between;
  321. height: 49px;
  322. background: #d3e0fe;
  323. font-size: 20px;
  324. line-height: 49px;
  325. padding: 0 10px 0 20px;
  326. .center_right {
  327. color: #ababab;
  328. font-size: $global-font-size-14;
  329. cursor: default;
  330. }
  331. }
  332. .center_2 {
  333. background: #f1f7ff;
  334. height: 350px;
  335. overflow: hidden;
  336. .center_list {
  337. width: 100%;
  338. display: flex;
  339. align-items: center;
  340. height: 47px;
  341. border-bottom: 1px dashed #e5e5e5;
  342. line-height: 47px;
  343. padding-left: 20px;
  344. .center_left {
  345. width: 84%;
  346. font-size: $global-font-size-16;
  347. }
  348. .center_right {
  349. color: #999;
  350. font-size: $global-font-size-14;
  351. }
  352. }
  353. }
  354. }
  355. .two_right {
  356. width: 307px;
  357. .right_more {
  358. width: 307px;
  359. height: 124px;
  360. margin-bottom: 13px;
  361. border-radius: 8px;
  362. cursor: default;
  363. .right_left {
  364. display: flex;
  365. align-items: center;
  366. padding-top: 25px;
  367. .image {
  368. padding: 0 10px 0 15px;
  369. }
  370. .name {
  371. font-size: $global-font-size-28;
  372. font-weight: 400;
  373. line-height: 30px;
  374. margin: 0 0 8px 0;
  375. }
  376. .english {
  377. font-size: $global-font-size-14;
  378. line-height: 14px;
  379. }
  380. }
  381. .right_right {
  382. display: flex;
  383. justify-content: flex-end;
  384. padding-right: 16px;
  385. padding-top: 5px;
  386. font-size: $global-font-size-14;
  387. }
  388. }
  389. .right_1 {
  390. background: linear-gradient(90deg, #d1dcff, #d7e7fb);
  391. color: #2073c7;
  392. .right_right {
  393. color: #89b9ee;
  394. }
  395. }
  396. .right_2 {
  397. background: linear-gradient(90deg, #f9e6d7, #fcf6f2);
  398. color: #e48a27;
  399. .right_right {
  400. color: #f5c494;
  401. }
  402. }
  403. .right_3 {
  404. background: linear-gradient(90deg, #b4e7d0, #cdf2eb);
  405. color: #11af84;
  406. margin-bottom: 0;
  407. .right_right {
  408. color: #62c5aa;
  409. }
  410. }
  411. }
  412. }
  413. .thr {
  414. width: 1300px;
  415. margin: 20px auto;
  416. .thr_1 {
  417. display: flex;
  418. justify-content: center;
  419. margin: 0 0 20px 0;
  420. .title {
  421. background-image: url(/images/sg-title.png);
  422. background-position: center center;
  423. background-repeat: no-repeat;
  424. background-size: cover;
  425. text-align: center;
  426. font-size: $global-font-size-36;
  427. width: 500px;
  428. line-height: 46px;
  429. height: 46px;
  430. }
  431. }
  432. .thr_2 {
  433. display: flex;
  434. .left {
  435. width: 598px;
  436. padding: 10px;
  437. transition: box-shadow 0.3s ease; /* 添加过渡效果,使阴影的出现更平滑 */
  438. .image {
  439. width: 558px;
  440. height: 342px;
  441. border-radius: 4px;
  442. overflow: hidden;
  443. }
  444. .name {
  445. margin: 16px 0;
  446. max-height: 52px;
  447. font-size: $global-font-size-20;
  448. }
  449. .brief {
  450. min-height: 115px;
  451. margin-bottom: 20px !important;
  452. font-size: $global-font-size-16;
  453. color: #717794;
  454. -webkit-line-clamp: 3;
  455. display: -webkit-box;
  456. -webkit-box-orient: vertical;
  457. overflow: hidden;
  458. }
  459. .other {
  460. display: flex;
  461. align-items: center;
  462. justify-content: space-between;
  463. .time {
  464. display: flex;
  465. align-items: center;
  466. color: #858585;
  467. .image {
  468. width: 18px;
  469. height: 18px;
  470. margin: 0 5px 0 0;
  471. }
  472. }
  473. .button {
  474. color: $global-color-107;
  475. padding: 5px 15px;
  476. cursor: default;
  477. }
  478. .button:hover {
  479. color: $global-color-fff;
  480. background-color: $global-color-107;
  481. border-radius: 20px;
  482. cursor: default;
  483. }
  484. }
  485. }
  486. .left:hover {
  487. box-shadow: 0 0 10px rgb(186, 196, 240); /* 阴影效果 */
  488. }
  489. .right {
  490. display: flex;
  491. justify-content: space-between;
  492. flex-wrap: wrap;
  493. align-items: center;
  494. .list {
  495. width: 50%;
  496. padding: 10px;
  497. transition: box-shadow 0.3s ease; /* 添加过渡效果,使阴影的出现更平滑 */
  498. .image {
  499. border-radius: 4px;
  500. overflow: hidden;
  501. }
  502. .name {
  503. min-height: 40px;
  504. margin: 5px 0;
  505. font-size: $global-font-size-18;
  506. }
  507. .other {
  508. display: flex;
  509. align-items: center;
  510. justify-content: space-between;
  511. .time {
  512. display: flex;
  513. align-items: center;
  514. color: #858585;
  515. .image {
  516. width: 18px;
  517. height: 18px;
  518. margin: 0 5px 0 0;
  519. }
  520. }
  521. .button {
  522. color: $global-color-107;
  523. padding: 5px 15px;
  524. cursor: default;
  525. }
  526. .button:hover {
  527. color: $global-color-fff;
  528. background-color: $global-color-107;
  529. border-radius: 20px;
  530. cursor: default;
  531. }
  532. }
  533. }
  534. .list:hover {
  535. box-shadow: 0 0 10px rgb(186, 196, 240); /* 阴影效果 */
  536. }
  537. }
  538. }
  539. }
  540. .four {
  541. width: 1300px;
  542. margin: 20px auto;
  543. .four_1 {
  544. display: flex;
  545. justify-content: center;
  546. align-items: center;
  547. margin: 0 0 20px 0;
  548. .title {
  549. background-image: url(/images/sg-title.png);
  550. background-position: center center;
  551. background-repeat: no-repeat;
  552. background-size: cover;
  553. text-align: center;
  554. font-size: $global-font-size-36;
  555. width: 500px;
  556. line-height: 46px;
  557. height: 46px;
  558. }
  559. }
  560. .four_2 {
  561. display: flex;
  562. align-items: center;
  563. justify-content: center;
  564. flex-wrap: wrap;
  565. .list {
  566. margin: 10px;
  567. .image {
  568. width: 245px;
  569. height: 140px;
  570. }
  571. }
  572. }
  573. }
  574. .five {
  575. width: 1300px;
  576. margin: 20px auto;
  577. .five_1 {
  578. display: flex;
  579. justify-content: center;
  580. margin: 0 0 20px 0;
  581. .title {
  582. background-image: url(/images/sg-title.png);
  583. background-position: center center;
  584. background-repeat: no-repeat;
  585. background-size: cover;
  586. text-align: center;
  587. font-size: $global-font-size-36;
  588. width: 500px;
  589. line-height: 46px;
  590. height: 46px;
  591. }
  592. }
  593. .five_2 {
  594. display: flex;
  595. .list {
  596. .list_1 {
  597. background-image: url(/images/rczy-title.png);
  598. background-position: center center;
  599. background-repeat: no-repeat;
  600. background-size: cover;
  601. text-align: center;
  602. font-size: $global-font-size-36;
  603. line-height: 33px;
  604. height: 33px;
  605. margin: 20px 0;
  606. .title {
  607. font-size: $global-font-size-20;
  608. font-weight: 600;
  609. text-align: center;
  610. color: #252f49;
  611. }
  612. }
  613. .list_2 {
  614. font-size: $global-font-size-18;
  615. margin: 8px;
  616. padding: 5px;
  617. text-align: center;
  618. border: 1px #ebe2e2 solid;
  619. border-radius: 4px;
  620. }
  621. .list_2:hover {
  622. background: #2280ff;
  623. color: #ffffff;
  624. cursor: default;
  625. }
  626. }
  627. }
  628. }
  629. </style>