sitemsg.js 4.0 KB

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