123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- const app=getApp();
- var utils=require("../../../utils/http");
- const util=require("../../../utils/util");
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- cid:'',
- siteobj:{},
- imgUrl:app.globalData.imgUrl,
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData({
- cid:options.cid
- })
- this.sitemdg();
- },
- sitemdg(){
- const that=this;
- utils.$post({
- url: app.globalData.webUrl + 'api/construction/view',
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data: {
- id:that.data.cid
- },
- success: function (res) {
- wx.hideLoading();
- if(res.data.code==0){
- that.setData({
- siteobj:res.data.data
- })
- wx.setNavigationBarTitle({
- title: res.data.data.name,
- })
- }
- }
- })
- },
- looktap(e){
- wx.previewImage({
- current: e.currentTarget.dataset.img, // 当前显示图片的 http 链接
- urls: this.data.siteobj.step_list[e.currentTarget.dataset.idx].data.img // 需要预览的图片 http 链接列表
- })
- },
- openVRLink(e) {
- let type = e.currentTarget.dataset.type;
- let vrlink = e.currentTarget.dataset.vr;
- wx.navigateTo({
- 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,
- })
- },
- collectap(e){
- const that=this;
- let str="";
- let siteobj=this.data.siteobj;
- if(siteobj.collect==0){
- str='api/construction/collect'
- }else{
- str='api/construction/collectCancel'
- }
- utils.$post({
- url: app.globalData.webUrl + str,
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data: {
- id:that.data.cid
- },
- success: function (res) {
- wx.hideLoading();
- if(res.data.code==0){
-
- if(str=='api/construction/collect'){
- siteobj.collect=1;
- }else{
- siteobj.collect=0;
- }
-
- that.setData({
- siteobj:siteobj
- })
- }
- }
- })
- },
- sharetap:function(){
- this.setData({
- wshareshow:true
- })
- },
- setpostertap: function () {
- wx.navigateTo({
- url: '/index/pages/setposter/setposter?type=Construction&aid='+this.data.cid+"&listshare=",
- })
- },
- sendfriendtap(){
- this.shareaddlog();
- },
- shareaddlog:function(){
- var that=this;
- utils.$post({
- url: app.globalData.webUrl + 'api/share/addlog',
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data: {
- id:that.data.cid,
- type:'Construction'
- },
- success: function (r) {
- }
- })
- },
- shareurltap:function(){
- wx.showLoading({
- title: '加载中...',
- })
- util.schemefun('/share/pages/constructsite/constructsite','cid='+this.data.cid+'&uid='+app.globalData.personMsg.id+'&ctp='+app.globalData.clientype,this.data.cid,'Construction','');
- this.shareaddlog();
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- this.shareaddlog();
- console.log('/share/pages/constructsite/constructsite?cid='+this.data.cid+'&uid='+app.globalData.personMsg.id+'&ctp='+app.globalData.clientype)
- return {
- title: this.data.siteobj.name,
- imageUrl: this.data.siteobj.cover,
- path: '/share/pages/constructsite/constructsite?cid='+this.data.cid+'&uid='+app.globalData.personMsg.id+'&ctp='+app.globalData.clientype
- }
- }
- })
|