index.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import Vue from "vue";
  2. import browser from "@/utils/browser";
  3. import { u_extend } from "@/utils";
  4. import { $showTips, $showLoading, $hideLoading } from "@/components/popupLayout";
  5. import { $showBirdView, $hideBirdView } from "@/components/bird_view/build.js";
  6. import { $showOrientationtip, $hideOrientationtip } from "@/components/orientationtip/build.js";
  7. Vue.prototype.$bus = new Vue();
  8. import clickoutside from "./v-clickoutside";
  9. import clickwindow from "./v-clickwindow";
  10. import pagination from "@/components/pagination";
  11. import { region } from "@/data/raw";
  12. window.g_lock = false;
  13. let hotUrl = "//super.4dage.com/";
  14. // let hotUrl = '//wangzhan.cctv.com/wlwm2022/'
  15. Vue.mixin({
  16. data() {
  17. return {
  18. isMobile: browser.mobile,
  19. isiPad: browser.iPad,
  20. themes: region,
  21. g_isLandscape: window.orientation === 90 || window.orientation === -90,
  22. };
  23. },
  24. computed: {
  25. theme() {
  26. return this.$route.params.type;
  27. }
  28. },
  29. mounted() {
  30. if (this.isMobile||this.isiPad) {
  31. // window.orientation:获取屏幕旋转方向
  32. window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", ()=> {
  33. // 正常方向或屏幕旋转180度
  34. if (window.orientation === 180 || window.orientation === 0) {
  35. this.g_isLandscape = false;
  36. }
  37. // 屏幕顺时钟旋转90度或屏幕逆时针旋转90度
  38. if (window.orientation === 90 || window.orientation === -90) {
  39. this.g_isLandscape = true;
  40. this.$bus.$emit("isShowHuDong", false)
  41. }
  42. });
  43. }
  44. },
  45. components: {
  46. pagination,
  47. },
  48. directives: {
  49. clickoutside: clickoutside,
  50. clickwindow: clickwindow,
  51. },
  52. methods: {
  53. $showTips,
  54. $showLoading,
  55. $hideLoading,
  56. $showBirdView,
  57. $hideBirdView,
  58. $showOrientationtip,
  59. $hideOrientationtip,
  60. u_extend,
  61. g_fixUrl(url) {
  62. return url.replace("https://super.4dage.com/", hotUrl);
  63. },
  64. handleContent(content, fontsize = 16) {
  65. if (!content) {
  66. return "";
  67. }
  68. console.log(1111);
  69. var reg = new RegExp(" {4}", "g"); //g就是代表全部
  70. return content.replace(reg, `<span style="display:inline-block;width:${fontsize * 2}px;"></span>`);
  71. },
  72. },
  73. });