|
|
@@ -1,5 +1,6 @@
|
|
|
import { pageTo, isLogin } from '@/utils/util.js'
|
|
|
import { wxLoginFn } from '@/utils/auth'
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -9,8 +10,12 @@ export default {
|
|
|
pageTo: pageTo
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({ loginInfo: "getLoginInfo" })
|
|
|
+ },
|
|
|
// 页面生命周期才触发
|
|
|
onLoad: function (option) {
|
|
|
+ let that = this
|
|
|
this.option = option || null
|
|
|
if (option.token) {
|
|
|
uni.setStorageSync('token', option.token)
|
|
|
@@ -56,7 +61,13 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- this.init()
|
|
|
- wxLoginFn()
|
|
|
+ if (that.$util.isEmpty(that.getLoginInfo)) {
|
|
|
+ wxLoginFn().then(wxRes=>{
|
|
|
+ that.init()
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ that.init()
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|