demo.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // pages/demo/demo.js
  2. import VODUpload from '../../utils/aliyun-upload-sdk-1.0.1.min'
  3. const app = getApp()
  4. const util = require("../../utils/util")
  5. const urlDef = require("../../utils/urls")
  6. const recordManager = wx.getRecorderManager()
  7. const audio = wx.createInnerAudioContext()
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. height: 0,
  14. animation: {},
  15. left: 750
  16. },
  17. takePhoto() {
  18. const ctx = wx.createCameraContext()
  19. ctx.takePhoto({
  20. quality: 'high',
  21. success: (res) => {
  22. console.log(res.tempImagePath)
  23. },
  24. error(e) {
  25. console.log(e.detail)
  26. }
  27. })
  28. },
  29. scanCode:function(e){
  30. console.log(JSON.stringify(e))
  31. },
  32. closeCamera:function(){
  33. this.animation = wx.createAnimation({
  34. timingFunction: 'linear',
  35. duration: 500
  36. })
  37. const left = 750
  38. this.animation.translateX(left).step()
  39. this.setData({
  40. animation:this.animation.export()
  41. })
  42. },
  43. showCamera:function(){
  44. this.animation = wx.createAnimation({
  45. timingFunction: 'linear',
  46. duration: 500
  47. })
  48. const left = 0
  49. this.animation.translateX(left).step()
  50. this.setData({
  51. animation:this.animation.export(),
  52. })
  53. },
  54. /**
  55. * 生命周期函数--监听页面加载
  56. */
  57. onLoad: function (options) {
  58. wx.getSystemInfo({
  59. success: (result) => {
  60. this.setData({
  61. height: result.windowHeight
  62. })
  63. },
  64. })
  65. },
  66. /**
  67. * 生命周期函数--监听页面初次渲染完成
  68. */
  69. onReady: function () {
  70. },
  71. /**
  72. * 生命周期函数--监听页面显示
  73. */
  74. onShow: function () {
  75. },
  76. /**
  77. * 生命周期函数--监听页面隐藏
  78. */
  79. onHide: function () {
  80. },
  81. /**
  82. * 生命周期函数--监听页面卸载
  83. */
  84. onUnload: function () {
  85. },
  86. /**
  87. * 页面相关事件处理函数--监听用户下拉动作
  88. */
  89. onPullDownRefresh: function () {
  90. },
  91. /**
  92. * 页面上拉触底事件的处理函数
  93. */
  94. onReachBottom: function () {
  95. },
  96. /**
  97. * 用户点击右上角分享
  98. */
  99. onShareAppMessage: function () {
  100. }
  101. })