App.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <style lang="scss">
  2. /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
  3. @import "uview-ui/index.scss";
  4. </style>
  5. <script>
  6. export default {
  7. onLaunch: function() {
  8. let that = this;
  9. wx.login({
  10. success(re) {
  11. that.$api.wxAuthLogin({code:re.code}).then(res=>{
  12. uni.setStorageSync('userInfo',res.data.data.userInfo)
  13. uni.setStorageSync('accessToken',res.data.data.access_token)
  14. uni.setStorageSync('phoneIsBind',res.data.data.phoneIsBind)
  15. if (res.data.data.phoneIsBind){
  16. uni.switchTab({
  17. url: '/pages/index/index',
  18. })
  19. }
  20. })
  21. },
  22. })
  23. console.log('App Launch')
  24. },
  25. onShow: function() {
  26. console.log('App Show')
  27. },
  28. onHide: function() {
  29. console.log('App Hide')
  30. }
  31. }
  32. </script>