networktool.js 1.9 KB

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