pageNavigation.vue 11 KB

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