figureprice.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. const app=getApp(),utils=require("../../../utils/http");
  2. var stoptime=0;
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. url:'',
  9. share_user_id:'',
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. // ?token='+app.globalData.token
  16. this.setData({
  17. share_user_id:options.share_user_id,
  18. url: app.globalData.webUrl + 'applet.html#/figureprice?share_user_id=' + options.share_user_id + '&token=' + app.globalData.token + '&client_type=' + app.globalData.clientype,
  19. })
  20. },
  21. /**
  22. * 生命周期函数--监听页面初次渲染完成
  23. */
  24. onReady: function () {
  25. },
  26. /**
  27. * 生命周期函数--监听页面显示
  28. */
  29. onShow: function () {
  30. stoptime=0;
  31. setTimeout(function(){
  32. stoptime=stoptime*1+1;
  33. },1000)
  34. },
  35. /**
  36. * 生命周期函数--监听页面隐藏
  37. */
  38. onHide: function () {
  39. var timearr=app.globalData.timearr,flag=false;
  40. for(var i=0;i<timearr.length;i++){
  41. if(timearr[i].type=='figureprice'){
  42. timearr[i].time=timearr[i].time*1+stoptime*1;
  43. flag=true;
  44. }
  45. }
  46. if(!flag){
  47. var obj={
  48. type:'figureprice',
  49. time:stoptime
  50. };
  51. app.globalData.timearr.push(obj);
  52. }else{
  53. app.globalData.timearr=timearr;
  54. }
  55. },
  56. /**
  57. * 生命周期函数--监听页面卸载
  58. */
  59. onUnload: function () {
  60. },
  61. /**
  62. * 页面相关事件处理函数--监听用户下拉动作
  63. */
  64. onPullDownRefresh: function () {
  65. },
  66. /**
  67. * 页面上拉触底事件的处理函数
  68. */
  69. onReachBottom: function () {
  70. },
  71. /**
  72. * 用户点击右上角分享
  73. */
  74. // onShareAppMessage: function () {
  75. // return {
  76. // title: '我是'+app.globalData.sharename+",这是我的个人微网。",
  77. // imageUrl:"../../../img/weiw.png",
  78. // path: '/pages/microgrid/microgrid?share_user_id='+this.data.share_user_id+"&sharename="+app.globalData.sharename
  79. // }
  80. // }
  81. })