Browse Source

set userinfo

nieyuge 2 years ago
parent
commit
c0830ec7aa
2 changed files with 13 additions and 4 deletions
  1. 13 1
      src/pages/index.vue
  2. 0 3
      src/pages/nft/index.vue

+ 13 - 1
src/pages/index.vue

@@ -72,10 +72,14 @@
 
 <script setup lang="ts">
 import { onMounted } from 'vue';
+import { useRoute, useRouter } from 'vue-router'
+import { setStorage, storageKey } from '../static/utils/storage'
 import headerLayer from '../components/header.vue';
 import footerLayer from '../components/footer.vue';
 
-function install() {
+const route = useRoute()
+
+const install = () => {
     window.open(`https://chrome.google.com/webstore/detail/denet/inlfbeejfdgkknpiodhemfcokbdgofja`);
 }
 
@@ -104,6 +108,14 @@ onMounted(() => {
             observer.observe(el);
         });
     }
+
+    let str = route.query && route.query.params || ''
+    if (str) {
+        // @ts-ignore
+        let params = JSON.parse(atob(str));
+        setStorage(storageKey.userInfo, params)
+        location.href = `/`;
+    }
 })
 </script>
 

+ 0 - 3
src/pages/nft/index.vue

@@ -4,11 +4,8 @@
 
 <script lang="ts" setup>
 import { onMounted } from 'vue'
-import { useRouter } from 'vue-router'
 import { getStorage, storageKey } from '../../static/utils/storage'
 
-let router = useRouter()
-
 onMounted(() => {
     let userInfo = getStorage(storageKey.userInfo);
     if (!userInfo) {