mixin.js 799 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * 全局注入器
  3. */
  4. let page = {
  5. data() {
  6. return {
  7. }
  8. },
  9. computed: {
  10. //ios底部安全区域
  11. safeAreaBottom() {
  12. let info = uni.getSystemInfoSync()
  13. let safe = 20
  14. if (
  15. info && ['devtools', 'ios'].includes(info.platform) &&
  16. info.statusBarHeight > safe
  17. ) {
  18. return info.statusBarHeight - safe
  19. }
  20. return 0
  21. }
  22. },
  23. methods: {
  24. },
  25. onLoad(options) {
  26. let currentPage = this.$util.getCurrentRoute()
  27. //全局登录拦截
  28. if (!this.vuex_userId) {
  29. if (currentPage.indexOf('pages/agent/') != -1) {
  30. uni.reLaunch({
  31. url: "/pages/gain/gain?current=1"
  32. })
  33. return
  34. }
  35. if (currentPage.indexOf('pages/mine/') != -1 && currentPage != 'pages/mine/mine') {
  36. uni.reLaunch({
  37. url: "/pages/mine/mine"
  38. })
  39. }
  40. }
  41. }
  42. }
  43. export default page