sixth.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // StepPage/pages/third/third.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. phoneIndex:null,
  8. showCamera:false,
  9. imgList:[
  10. {
  11. src:''
  12. },{
  13. src:''
  14. },{
  15. src:''
  16. }
  17. ],
  18. },
  19. handleOpenCamera(row){
  20. this.setData({
  21. showCamera:true,
  22. phoneIndex:row.currentTarget.dataset.index,
  23. })
  24. },
  25. takePhoto() {
  26. const ctx = wx.createCameraContext()
  27. ctx.takePhoto({
  28. quality: 'high',
  29. success: (res) => {
  30. this.data.imgList[this.data.phoneIndex].src = res.tempImagePath;
  31. this.setData({
  32. imgList:this.data.imgList,
  33. showCamera:false
  34. })
  35. }
  36. })
  37. },
  38. error(e) {
  39. console.log(e.detail)
  40. },
  41. handleNext(){
  42. wx.navigateTo({
  43. url: '../seventh/seventh',
  44. })
  45. },
  46. handleReturn(){
  47. wx.navigateBack({
  48. delta:1
  49. })
  50. },
  51. /**
  52. * 生命周期函数--监听页面加载
  53. */
  54. onLoad(options) {
  55. },
  56. /**
  57. * 生命周期函数--监听页面初次渲染完成
  58. */
  59. onReady() {
  60. },
  61. /**
  62. * 生命周期函数--监听页面显示
  63. */
  64. onShow() {
  65. },
  66. /**
  67. * 生命周期函数--监听页面隐藏
  68. */
  69. onHide() {
  70. },
  71. /**
  72. * 生命周期函数--监听页面卸载
  73. */
  74. onUnload() {
  75. },
  76. /**
  77. * 页面相关事件处理函数--监听用户下拉动作
  78. */
  79. onPullDownRefresh() {
  80. },
  81. /**
  82. * 页面上拉触底事件的处理函数
  83. */
  84. onReachBottom() {
  85. },
  86. /**
  87. * 用户点击右上角分享
  88. */
  89. onShareAppMessage() {
  90. }
  91. })