lucencyHeader.vue 7.9 KB

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