header.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <div class="nav" @click.stop>
  3. <div class="nav-content">
  4. <router-link :to="{name: 'home'}" class="logo" ><img width="128" height="37" src="http://video.cgaii.com/new4dage/images/images/logo_en.svg" @click="showMenu = false"></router-link>
  5. <div class="menu" :style="[{height: height}, style]" ref="menu">
  6. <Menu v-for="(menu,i) in menus"
  7. :link="menu.link"
  8. :key="i"
  9. :text="menu.text"
  10. :childs="menu.childs"
  11. :show="menu.show"
  12. class="menu-item"
  13. @open=" open(menu)"
  14. @hide="hide(menu)"
  15. @change="change(menu)"
  16. @tolink="showMenu = false">
  17. </Menu>
  18. <div class="head-info">
  19. <a class="number">400<span>-</span>6698<span>-</span>025</a><div class="language"
  20. :class="{pc: !isMobile}"
  21. @mouseenter="langShow = true"
  22. @mouseleave="langShow = false">
  23. <Menu
  24. v-if="!isMobile"
  25. :link="'#'"
  26. :text="langMap[language - 1]"
  27. :childs="[
  28. {link: '#', lang: '/cn/', text: '简体中文'},
  29. {link: '#', lang: '/en/', text: 'English'},
  30. {link: '#', lang: '/de/', text: 'Deutsch'}
  31. ]"
  32. :show="langShow"
  33. class="menu-item"
  34. @checkItem="changeLange">
  35. </Menu>
  36. <template v-else>
  37. <span @click="urlrep('/cn/')">简体中文</span> |
  38. <span @click="urlrep('/en/')">English</span> |
  39. <span @click="urlrep('/de/')">Deutsch</span>
  40. </template>
  41. </div>
  42. </div>
  43. </div>
  44. <button class="ctl" @click="changeState">
  45. <span></span><span></span><span></span>
  46. </button>
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. import Menu from '@/components/menu'
  52. import browser from '@/util/browser'
  53. export default {
  54. name: 'navigation',
  55. data () {
  56. return {
  57. langMap: ['中文简体', 'English', 'Deutsch'],
  58. language: global.language,
  59. langShow: false,
  60. menus: [
  61. {
  62. link: '/product',
  63. text: ' Products',
  64. show: false,
  65. childs: [
  66. {link: '/product?id=swkk', text: '4DKanKan'},
  67. {link: '/product?id=swmk', text: '4DModel'},
  68. {link: '/product?id=swys', text: '4DArt'},
  69. {link: '/product?id=swkz', text: '4DMuseum'},
  70. {link: '/product?id=wwq', text: '4DWall'},
  71. {link: '/product?id=swar', text: '4DAR'}
  72. ]
  73. },
  74. {
  75. link: '/planculture',
  76. text: 'Solutions',
  77. show: false,
  78. childs: [
  79. {link: '/planculture', text: 'Digital Museum'},
  80. {link: '/planlife', text: 'Digital Life'},
  81. {link: '/planindustry', text: 'Digital Industry'}
  82. ]
  83. },
  84. {
  85. link: '/technology',
  86. text: 'Technologies',
  87. show: false,
  88. childs: [
  89. {link: '/technology?id=szjm', text: 'Automatic 3D Digital Reconstruction'},
  90. {link: '/technology?id=jqsj', text: 'High-precision Machine Vision'},
  91. {link: '/technology?id=slam', text: 'Simultaneous Localization and Mapping'},
  92. {link: '/technology?id=sjjs', text: 'Computer Vision'}
  93. ]
  94. },
  95. {
  96. link: '/case/文博',
  97. text: '3D Showcase',
  98. show: false,
  99. childs: [
  100. {link: {name: 'case_details', params: {id: '文博'}}, text: 'Museum '},
  101. {link: {name: 'case_details', params: {id: '政务'}}, text: 'Administration '},
  102. {link: {name: 'case_details', params: {id: '电商'}}, text: ' E-Commerce'},
  103. {link: {name: 'case_details', params: {id: '工业'}}, text: 'Industry '},
  104. {link: {name: 'case_details', params: {id: '地产'}}, text: 'Real Estate'},
  105. {link: {name: 'case_details', params: {id: '文物'}}, text: ' Cultural Relic'}
  106. ]
  107. },
  108. {
  109. link: '/information/news',
  110. text: 'News',
  111. show: false,
  112. childs: [
  113. {link: '/information/news', text: 'news'},
  114. {link: '/information/media', text: 'media library'}
  115. // ,
  116. // {link: '/information/code', text: 'Social media'}
  117. ]
  118. },
  119. {
  120. link: '/about',
  121. text: 'About Us',
  122. show: false,
  123. childs: [
  124. {link: '/about?id=qyjj', text: 'Overview'},
  125. {link: '/about?id=jrwm', text: 'Job Search'}
  126. ]
  127. }
  128. ],
  129. showMenu: false,
  130. height: 0,
  131. mxHeight: null,
  132. isMobile: browser.mobile
  133. }
  134. },
  135. methods: {
  136. changeLange (item) {
  137. this.urlrep(item.lang)
  138. },
  139. urlrep (lg) {
  140. location.pathname = lg
  141. },
  142. open (menu) {
  143. this.menus.forEach(m => {
  144. m.show = false
  145. })
  146. menu.show = true
  147. },
  148. hide (menu) {
  149. menu.show = false
  150. },
  151. change (menu) {
  152. menu.show ? this.hide(menu) : this.open(menu)
  153. },
  154. over (menu) {
  155. menu.active = true
  156. },
  157. out (menu) {
  158. menu.active = false
  159. },
  160. changeState () {
  161. if (!this.menuHeight) {
  162. this.$refs.menu.style.visibility = 'hidden'
  163. this.$refs.menu.style.height = 'auto'
  164. this.menuHeight = this.$refs.menu.offsetHeight
  165. this.$refs.menu.style.visibility = ''
  166. this.$refs.menu.style.height = '0'
  167. }
  168. this.showMenu = !this.showMenu
  169. },
  170. sizeHandle () {
  171. if (window.innerWidth < 1230) {
  172. this.mxHeight = window.innerHeight - 65
  173. } else {
  174. this.mxHeight = 0
  175. }
  176. }
  177. },
  178. watch: {
  179. showMenu () {
  180. this.height = !this.showMenu ? '0' : this.menuHeight + 'px'
  181. this.showMenu && setTimeout(() => {
  182. this.height = 'auto'
  183. }, 300)
  184. }
  185. },
  186. computed: {
  187. style () {
  188. if (this.mxHeight) {
  189. return {
  190. maxHeight: this.mxHeight + 'px',
  191. overflowY: 'scroll'
  192. }
  193. } else {
  194. return {
  195. overflowY: 'inherit',
  196. maxHeight: 'auto'
  197. }
  198. }
  199. }
  200. },
  201. mounted () {
  202. document.documentElement.addEventListener('click', () => {
  203. this.showMenu = false
  204. })
  205. if (this.isMobile) {
  206. this.mxHeight = window.innerHeight - 65
  207. } else {
  208. this.sizeHandle = this.sizeHandle.bind(this)
  209. this.sizeHandle()
  210. this.$bus.$on('resize', this.sizeHandle)
  211. }
  212. },
  213. beforeDestroy () {
  214. this.$bus.$off('resize', this.sizeHandle)
  215. },
  216. components: { Menu }
  217. }
  218. </script>
  219. <style scoped type="text/css">
  220. .nav {
  221. background-color: #292929;
  222. box-shadow: 0 0 20px rgba(0,0,0,0.7);
  223. position: relative;
  224. padding: 0 20px;
  225. color: #fff;
  226. font-size: 16px;
  227. font-weight: 400;
  228. box-sizing: border-box;
  229. transition: all linear .3s;
  230. }
  231. .nav::after {
  232. content: '';
  233. display: block;
  234. clear: both;
  235. }
  236. .nav-content {
  237. max-width: 1400px;
  238. margin: 0 auto;
  239. }
  240. .ctl {
  241. float: right;
  242. border: 1px solid #fff;
  243. padding: 6px;
  244. background-color: transparent;
  245. width: 40px;
  246. overflow: hidden;
  247. margin: 18px 0;
  248. }
  249. .ctl span {
  250. background-color: #888;
  251. width: 100%;
  252. height: 2px;
  253. border-radius: 1px;
  254. float: left;
  255. }
  256. .ctl span:nth-child(2) {
  257. margin: 4px 0;
  258. }
  259. .logo {
  260. float: left;
  261. padding: 13px 0;
  262. }
  263. .menu {
  264. display: block;
  265. position: absolute;
  266. top: 100%;
  267. left: 0;
  268. width: 100%;
  269. background-color: #292929;
  270. height: 0;
  271. transition: height ease-in-out .3s;
  272. overflow-y: scroll;
  273. }
  274. .menu .menu-item {
  275. text-decoration: none;
  276. padding: 0 24px;
  277. display: block;
  278. }
  279. .language span {
  280. transition: color .3s linear;
  281. }
  282. .language span:hover {
  283. color: #18ade9;
  284. }
  285. .language {
  286. vertical-align: middle;
  287. margin-left: 0;
  288. padding: 24px 0 24px 30px;
  289. display: block;
  290. }
  291. .number {
  292. vertical-align: middle;
  293. padding: 20px;
  294. position: relative;
  295. margin-left: 30px;
  296. padding-left: 30px;
  297. display: inline-block;
  298. }
  299. .number::before {
  300. position: absolute;
  301. content: '';
  302. width: 20px;
  303. height: 20px;
  304. background: url('http://video.cgaii.com/new4dage/images/images/phone.png') no-repeat left top;
  305. left: 0;
  306. top: 17px;
  307. }
  308. .number span {
  309. display: inline-block;
  310. transform: translateY(-2px)
  311. }
  312. .head-info {
  313. display: inline-block;
  314. }
  315. .language.pc {
  316. padding: 0 !important
  317. }
  318. @media screen and (min-width: 1230px) {
  319. .nav {
  320. text-align: right;
  321. }
  322. .ctl {
  323. display: none;
  324. }
  325. .menu {
  326. position: static;
  327. margin: 0;
  328. width: auto;
  329. display: inline-block;
  330. background: none;
  331. height: auto !important;
  332. overflow: inherit;
  333. }
  334. .menu .menu-item {
  335. height: 100%;
  336. padding: 24px 20px;
  337. display: inline-block;
  338. }
  339. .language {
  340. display: inline-block;
  341. }
  342. .number {
  343. display: inline-block;
  344. padding: 0;
  345. padding: 24px 0 24px 30px;
  346. }
  347. .number::before {
  348. top: 22px;
  349. }
  350. }
  351. @media screen and (min-width: 1400px) {
  352. .menu .menu-item {
  353. padding: 24px 40px;
  354. }
  355. }
  356. @media screen and (min-width: 1660px) {
  357. .nav {
  358. padding: 0 150px;
  359. }
  360. }
  361. </style>