店播抖音版小程序

App.vue 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. console.log('App onLaunch')
  5. var _this = this;
  6. if(!uni.getStorageSync('isLogin')){
  7. this.$store.dispatch('login_verified',).then((res)=>{
  8. this.$isResolve()
  9. }).catch(()=>{
  10. this.$store.dispatch('login_first').then(()=>{
  11. this.$isResolve()
  12. }).catch(()=>{
  13. uni.redirectTo({
  14. url:'/pages/subPackages/login/login'
  15. })
  16. })
  17. })
  18. }else{
  19. this.$isResolve()
  20. }
  21. //获取系统信息
  22. uni.getSystemInfo({
  23. success: function (res) {
  24. var data = res;
  25. let modelmes = res.model; //手机品牌
  26. if (modelmes.indexOf('iPhone X') != -1 || modelmes.indexOf('iPhone XS') != -1 || modelmes.indexOf('iPhone XR') != -1 || modelmes.indexOf('iPhone XS Max') != -1 || modelmes.indexOf('iPhone 11') != -1 || modelmes.indexOf('iPhone 11 Pro') != -1 || modelmes.indexOf('iPhone 11 Pro Max') != -1) {
  27. data.isIpx = true
  28. }
  29. data.safeAreaTop = data.statusBarHeight + 40;//statusBarHeight为状态栏的高度,safeAreaTop为内容区距离顶部位置
  30. _this.$store.commit('setSystemInfo',data)
  31. }
  32. });
  33. },
  34. onShow: function() {
  35. console.log('App Show')
  36. },
  37. onHide: function() {
  38. console.log('App Hide')
  39. }
  40. }
  41. </script>
  42. <style>
  43. /*每个页面公共css */
  44. page{
  45. background: #F2F2F2;
  46. }
  47. .tabbar-container{
  48. padding-bottom: 150rpx;
  49. }
  50. </style>