login-pannel.js 872 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { loginByUserInfo } from './../../utils/login'
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. visible: Boolean
  8. },
  9. /**
  10. * 组件的初始数据
  11. */
  12. data: {
  13. show: false
  14. },
  15. ready () {
  16. this.showPannel()
  17. wx.login({
  18. success: (res) => {
  19. this.wx_code = res.code
  20. }
  21. })
  22. },
  23. /**
  24. * 组件的方法列表
  25. */
  26. methods: {
  27. bindgetuserinfo (e) {
  28. loginByUserInfo(e.detail, this.wx_code).then(res => {
  29. this.triggerEvent('loginSuccess')
  30. })
  31. },
  32. showPannel () {
  33. this.animation = wx.createAnimation({
  34. duration: 200,
  35. timingFunction: 'ease'
  36. })
  37. this.animation.translateY(8).step()
  38. this.setData({
  39. animationData: this.animation.export(),
  40. show: true
  41. })
  42. },
  43. hide () {
  44. this.triggerEvent('hide')
  45. }
  46. }
  47. })