lucencyHeader.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <div class="header">
  3. <div class="conBox header-content">
  4. <a class="logo" href="/">
  5. <img src="headerLogo.png" alt="" class="logo">
  6. </a>
  7. <div class="right-header">
  8. <div class="top">
  9. <img src="image/logotext2.png" alt="">
  10. </div>
  11. <div class="menus">
  12. <div class="top-menu">
  13. <a class="menu" href="/">{{ lang===langType.cn?"首页":getLangText("首页") }}</a>
  14. <a class="menu" @click="switchLangClickHandle">
  15. {{ lang===langType.cn?"English":getLangText("English") }}
  16. </a>
  17. </div>
  18. <ul class="subMenu">
  19. <li class="menu" v-for="(item,i) in menus" :key="item.url+'_'+i"
  20. :title="lang===langType.cn?item.text:getLangText(item.text)">
  21. <a :href="item.url" >{{lang===langType.cn?item.text:getAbbrText(item.text)}}</a>
  22. </li>
  23. </ul>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="conBox header-main">
  28. <ul class="main-menus">
  29. <li class="main-menu"
  30. v-for="(item,i) in mainMenus"
  31. :key="`main-${item.path}-${i}`"
  32. @mouseenter="showSubMenu(item)"
  33. @mouseleave="startHideSubMenu(item)"
  34. >
  35. <a :href="item.url" >{{lang===langType.cn?item.text:getAbbrText(item.text)}}</a>
  36. <span class="now" v-if="pageKey===item.key"></span>
  37. <menu-drop
  38. v-show="item.showSub"
  39. v-if="item.isSub"
  40. :type="item.subKey"
  41. :lang="lang"
  42. />
  43. </li>
  44. </ul>
  45. <div class="search-box">
  46. <div class="search">
  47. <input type="text" v-model="searchKey"
  48. placeholder="搜索咨询与产品">
  49. <button @click="searchItem" >
  50. <img src="image/search.png" alt="搜索">
  51. </button>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. import langMap from "~/map/langMap";
  59. import menuDrop from "~/components/header/menuDrops/menuDrop";
  60. export default {
  61. name: "lucencyHeader",
  62. props: {
  63. lang:{
  64. default: langMap.lang.cn
  65. },
  66. pageKey:{
  67. default: "index"
  68. },
  69. },
  70. components:{
  71. menuDrop
  72. },
  73. data(){
  74. return {
  75. langType: langMap.lang,
  76. menus: [
  77. {
  78. url:'https://gpscore.net/',
  79. text: '合方圆管理平台'
  80. },
  81. {
  82. url:'/',
  83. text: '智慧能源'
  84. },
  85. {
  86. url:'/',
  87. text: '输电线路摄像头'
  88. },
  89. {
  90. url:'https://gpscore.net/',
  91. text: '4G低功耗摄像头'
  92. },
  93. {
  94. url:'https://gpscore.net/',
  95. text: '自动变焦双目协同摄像头'
  96. },
  97. {
  98. url:'https://gpscore.net/',
  99. text: 'M2M产品'
  100. },
  101. {
  102. url:'https://gpscore.net/',
  103. text: '智能终端'
  104. },
  105. ],
  106. mainMenus:[
  107. {
  108. key: "index",
  109. path: "/",
  110. text: "首页"
  111. },
  112. {
  113. key: "product",
  114. path: "/product.html",
  115. text: "产品中心",
  116. isSub: true,
  117. subKey: "product",
  118. showSub: false
  119. },
  120. {
  121. key: "solution",
  122. path: "/solution.html",
  123. text: "解决方案",
  124. isSub: true,
  125. subKey: "solution",
  126. showSub: false
  127. },
  128. {
  129. key: "new",
  130. path: "/new.html",
  131. text: "新闻中心"
  132. },
  133. {
  134. key: "support",
  135. path: "/technicalSupport.html",
  136. text: "技术支持",
  137. sub:{
  138. type: "about",
  139. }
  140. },
  141. {
  142. key: "about",
  143. path: "/about.html",
  144. text: "关于我们",
  145. sub:{
  146. type: "about",
  147. }
  148. }
  149. ],
  150. searchKey: "",
  151. nowSub: "",
  152. hideTimer: null,
  153. }
  154. },
  155. methods:{
  156. getLangText(str){
  157. return langMap.getText(this.lang,str);
  158. },
  159. getAbbrText(str){
  160. return langMap.getAbbrText(this.lang,str);
  161. },
  162. switchLangClickHandle(){
  163. this.$root.$emit('changeLang');
  164. },
  165. searchItem(){
  166. },
  167. showSubMenu(item){
  168. // console.log("0000000")
  169. if(item.isSub){
  170. // 清除隐藏定时器
  171. if(this.hideTimer){
  172. clearTimeout(this.hideTimer);
  173. this.hideTimer = null;
  174. }
  175. if(this.nowSub !== item.key){
  176. // 不同key切换
  177. let oldItem = this.mainMenus.find(val => val.key === this.nowSub);
  178. console.log(oldItem)
  179. if(oldItem){
  180. this.hideSubMenu(oldItem);
  181. }
  182. }
  183. item.showSub = true;
  184. this.nowSub = item.key;
  185. }
  186. },
  187. startHideSubMenu(item){
  188. this.hideTimer = setTimeout(()=>{
  189. this.hideSubMenu(item);
  190. },700)
  191. },
  192. hideSubMenu(item){
  193. item.showSub = false;
  194. this.nowSub = "";
  195. if(this.hideTimer){
  196. clearTimeout(this.hideTimer);
  197. this.hideTimer = null;
  198. }
  199. }
  200. }
  201. }
  202. </script>
  203. <style scoped>
  204. .header{
  205. backdrop-filter: blur(5px);
  206. box-shadow: 0px 2px 6px 0px rgb(0 0 0 / 20%) ;
  207. /*text-shadow: 0 0 5px skyblue;*/
  208. }
  209. .header-content {
  210. display: flex;
  211. height: 70px;
  212. }
  213. .header-content > .logo{
  214. display: block;
  215. width: 260px;
  216. height: 70px;
  217. margin-top: 7.5px;
  218. }
  219. .header-content > .logo img{
  220. display: block;
  221. width: auto;
  222. height: 65px;
  223. }
  224. .header-content .right-header{
  225. width: 1060px;
  226. height: 100%;
  227. margin-left: 11px;
  228. position: relative;
  229. top: -35px;
  230. }
  231. .right-header .top{
  232. margin-top: 35px;
  233. height: 63px;
  234. }
  235. .right-header .top img{
  236. display: block;
  237. width: 253px;
  238. height: 63px;
  239. }
  240. .menus{
  241. height: 40px;
  242. position: relative;
  243. display: flex;
  244. flex-direction: column;
  245. align-items: flex-end;
  246. margin-top: -28px;
  247. }
  248. .menus .top-menu{
  249. width: auto;
  250. height: 30px;
  251. right: 0;
  252. top: -30px;
  253. position: absolute;
  254. }
  255. .menus .menu{
  256. padding: 0 8px;
  257. list-style: none;
  258. cursor: pointer;
  259. color: #16a0d7;
  260. font-size: 1.1em;
  261. }
  262. .menus .menu:hover{
  263. color: skyblue !important;
  264. }
  265. .menus .subMenu{
  266. max-width: 90%;
  267. height: 100%;
  268. display: flex;
  269. list-style: none;
  270. align-items: center;
  271. position: relative;
  272. right: 0;
  273. }
  274. .menus .subMenu .menu{
  275. font-size: 0.85em;
  276. color: #343434;
  277. }
  278. .header-main{
  279. height: 40px;
  280. display: flex;
  281. justify-content: space-between;
  282. }
  283. .header-main .main-menus{
  284. height: 100%;
  285. list-style: none;
  286. display: flex;
  287. align-items: flex-end;
  288. font-size: 1.15em;
  289. }
  290. .main-menus .main-menu{
  291. width: auto;
  292. height: auto;
  293. /*color: #1a1a1a;*/
  294. margin-left: 15px;
  295. cursor: pointer;
  296. position: relative;
  297. }
  298. .main-menus .main-menu:first-child{
  299. margin-left: 0px;
  300. }
  301. .main-menus .main-menu > a{
  302. display: block;
  303. padding: 3px 20px 3px 5px;
  304. }
  305. .main-menus .main-menu > a:hover{
  306. color: orangered;
  307. }
  308. .main-menus .main-menu > a::before{
  309. content: "";
  310. width: 0;
  311. margin: 0 auto;
  312. height: 2px;
  313. background-color: #1e45e7;
  314. transition: all 0.6s;
  315. position: absolute;
  316. bottom: 0;
  317. left: 50%;
  318. }
  319. .main-menus .main-menu > .now{
  320. width: 100%;
  321. height: 2px;
  322. background-color: #1e45e7;
  323. position: absolute;
  324. bottom: 0;
  325. left: 0;
  326. overflow: hidden;
  327. }
  328. .main-menus .main-menu > a:hover:before{
  329. width: 100%;
  330. left: 0;
  331. }
  332. .search-box{
  333. height: 100%;
  334. display: flex;
  335. /*border-radius: 50%;*/
  336. align-items: center;
  337. font-size: 0.9em;
  338. }
  339. .search-box .search{
  340. height: 26px;
  341. width: 100%;
  342. border-radius: 26px;
  343. border: 1px solid gray;
  344. display: flex;
  345. position: relative;
  346. margin-top: 8px;
  347. }
  348. .search-box .search > *{
  349. outline: none;
  350. }
  351. .search > input{
  352. display: block;
  353. width: 100%;
  354. height: 24px;
  355. border-radius: 24px;
  356. padding-left: 5px;
  357. padding-right: 15px;
  358. font-size: 0.85em;
  359. }
  360. .search > button{
  361. display: block;
  362. width: 24px;
  363. height: 24px;
  364. position: absolute;
  365. top: 0;
  366. right: 3px;
  367. }
  368. .search > button:hover{
  369. color: orange;
  370. }
  371. </style>