pageNavigation.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <template>
  2. <!-- 导航 -->
  3. <div class="navigate">
  4. <div class="partOne">
  5. <div class="inner">
  6. <!-- 导航一 -->
  7. <div class="navLeft">
  8. <div class="navIndex">
  9. <NuxtLink to="/" target="_blank" title="首页">
  10. 首页
  11. </NuxtLink>
  12. </div>
  13. <div class="navClass">
  14. <div>乡村资讯</div>
  15. <div>社会资讯</div>
  16. </div>
  17. </div>
  18. <ul class="navigationOne">
  19. <li v-for="(item, index) in navigation1" :key="index">
  20. <NuxtLink :to="getLinkPath(item)">
  21. <span>{{ item.alias }}</span>
  22. </NuxtLink>
  23. </li>
  24. </ul>
  25. <div class="navRight">
  26. <div class="nav111" v-for="(item, index) in navigation2">
  27. <NuxtLink :to="getLinkPath(item)">
  28. <span>{{ item.alias }}</span>
  29. </NuxtLink>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="partTwo">
  35. <div class="inner">
  36. <h3>
  37. 深度服务
  38. </h3>
  39. <ul class="partTwoTitle">
  40. <li class="titleList" v-for="(item, index) in navigation3">
  41. <NuxtLink :to="getLinkPath(item)">
  42. <span>{{ item.alias }}</span>
  43. </NuxtLink>
  44. </li>
  45. </ul>
  46. <div class="searchBox">
  47. <input v-model="keywords" type="text" placeholder="请输入关键词" @keydown.enter="goToSearch">
  48. <img src="../../public/image/search.png" @keydown.enter="goToSearch">
  49. </div>
  50. </div>
  51. </div>
  52. <div class="littleNav">
  53. <div class="inner">
  54. <img src="../../public/index/hdpt.png" alt="">
  55. <ul class="leftPart">
  56. <li class="navList" v-for="item in navigation4">
  57. <NuxtLink :to="getLinkPath(item)">
  58. <span>{{ item.alias }}</span>
  59. </NuxtLink>
  60. </li>
  61. </ul>
  62. <ul class="rightPart">
  63. <li class="navList" v-for="item in navigation4data2">
  64. <NuxtLink :to="getLinkPath(item)" >
  65. <span>{{ item.alias }}</span>
  66. </NuxtLink>
  67. </li>
  68. </ul>
  69. </div>
  70. </div>
  71. </div>
  72. </template>
  73. <script setup>
  74. //1.加载依赖 start ---------------------------------------->
  75. //1.加载依赖 end ---------------------------------------->
  76. //2.页面公用方法 start ---------------------------------------->
  77. const getLinkPath = (item) => {
  78. if (item.is_url == 1) {
  79. return {
  80. url: item.web_url,
  81. target: '_blank'
  82. }
  83. }else{
  84. if (item.children_count != 0) {
  85. return { path: `/primaryNavigation/${item.category_id}` }
  86. }else{
  87. return { path: `/newsList/${item.category_id}` }
  88. }
  89. }
  90. }
  91. //2.页面公用方法 end ---------------------------------------->
  92. //3.获取导航菜单 start ---------------------------------------->
  93. const navigation1 = ref([]);
  94. //2是那个独立的2个
  95. const navigation2 = ref([]);
  96. const navigation3 = ref([]);
  97. //下面一行是2边分开的 一边5个
  98. const navigation4 = ref([]);
  99. const navigation4data2 = ref([]);
  100. //获取导航菜单1
  101. async function getNavigation1() {
  102. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  103. method: 'GET',
  104. query: {
  105. 'pid': 0,
  106. 'num': 20,
  107. 'placeid': 1
  108. },
  109. });
  110. navigation1.value = mkdata.data;
  111. }
  112. getNavigation1();
  113. //获取导航菜单2
  114. async function getNavigation2() {
  115. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  116. method: 'GET',
  117. query: {
  118. 'pid': 0,
  119. 'num': 2,
  120. 'placeid': 20
  121. },
  122. });
  123. navigation2.value = mkdata.data;
  124. }
  125. getNavigation2();
  126. //获取导航菜单3
  127. async function getNavigation3() {
  128. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  129. method: 'GET',
  130. query: {
  131. 'pid': 0,
  132. 'num': 6,
  133. 'placeid': 22
  134. },
  135. });
  136. navigation3.value = mkdata.data;
  137. }
  138. getNavigation3();
  139. //获取导航菜单4
  140. async function getNavigation4() {
  141. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  142. method: 'GET',
  143. query: {
  144. 'pid': 0,
  145. 'num': 10,
  146. 'placeid': 28
  147. },
  148. });
  149. for(let i in mkdata.data){
  150. if(i < 5){
  151. navigation4.value.push(mkdata.data[i]);
  152. }else{
  153. navigation4data2.value.push(mkdata.data[i]);
  154. }
  155. }
  156. //navigation4.value = mkdata.data;
  157. //navigation4data2.value = mkdata.data;
  158. }
  159. getNavigation4();
  160. //3.获取导航菜单 end ---------------------------------------->
  161. //4.跳转到搜索页面 start ---------------------------------------->
  162. const keywords = ref("")
  163. let goToSearch = () => {
  164. const route = "/search/search?keyword=" + keywords.value;
  165. window.open(route, '_blank');
  166. }
  167. //4.跳转到搜索页面 end ---------------------------------------->
  168. </script>
  169. <style lang="less" scoped>
  170. // 导航部分
  171. .partOne .navigationOne,
  172. .partOne .navigationOne>li {
  173. float: left;
  174. }
  175. .partOne {
  176. width: 100%;
  177. height: 133px;
  178. // margin-bottom: 10px;
  179. background-color: #a01c0e;
  180. font-size: 20px;
  181. font-family: PingFang SC-Semibold;
  182. .inner {
  183. display: flex;
  184. justify-content: space-between;
  185. .navLeft {
  186. width: 160px;
  187. font-size: 16px;
  188. display: flex;
  189. }
  190. .navIndex {
  191. height: 100px;
  192. line-height: 130px;
  193. a {
  194. font-weight: bold;
  195. font-size: 16px;
  196. color: #F8ECD2;
  197. }
  198. }
  199. .navClass {
  200. padding-top: 35px;
  201. padding-left: 30px;
  202. font-weight: bold;
  203. color: #F8ECD2;
  204. div:nth-child(2) {
  205. padding-top: 20px;
  206. }
  207. }
  208. }
  209. .navigationOne {
  210. width: 1200px;
  211. color: #333;
  212. display: flex;
  213. flex-wrap: wrap;
  214. padding-top: 24px;
  215. //justify-content: space-around;
  216. li {
  217. width: 74px;
  218. font-family: PingFang SC;
  219. height: 42px;
  220. line-height: 42px;
  221. //font-weight: 600;
  222. font-size: 16px;
  223. text-align: left;
  224. font-style: normal;
  225. text-transform: none;
  226. margin: 0 10px;
  227. text-align: center;
  228. // &:nth-last-child(1) {
  229. // margin-right: 0px;
  230. // }
  231. a {
  232. font-weight: 400;
  233. font-size: 16px;
  234. color: #FFFFFF;
  235. display: block;
  236. }
  237. }
  238. >li:hover a {
  239. color: #F8ECD2;
  240. }
  241. .active {
  242. color: #F8ECD2;
  243. // display: inline-block;
  244. // height: 50px;
  245. // border-bottom: 2px solid #139602
  246. }
  247. }
  248. .navRight {
  249. width: 135px;
  250. height: 75px;
  251. font-size: 16px;
  252. margin-top: 30px;
  253. background: url(/_nuxt/public/index/nav_bg.png) no-repeat;
  254. .nav111 {
  255. width: 98px;
  256. height: 30px;
  257. line-height: 44px;
  258. text-align: center;
  259. font-family: Microsoft YaHei, Microsoft YaHei;
  260. font-weight: bold;
  261. font-size: 16px;
  262. a {
  263. font-weight: bold;
  264. background: linear-gradient(to bottom, #FFF6B1 0%, #F5BC38 100%);
  265. -webkit-background-clip: text;
  266. color: transparent;
  267. }
  268. }
  269. }
  270. }
  271. .partTwo {
  272. width: 100%;
  273. height: 60px;
  274. line-height: 60px;
  275. // border-bottom: 1px solid #e3e3e3;
  276. background-color: #fafafa;
  277. .inner {
  278. width: 1200px;
  279. height: 57px;
  280. display: flex;
  281. // justify-content: space-between;
  282. h3 {
  283. font-family: Microsoft YaHei, Microsoft YaHei;
  284. font-weight: bold;
  285. font-size: 16px;
  286. padding-left: 60px;
  287. a {
  288. color: #333333;
  289. }
  290. }
  291. .partTwoTitle {
  292. display: flex;
  293. justify-content: flex-start;
  294. width: 633px;
  295. padding-left: 40px;
  296. padding-right: 40px;
  297. .titleList {
  298. font-size: 16px;
  299. font-family: PingFang SC, PingFang SC;
  300. font-weight: 400;
  301. margin-right: 40px;
  302. a {
  303. color: #333333;
  304. }
  305. }
  306. .titleList:hover a {
  307. color: #A01C0E;
  308. }
  309. }
  310. .searchBox {
  311. width: 356px;
  312. height: 40px;
  313. line-height: 40px;
  314. background-color: #fff;
  315. margin-top: 10px;
  316. border-radius: 25px;
  317. border: 1px solid #ededed;
  318. input {
  319. width: 285px;
  320. height: 35px;
  321. line-height: 35px;
  322. margin-left: 20px;
  323. border: none;
  324. outline: none;
  325. }
  326. img {
  327. width: 32px;
  328. height: 32px;
  329. vertical-align: middle;
  330. cursor: pointer;
  331. }
  332. }
  333. }
  334. }
  335. //小导航
  336. .littleNav {
  337. width: 100%;
  338. height: 88px;
  339. margin-top: 15px;
  340. .inner {
  341. width: 1200px;
  342. height: 88px;
  343. line-height: 88px;
  344. margin: 0 auto;
  345. display: flex;
  346. border: 1px solid #D3D5D8;
  347. background-color: #fafafa;
  348. img {
  349. width: 138px;
  350. height: 38px;
  351. margin-top: 22px;
  352. margin-left: 25px;
  353. }
  354. .leftPart {
  355. margin-left: 40px;
  356. margin-right: 10px;
  357. }
  358. .leftPart,
  359. .rightPart {
  360. width: 470px;
  361. height: 78px;
  362. margin-top: 5px;
  363. display: flex;
  364. align-items: center;
  365. justify-content: space-between;
  366. padding: 0 10px;
  367. border-bottom: 3px solid #A01C0E;
  368. .navList {
  369. a {
  370. font-family: Microsoft YaHei, Microsoft YaHei;
  371. font-weight: bold;
  372. font-size: 16px;
  373. color: #333333;
  374. line-height: 19px;
  375. }
  376. }
  377. .navList:hover a {
  378. color: #A01C0E;
  379. }
  380. }
  381. }
  382. }
  383. </style>