App.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.wxLogin({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. uni.removeStorageSync('parent_member_id');
  16. if (!res.data.data.phoneIsBind){
  17. uni.showModal({
  18. title:'温馨提示',
  19. content:'请绑定手机号,以便为你提供服务',
  20. success:res=>{
  21. if (res.confirm){
  22. uni.navigateTo({
  23. url: '/myPages/setting/setting-telphone',
  24. })
  25. }
  26. }
  27. })
  28. }
  29. })
  30. },
  31. })
  32. console.log('App Launch')
  33. },
  34. onShow: function() {
  35. console.log('App Show')
  36. },
  37. onHide: function() {
  38. console.log('App Hide')
  39. }
  40. }
  41. </script>