mixin.js 969 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. const LOGIN_LIST = ['pages/mine/mine']
  2. /*
  3. * 全局注入器
  4. */
  5. let page = {
  6. data() {
  7. return {
  8. }
  9. },
  10. computed: {
  11. //ios底部安全区域
  12. safeAreaBottom() {
  13. let info = uni.getSystemInfoSync()
  14. let safe = 20
  15. if (
  16. info && ['devtools', 'ios'].includes(info.platform) &&
  17. info.statusBarHeight > safe
  18. ) {
  19. return info.statusBarHeight - safe + 'px'
  20. }
  21. return 0
  22. }
  23. },
  24. onLoad(options) {
  25. },
  26. onShow() {
  27. let currentPage = this.$util.getCurrentRoute()
  28. if (LOGIN_LIST.includes(currentPage)) {
  29. this.login()
  30. }
  31. },
  32. methods: {
  33. // 登录 begin
  34. showLogin() {
  35. this.$refs.login.show()
  36. },
  37. signIn(resp) {
  38. //获取数据
  39. this.init()
  40. },
  41. async login(e) {
  42. if (this.$isEmpty(this.vuex_userId)) {
  43. this.showLogin()
  44. return
  45. }
  46. //获取数据
  47. this.init()
  48. //获取手机号
  49. if (this.$isEmpty(this.vuex_phone)) {
  50. this.$refs.login.showPhoneModal()
  51. }
  52. },
  53. // 登录 end
  54. },
  55. }
  56. export default page