pageNavigation.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div class="navigate">
  3. <div class="partOne">
  4. <div class="inner">
  5. <div class="navLeft">
  6. <div class="navIndex">
  7. <NuxtLink :to="'/'" title="首页">首页</NuxtLink>
  8. </div>
  9. <div class="navClass">
  10. <div>
  11. 商城类
  12. </div>
  13. <div>
  14. 资讯类
  15. </div>
  16. </div>
  17. </div>
  18. <ul class="navigationOne">
  19. <li v-for="(item, index) in navigation1" :key="index">
  20. <NuxtLink :href="getLinkPath(item)" :title="item.alias" v-if="index <= 23"
  21. :target="item.is_url == 1 ? '_blank' : '_self'">
  22. {{ item.alias }}
  23. </NuxtLink>
  24. </li>
  25. </ul>
  26. </div>
  27. </div>
  28. <!-- 深度服务 -->
  29. <div class="deepServer">
  30. <div class="inner">
  31. <div class="deepServer_left">
  32. <div class="serverTitle">
  33. 深度服务
  34. </div>
  35. <ul class="contentList">
  36. <li v-for="(item, index) in navigation2" :key="index">
  37. <NuxtLink :href="getLinkPath(item)" :title="item.alias"
  38. :target="item.is_url == 1 ? '_blank' : '_self'">
  39. {{ item.alias }}
  40. </NuxtLink>
  41. </li>
  42. </ul>
  43. </div>
  44. <div class="deepServer_right">
  45. <div class="serverTitle_right">
  46. 站内搜索:
  47. </div>
  48. <div class="searchRole">
  49. <el-select v-model="selectValue" placeholder="请选择.." size="large" style="width: 100px">
  50. <el-option v-for="(item, index) in selectOptions" :key="index" :label="item.name"
  51. :value="item.id" />
  52. </el-select>
  53. <i></i>
  54. <input type="text" v-model="inputValue" placeholder="输入关键词" class="ipt">
  55. <em @click="goToPrimary"></em>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="phone_nav pc_none">
  61. <div class="phone_nav_in">
  62. <NuxtLink
  63. to="/" title="首页"
  64. class="phone_nav_index"
  65. :class="{ 'phone_nav_index_only': $route.path === '/' }"
  66. >
  67. 首页
  68. </NuxtLink>
  69. <div class="phone_nav_a_box">
  70. <NuxtLink
  71. v-for="(item, index) in navigation1" :key="index"
  72. :href="getLinkPath(item)"
  73. :title="item.alias"
  74. :target="item.is_url == 1 ? '_blank' : '_self'">
  75. {{ item.alias }}
  76. </NuxtLink>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </template>
  82. <script setup>
  83. //1.获取导航菜单 start ---------------------------------------->
  84. //第一行导航菜单 10个
  85. const navigation1 = ref([]);
  86. //两行的导航菜单 20个
  87. const navigation2 = ref([]);
  88. //获取导航菜单1
  89. async function getNavigation1() {
  90. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  91. method: 'GET',
  92. query: {
  93. 'pid': 0,
  94. 'num': 20,
  95. 'placeid': 1
  96. },
  97. });
  98. navigation1.value = mkdata.data;
  99. // console.log("导航菜单1", navigation1.value);
  100. }
  101. getNavigation1();
  102. //获取导航菜单2
  103. async function getNavigation2() {
  104. const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
  105. method: 'GET',
  106. query: {
  107. 'pid': 0,
  108. 'num': 4,
  109. 'placeid': 21
  110. },
  111. });
  112. navigation2.value = mkdata.data;
  113. }
  114. getNavigation2();
  115. //1.获取导航菜单 end ---------------------------------------->
  116. //2.搜索 start ---------------------------------------->
  117. import { ElSelect, ElOption, ElMessage } from 'element-plus'
  118. let selectOptions = [ //下拉框选项
  119. { name: '资讯', id: 1 },
  120. { name: '商城', id: 2 },
  121. { name: '招聘', id: 4 },
  122. { name: '求职', id: 5 },
  123. ]
  124. const selectValue = ref("") //搜索左侧下拉选择的值
  125. const inputValue = ref("") //搜索右侧框输入的值
  126. //2.1跳转到搜索页面
  127. let goToPrimary = async () => {
  128. if (selectValue.value == "") {
  129. ElMessage.error('搜索项类型不能为空!')
  130. } else {
  131. const route = `/search/search?type=${selectValue.value}&keyword=${inputValue.value}`;
  132. window.location.href = route;
  133. }
  134. }
  135. //2.搜索 end ---------------------------------------->
  136. </script>
  137. <style lang="less" scoped>
  138. @import url('@/assets/css/public/nav.less');
  139. </style>
  140. <style lang="less" scoped>
  141. @media screen and (min-width:801px){/*pc*/
  142. .pc_none{display:none;}
  143. }
  144. @media screen and (max-width:800px){/*ipad_phone*/
  145. .phone_nav{
  146. width:100%;margin:10px auto 0;
  147. height:44px;background:#255590;
  148. }
  149. .phone_nav_in{height:44px;width:92%;margin:0px auto;}
  150. .phone_nav_index{height:44px;line-height:44px;font-size:16px;float:left;
  151. color:rgba(255, 255, 255,.6);;margin-right:20px;}
  152. .phone_nav_a_box{height:44px;
  153. overflow-x:auto;overflow-y:hidden;word-break: keep-all; white-space: nowrap;
  154. }
  155. .phone_nav_a_box::-webkit-scrollbar{height:0px;}
  156. .phone_nav_a_box a{display:inline-block;height:44px;line-height:44px;font-size:16px;margin:0 10px;
  157. color:rgba(255, 255, 255,.6);}
  158. .phone_nav_a_box a:nth-of-type(1){margin-left:0px;}
  159. .phone_nav_index_only{ color:#fff; font-weight:bold;}
  160. .phone_nav_a_box a.router-link-exact-active{color:#fff;font-weight:bold;}
  161. .partOne{display:none;}
  162. .deepServer{display:none;}
  163. .littleNav{display:none;}
  164. .phone_none{display:none;}
  165. }
  166. </style>