mixin.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. init(){
  34. console.log("登录成功,初始化数");
  35. },
  36. // 登录 begin
  37. showLogin() {
  38. this.$refs.login.show()
  39. },
  40. signIn(resp) {
  41. //获取数据
  42. this.init()
  43. },
  44. async login(e) {
  45. if (this.$isEmpty(this.vuex_userId)) {
  46. this.showLogin()
  47. return
  48. }
  49. //获取数据
  50. this.init()
  51. //获取手机号
  52. if (this.$isEmpty(this.vuex_phone)&&this.$config.isAuthPhone) {
  53. this.$refs.login.showPhoneModal()
  54. }
  55. },
  56. async checkIsCmcc(){
  57. if (this.$isEmpty(this.vuex_phone)) {
  58. return
  59. }
  60. let params={
  61. phone:this.vuex_phone
  62. }
  63. let res=await this.$api.CMCC.isCMCC(params)
  64. console.log(res,"res....");
  65. return res.data.data
  66. },
  67. phoneSuccess(){
  68. console.log('手机号获取成功>>>>>>>>');
  69. },
  70. // 登录 end
  71. },
  72. }
  73. export default page