routerItem.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <template>
  2. <div>
  3. <div class="heard">
  4. <HeaderItem :selectShow="selectShow"></HeaderItem>
  5. <!-- <button id="change" @click="click">中英文切换</button>
  6. <div>{{ $t('common.home')}}</div> -->
  7. <tabers ref="child2Container"></tabers>
  8. </div>
  9. <router-view></router-view>
  10. <div style="clear: both"></div>
  11. <div style="width: 100%">
  12. <footers style="width: 100%"></footers>
  13. </div>
  14. <div
  15. style="
  16. position: fixed;
  17. left: 50%;
  18. top: 50%;
  19. transform: translate(610px, -50%);
  20. width: 70px;
  21. background: #fff;
  22. box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.5);
  23. "
  24. >
  25. <div
  26. style="
  27. width: 70px;
  28. height: 70px;
  29. background: #2a548c;
  30. text-align: center;
  31. font-size: 12px;
  32. color: #fff;
  33. "
  34. @click="toView('customerService')"
  35. >
  36. <img
  37. src="@/assets/img/home/footer/customerServiceexport@2x.png"
  38. alt=""
  39. style="width: 30px; margin-top: 10px"
  40. />
  41. <div>{{ $t('common.Online') }}</div>
  42. </div>
  43. <div
  44. style="
  45. width: 70px;
  46. height: 70px;
  47. text-align: center;
  48. font-size: 12px;
  49. color: #666;
  50. border-bottom: 1px solid rgba(241, 241, 241, 1);
  51. cursor: pointer;
  52. "
  53. @mouseover="mouseOver"
  54. @mouseleave="mouseLeave"
  55. >
  56. <img
  57. src="@/assets/img/home/footer/QRcodeexport@2x.png"
  58. alt=""
  59. style="width: 30px; margin-top: 10px"
  60. />
  61. <div>{{ $i18n.locale == 'zh' ? '手机网页版' : 'Mobile Web' }}</div>
  62. </div>
  63. <div
  64. ref="QRCode"
  65. id="qrcode"
  66. style="
  67. position: absolute;
  68. transform: translate(-120%, -50%);
  69. display: none;
  70. "
  71. ></div>
  72. <div
  73. style="
  74. width: 70px;
  75. height: 70px;
  76. text-align: center;
  77. font-size: 12px;
  78. color: #666;
  79. border-bottom: 1px solid rgba(241, 241, 241, 1);
  80. cursor: pointer;
  81. "
  82. @click="ShareChange"
  83. >
  84. <img
  85. src="@/assets/img/home/footer/rectangle@2x.png"
  86. alt=""
  87. style="width: 30px; margin-top: 10px"
  88. />
  89. <div>{{ $t('common.Share') }}</div>
  90. </div>
  91. <div
  92. style="position: absolute; transform: translate(90%, -90%)"
  93. v-show="ShareNum"
  94. >
  95. <!-- <vshare></vshare> -->
  96. <share style="width: 84px" :config="vshareConfig"></share>
  97. </div>
  98. <div
  99. style="
  100. width: 70px;
  101. height: 70px;
  102. text-align: center;
  103. font-size: 12px;
  104. color: #666;
  105. border-bottom: 1px solid rgba(241, 241, 241, 1);
  106. cursor: pointer;
  107. "
  108. @click="toView('appDownload')"
  109. >
  110. <img
  111. src="@/assets/img/home/footer/app.png"
  112. alt=""
  113. style="width: 30px; margin-top: 10px"
  114. />
  115. <div>{{ $t('common.appDownload') }}</div>
  116. </div>
  117. <div
  118. style="
  119. width: 70px;
  120. height: 70px;
  121. text-align: center;
  122. font-size: 12px;
  123. color: #666;
  124. border-bottom: 1px solid rgba(241, 241, 241, 1);
  125. cursor: pointer;
  126. "
  127. @click="toView('home')"
  128. >
  129. <img
  130. src="@/assets/img/home/footer/home@2x.png"
  131. alt=""
  132. style="width: 30px; margin-top: 10px"
  133. />
  134. <div>{{ $t('common.Home') }}</div>
  135. </div>
  136. <div
  137. class="cursor"
  138. style="
  139. width: 70px;
  140. height: 70px;
  141. text-align: center;
  142. display: none;
  143. font-size: 12px;
  144. color: #666;
  145. border-bottom: 1px solid rgba(241, 241, 241, 1);
  146. "
  147. @click="toUp"
  148. id="toUp"
  149. >
  150. <img
  151. src="@/assets/img/home/footer/BackTopexport@2x.png"
  152. alt=""
  153. style="width: 30px; margin-top: 10px"
  154. />
  155. <div>{{ $t('common.Top') }}</div>
  156. </div>
  157. </div>
  158. </div>
  159. </template>
  160. <script>
  161. import Cookies from 'js-cookie' //引入cookie操作依赖
  162. import Bus from '@/api/bus' //注意引入
  163. import HeaderItem from '@/components/headerItem'
  164. import tabers from '@/components/taber'
  165. import footers from '@/components/footers'
  166. import Enterprise from '@/views/enterprise/Enterprise'
  167. import QRCode from 'qrcodejs2'
  168. import vshare from 'vshare'
  169. import Share from 'vue-social-share'
  170. export default {
  171. name: 'routerItem',
  172. components: { tabers, HeaderItem, footers, Enterprise, vshare, Share },
  173. data() {
  174. return {
  175. routerView: 'Enterprise',
  176. ShareNum: false,
  177. selectShow: true,
  178. vshareConfig: {
  179. shareList: [
  180. // 此处放分享列表(ID)
  181. 'weixin',
  182. ],
  183. common: {
  184. //此处放置通用设置
  185. bdUrl: window.location.href,
  186. },
  187. share: [
  188. {
  189. //此处放置分享按钮设置
  190. },
  191. ],
  192. url: window.location.href.replace('#/', ''), // 网址,默认使用
  193. sites: ['wechat'],
  194. wechatQrcodeTitle: '',
  195. wechatQrcodeHelper: '<p>https://www.geidcp.com</p>',
  196. image: [
  197. //此处放置图片分享设置
  198. ],
  199. selectShare: [
  200. //此处放置划词分享设置
  201. ],
  202. },
  203. // id:this.$router.params.key,
  204. }
  205. },
  206. destroyed() {
  207. window.removeEventListener('scroll', this.scrollToTop)
  208. },
  209. watch: {
  210. '$route.path'() {
  211. let path = this.$route.path.substr(1)
  212. this.$store.commit('modify', path)
  213. window.localStorage.setItem('router', path)
  214. },
  215. $route(to, from) {
  216. // alert(to.path, form)
  217. if (to.path == '/WholeStationSearch') {
  218. this.selectShow = false
  219. } else {
  220. this.selectShow = true
  221. }
  222. },
  223. '$i18n.locale'() {
  224. this.qrcode()
  225. },
  226. },
  227. mounted() {
  228. if (window._bd_share_main) {
  229. window._bd_share_main.init()
  230. }
  231. let path = this.$route.path.substr(1)
  232. this.$store.commit('modify', path)
  233. window.localStorage.setItem('router', path)
  234. window.addEventListener('scroll', this.showbtn, true)
  235. // if(window.localStorage.getItem("router")){
  236. // this.$store.commit('modify', localStorage.getItem("routerItem")?localStorage.getItem("routerItem"):localStorage.getItem("router"));
  237. // }
  238. let router = null
  239. Bus.$on('title', (val) => {
  240. if (val.router) {
  241. router = val.router
  242. }
  243. })
  244. // if(Cookies.get('login')){
  245. // window.sessionStorage.setItem('token','res.data.token');
  246. // }else {
  247. // window.sessionStorage.removeItem('token');
  248. // }
  249. // if( window.sessionStorage.setItem('token')){
  250. // Cookies.get('login','login');
  251. // }else {
  252. // // window.sessionStorage.removeItem('token');
  253. // Cookies.remove('login');
  254. // }
  255. if (this.$route.query.key && this.$route.query.key.length > 0) {
  256. let query = this.$route.query
  257. this.$router.replace({
  258. name: router ? router : this.$store.state.router,
  259. query: {
  260. ...query,
  261. },
  262. })
  263. } else {
  264. this.$router.replace({ name: this.$store.state.router })
  265. }
  266. // var sUserAgent = navigator.userAgent;
  267. // if (sUserAgent.indexOf('Android') > -1 || sUserAgent.indexOf('iPhone') > -1 || sUserAgent.indexOf('iPad') > -1 || sUserAgent.indexOf('iPod') > -1 || sUserAgent.indexOf('Symbian') > -1) {
  268. // this.$route.push('http://baidu.com');
  269. // } else {
  270. // }
  271. },
  272. methods: {
  273. qrcode() {
  274. document.getElementById('qrcode').innerHTML = ''
  275. this.url = window.location.href
  276. const that = this
  277. let qrcode = new QRCode('qrcode', {
  278. width: 132,
  279. height: 132,
  280. text: 'https://m.geidcp.com/#/?language=' + that.$i18n.locale, // 二维码地址
  281. })
  282. },
  283. ShareChange() {
  284. this.ShareNum = !this.ShareNum
  285. },
  286. save() {
  287. this.$refs.child2Container.getSave()
  288. },
  289. mouseOver() {
  290. // this.$refs['QRCode'][0].style.display='block';
  291. this.qrcode()
  292. this.ShareNum = false
  293. this.$refs['QRCode'].style.display = 'block'
  294. },
  295. mouseLeave() {
  296. this.$refs['QRCode'].style.display = 'none'
  297. },
  298. showbtn() {
  299. let topBtn = document.getElementById('toUp')
  300. let scrollTop =
  301. window.pageYOffset ||
  302. document.documentElement.scrollTop ||
  303. document.body.scrollTop
  304. let browserHeight = window.outerHeight
  305. if (scrollTop > 400) {
  306. if (topBtn !== null) {
  307. topBtn.style.display = 'block'
  308. }
  309. } else {
  310. if (topBtn !== null) {
  311. topBtn.style.display = 'none'
  312. }
  313. }
  314. },
  315. // 返回顶部
  316. toUp() {
  317. // window.scrollTo(0,0);
  318. var timer = setInterval(function () {
  319. let osTop =
  320. document.documentElement.scrollTop || document.body.scrollTop
  321. let ispeed = Math.floor(-osTop / 5)
  322. document.documentElement.scrollTop = document.body.scrollTop =
  323. osTop + ispeed
  324. this.isTop = true
  325. if (osTop === 0) {
  326. clearInterval(timer)
  327. }
  328. }, 30)
  329. },
  330. toView(router, json) {
  331. this.$router.push({ name: router, query: { key: json } })
  332. },
  333. },
  334. }
  335. </script>
  336. <style scoped>
  337. .heard {
  338. height: 230px;
  339. margin: auto;
  340. width: 100%;
  341. background: url('../assets/img/home/banner2.jpg');
  342. background-size: 100% 230px;
  343. /* z-index: 99; */
  344. animation: panoramic 10s linear infinite;
  345. -moz-animation: panoramic 10s linear infinite;
  346. -o-animation: panoramic 10s linear infinite;
  347. }
  348. .heard:hover {
  349. animation-play-state: paused;
  350. }
  351. @-webkit-keyframes panoramic {
  352. 0% {
  353. background-position: 0 0;
  354. }
  355. 12% {
  356. background-position: 60% 10px;
  357. }
  358. 25% {
  359. background-position: 120% 20px;
  360. }
  361. 38% {
  362. background-position: 60% 10px;
  363. }
  364. 50% {
  365. background-position: 0 0;
  366. }
  367. 62% {
  368. background-position: -60% -10px;
  369. }
  370. 75% {
  371. background-position: -120% -20px;
  372. }
  373. 88% {
  374. background-position: -60% -10px;
  375. }
  376. 100% {
  377. background-position: 0 0;
  378. }
  379. }
  380. @-moz-keyframes panoramic {
  381. 0% {
  382. background-position: 0 0;
  383. }
  384. 12% {
  385. background-position: 60% 10px;
  386. }
  387. 25% {
  388. background-position: 120% 20px;
  389. }
  390. 38% {
  391. background-position: 60% 10px;
  392. }
  393. 50% {
  394. background-position: 0 0;
  395. }
  396. 62% {
  397. background-position: -60% -10px;
  398. }
  399. 75% {
  400. background-position: -120% -20px;
  401. }
  402. 88% {
  403. background-position: -60% -10px;
  404. }
  405. 100% {
  406. background-position: 0 0;
  407. }
  408. }
  409. @-o-keyframes panoramic {
  410. 0% {
  411. background-position: 0 0;
  412. }
  413. 12% {
  414. background-position: 60% 10px;
  415. }
  416. 25% {
  417. background-position: 120% 20px;
  418. }
  419. 38% {
  420. background-position: 60% 10px;
  421. }
  422. 50% {
  423. background-position: 0 0;
  424. }
  425. 62% {
  426. background-position: -60% -10px;
  427. }
  428. 75% {
  429. background-position: -120% -20px;
  430. }
  431. 88% {
  432. background-position: -60% -10px;
  433. }
  434. 100% {
  435. background-position: 0 0;
  436. }
  437. }
  438. @keyframes panoramic {
  439. 0% {
  440. background-position: 0 0;
  441. }
  442. 12% {
  443. background-position: 60% 10px;
  444. }
  445. 25% {
  446. background-position: 120% 20px;
  447. }
  448. 38% {
  449. background-position: 60% 10px;
  450. }
  451. 50% {
  452. background-position: 0 0;
  453. }
  454. 62% {
  455. background-position: -60% -10px;
  456. }
  457. 75% {
  458. background-position: -120% -20px;
  459. }
  460. 88% {
  461. background-position: -60% -10px;
  462. }
  463. 100% {
  464. background-position: 0 0;
  465. }
  466. }
  467. /* @keyframes panoramic {
  468. to {
  469. background-position: 100% 50px;
  470. }
  471. } */
  472. </style>