SecondaryHeading.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <div class="sannongzhichuang">
  3. <div class="inner">
  4. <h2>
  5. {{ title }}
  6. <em class="iconfont icon-xingzhuang-zhijiaosanjiaoxing-copy"></em>
  7. </h2>
  8. <div class="introduction">
  9. <strong>频道介绍</strong>
  10. <div v-for="(item,index) in titleData">
  11. <span v-if="index<=7">
  12. <NuxtLink :to="{ path: `/newsList/${item.cid}`}">{{item.alias}}</NuxtLink>
  13. </span>
  14. <b v-else></b>
  15. </div>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script setup>
  21. //设置组件数据 start---------------------------------------->
  22. //子导航
  23. const props = defineProps({
  24. titleData:Array
  25. });
  26. //二级标题名称
  27. const route = useRoute();
  28. //动态路由别名
  29. //获取route中的数字部分
  30. // const extractNumberFromPath = (path) => {
  31. // const match = path.match(/\d+/);
  32. // return match ? match[0] : null;
  33. // };
  34. // const routeId = extractNumberFromPath(route.path); //获得该页面的id
  35. const routeId = route.params.id; //获得该页面的id
  36. const routeName = route.query.name; //获得该页面的名称
  37. const title = ref("")
  38. async function getPageData() {
  39. const mkdata = await requestDataPromise('/web/getOneWebsiteCategory', {
  40. method: 'GET',
  41. query: {
  42. 'catid': routeId,
  43. },
  44. });
  45. if(mkdata.code == 200){
  46. title.value = mkdata.data.alias;
  47. }else{
  48. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  49. console.log("错误位置:获取二级标题")
  50. console.log("后端错误反馈:",mkdata.message)
  51. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  52. }
  53. }
  54. getPageData();
  55. </script>
  56. <style lang="less" scoped>
  57. // 三农之窗
  58. .sannongzhichuang {
  59. margin: 30px 0 40px;
  60. .inner {
  61. width: 1200px;
  62. height: 67px;
  63. position: relative;
  64. }
  65. h2 {
  66. display: inline-block;
  67. //background-image: url("../../public/image/bg1.png");
  68. background: #139602;
  69. width: 156px;
  70. height: 43px;
  71. padding: 14px 31px 10px 25px;
  72. font-family: STXingkai, STXingkai;
  73. font-weight: 400;
  74. font-size: 39px;
  75. color: #FFFFFF;
  76. line-height: 46px;
  77. text-align: center;
  78. font-style: normal;
  79. text-transform: none;
  80. -webkit-text-stroke: 1px #3C6C47;
  81. position: absolute;
  82. top: 0;
  83. left: 0;
  84. z-index: 99;
  85. em {
  86. position: absolute;
  87. top: -16px;
  88. right: -12px;
  89. color: #185410;
  90. display: inline-block;
  91. width: 13px;
  92. height: 13px;
  93. }
  94. }
  95. div.introduction {
  96. display: inline-block;
  97. width: 1003px;
  98. height: 56px;
  99. line-height: 56px;
  100. background-color: #fafafa;
  101. position: absolute;
  102. bottom: 0;
  103. right: 0;
  104. display: flex;
  105. >strong:first-child {
  106. margin-left: 40px;
  107. display: inline-block;
  108. vertical-align: middle;
  109. width: 32px;
  110. height: 36px;
  111. padding: 3px 7px;
  112. border: 0.5px solid #129502;
  113. font-family: Microsoft YaHei, Microsoft YaHei;
  114. font-weight: bold;
  115. font-size: 14px;
  116. color: #139602;
  117. line-height: 18px;
  118. text-align: center;
  119. font-style: normal;
  120. text-transform: none;
  121. }
  122. div {
  123. overflow: hidden;
  124. text-overflow: ellipsis;
  125. white-space: nowrap;
  126. >span {
  127. width: 64px;
  128. height: 21px;
  129. font-family: Microsoft YaHei, Microsoft YaHei;
  130. font-weight: 400;
  131. font-size: 16px;
  132. color: #000000;
  133. line-height: 21px;
  134. text-align: left;
  135. font-style: normal;
  136. text-transform: none;
  137. margin-top: 17px;
  138. padding: 0 24px;
  139. border-right: 1px solid #ccc;
  140. a {
  141. color: #000;
  142. }
  143. }
  144. >span:hover a {
  145. color: #139602;
  146. }
  147. >span:last-child {
  148. border: none;
  149. }
  150. }
  151. }
  152. }
  153. </style>