2.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <div>
  3. <div class="channelMenuTitle_skin2" v-if="componentStyle == 1 || componentStyle == 2 || componentStyle == 3">
  4. {{title}}
  5. </div>
  6. <!--样式1-->
  7. <div class="channelMenuList" v-if="componentStyle==1">
  8. <div v-for="item in navigateData">
  9. <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">{{item.alias}}</NuxtLink>
  10. </div>
  11. </div>
  12. <!--样式2-->
  13. <div class="channelMenuList menuListStyle2" v-if="componentStyle==2">
  14. <div v-for="item in navigateData">
  15. <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">{{item.alias}}</NuxtLink>
  16. </div>
  17. </div>
  18. <!-- 样式3 -->
  19. <div class="channelMenuList menuListStyle3" v-if="componentStyle == 3">
  20. <div v-for="item in navigateData">
  21. <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">{{item.alias}}</NuxtLink>
  22. </div>
  23. </div>
  24. <!-- 样式4 -->
  25. <div class="channelMenuList menuListStyle4" v-if="componentStyle == 4">
  26. <div class="menuTitle">{{ title }}</div>
  27. <div class="menulist" v-for="item in navigateData">
  28. <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">
  29. <span class="title">{{item.alias}}</span>
  30. <span class="line" v-if="item.alias != navigateData[navigateData.length - 1].alias">/</span>
  31. </NuxtLink>
  32. </div>
  33. </div>
  34. <!-- 样式5 -->
  35. <div class="channelMenuList menuListStyle4 menuListStyle5" v-if="componentStyle == 5">
  36. <div class="menuTitle">{{ title }}</div>
  37. <div class="menulist" v-for="item in navigateData">
  38. <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">
  39. <span class="title">{{item.alias}}</span>
  40. <span class="line" v-if="item.alias != navigateData[navigateData.length - 1].alias">/</span>
  41. </NuxtLink>
  42. </div>
  43. </div>
  44. <!-- 样式6 -->
  45. <div class="channelMenuList menuListStyle4 menuListStyle6" v-if="componentStyle == 6">
  46. <div class="menuTitle">{{ title }}</div>
  47. <div class="menulist" v-for="item in navigateData">
  48. <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">
  49. <span class="title">{{item.alias}}</span>
  50. <span class="line" v-if="item.alias != navigateData[navigateData.length - 1].alias">/</span>
  51. </NuxtLink>
  52. </div>
  53. </div>
  54. <!--样式7-->
  55. <div class="menuListStyle7" v-if="componentStyle == 7">
  56. <div class="channelMenuListTitle">{{ title }}</div>
  57. <div class="hannelMenuListFloatMenu">
  58. <div v-for="item in navigateData">
  59. <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">
  60. <span class="title">{{item.alias}}</span>
  61. </NuxtLink>
  62. </div>
  63. </div>
  64. </div>
  65. <!--样式8-->
  66. <div class="menuListStyle7 menuListStyle8" v-if="componentStyle == 8">
  67. <div class="channelMenuListTitle">{{ title }}</div>
  68. <div class="hannelMenuListFloatMenu">
  69. <div v-for="item in navigateData">
  70. <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">
  71. <span class="title">{{item.alias}}</span>
  72. </NuxtLink>
  73. </div>
  74. </div>
  75. </div>
  76. <!--样式9-->
  77. <div class="menuListStyle7 menuListStyle9" v-if="componentStyle == 9">
  78. <div class="channelMenuListTitle">{{ title }}</div>
  79. <div class="hannelMenuListFloatMenu">
  80. <div v-for="item in navigateData">
  81. <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">
  82. <span class="title">{{item.alias}}</span>
  83. </NuxtLink>
  84. </div>
  85. </div>
  86. </div>
  87. <!--样式10-->
  88. <div class="menuListStyle7 menuListStyle9 menuListStyle8" v-if="componentStyle == 10">
  89. <div class="channelMenuListTitle">{{ title }}</div>
  90. <div class="hannelMenuListFloatMenu">
  91. <div v-for="item in navigateData">
  92. <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">
  93. <span class="title">{{item.alias}}</span>
  94. </NuxtLink>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </template>
  100. <script setup>
  101. //引入vue
  102. import {ref} from 'vue';
  103. //获得新闻数据
  104. const props = defineProps({
  105. componentStyle:Number,//样式编号
  106. navigateData:Array,//子导航数据
  107. routeId:Number//导航对应的cid
  108. });
  109. //获得导航名称
  110. const title = ref("")
  111. const mkdata = await requestDataPromise('/web/getOneWebsiteCategory', {
  112. method: 'GET',
  113. query: {
  114. 'catid': props.routeId,
  115. },
  116. });
  117. if (mkdata.code == 200) {
  118. title.value = mkdata.data.parent_name;
  119. }
  120. //获取当前url路径
  121. const route = useRoute();
  122. //获得当前的完整路径
  123. const fullPath = route.path;
  124. const segments = fullPath.split('/');
  125. const targetSegment = segments[1];
  126. const targetSegment2 = segments[2];
  127. //判断当前为第几层的列表页
  128. // const routeLevel = ref(0);
  129. // if(route.name == "dir-list-id"){
  130. // routeLevel.value = 1;
  131. // console.log("当前的路由层级为:" + routeLevel.value);
  132. // }
  133. // if(route.name == "dir-dir-list-id"){
  134. // routeLevel.value = 2;
  135. // console.log("当前的路由层级为:" + routeLevel.value);
  136. // }
  137. </script>
  138. <style lang="less" scoped>
  139. //基本样式 start ---------------------------------------->
  140. .channelMenuTitle_skin2 {
  141. width: 1200px;
  142. height: 32px;
  143. line-height: 32px;
  144. font-size: 24px;
  145. color:#A91B33;
  146. font-weight: bold;
  147. text-align: center;
  148. background: url('http://img.bjzxtw.org.cn/pre/image/jpeg/20250626/1750914827434788.jpg') no-repeat center center;
  149. margin-bottom: 25px;
  150. }
  151. .channelMenuList {
  152. display: flex;
  153. justify-content: flex-start;
  154. align-items: center;
  155. color: #333;
  156. border-bottom: 2px solid #A91B33;
  157. padding-bottom: 15px;
  158. div {
  159. font-size: 16px;
  160. font-weight: bold;
  161. width: 150px;
  162. height: 22px;
  163. line-height: 22px;
  164. a {
  165. color: #333;
  166. display: block;
  167. text-align: center;
  168. &:hover {
  169. color: #A91B33;
  170. }
  171. }
  172. a.active {
  173. color: #A91B33;
  174. }
  175. &:first-child {
  176. color: #A91B33;
  177. }
  178. }
  179. }
  180. //基本样式 end ---------------------------------------->
  181. //样式2 start ---------------------------------------->
  182. .menuListStyle2 {
  183. border-bottom: 0;
  184. }
  185. //样式2 end ---------------------------------------->
  186. //样式3
  187. .menuListStyle3 {
  188. border-bottom: 0;
  189. div{
  190. text-align: center;
  191. height: 36px;
  192. &:hover {
  193. color: #A91B33;
  194. padding-bottom: 15px;
  195. border-bottom: 2px solid #A91B33;
  196. box-sizing: border-box;
  197. }
  198. }
  199. }
  200. //样式4
  201. .menuListStyle4 {
  202. height: 54px;
  203. padding-top: 23px;
  204. padding-bottom: 0px;
  205. .menuTitle {
  206. width: 140px;
  207. font-size: 26px;
  208. font-weight: bold;
  209. color: #A91B33;
  210. margin-right: 80px;
  211. }
  212. .menulist {
  213. display: flex;
  214. justify-content: flex-start;
  215. align-items: center;
  216. font-size: 16px;
  217. font-weight: bold;
  218. color: #333;
  219. padding: 15px 0;
  220. a{
  221. display: flex;
  222. justify-content: flex-start;
  223. align-items: center;
  224. .title{
  225. width: 120px;
  226. height: 16px;
  227. text-align: center;
  228. &:hover{
  229. color: #A91B33;
  230. }
  231. }
  232. .line{
  233. color: #A91B33;
  234. padding-top: 5px;
  235. }
  236. }
  237. }
  238. }
  239. //样式5
  240. .menuListStyle5 {
  241. border-bottom: none;
  242. }
  243. //样式6
  244. .menuListStyle6 {
  245. border-bottom: none;
  246. position: relative;
  247. }
  248. .menuListStyle6::after {
  249. content: '';
  250. position: absolute;
  251. bottom: -2px;
  252. left: 0;
  253. width: 8%;
  254. height: 2px;
  255. background-color: #A91B33;
  256. }
  257. //样式7
  258. .menuListStyle7 {
  259. margin-top: 30px;
  260. position: relative;
  261. padding-top: 25px;
  262. padding-bottom: 15px;
  263. border-bottom: 2px solid #E4E4E4;
  264. .channelMenuListTitle {
  265. background: url(https://img.bjzxtw.org.cn/pre/image/png/20250930/1759212724832324.png) no-repeat center center;
  266. width: 200px;
  267. height: 40px;
  268. line-height: 40px;
  269. color: #ffffff;
  270. font-size: 24px;
  271. padding-left: 30px;
  272. box-sizing: border-box;
  273. }
  274. .hannelMenuListFloatMenu {
  275. position: absolute;
  276. display: flex;
  277. flex-wrap: wrap;
  278. font-size: 12px;
  279. color: #333333;
  280. font-weight: bold;
  281. top:33px;
  282. right: 0;
  283. div {
  284. width: 123px;
  285. font-size: 16px;
  286. text-align: center;
  287. font-weight: bold;
  288. &:last-child{
  289. background: none;
  290. }
  291. &.active {
  292. color:#A91B33
  293. }
  294. a{
  295. color: #333333;
  296. }
  297. a:hover{
  298. color: #A91B33;
  299. }
  300. }
  301. }
  302. }
  303. //样式8
  304. .menuListStyle8 {
  305. border-bottom: none;
  306. }
  307. //样式9
  308. .menuListStyle9 {
  309. .hannelMenuListFloatMenu {
  310. div {
  311. width: 123px;
  312. font-size: 16px;
  313. text-align: center;
  314. font-weight: bold;
  315. height: 43px;
  316. &:last-child{
  317. background: none;
  318. }
  319. &.active {
  320. color:#A91B33;
  321. border-bottom: 2px solid #A91B33;
  322. }
  323. &:hover{
  324. color: #A91B33;
  325. border-bottom: 2px solid #A91B33;
  326. }
  327. }
  328. }
  329. }
  330. </style>