index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. <template>
  2. <div class="page" id="page">
  3. <div class="top">
  4. <img src="@/assets/images/newsCategories/img1.png" alt="">
  5. <div>
  6. <div class="top_title">Industry News</div>
  7. <div class="top_location">
  8. <span class="iconfont icon-weizhi"></span>
  9. Current Location : Home <span class="iconfont icon-dkw_guanbi-"></span> <span>Industry News</span>
  10. </div>
  11. </div>
  12. </div>
  13. <div class="box">
  14. <div class="box_l">
  15. <div class="box_l_title">
  16. <div>Information Type</div>
  17. <div>
  18. <span class="iconfont icon-shouqi1"></span>
  19. </div>
  20. </div>
  21. <div class="box_l_list">
  22. <template v-for="item in newsCategory" :key="item">
  23. <div class="box_l_list_item" :class="{active:item.dictValue === params?.marketType}" @click=" handleType(item.dictValue)">
  24. <div class="box_l_list_item_l">{{ item.dictLabel }}</div>
  25. <div class="box_l_list_item_r ">
  26. <div></div>
  27. <span class="iconfont icon-duigou"></span>
  28. </div>
  29. </div>
  30. </template>
  31. </div>
  32. <div class="box_l_title">
  33. <div>Industry Segment</div>
  34. <div>
  35. <span class="iconfont icon-shouqi1"></span>
  36. </div>
  37. </div>
  38. <div class="box_l_list">
  39. <template v-for="(item,i) in reportTypes" :key="i">
  40. <div class="box_l_list_item" :class="{active:item.dictValue === params?.marketCategory }" @click="handleCategroy(item.dictValue)">
  41. <div class="box_l_list_item_l">{{ item.dictLabel }}</div>
  42. <div class="box_l_list_item_r ">
  43. <div></div>
  44. <span class="iconfont icon-duigou"></span>
  45. </div>
  46. </div>
  47. </template>
  48. </div>
  49. </div>
  50. <div class="box_r">
  51. <div class="box_r_list">
  52. <div class="box_r_item" v-for="item in pageList?.list" :key="item">
  53. <a :href="'/news/' +item.webTitle +'-' +item.id">
  54. <img :src="BaseUrl +'/fileupload/' + item.filePath +item.fileName" alt="">
  55. </a>
  56. <div class="box_r_item_content">
  57. <div class="date">{{formatDateEn(item.publishDate) }}</div>
  58. <a :href="'/news/' +item.webTitle +'-' +item.id" class="title">{{ item.title }}</a>
  59. <a :href="'/news/' +item.webTitle +'-' +item.id" class="btn">Know More</a>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="pageBox" v-if="pageList?.list.length>0">
  64. <n-pagination show-quick-jumper :page-count="pageList?.count" :on-update:page="changePage" :page-slot="6">
  65. <template #prev>
  66. <div class="pageBox_btn">Previous</div>
  67. </template>
  68. <template #next>
  69. <div class="pageBox_btn">Next</div>
  70. </template>
  71. <template #goto>
  72. <div class="pageBox_inp">Go To</div>
  73. </template>
  74. </n-pagination>
  75. </div>
  76. <div class="box-empty" v-if="pageList?.count === 0">
  77. <n-empty description="The specified information was not found">
  78. <template #extra>
  79. <!-- <n-button @click="handleDemand({ id: '', price: 0 }, '0')" round type="primary">{{ t("report.detail.custom") }}</n-button> -->
  80. </template>
  81. </n-empty>
  82. </div>
  83. <div class="load">
  84. <n-spin size="large">
  85. <template #description>Loading...</template>
  86. </n-spin>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </template>
  92. <script lang="ts" setup>
  93. import { IosFiling, MdHome, MdSearch } from "@vicons/ionicons4";
  94. import {
  95. NIcon,
  96. NBreadcrumb,
  97. NBreadcrumbItem,
  98. NInput,
  99. NList,
  100. NListItem,
  101. NThing,
  102. NPagination,
  103. NSpin,
  104. } from "naive-ui";
  105. import { useRouter, useRoute } from "vue-router";
  106. import { onMounted, onServerPrefetch, ref, watch } from "vue";
  107. import { useI18n } from "#imports";
  108. import { useUserStore } from "@/store/user";
  109. const config = useRuntimeConfig();
  110. const BaseUrl = ref(config.public.baseUrl);
  111. const pageSize = 10;
  112. const router = useRouter();
  113. const route = useRoute(); // 接收参数
  114. const reportTypes = ref([]); // 报告分类
  115. const newsCategory = ref([]); //资讯分类
  116. const params = ref({ pageSize: pageSize, pageNo: 1, keyword: "" }) as any; // 参数
  117. const pageList = ref({ list: [] }); //data
  118. const spinShow = ref("none"); // loading
  119. const { t } = useI18n();
  120. const pcShow = ref<boolean>(true);
  121. const userStore = useUserStore();
  122. const lang = userStore.getLang;
  123. function viewDetail(item: MarketInfo) {
  124. const language = lang === "zh-CN" ? "" : "en";
  125. router.push({
  126. name: "newsDetail",
  127. params: { webTitle: item.webTitle + "-" + item.id, lang: language },
  128. });
  129. }
  130. // onMounted(async () => {
  131. // pcShow.value = !isMobile();
  132. // const keyword = route.params.keyword;
  133. // if (keyword) {
  134. // params.value.keyword = keyword;
  135. // }
  136. // const dicts = await getLocalSessionReport();
  137. // reportTypes.value = dicts;
  138. // const dicts02 = await getLocalSessionNews();
  139. // newsCategory.value = dicts02;
  140. // if (containsMarketType(dicts, route.params.marketType)) {
  141. // params.value.marketCategory = route.params.marketType;
  142. // } else {
  143. // params.value.marketType = route.params.marketType;
  144. // }
  145. // await getData();
  146. // });
  147. watch(
  148. () => [
  149. route.params.marketType,
  150. route.params.marketCategory,
  151. route.params.keyword,
  152. ],
  153. async (newValue, oldValue) => {
  154. params.value.marketType = newValue[0];
  155. params.value.marketCategory = newValue[1];
  156. params.value.keyword = newValue[2];
  157. await getData();
  158. }
  159. );
  160. async function getData() {
  161. spinShow.value = "block";
  162. params.value.lang = lang;
  163. const ret = await marketInfoPageList({ ...params.value });
  164. // setTimeout(() => {
  165. pageList.value = ret;
  166. spinShow.value = "none";
  167. // }, 500);
  168. }
  169. //报告分类
  170. function handleCategroy(type: string | undefined) {
  171. params.value.marketType = "";
  172. const language = lang === "zh-CN" ? "" : "en";
  173. if (params.value.marketCategory == type) {
  174. router.push({
  175. name: "newsCategories",
  176. params: { lang: language },
  177. });
  178. } else {
  179. params.value.marketCategory = type;
  180. router.push({
  181. name: "newsCategories",
  182. params: { marketCategory: type, lang: language },
  183. });
  184. }
  185. }
  186. //资讯分类
  187. function handleType(type: string | undefined) {
  188. params.value.marketCategory = "";
  189. const language = lang === "zh-CN" ? "" : "en";
  190. if (params.value.marketType == type) {
  191. params.value.marketType = "";
  192. router.push({
  193. name: "newsCategories",
  194. params: { lang: language },
  195. });
  196. } else {
  197. params.value.marketType = type;
  198. router.push({
  199. name: "newsCategories",
  200. params: { marketType: type, lang: language },
  201. });
  202. }
  203. }
  204. // 全部
  205. function handleAll() {
  206. params.value.marketCategory = "";
  207. params.value.marketType = "";
  208. const language = lang === "zh-CN" ? "" : "en";
  209. router.push({ name: "newsCategories", params: { lang: language } });
  210. }
  211. // 改变页数
  212. async function changePage(page: number) {
  213. document.documentElement.scrollTop = 0;
  214. params.value.pageNo = page;
  215. await getData();
  216. }
  217. // 关键字查询
  218. async function handleSearch() {
  219. await getData();
  220. }
  221. try {
  222. const keyword = route.params.keyword;
  223. if (keyword) {
  224. params.value.keyword = keyword;
  225. }
  226. const dicts = await getLocalSessionReport();
  227. reportTypes.value = dicts;
  228. const dicts02 = await getLocalSessionNews();
  229. newsCategory.value = dicts02;
  230. if (containsMarketType(dicts, route.params.marketType)) {
  231. params.value.marketCategory = route.params.marketType;
  232. } else {
  233. params.value.marketType = route.params.marketType;
  234. }
  235. params.value.lang = lang;
  236. const ret = await marketInfoPageList({ ...params.value });
  237. pageList.value = ret;
  238. } catch (error) {
  239. console.log(error);
  240. }
  241. useHead({
  242. title: t("common.navigate.news") + "-" + t("defaultSettings.title"),
  243. viewport: "width=device-width,initial-scale=1,maximum-scale=1 ",
  244. charset: "utf-8",
  245. meta: [
  246. {
  247. hid: "keywords",
  248. name: "keywords",
  249. content: t("defaultSettings.keyword"),
  250. },
  251. {
  252. hid: "description",
  253. name: "description",
  254. content: t("defaultSettings.desc"),
  255. },
  256. ],
  257. });
  258. </script>
  259. <style scoped lang="scss">
  260. @import "~/assets/css/tool.scss";
  261. .load {
  262. display: v-bind("spinShow");
  263. }
  264. .page {
  265. .top {
  266. width: 100%;
  267. position: relative;
  268. margin-top: var(--size-130);
  269. img {
  270. width: 100%;
  271. }
  272. > div {
  273. width: 100%;
  274. padding: var(--size-60) var(--size-176) 0;
  275. position: absolute;
  276. top: 0;
  277. left: 0;
  278. .top_title {
  279. font-size: var(--size-48);
  280. font-family: Arial, Arial-Bold;
  281. font-weight: 700;
  282. text-align: left;
  283. color: #ffffff;
  284. }
  285. .top_location {
  286. font-size: var(--size-14);
  287. font-family: Arial, Arial-Regular;
  288. font-weight: 400;
  289. color: #ffffff;
  290. .icon-dkw_guanbi- {
  291. color: #ffffff;
  292. font-size: var(--size-12);
  293. }
  294. span {
  295. color: #72ff56;
  296. }
  297. }
  298. }
  299. }
  300. .box {
  301. background: #f6f7fa;
  302. padding: var(--size-30) var(--size-147) var(--size-70);
  303. display: flex;
  304. .box_l {
  305. background: #ffffff;
  306. width: var(--size-493);
  307. flex-shrink: 0;
  308. .box_l_title {
  309. width: 100%;
  310. padding: var(--size-20) var(--size-30);
  311. background: #6aaa87;
  312. font-size: var(--size-22);
  313. font-family: Arial, Arial-Bold;
  314. font-weight: 700;
  315. text-align: left;
  316. color: #ffffff;
  317. line-height: var(--size-22);
  318. display: flex;
  319. justify-content: space-between;
  320. span {
  321. font-size: var(--size-13);
  322. }
  323. }
  324. .box_l_list {
  325. padding: var(--size-12) 0;
  326. border: 1px solid #ffffff;
  327. border-bottom: var(--size-20) solid #ffffff;
  328. background: #f4f7f9;
  329. min-height: var(--size-282);
  330. .box_l_list_item {
  331. padding: var(--size-6) var(--size-30);
  332. display: flex;
  333. justify-content: space-between;
  334. background: #f4f7f9;
  335. cursor: pointer;
  336. .box_l_list_item_l {
  337. font-size: var(--size-18);
  338. font-family: Arial, Arial-Regular;
  339. color: #639e57;
  340. line-height: var(--size-22);
  341. }
  342. .box_l_list_item_r {
  343. width: var(--size-27);
  344. height: var(--size-27);
  345. border: 1px solid #639e57;
  346. border-radius: 50%;
  347. display: flex;
  348. align-items: center;
  349. justify-content: center;
  350. > div {
  351. width: var(--size-17);
  352. height: var(--size-17);
  353. background: #639e57;
  354. border-radius: 50%;
  355. display: block;
  356. }
  357. span {
  358. display: none;
  359. }
  360. }
  361. }
  362. .active {
  363. .box_l_list_item_l {
  364. font-weight: 700;
  365. }
  366. .box_l_list_item_r {
  367. background: #639e57;
  368. span {
  369. color: #ffffff;
  370. font-size: var(--size-25);
  371. }
  372. > div {
  373. display: none;
  374. }
  375. span {
  376. display: block;
  377. }
  378. }
  379. }
  380. .selBox {
  381. display: flex;
  382. align-items: center;
  383. padding: var(--size-8) var(--size-30);
  384. > span {
  385. display: inline-block;
  386. }
  387. .selBox_btn {
  388. width: var(--size-68);
  389. height: var(--size-44);
  390. background: linear-gradient(90deg, #719d58 4%, #43a086 99%);
  391. border-radius: var(--size-4);
  392. font-size: var(--size-16);
  393. font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  394. color: #ffffff;
  395. cursor: pointer;
  396. text-align: center;
  397. line-height: var(--size-44);
  398. flex-shrink: 0;
  399. }
  400. }
  401. }
  402. }
  403. .box_r {
  404. margin-left: var(--size-42);
  405. flex-grow: 1;
  406. .box_r_list {
  407. display: flex;
  408. flex-wrap: wrap;
  409. .box_r_item {
  410. width: var(--size-526);
  411. background: #ffffff;
  412. border-radius: var(--size-10);
  413. overflow: hidden;
  414. padding: var(--size-19);
  415. margin-bottom: var(--size-20);
  416. cursor: default;
  417. &:nth-child(2n-1) {
  418. margin-right: var(--size-20);
  419. }
  420. img {
  421. width: var(--size-488);
  422. height: var(--size-274);
  423. border-radius: var(--size-8);
  424. overflow: hidden;
  425. }
  426. .box_r_item_content {
  427. .date {
  428. font-size: var(--size-16);
  429. font-family: Arial, Arial-Regular;
  430. color: #808080;
  431. line-height: var(--size-15);
  432. margin-top: var(--size-15);
  433. }
  434. .title {
  435. font-size: var(--size-20);
  436. font-family: Arial-BoldMT;
  437. color: #333333;
  438. line-height: var(--size-28);
  439. margin-top: var(--size-10);
  440. font-weight: 700;
  441. overflow: hidden;
  442. text-overflow: ellipsis;
  443. display: -webkit-box;
  444. -webkit-line-clamp: 2;
  445. -webkit-box-orient: vertical;
  446. }
  447. .btn {
  448. width: var(--size-108);
  449. height: var(--size-29);
  450. display: block;
  451. background: rgba(0, 0, 0, 0);
  452. border: var(--size-1) solid #509f7a;
  453. font-size: var(--size-14);
  454. font-family: ArialMT;
  455. text-align: center;
  456. color: #509f7a;
  457. line-height: var(--size-27);
  458. margin-top: var(--size-20);
  459. cursor: pointer;
  460. }
  461. }
  462. &:hover {
  463. background: #399ac0;
  464. .box_r_item_content {
  465. .date {
  466. color: #ffffff;
  467. }
  468. .title {
  469. color: #ffffff;
  470. }
  471. .btn {
  472. color: #ffffff;
  473. border: var(--size-1) solid #ffffff;
  474. }
  475. }
  476. }
  477. }
  478. }
  479. .pageBox {
  480. display: flex;
  481. justify-content: center;
  482. ::v-deep .n-pagination-item {
  483. min-width: var(--size-42);
  484. height: var(--size-42);
  485. background: #f2f2f2;
  486. border: 1px solid #cccccc;
  487. border-radius: var(--size-4);
  488. font-size: var(--size-14);
  489. color: #808080;
  490. text-align: center;
  491. line-height: var(--size-40);
  492. }
  493. ::v-deep .n-pagination-item--active {
  494. background: rgba(57, 154, 192, 1);
  495. color: #ffffff;
  496. &:hover {
  497. background: rgba(57, 154, 192, 1);
  498. color: #ffffff;
  499. }
  500. }
  501. .pageBox_btn {
  502. width: var(--size-70);
  503. color: #333333;
  504. }
  505. ::v-deep(.n-input__input) {
  506. height: var(--size-40);
  507. line-height: var(--size-40);
  508. }
  509. ::v-deep(.n-pagination .n-pagination-quick-jumper .n-input) {
  510. border: 1px solid #cccccc;
  511. }
  512. .pageBox_inp {
  513. font-size: var(--size-16);
  514. }
  515. }
  516. }
  517. }
  518. }
  519. @include responseTo("phone") {
  520. .page {
  521. .top {
  522. img {
  523. height: 100px;
  524. object-fit: cover;
  525. }
  526. > div {
  527. padding: var(--size-15);
  528. .top_title {
  529. font-size: var(--size-28);
  530. }
  531. }
  532. }
  533. .box {
  534. padding: var(--size-15);
  535. width: 100%;
  536. display: block;
  537. .box_l {
  538. width: 100%;
  539. .box_l_list {
  540. .box_l_list_item {
  541. padding: var(--size-6) var(--size-20);
  542. .box_l_list_item_l {
  543. font-size: var(--size-16);
  544. }
  545. .box_l_list_item_r {
  546. width: var(--size-20);
  547. height: var(--size-20);
  548. > div {
  549. width: var(--size-12);
  550. height: var(--size-12);
  551. }
  552. }
  553. }
  554. .active .box_l_list_item_r span {
  555. font-size: var(--size-18);
  556. }
  557. .selBox {
  558. padding: var(--size-6) var(--size-20);
  559. .selBox_btn {
  560. width: var(--size-52);
  561. height: var(--size-34);
  562. border-radius: var(--size-4);
  563. font-size: var(--size-16);
  564. line-height: var(--size-34);
  565. }
  566. }
  567. }
  568. }
  569. .box_r {
  570. margin-left: 0;
  571. margin-top: var(--size-20);
  572. .box_r_list {
  573. justify-content: space-between;
  574. .box_r_item {
  575. width: 48%;
  576. padding: var(--size-10) var(--size-10) var(--size-20);
  577. margin-right: 0 !important;
  578. margin-bottom: var(--size-10);
  579. img {
  580. width: 100%;
  581. // height: auto;
  582. height: var(--size-82);
  583. display: block;
  584. }
  585. .box_r_item_content {
  586. .date {
  587. margin-top: var(--size-5);
  588. font-size: var(--size-14);
  589. }
  590. .title {
  591. font-size: var(--size-16);
  592. line-height: var(--size-20);
  593. margin-top: var(--size-5);
  594. }
  595. .btn {
  596. margin-top: var(--size-15);
  597. }
  598. }
  599. }
  600. }
  601. .pageBox {
  602. ::v-deep .n-pagination-item {
  603. min-width: var(--size-21);
  604. height: var(--size-21);
  605. border-radius: var(--size-2);
  606. font-size: var(--size-8);
  607. line-height: var(--size-20);
  608. }
  609. .pageBox_btn {
  610. width: var(--size-35);
  611. }
  612. ::v-deep(.n-input__input) {
  613. height: var(--size-20);
  614. line-height: var(--size-20);
  615. font-size: var(--size-9);
  616. }
  617. .pageBox_inp {
  618. font-size: var(--size-8);
  619. }
  620. ::v-deep(.n-pagination .n-pagination-quick-jumper .n-input) {
  621. width: var(--size-35);
  622. }
  623. ::v-deep(.n-input .n-input__input-el) {
  624. height: var(--size-20);
  625. line-height: var(--size-20);
  626. }
  627. }
  628. }
  629. }
  630. }
  631. }
  632. </style>