sitemsg.js 4.7 KB

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