detail.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <div class="page" id="page">
  3. <div class="location">
  4. <div class="location_l"> <span class="iconfont icon-weizhi"></span></div>
  5. <div class="location_r"> Current Location : Home <span class="iconfont icon-dkw_guanbi-"></span> <span>Industry News</span></div>
  6. </div>
  7. <div class="content">
  8. <div class="content_title">{{ vo?.title }}</div>
  9. <div class="content_deta">
  10. <span class="iconfont icon-normal"></span>
  11. {{formatDateEn(vo?.publishDate)}}
  12. </div>
  13. <div class="newsdt-text">
  14. <div v-html="vo?.context"></div>
  15. </div>
  16. <div class="content_btn" @click="router.go(-1)">
  17. Return to List
  18. </div>
  19. <div class="content_list">
  20. <div class="content_list_item" @click="handleSwt(last)" v-if="last?.title">
  21. Previous Article :
  22. <a>{{last?.title}}</a>
  23. </div>
  24. <div class="content_list_item" @click="handleSwt(next)" v-if="next?.title">
  25. Next Article :
  26. <a>{{next?.title}}</a>
  27. </div>
  28. </div>
  29. </div>
  30. <!-- <div class="load">
  31. <n-spin size="large">
  32. <template #description>{{ t('report.content.loading') }}</template>
  33. </n-spin>
  34. </div> -->
  35. </div>
  36. </template>
  37. <script lang="ts" setup>
  38. import { IosFiling, MdTime } from "@vicons/ionicons4";
  39. import { NIcon, NSpin } from "naive-ui";
  40. import { ref, watch, onMounted, onServerPrefetch } from "vue";
  41. import { useRoute, useRouter } from "vue-router";
  42. import { useI18n } from "#imports";
  43. import { useUserStore } from "@/store/user";
  44. const userStore = useUserStore();
  45. const lang = userStore.getLang;
  46. const route = useRoute();
  47. const router = useRouter();
  48. const vo = ref<MarketInfo>(),
  49. last = ref<MarketInfo>(),
  50. next = ref<MarketInfo>();
  51. //const id = ref();
  52. const spinShow = ref("none");
  53. const { t } = useI18n();
  54. // watch(() => route.params.webTitle, (newValue, oldValue) => {
  55. // const wts = newValue.split('-');
  56. // getDetail(wts[wts.length - 1]);
  57. // });
  58. // onMounted(() => {
  59. // const webTitle = route.params.webTitle;
  60. // const wts = webTitle.split("-");
  61. // getDetail(wts[wts.length - 1]);
  62. // });
  63. async function getDetail(id: any) {
  64. spinShow.value = "block";
  65. const ret = await marketInfoDetailList({ id: id, lang: lang });
  66. if (Object.keys(ret).length != 0) {
  67. setTimeout(() => {
  68. vo.value = ret.vo;
  69. last.value = ret.last;
  70. next.value = ret.next;
  71. spinShow.value = "none";
  72. }, 200);
  73. } else {
  74. spinShow.value = "none";
  75. //router.push({name: 'news'});
  76. }
  77. }
  78. // 上下页切换
  79. function handleSwt(item: MarketInfo) {
  80. router.push({
  81. name: "newsDetail",
  82. params: { webTitle: item.webTitle + "-" + item.id },
  83. });
  84. }
  85. // onServerPrefetch(async () => {
  86. try {
  87. const webTitle = route.params.webTitle;
  88. const wts = webTitle.split("-");
  89. const ret = await marketInfoDetailList({
  90. id: wts[wts.length - 1],
  91. lang: lang,
  92. });
  93. if (Object.keys(ret).length != 0) {
  94. vo.value = ret.vo;
  95. last.value = ret.last;
  96. next.value = ret.next;
  97. }
  98. } catch (error) {
  99. console.log(error);
  100. }
  101. useHead({
  102. title: t("defaultSettings.title"),
  103. viewport: "width=device-width,initial-scale=1,maximum-scale=1 ",
  104. charset: "utf-8",
  105. meta: [
  106. {
  107. hid: "keywords",
  108. name: "keywords",
  109. content: t("defaultSettings.keyword"),
  110. },
  111. {
  112. hid: "description",
  113. name: "description",
  114. content: t("defaultSettings.desc"),
  115. },
  116. ],
  117. });
  118. // });
  119. </script>
  120. <style lang="scss" scoped>
  121. @import "~/assets/css/tool.scss";
  122. .page {
  123. margin-top: var(--size-130);
  124. .location {
  125. display: flex;
  126. border-bottom: 1px solid #e6e6e6;
  127. padding: 0 var(--size-160);
  128. background: #ffffff;
  129. .location_l {
  130. width: var(--size-60);
  131. height: var(--size-60);
  132. background: #dcdcdc;
  133. color: #383838;
  134. font-size: var(--size-16);
  135. text-align: center;
  136. line-height: var(--size-60);
  137. margin-right: var(--size-30);
  138. }
  139. .location_r {
  140. font-size: var(--size-14);
  141. font-family: Arial, Arial-Regular;
  142. color: #666666;
  143. line-height: var(--size-59);
  144. span {
  145. color: #639e57;
  146. font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  147. }
  148. .icon-dkw_guanbi- {
  149. color: #666666;
  150. font-size: var(--size-12);
  151. }
  152. }
  153. }
  154. .content {
  155. padding: var(--size-50) var(--size-195);
  156. .content_title {
  157. font-size: var(--size-38);
  158. font-family: Arial, Arial-Bold;
  159. font-weight: 700;
  160. text-align: center;
  161. color: #1a1a1a;
  162. line-height: var(--size-59);
  163. }
  164. .content_deta {
  165. font-size: var(--size-18);
  166. font-family: Arial, Arial-Regular;
  167. font-weight: 400;
  168. text-align: center;
  169. color: #999999;
  170. line-height: var(--size-44);
  171. border-bottom: 1px solid #d9d9d9;
  172. padding-bottom: var(--size-20);
  173. span {
  174. font-size: var(--size-18);
  175. display: inline-block;
  176. margin-right: var(--size-2);
  177. }
  178. }
  179. .newsdt-text {
  180. padding: var(--size-40) 0;
  181. }
  182. .content_btn {
  183. font-size: var(--size-18);
  184. font-family: MicrosoftYaHei;
  185. text-align: center;
  186. color: #ffffff;
  187. line-height: var(--size-63);
  188. width: var(--size-227);
  189. height: var(--size-63);
  190. background: linear-gradient(90deg, #7b9c4f 0%, #549f76 70%, #2da19d 100%);
  191. border-radius: var(--size-8);
  192. margin: auto;
  193. cursor: pointer;
  194. }
  195. .content_list {
  196. margin-top: var(--size-55);
  197. > div {
  198. font-size: var(--size-18);
  199. font-family: Arial, Arial-Regular;
  200. color: #1a1a1a;
  201. line-height: var(--size-44);
  202. a {
  203. color: #808080;
  204. cursor: pointer;
  205. }
  206. &:hover {
  207. font-weight: 700;
  208. color: #639e57;
  209. a {
  210. color: #639e57;
  211. }
  212. }
  213. }
  214. }
  215. }
  216. }
  217. .load {
  218. display: v-bind("spinShow");
  219. }
  220. @include responseTo("phone") {
  221. .page {
  222. .location {
  223. padding: 0;
  224. .location_l {
  225. margin-right: var(--size-15);
  226. }
  227. }
  228. .content {
  229. padding: var(--size-15);
  230. .content_title {
  231. font-size: var(--size-16);
  232. font-weight: 700;
  233. line-height: var(--size-26);
  234. }
  235. .content_deta {
  236. font-size: var(--size-14);
  237. padding-bottom: var(--size-10);
  238. span {
  239. font-size: var(--size-16);
  240. }
  241. }
  242. .newsdt-text {
  243. padding: 0 0 var(--size-40);
  244. :deep(img) {
  245. max-width: 100%;
  246. }
  247. }
  248. .content_list {
  249. margin-top: var(--size-25);
  250. > div {
  251. font-size: var(--size-16);
  252. line-height: var(--size-28);
  253. a {
  254. font-size: var(--size-16);
  255. }
  256. &:hover {
  257. font-weight: 700;
  258. color: #639e57;
  259. a {
  260. color: #639e57;
  261. }
  262. }
  263. }
  264. }
  265. .content_btn {
  266. width: var(--size-108);
  267. height: var(--size-34);
  268. font-size: var(--size-14);
  269. line-height: var(--size-32);
  270. }
  271. }
  272. }
  273. }
  274. </style>
  275. <style lang="scss">
  276. .newsdt-text {
  277. ul,
  278. li {
  279. list-style: disc;
  280. }
  281. }
  282. </style>