threethousanddream 1 månad sedan
förälder
incheckning
6129cd8f58
1 ändrade filer med 11 tillägg och 8 borttagningar
  1. 11 8
      util/index.js

+ 11 - 8
util/index.js

@@ -7,17 +7,20 @@ export function arrayToTree(list, {parentId = parentId, id = id}) {
   })
   return parents
 }
+window.getUserInfo = function (obj) {
+  window.alert(obj)
+  if (typeof obj === 'string') obj = JSON.parse(obj)
+  let {token, userId} = obj.userInfo
+  window.alert(token)
+  Cookies.set('congress', token)
+}
 export function setToken() {
   return new Promise((resolve, reject) => {
     if (!Cookies.get('congress')) {
-      window.insideH5ToApp('userInfo', function (obj) {
-        window.alert(obj)
-        if (typeof obj === 'string') obj = JSON.parse(obj)
-        let {token, userId} = obj
-        window.alert(token)
-        Cookies.set('congress', token)
-        resolve()
-      })
+      window.insideH5ToApp({key: 'userInfo', void: 'getUserInfo'})
+      setTimeout(() => {
+        setToken().then(resolve)
+      }, 50)
     } else {
       resolve()
     }