123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <template>
- <div id="app" :style="style">
- <router-view />
- </div>
- </template>
- <script>
- export default {
- name: "App",
- data() {
- return {
- width: 0,
- height: 0,
- };
- },
- computed: {
- style() {
- return {
- width: this.width ? this.width + "px" : "100%",
- minHeight: this.height ? this.height + "px" : "auto",
- };
- },
- },
- created() {
- // const width = this.getQueryParam("width") || null;
- // const height = this.getQueryParam("height") || null;
- // const apiToken = this.getQueryParam("apiToken") || null;
- // const userId = this.getQueryParam("userId") || null;
- // console.log("query=>>", this.$route.query)
- const { width, height, apiToken, userId } = this.$route.query;
- // console.log("apiToken", apiToken);
- // console.log("userId=>>", userId)
- if (userId) {
- this.$store.commit("SET_APP_VERSION", {
- type: "userId",
- value: userId,
- });
- // localStorage.setItem("apiToken", apiToken);
- }
- if (apiToken) {
- this.$store.commit("SET_APP_VERSION", {
- type: "apiToken",
- value: apiToken,
- });
- localStorage.setItem("apiToken", apiToken);
- }
- if (height) {
- this.$store.commit("SET_APP_VERSION", {
- type: "height",
- value: height,
- });
- this.height = height;
- }
- if (width) {
- this.$store.commit("SET_APP_VERSION", {
- type: "width",
- value: width,
- });
- this.width = width;
- }
- },
- // watch: {
- // $route(to, from) {
- // // console.log("this.$route.query==>", this.$route.query);
- // // this.width = this.$store.state.width;
- // // this.height = this.$store.state.height;
- // console.log("from==>", from);
- // console.log("to==>", to);
- // console.log("this.$route==>", this.$route);
- // if (to) {
- // this.$nextTick(() => {
- // this.$router.removeRoute(from.name);
- // });
- // }
- // },
- // },
- methods: {
- getQueryParam(paramName) {
- const urlParams = new URLSearchParams(window.location.search);
- return urlParams.get(paramName);
- },
- },
- beforeDestroy() {
- this.$store.dispatch("disconnect");
- },
- };
- </script>
- <style>
- body {
- display: block;
- margin: 0 !important;
- }
- #app {
- /* font-family: Avenir, Helvetica, Arial, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- text-align: center;
- color: #2c3e50; */
- /* background-color: red;
- box-sizing: border-box; */
- }
- .el-message {
- min-width: auto !important;
- background-color: rgba(88, 88, 88, 1) !important;
- color: #fff !important;
- border: none !important;
- }
- .el-message__content {
- color: #fff !important;
- }
- .el-message .el-message__icon {
- display: none !important;
- }
- </style>
|