App.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div id="app" :style="style">
  3. <router-view />
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: "App",
  9. data() {
  10. return {
  11. width: 0,
  12. height: 0,
  13. };
  14. },
  15. computed: {
  16. style() {
  17. return {
  18. width: this.width ? this.width + "px" : "100%",
  19. minHeight: this.height ? this.height + "px" : "auto",
  20. };
  21. },
  22. },
  23. created() {
  24. // const width = this.getQueryParam("width") || null;
  25. // const height = this.getQueryParam("height") || null;
  26. // const apiToken = this.getQueryParam("apiToken") || null;
  27. // const userId = this.getQueryParam("userId") || null;
  28. // console.log("query=>>", this.$route.query)
  29. const { width, height, apiToken, userId } = this.$route.query;
  30. // console.log("apiToken", apiToken);
  31. // console.log("userId=>>", userId)
  32. if (userId) {
  33. this.$store.commit("SET_APP_VERSION", {
  34. type: "userId",
  35. value: userId,
  36. });
  37. // localStorage.setItem("apiToken", apiToken);
  38. }
  39. if (apiToken) {
  40. this.$store.commit("SET_APP_VERSION", {
  41. type: "apiToken",
  42. value: apiToken,
  43. });
  44. localStorage.setItem("apiToken", apiToken);
  45. }
  46. if (height) {
  47. this.$store.commit("SET_APP_VERSION", {
  48. type: "height",
  49. value: height,
  50. });
  51. this.height = height;
  52. }
  53. if (width) {
  54. this.$store.commit("SET_APP_VERSION", {
  55. type: "width",
  56. value: width,
  57. });
  58. this.width = width;
  59. }
  60. },
  61. // watch: {
  62. // $route(to, from) {
  63. // // console.log("this.$route.query==>", this.$route.query);
  64. // // this.width = this.$store.state.width;
  65. // // this.height = this.$store.state.height;
  66. // console.log("from==>", from);
  67. // console.log("to==>", to);
  68. // console.log("this.$route==>", this.$route);
  69. // if (to) {
  70. // this.$nextTick(() => {
  71. // this.$router.removeRoute(from.name);
  72. // });
  73. // }
  74. // },
  75. // },
  76. methods: {
  77. getQueryParam(paramName) {
  78. const urlParams = new URLSearchParams(window.location.search);
  79. return urlParams.get(paramName);
  80. },
  81. },
  82. beforeDestroy() {
  83. this.$store.dispatch("disconnect");
  84. },
  85. };
  86. </script>
  87. <style>
  88. body {
  89. display: block;
  90. margin: 0 !important;
  91. }
  92. #app {
  93. /* font-family: Avenir, Helvetica, Arial, sans-serif;
  94. -webkit-font-smoothing: antialiased;
  95. -moz-osx-font-smoothing: grayscale;
  96. text-align: center;
  97. color: #2c3e50; */
  98. /* background-color: red;
  99. box-sizing: border-box; */
  100. }
  101. .el-message {
  102. min-width: auto !important;
  103. background-color: rgba(88, 88, 88, 1) !important;
  104. color: #fff !important;
  105. border: none !important;
  106. }
  107. .el-message__content {
  108. color: #fff !important;
  109. }
  110. .el-message .el-message__icon {
  111. display: none !important;
  112. }
  113. </style>