student.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // pages/student/student.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. height: 0,
  8. animation: {},
  9. left: 750
  10. },
  11. closeCamera:function(){
  12. this.animation = wx.createAnimation({
  13. timingFunction: 'linear',
  14. duration: 400
  15. })
  16. const left = 750
  17. this.animation.translateX(left).step()
  18. this.setData({
  19. animation:this.animation.export()
  20. })
  21. },
  22. showCamaer:function(){
  23. this.animation = wx.createAnimation({
  24. timingFunction: 'linear',
  25. duration: 100
  26. })
  27. const left = 0
  28. this.animation.translateX(left).step()
  29. this.setData({
  30. animation:this.animation.export(),
  31. left
  32. })
  33. },
  34. scanCode:function(e){
  35. console.log(JSON.stringify(e))
  36. },
  37. /**
  38. * 生命周期函数--监听页面加载
  39. */
  40. onLoad: function (options) {
  41. wx.getSystemInfo({
  42. success: (result) => {
  43. this.setData({
  44. height: result.windowHeight
  45. })
  46. },
  47. })
  48. },
  49. /**
  50. * 生命周期函数--监听页面初次渲染完成
  51. */
  52. onReady: function () {
  53. },
  54. /**
  55. * 生命周期函数--监听页面显示
  56. */
  57. onShow: function () {
  58. },
  59. /**
  60. * 生命周期函数--监听页面隐藏
  61. */
  62. onHide: function () {
  63. },
  64. /**
  65. * 生命周期函数--监听页面卸载
  66. */
  67. onUnload: function () {
  68. },
  69. /**
  70. * 页面相关事件处理函数--监听用户下拉动作
  71. */
  72. onPullDownRefresh: function () {
  73. },
  74. /**
  75. * 页面上拉触底事件的处理函数
  76. */
  77. onReachBottom: function () {
  78. },
  79. /**
  80. * 用户点击右上角分享
  81. */
  82. onShareAppMessage: function () {
  83. }
  84. })