index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  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', '1')">
  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('/center/basic', '0')">
  11. <div class="name">个人中心</div>
  12. <div class="english">PERSONAL CENTER</div>
  13. <div class="remark">个人信息入口</div>
  14. </div>
  15. <div class="left_more left_3" @click="toComon('/four', '1')">
  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', '1')">
  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', '1')">
  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', '1')">
  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. import { UserStore } from '@/store/user'
  147. const userStore = UserStore()
  148. const user = computed(() => userStore.user)
  149. // 接口
  150. import { NewsStore } from '@/store/api/platform/news'
  151. import { MatchStore } from '@/store/api/platform/match'
  152. import { DesignStore } from '@/store/api/platform/design'
  153. const newsStore = NewsStore()
  154. const matchStore = MatchStore()
  155. const designStore = DesignStore()
  156. // 加载中
  157. const loading = ref(false)
  158. // 路由
  159. const router = useRouter()
  160. const carouselList = ref([])
  161. const friendList = ref([])
  162. // 新闻
  163. const newsList = ref([])
  164. // 比赛
  165. const matchList = ref([])
  166. const matchInfo = ref({})
  167. // 分类
  168. const typeList = ref([
  169. { title: '热门高校', list: [] },
  170. { title: '政府部门', list: [] },
  171. { title: '科研机构', list: [] }
  172. ])
  173. // 请求
  174. onMounted(async () => {
  175. loading.value = true
  176. await searchOther()
  177. await searchMatch()
  178. loading.value = false
  179. })
  180. const searchOther = async () => {
  181. const info = { skip: 0, limit: 10, is_use: '0', status: '1' }
  182. let res
  183. // 政策新闻
  184. res = await newsStore.query({ ...info })
  185. if (res.errcode == '0') newsList.value = res.data
  186. // 基础设置
  187. res = await designStore.query({})
  188. if ($checkRes(res)) {
  189. carouselList.value = res.data[0].carouselUrl || []
  190. friendList.value = res.data[0].friend || []
  191. const friendship = res.data[0].friendship || []
  192. for (const val of friendship) {
  193. for (const tag of typeList.value) {
  194. if (val.type == tag.title) {
  195. tag.list.push(val)
  196. }
  197. }
  198. }
  199. }
  200. }
  201. const searchMatch = async () => {
  202. const info = { skip: 0, limit: 5, is_use: '0', status: '1' }
  203. const res = await matchStore.query(info)
  204. if (res.errcode == '0') {
  205. matchList.value = res.data.slice(1, 5)
  206. matchInfo.value = res.data[0]
  207. }
  208. }
  209. // 查看详情
  210. const toView = (item, type) => {
  211. if (type == '0') router.push({ path: '/news/detail', query: { id: item.id || item._id } })
  212. else if (type == '1') router.push({ path: '/achievement/detail', query: { id: item.id || item._id } })
  213. else router.push({ path: '/match/detail', query: { id: item.id || item._id } })
  214. }
  215. // 查看更多
  216. const toMore = () => {
  217. router.push({ path: '/news' })
  218. }
  219. // 查看
  220. const toComon = (route, type) => {
  221. if (user.value.id || type == '1') {
  222. router.push({ path: route })
  223. } else {
  224. router.push({ path: '/login', query: { status: '1' } })
  225. }
  226. }
  227. const removeHtmlStyle = (html) => {
  228. let relStyle = /style\s*?=\s*?([‘"])[\s\S]*?\1/g //去除样式
  229. let relTag = /<.+?>/g //去除标签
  230. let relClass = /class\s*?=\s*?([‘"])[\s\S]*?\1/g // 清除类名
  231. let newHtml = ''
  232. if (html) {
  233. newHtml = html.replace(relStyle, '')
  234. newHtml = newHtml.replace(relTag, '')
  235. newHtml = newHtml.replace(relClass, '')
  236. }
  237. return newHtml
  238. }
  239. const toLink = (item) => {
  240. window.open(item.href, '_blank') // 在新标签页中打开URL
  241. }
  242. const getUrl = (item, type) => {
  243. if (item) {
  244. if (type == 'array') return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
  245. else return `${import.meta.env.VITE_APP_HOST}${item.uri}`
  246. }
  247. }
  248. </script>
  249. <style scoped lang="scss">
  250. .one {
  251. .image {
  252. width: 100%;
  253. height: 100%;
  254. }
  255. }
  256. .two {
  257. width: 1300px;
  258. margin: 20px auto;
  259. display: flex;
  260. justify-content: space-between;
  261. .two_left {
  262. width: 327px;
  263. .left_more {
  264. width: 327px;
  265. padding-left: 45px;
  266. height: 127px;
  267. border-radius: 2px;
  268. color: #fff;
  269. margin-bottom: 9px;
  270. position: relative;
  271. cursor: default;
  272. .name {
  273. font-size: $global-font-size-26;
  274. font-weight: 700;
  275. line-height: 30px;
  276. padding-top: 20px;
  277. }
  278. .english {
  279. font-size: $global-font-size-14;
  280. padding: 7px 0;
  281. }
  282. .remark {
  283. font-size: $global-font-size-14;
  284. padding: 0 10px;
  285. height: 30px;
  286. display: block;
  287. border: 1px solid hsla(0, 0%, 100%, 0.5);
  288. text-align: center;
  289. line-height: 30px;
  290. float: left;
  291. }
  292. }
  293. .left_1 {
  294. background: linear-gradient(90deg, #6a8df3, #119eee);
  295. }
  296. .left_2 {
  297. background: linear-gradient(90deg, #ef7d2b, #fcaa64);
  298. }
  299. .left_3 {
  300. background: linear-gradient(90deg, #22b9c7, #32cfc6);
  301. }
  302. }
  303. .two_center {
  304. margin: 0 10px;
  305. width: 635px;
  306. .center_1 {
  307. display: flex;
  308. justify-content: space-between;
  309. height: 49px;
  310. background: #d3e0fe;
  311. font-size: 20px;
  312. line-height: 49px;
  313. padding: 0 10px 0 20px;
  314. .center_right {
  315. color: #ababab;
  316. font-size: $global-font-size-14;
  317. cursor: default;
  318. }
  319. }
  320. .center_2 {
  321. background: #f1f7ff;
  322. height: 350px;
  323. overflow: hidden;
  324. .center_list {
  325. width: 100%;
  326. display: flex;
  327. align-items: center;
  328. height: 47px;
  329. border-bottom: 1px dashed #e5e5e5;
  330. line-height: 47px;
  331. padding-left: 20px;
  332. .center_left {
  333. width: 84%;
  334. font-size: $global-font-size-16;
  335. }
  336. .center_right {
  337. color: #999;
  338. font-size: $global-font-size-14;
  339. }
  340. }
  341. }
  342. }
  343. .two_right {
  344. width: 307px;
  345. .right_more {
  346. width: 307px;
  347. height: 124px;
  348. margin-bottom: 13px;
  349. border-radius: 8px;
  350. cursor: default;
  351. .right_left {
  352. display: flex;
  353. align-items: center;
  354. padding-top: 25px;
  355. .image {
  356. padding: 0 10px 0 15px;
  357. }
  358. .name {
  359. font-size: $global-font-size-28;
  360. font-weight: 400;
  361. line-height: 30px;
  362. margin: 0 0 8px 0;
  363. }
  364. .english {
  365. font-size: $global-font-size-14;
  366. line-height: 14px;
  367. }
  368. }
  369. .right_right {
  370. display: flex;
  371. justify-content: flex-end;
  372. padding-right: 16px;
  373. padding-top: 5px;
  374. font-size: $global-font-size-14;
  375. }
  376. }
  377. .right_1 {
  378. background: linear-gradient(90deg, #d1dcff, #d7e7fb);
  379. color: #2073c7;
  380. .right_right {
  381. color: #89b9ee;
  382. }
  383. }
  384. .right_2 {
  385. background: linear-gradient(90deg, #f9e6d7, #fcf6f2);
  386. color: #e48a27;
  387. .right_right {
  388. color: #f5c494;
  389. }
  390. }
  391. .right_3 {
  392. background: linear-gradient(90deg, #b4e7d0, #cdf2eb);
  393. color: #11af84;
  394. margin-bottom: 0;
  395. .right_right {
  396. color: #62c5aa;
  397. }
  398. }
  399. }
  400. }
  401. .thr {
  402. width: 1300px;
  403. margin: 20px auto;
  404. .thr_1 {
  405. display: flex;
  406. justify-content: center;
  407. margin: 0 0 20px 0;
  408. .title {
  409. background-image: url(/images/sg-title.png);
  410. background-position: center center;
  411. background-repeat: no-repeat;
  412. background-size: cover;
  413. text-align: center;
  414. font-size: $global-font-size-36;
  415. width: 500px;
  416. line-height: 46px;
  417. height: 46px;
  418. }
  419. }
  420. .thr_2 {
  421. display: flex;
  422. .left {
  423. width: 598px;
  424. padding: 10px;
  425. transition: box-shadow 0.3s ease; /* 添加过渡效果,使阴影的出现更平滑 */
  426. .image {
  427. width: 558px;
  428. height: 342px;
  429. border-radius: 4px;
  430. overflow: hidden;
  431. }
  432. .name {
  433. margin: 16px 0;
  434. max-height: 52px;
  435. font-size: $global-font-size-20;
  436. }
  437. .brief {
  438. min-height: 115px;
  439. margin-bottom: 20px !important;
  440. font-size: $global-font-size-16;
  441. color: #717794;
  442. -webkit-line-clamp: 3;
  443. display: -webkit-box;
  444. -webkit-box-orient: vertical;
  445. overflow: hidden;
  446. }
  447. .other {
  448. display: flex;
  449. align-items: center;
  450. justify-content: space-between;
  451. .time {
  452. display: flex;
  453. align-items: center;
  454. color: #858585;
  455. .image {
  456. width: 18px;
  457. height: 18px;
  458. margin: 0 5px 0 0;
  459. }
  460. }
  461. .button {
  462. color: $global-color-107;
  463. padding: 5px 15px;
  464. cursor: default;
  465. }
  466. .button:hover {
  467. color: $global-color-fff;
  468. background-color: $global-color-107;
  469. border-radius: 20px;
  470. cursor: default;
  471. }
  472. }
  473. }
  474. .left:hover {
  475. box-shadow: 0 0 10px rgb(186, 196, 240); /* 阴影效果 */
  476. }
  477. .right {
  478. display: flex;
  479. justify-content: space-between;
  480. flex-wrap: wrap;
  481. align-items: flex-start;
  482. .list {
  483. width: 50%;
  484. padding: 10px;
  485. transition: box-shadow 0.3s ease; /* 添加过渡效果,使阴影的出现更平滑 */
  486. .image {
  487. border-radius: 4px;
  488. overflow: hidden;
  489. }
  490. .name {
  491. min-height: 40px;
  492. margin: 5px 0;
  493. font-size: $global-font-size-18;
  494. }
  495. .other {
  496. display: flex;
  497. align-items: center;
  498. justify-content: space-between;
  499. .time {
  500. display: flex;
  501. align-items: center;
  502. color: #858585;
  503. .image {
  504. width: 18px;
  505. height: 18px;
  506. margin: 0 5px 0 0;
  507. }
  508. }
  509. .button {
  510. color: $global-color-107;
  511. padding: 5px 15px;
  512. cursor: default;
  513. }
  514. .button:hover {
  515. color: $global-color-fff;
  516. background-color: $global-color-107;
  517. border-radius: 20px;
  518. cursor: default;
  519. }
  520. }
  521. }
  522. .list:hover {
  523. box-shadow: 0 0 10px rgb(186, 196, 240); /* 阴影效果 */
  524. }
  525. }
  526. }
  527. }
  528. .four {
  529. width: 1300px;
  530. margin: 20px auto;
  531. .four_1 {
  532. display: flex;
  533. justify-content: center;
  534. align-items: center;
  535. margin: 0 0 20px 0;
  536. .title {
  537. background-image: url(/images/sg-title.png);
  538. background-position: center center;
  539. background-repeat: no-repeat;
  540. background-size: cover;
  541. text-align: center;
  542. font-size: $global-font-size-36;
  543. width: 500px;
  544. line-height: 46px;
  545. height: 46px;
  546. }
  547. }
  548. .four_2 {
  549. display: flex;
  550. align-items: center;
  551. justify-content: center;
  552. flex-wrap: wrap;
  553. .list {
  554. margin: 10px;
  555. .image {
  556. width: 245px;
  557. height: 140px;
  558. }
  559. }
  560. }
  561. }
  562. .five {
  563. width: 1300px;
  564. margin: 20px auto;
  565. .five_1 {
  566. display: flex;
  567. justify-content: center;
  568. margin: 0 0 20px 0;
  569. .title {
  570. background-image: url(/images/sg-title.png);
  571. background-position: center center;
  572. background-repeat: no-repeat;
  573. background-size: cover;
  574. text-align: center;
  575. font-size: $global-font-size-36;
  576. width: 500px;
  577. line-height: 46px;
  578. height: 46px;
  579. }
  580. }
  581. .five_2 {
  582. display: flex;
  583. .list {
  584. .list_1 {
  585. background-image: url(/images/rczy-title.png);
  586. background-position: center center;
  587. background-repeat: no-repeat;
  588. background-size: cover;
  589. text-align: center;
  590. font-size: $global-font-size-36;
  591. line-height: 33px;
  592. height: 33px;
  593. margin: 20px 0;
  594. .title {
  595. font-size: $global-font-size-20;
  596. font-weight: 600;
  597. text-align: center;
  598. color: #252f49;
  599. }
  600. }
  601. .list_2 {
  602. font-size: $global-font-size-18;
  603. margin: 8px;
  604. padding: 5px;
  605. text-align: center;
  606. border: 1px #ebe2e2 solid;
  607. border-radius: 4px;
  608. }
  609. .list_2:hover {
  610. background: #2280ff;
  611. color: #ffffff;
  612. cursor: default;
  613. }
  614. }
  615. }
  616. }
  617. </style>