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. />
  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",
  115. text: "产品中心",
  116. isSub: true,
  117. subKey: "product",
  118. showSub: false
  119. },
  120. {
  121. key: "solution",
  122. path: "/solution",
  123. text: "解决方案",
  124. isSub: true,
  125. subKey: "solution",
  126. showSub: false
  127. },
  128. {
  129. key: "new",
  130. path: "/new",
  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",
  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. getLangPathStr(pathStr){
  163. return langMap.getLangPathStr(this.lang,pathStr)
  164. },
  165. switchLangClickHandle(){
  166. this.$root.$emit('changeLang');
  167. },
  168. searchItem(){
  169. },
  170. showSubMenu(item){
  171. // console.log("0000000")
  172. if(item.isSub){
  173. // 清除隐藏定时器
  174. if(this.hideTimer){
  175. clearTimeout(this.hideTimer);
  176. this.hideTimer = null;
  177. }
  178. if(this.nowSub !== item.key){
  179. // 不同key切换
  180. let oldItem = this.mainMenus.find(val => val.key === this.nowSub);
  181. console.log(oldItem)
  182. if(oldItem){
  183. this.hideSubMenu(oldItem);
  184. }
  185. }
  186. item.showSub = true;
  187. this.nowSub = item.key;
  188. }
  189. },
  190. startHideSubMenu(item){
  191. this.hideTimer = setTimeout(()=>{
  192. this.hideSubMenu(item);
  193. },700)
  194. },
  195. hideSubMenu(item){
  196. item.showSub = false;
  197. this.nowSub = "";
  198. if(this.hideTimer){
  199. clearTimeout(this.hideTimer);
  200. this.hideTimer = null;
  201. }
  202. }
  203. }
  204. }
  205. </script>
  206. <style scoped>
  207. .header{
  208. backdrop-filter: blur(5px);
  209. box-shadow: 0px 2px 6px 0px rgb(0 0 0 / 20%) ;
  210. /*text-shadow: 0 0 5px skyblue;*/
  211. }
  212. .header-content {
  213. display: flex;
  214. height: 70px;
  215. }
  216. .header-content > .logo{
  217. display: block;
  218. width: 260px;
  219. height: 70px;
  220. margin-top: 7.5px;
  221. }
  222. .header-content > .logo img{
  223. display: block;
  224. width: auto;
  225. height: 65px;
  226. }
  227. .header-content .right-header{
  228. width: 1060px;
  229. height: 100%;
  230. margin-left: 11px;
  231. position: relative;
  232. top: -35px;
  233. }
  234. .right-header .top{
  235. margin-top: 35px;
  236. height: 63px;
  237. }
  238. .right-header .top img{
  239. display: block;
  240. width: 253px;
  241. height: 63px;
  242. }
  243. .menus{
  244. height: 40px;
  245. position: relative;
  246. display: flex;
  247. flex-direction: column;
  248. align-items: flex-end;
  249. margin-top: -28px;
  250. }
  251. .menus .top-menu{
  252. width: auto;
  253. height: 30px;
  254. right: 0;
  255. top: -30px;
  256. position: absolute;
  257. }
  258. .menus .menu{
  259. padding: 0 8px;
  260. list-style: none;
  261. cursor: pointer;
  262. color: #16a0d7;
  263. font-size: 1.1em;
  264. }
  265. .menus .menu:hover{
  266. color: skyblue !important;
  267. }
  268. .menus .subMenu{
  269. max-width: 90%;
  270. height: 100%;
  271. display: flex;
  272. list-style: none;
  273. align-items: center;
  274. position: relative;
  275. right: 0;
  276. }
  277. .menus .subMenu .menu{
  278. font-size: 0.85em;
  279. color: #343434;
  280. }
  281. .header-main{
  282. height: 40px;
  283. display: flex;
  284. justify-content: space-between;
  285. }
  286. .header-main .main-menus{
  287. height: 100%;
  288. list-style: none;
  289. display: flex;
  290. align-items: flex-end;
  291. font-size: 1.15em;
  292. }
  293. .main-menus .main-menu{
  294. width: auto;
  295. height: auto;
  296. /*color: #1a1a1a;*/
  297. margin-left: 15px;
  298. cursor: pointer;
  299. position: relative;
  300. }
  301. .main-menus .main-menu:first-child{
  302. margin-left: 0px;
  303. }
  304. .main-menus .main-menu > a{
  305. display: block;
  306. padding: 3px 20px 3px 5px;
  307. }
  308. .main-menus .main-menu > a:hover{
  309. color: orangered;
  310. }
  311. .main-menus .main-menu > a::before{
  312. content: "";
  313. width: 0;
  314. margin: 0 auto;
  315. height: 2px;
  316. background-color: #1e45e7;
  317. transition: all 0.6s;
  318. position: absolute;
  319. bottom: 0;
  320. left: 50%;
  321. }
  322. .main-menus .main-menu > .now{
  323. width: 100%;
  324. height: 2px;
  325. background-color: #1e45e7;
  326. position: absolute;
  327. bottom: 0;
  328. left: 0;
  329. overflow: hidden;
  330. }
  331. .main-menus .main-menu > a:hover:before{
  332. width: 100%;
  333. left: 0;
  334. }
  335. .search-box{
  336. height: 100%;
  337. display: flex;
  338. /*border-radius: 50%;*/
  339. align-items: center;
  340. font-size: 0.9em;
  341. }
  342. .search-box .search{
  343. height: 26px;
  344. width: 100%;
  345. border-radius: 26px;
  346. border: 1px solid gray;
  347. display: flex;
  348. position: relative;
  349. margin-top: 8px;
  350. }
  351. .search-box .search > *{
  352. outline: none;
  353. }
  354. .search > input{
  355. display: block;
  356. width: 100%;
  357. height: 24px;
  358. border-radius: 24px;
  359. padding-left: 5px;
  360. padding-right: 15px;
  361. font-size: 0.85em;
  362. }
  363. .search > button{
  364. display: block;
  365. width: 24px;
  366. height: 24px;
  367. position: absolute;
  368. top: 0;
  369. right: 3px;
  370. }
  371. .search > button:hover{
  372. color: orange;
  373. }
  374. </style>