housestyle.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. var App=getApp();
  2. var utils=require("../../utils/http")
  3. var stoptime=0;
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. webUrl:'',
  10. clientype: App.globalData.clientype
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function (options) {
  16. var that=this;
  17. wx.showLoading({
  18. title: '加载中',
  19. })
  20. this.setData({
  21. clientype: App.globalData.clientype,
  22. webUrl:App.globalData.webUrl+'applet.html#/housestyle?token='+App.globalData.token + '&client_type=' + App.globalData.clientype+"&share_user_id="+App.globalData.personMsg.id+'&type=1',
  23. })
  24. wx.hideLoading()
  25. },
  26. /**
  27. * 生命周期函数--监听页面初次渲染完成
  28. */
  29. onReady: function () {
  30. },
  31. /**
  32. * 生命周期函数--监听页面显示
  33. */
  34. onShow: function () {
  35. // if(app.globalData.use_id!=this.data.share_user_id){
  36. // wx.hideHomeButton();
  37. // }
  38. stoptime=0;
  39. setTimeout(function(){
  40. stoptime=stoptime*1+1;
  41. },1000)
  42. },
  43. /**
  44. * 生命周期函数--监听页面隐藏
  45. */
  46. onHide: function () {
  47. var timearr=App.globalData.timearr,flag=false;
  48. for(var i=0;i<timearr.length;i++){
  49. if(timearr[i].type=='housestyle'){
  50. timearr[i].time=timearr[i].time*1+stoptime*1;
  51. flag=true;
  52. }
  53. }
  54. if(!flag){
  55. var obj={
  56. type:'housestyle',
  57. time:stoptime
  58. };
  59. App.globalData.timearr.push(obj);
  60. }else{
  61. App.globalData.timearr=timearr;
  62. }
  63. },
  64. /**
  65. * 生命周期函数--监听页面卸载
  66. */
  67. onUnload: function () {
  68. },
  69. /**
  70. * 页面相关事件处理函数--监听用户下拉动作
  71. */
  72. onPullDownRefresh: function () {
  73. },
  74. /**
  75. * 页面上拉触底事件的处理函数
  76. */
  77. onReachBottom: function () {
  78. },
  79. addshare:function(){
  80. var that=this;
  81. utils.$post({
  82. url: App.globalData.webUrl + 'api/tool/tool_share',
  83. header: {
  84. 'Authorization':'bearer '+App.globalData.token
  85. },
  86. data:{
  87. type:'styleTest'// 装修风格/styleTest 老房翻新/likeTest
  88. },
  89. success: function (res) {
  90. }
  91. })
  92. },
  93. /**
  94. * 用户点击右上角分享
  95. */
  96. // onShareAppMessage: function () {
  97. // var that=this;
  98. // this.addshare()
  99. // return {
  100. //     title: '装修风格测一测', // 默认是小程序的名称(可以写slogan等)
  101. //     path: '/pages/beforetest/beforetest?type=housestyle'+"&share_user_id="+that.data.share_user_id, // 默认是当前页面,必须是以‘/’开头的完整路径
  102. //     imageUrl: 'https://o.nczyzs.com/xcx/styletool.jpg', //自定义图片路径,图片长宽比是 5:4
  103. //   }
  104. // }
  105. })