sitemsg.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. var app=getApp();
  2. var utils=require("../../../utils/http");
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. top:app.globalData.statusBarHeight,
  9. hgt:app.globalData.titleBarHeight,
  10. siteobj:{},
  11. cid:'',
  12. bType: '',
  13. canIUseGetUserProfile: false,
  14. loadflag:false,
  15. shareobj:{},
  16. sharepersonMsg:app.globalData.sharepersonobj,
  17. employeeflag:false,//false是用户,true是员工
  18. type:'',
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad: function (options) {
  24. var that=this;
  25. wx.showLoading({
  26. title: '加载中...',
  27. })
  28. if (options.type) {
  29. this.setData({
  30. type: options.type
  31. })
  32. }
  33. if (!!options.ty) {
  34. wx.hideShareMenu();
  35. this.setData({
  36. bType: options.ty
  37. })
  38. }
  39. this.setData({
  40. cid:options.cid,
  41. employeeflag:(!!app.globalData.personMsg.binded&&app.globalData.personMsg.binded.state=='在职')?true:false
  42. })
  43. that.houseinfofun();
  44. },
  45. houseinfofun(){
  46. const that=this;
  47. utils.$post({
  48. url: app.globalData.webUrl + 'client/construction/view',
  49. header: {
  50. 'Authorization':'bearer '+app.globalData.token
  51. },
  52. data:{
  53. id:that.data.cid
  54. },
  55. success: function (res) {
  56. if(res.data.code=='0'){
  57. that.setData({
  58. siteobj:res.data.data
  59. })
  60. }
  61. setTimeout(function(){
  62. wx.hideLoading();
  63. },200)
  64. }
  65. })
  66. },
  67. phonrtap:function(){
  68. wx.makePhoneCall({
  69. phoneNumber: app.globalData.sharepersonobj.phone //仅为示例,并非真实的电话号码
  70. })
  71. },
  72. openVRLink(e) {
  73. let type = e.currentTarget.dataset.type;
  74. let vrlink = e.currentTarget.dataset.vr;
  75. wx.navigateTo({
  76. url: '/pages/other/other?type=565&vrlink=' + encodeURIComponent(vrlink) + '&uid=' + (app.globalData.shareuserid?app.globalData.shareuserid:app.globalData.personMsg.id) + '&cty=construction' + '&ctp=' + app.globalData.clientype + '&aid=' + this.data.cid,
  77. })
  78. },
  79. prelookimgtap(){
  80. if(!app.globalData.sharepersonobj.qrcode){
  81. wx.showToast({
  82. title: "当前专属客服的二维码为空!",
  83. icon: 'none',
  84. duration: 2000
  85. })
  86. return false;
  87. }
  88. wx.previewImage({
  89. current: app.globalData.imgUrl+app.globalData.sharepersonobj.qrcode, // 当前显示图片的http链接
  90. urls: [app.globalData.imgUrl+app.globalData.sharepersonobj.qrcode]// 需要预览的图片http链接列表
  91. })
  92. },
  93. /**
  94. * 生命周期函数--监听页面初次渲染完成
  95. */
  96. onReady: function () {
  97. },
  98. golastap:function(){
  99. wx.navigateBack()
  100. },
  101. goindextap:function(){
  102. wx.reLaunch({
  103. url: '/pages/index/index?state=1',
  104. })
  105. },
  106. looktap(e){
  107. wx.previewImage({
  108. current: e.currentTarget.dataset.img, // 当前显示图片的 http 链接
  109. urls: this.data.siteobj.step_list[e.currentTarget.dataset.idx].data.img // 需要预览的图片 http 链接列表
  110. })
  111. },
  112. /**
  113. * 生命周期函数--监听页面显示
  114. */
  115. onShow: function () {
  116. },
  117. /**
  118. * 生命周期函数--监听页面隐藏
  119. */
  120. onHide: function () {
  121. },
  122. /**
  123. * 生命周期函数--监听页面卸载
  124. */
  125. onUnload: function () {
  126. },
  127. /**
  128. * 页面相关事件处理函数--监听用户下拉动作
  129. */
  130. onPullDownRefresh: function () {
  131. },
  132. /**
  133. * 页面上拉触底事件的处理函数
  134. */
  135. onReachBottom: function () {
  136. },
  137. shareaddlog:function(){
  138. var that=this;
  139. utils.$post({
  140. url: app.globalData.webUrl + 'api/share/addlog',
  141. header: {
  142. 'Authorization':'bearer '+app.globalData.token
  143. },
  144. data: {
  145. id:that.data.cid,
  146. type:'Construction'
  147. },
  148. success: function (r) {
  149. }
  150. })
  151. },
  152. /**
  153. * 用户点击右上角分享
  154. */
  155. onShareAppMessage: function () {
  156. this.shareaddlog();
  157. let img=this.data.siteobj.cover_share_img?this.data.siteobj.cover_share_img:this.data.siteobj.cover;
  158. return {
  159. title: this.data.siteobj.name,
  160. imageUrl: img,
  161. path: '/share/pages/constructsite/constructsite?cid='+this.data.cid+'&uid='+app.globalData.personMsg.id+'&ctp='+app.globalData.clientype
  162. }
  163. }
  164. })