index.vue 18 KB

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