pageNavigation1.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <div class="navigate">
  3. <div class="partOne">
  4. <div class="inner">
  5. <div class="navLeft">
  6. <div class="navClass">
  7. <div>
  8. 资讯信息
  9. </div>
  10. <div>
  11. 网上互动
  12. </div>
  13. </div>
  14. </div>
  15. <ul class="navigationOne">
  16. <li v-for="item in navigation1"
  17. @mousemove="item.alias == '供求信息' ? showTwo = true : showTwo = false">
  18. <NuxtLink :href="getLinkPath(item)" :title="item.alias"
  19. :target="item.is_url == 1 ? '_blank' : '_self'">
  20. {{ item.alias }}
  21. </NuxtLink>
  22. </li>
  23. </ul>
  24. <ul class="navigationTwo" v-if="showTwo" @mouseleave="showTwo = false">
  25. <li v-for="(item, index) in secNav" :key="index">
  26. <NuxtLink :href="`/gongqiuxinxi/${item.aLIas_pinyin}/index.html`" :title="item.alias"
  27. :target="item.is_url == 1 ? '_blank' : '_self'">
  28. {{ item.alias }}
  29. </NuxtLink>
  30. </li>
  31. </ul>
  32. </div>
  33. </div>
  34. <div class="partTwo">
  35. <div class="inner">
  36. <ul class="part2_left">
  37. <li>农资商城</li>
  38. <li class="part2_navList" v-for="item in navigation2">
  39. <NuxtLink :href="getLinkPath(item)" :title="item.alias"
  40. :target="item.is_url == 1 ? '_blank' : '_self'">
  41. {{ item.alias }}
  42. </NuxtLink>
  43. </li>
  44. </ul>
  45. <ul class="part2_right">
  46. <li class="part2_right_navList" v-for="(item, index) in navigation3">
  47. <NuxtLink :href="getLinkPath(item)" :title="item.alias"
  48. :target="item.is_url == 1 ? '_blank' : '_self'">
  49. {{ item.alias }}
  50. </NuxtLink>
  51. <em v-if="index != 2"></em>
  52. </li>
  53. </ul>
  54. </div>
  55. </div>
  56. <!-- 深度服务 -->
  57. <div class="deepServer">
  58. <div class="inner">
  59. <div class="deepServer_left">
  60. <div class="serverTitle">
  61. <NuxtLink href="/">
  62. 网站首页
  63. </NuxtLink>
  64. </div>
  65. <el-radio-group v-model="checkList">
  66. <el-radio value="1">资讯</el-radio>
  67. <el-radio value="2">商城</el-radio>
  68. <el-radio value="6">企业</el-radio>
  69. <el-radio value="7">项目</el-radio>
  70. </el-radio-group>
  71. </div>
  72. <div class="deepServer_right">
  73. <div class="searchRole">
  74. <input type="text" v-model="inputValue" placeholder="输入关键词" class="ipt">
  75. <em @click="goToPrimary"></em>
  76. </div>
  77. <!-- <div class="serverTitle_right">
  78. 【高级搜索】
  79. </div> -->
  80. </div>
  81. </div>
  82. </div>
  83. <div class="phone_nav pc_none">
  84. <div class="phone_nav_in">
  85. <NuxtLink
  86. to="/"
  87. class="phone_nav_index"
  88. :class="{ 'phone_nav_index_only': $route.path === '/' }"
  89. >
  90. 首页
  91. </NuxtLink>
  92. <div class="phone_nav_a_box">
  93. <NuxtLink
  94. v-for="(item, index) in navigation1" :key="index"
  95. :to="getLinkPath(item)"
  96. :target="item.is_url == 1 ? '_blank' : '_self'">
  97. {{ item.alias }}
  98. </NuxtLink>
  99. <NuxtLink
  100. v-for="(item, index) in navigation2" :key="index"
  101. :to="getLinkPath(item)"
  102. :target="item.is_url == 1 ? '_blank' : '_self'">
  103. {{ item.alias }}
  104. </NuxtLink>
  105. <NuxtLink
  106. v-for="(item, index) in navigation3" :key="index"
  107. :to="getLinkPath(item)"
  108. :target="item.is_url == 1 ? '_blank' : '_self'">
  109. {{ item.alias }}
  110. </NuxtLink>
  111. <NuxtLink
  112. v-for="(item, index) in navigation4" :key="index"
  113. :to="getLinkPath(item)"
  114. :target="item.is_url == 1 ? '_blank' : '_self'">
  115. {{ item.alias }}
  116. </NuxtLink>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. </template>
  122. <script setup>
  123. //1.获取导航菜单 start ---------------------------------------->
  124. import { ElCheckbox, ElCheckboxGroup, ElMessage, ElRadio, ElRadioGroup } from 'element-plus'
  125. let showTwo = ref(false);
  126. const props = defineProps({
  127. type: String
  128. });
  129. //第一行导航菜单 10个
  130. const navigation1 = ref([]);
  131. //两行的导航菜单 20个
  132. const navigation2 = ref([]);
  133. //三行的导航菜单 3个
  134. const navigation3 = ref([]);
  135. //获取导航菜单1
  136. async function getNavigation1() {
  137. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  138. method: 'GET',
  139. query: {
  140. 'pid': 0,
  141. 'num': 28,
  142. 'placeid': 1
  143. },
  144. });
  145. navigation1.value = mkdata.data;
  146. }
  147. getNavigation1();
  148. //获取导航菜单2
  149. async function getNavigation2() {
  150. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  151. method: 'GET',
  152. query: {
  153. 'pid': 0,
  154. 'num': 10,
  155. 'placeid': 29
  156. },
  157. });
  158. navigation2.value = mkdata.data;
  159. }
  160. getNavigation2();
  161. //获取导航菜单3
  162. async function getNavigation3() {
  163. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  164. method: 'GET',
  165. query: {
  166. 'pid': 0,
  167. 'num': 3,
  168. 'placeid': 39
  169. },
  170. });
  171. navigation3.value = mkdata.data;
  172. }
  173. getNavigation3();
  174. // 1.4 获取供求信息二级导航
  175. //引入导航
  176. const { $pageNav } = useNuxtApp();
  177. const pid = $pageNav[14];
  178. console.log('供求信息二级栏目', pid);
  179. const secNav = ref([]);
  180. async function getNavigation4() {
  181. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  182. method: 'GET',
  183. query: {
  184. 'pid': pid,
  185. 'num': 2,
  186. 'placeid': 1,
  187. 'type': 1
  188. },
  189. });
  190. console.log("供求信息二级栏目", mkdata.data);
  191. secNav.value = mkdata.data;
  192. }
  193. getNavigation4();
  194. //1.获取导航菜单 end ---------------------------------------->
  195. //2.搜索 start ---------------------------------------->
  196. const checkList = ref("1");// 单选
  197. if(props.type) {
  198. checkList.value = props.type;
  199. }else{
  200. checkList.value = "1";
  201. }
  202. const inputValue = ref("") //关键词搜索
  203. //2.1跳转到搜索页面
  204. let goToPrimary = async () => {
  205. if (checkList.value == "") {
  206. ElMessage.error('搜索项不能为空!')
  207. } else {
  208. const route = `/search/search?keyword=${inputValue.value}&type=${checkList.value}`;
  209. window.location.href = route;
  210. }
  211. }
  212. //2.搜索 end ---------------------------------------->
  213. </script>
  214. <style lang="less" scoped>
  215. @import url('@/assets/css/public/nav.less');
  216. </style>
  217. <style lang="less" scoped>
  218. @media screen and (min-width:801px){/*pc*/
  219. .pc_none{display:none;}
  220. }
  221. @media screen and (max-width:800px){/*ipad_phone*/
  222. .phone_nav{
  223. width:100%;margin:10px auto 0;
  224. height:44px;background:#a91b33;
  225. }
  226. .phone_nav_in{height:44px;width:92%;margin:0px auto;}
  227. .phone_nav_index{height:44px;line-height:44px;font-size:16px;float:left;
  228. color:rgba(255, 255, 255,.6);;margin-right:20px;}
  229. .phone_nav_a_box{height:44px;
  230. overflow-x:auto;overflow-y:hidden;word-break: keep-all; white-space: nowrap;
  231. }
  232. .phone_nav_a_box::-webkit-scrollbar{height:0px;}
  233. .phone_nav_a_box a{display:inline-block;height:44px;line-height:44px;font-size:16px;margin:0 10px;
  234. color:rgba(255, 255, 255,.6);}
  235. .phone_nav_index_only{ color:#fff; font-weight:bold;}
  236. .phone_nav_a_box a.router-link-exact-active{color:#fff;font-weight:bold;}
  237. .partOne{display:none;}
  238. .partTwo{display:none;}
  239. .deepServer{display:none;}
  240. .phone_none{display:none;}
  241. }
  242. </style>