| | |
| | | that.$store.commit('setToken', res.data.token) |
| | | that.$store.commit('setOpenid', res.data.openid) |
| | | that.$store.commit('setUserInfo', res.data.member) |
| | | uni.getLocation({ |
| | | type: 'wgs84', |
| | | success: (addr) => { |
| | | that.$store.commit('setPosition', { latitude: addr.latitude, longitude: addr.longitude }) |
| | | that.$isResolve() |
| | | }, |
| | | fail: (err) => { |
| | | console.error('获取位置失败', err); |
| | | that.$isResolve() |
| | | } |
| | | }); |
| | | |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | onShow: function() { |
| | | console.log('App Show') |
| | | } else { |
| | | var that =this |
| | | let res = this.$u.api.getMemberInfo({}).then(res =>{ |
| | | if (res && res.code ===200) { |
| | | that.$store.commit('setUserInfo', res.data) |
| | | uni.getLocation({ |
| | | type: 'wgs84', |
| | | success: (addr) => { |
| | | that.$store.commit('setPosition', { latitude: addr.latitude, longitude: addr.longitude }) |
| | | that.$isResolve() |
| | | }, |
| | | fail: (err) => { |
| | | console.error('获取位置失败', err); |
| | | that.$isResolve() |
| | | } |
| | | }); |
| | | }else{ |
| | | that.$store.commit('setToken','') |
| | | that.$store.commit('setUserInfo',{}) |
| | | uni.getLocation({ |
| | | type: 'wgs84', |
| | | success: (addr) => { |
| | | that.$store.commit('setPosition', { latitude: addr.latitude, longitude: addr.longitude }) |
| | | that.$isResolve() |
| | | }, |
| | | fail: (err) => { |
| | | console.error('获取位置失败', err); |
| | | that.$isResolve() |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | |
| | | } |
| | | }, |
| | | onShow: function() { |
| | | console.log('App Show') |
| | | }, |
| | | onHide: function() { |
| | | console.log('App Hide') |