Map.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div>
  3. <div class="content type-zwdt" data-item="type-zwdt">
  4. <div class="content-title">
  5. <img src="images/title-zwdt.png" alt=""><span>政务地图</span>
  6. </div>
  7. <div class="content-content" style="background-color: white;">
  8. <iframe id="mainIframe" name="mainIframe" :src="url" scrolling="no" frameborder="no" border="0" marginwidth="0"
  9. marginheight="0" allowtransparency="yes" sandbox="allow-same-origin allow-scripts allow-forms"></iframe>
  10. </div>
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: "website",
  17. data() {
  18. return {
  19. url: 'https://data.cqna.gov.cn/district2/sy.html'
  20. }
  21. },
  22. methods: {
  23. goToMain() {
  24. this.$router.push("/");
  25. }
  26. },
  27. mounted() {
  28. //设置多少秒跳转
  29. var mtReturnTime = 120;
  30. //剩余秒数
  31. var myTime = 120;
  32. this.timer = setInterval(() => {
  33. myTime--;
  34. document.getElementById("secondText").innerHTML = "(" + myTime + ")";
  35. //0秒跳转目标页面
  36. if (myTime == 0) {
  37. this.$router.push("/");
  38. }
  39. }, 1000);
  40. //设置各类监听事件
  41. var body = document.querySelector('html');
  42. body.addEventListener("click", function () {
  43. myTime = mtReturnTime
  44. });
  45. body.addEventListener("keydown", function () {
  46. myTime = mtReturnTime
  47. });
  48. body.addEventListener("mousemove", function () {
  49. myTime = mtReturnTime
  50. });
  51. body.addEventListener("mousewheel", function () {
  52. myTime = mtReturnTime
  53. });
  54. document.addEventListener("scroll", function () {
  55. myTime = mtReturnTime
  56. });
  57. },
  58. //页面关闭销毁定时器
  59. beforeDestroy() {
  60. clearInterval(this.timer);
  61. this.timer = null;
  62. }
  63. }
  64. </script>
  65. <style scoped>
  66. #mainIframe {
  67. width: 100%;
  68. height: 100%;
  69. border: 0.0625rem solid #B3D4FF;
  70. border-radius: 1.25rem;
  71. }
  72. </style>