// components/component-list.js const { cosBaseUrl } = require('../../../utils/newServices.js') const app = getApp() Component({ /** * 组件的属性列表 */ properties: { hasProduct: { type: Boolean }, hasPay: { type: Boolean }, sceneId: { type: String }, thumbUrl: { type: String }, imageUrl: { type: String }, name: { type: String }, pavilionName: { type: String }, statusTextDesp: { type: String }, distance: { type: String }, detailType: { type: [Number, String], }, online: Number, scenePv: Number, link: String }, options: { addGlobalClass: true, newImg: '' }, lifetimes: { attached: function(){ let that = this this.setData({ newImg: that.getImgUrl() }) } }, /** * 组件的初始数据 */ data: { cosBaseUrl }, /** * 组件的方法列表 */ methods: { goBigScene: function(){ console.log(this.data.detailType, 666) if(this.data.detailType == 2){ wx.navigateTo({ url: '/pages/guicangDetails/index?id=' + this.data.sceneId }); } else { if (this.data.online === 1){ app.globalData.currentUrl = this.data.link wx.navigateTo({ url: `../../wv_page/index?id=${this.data.sceneId}`, success: function (res) { }, fail: function (res) { }, complete: function (res) { }, }) }else{ wx.navigateTo({ url: `/pages/zl_detail/index?id=${this.data.sceneId}`, success: function (res) { }, fail: function (res) { }, complete: function (res) { }, }) } } }, getImgUrl: function(){ let url = this.data.thumbUrl || this.data.imageUrl return url.includes('http') ? url : (this.data.cosBaseUrl + url) } }, ready : function(){ console.log(this.data) } })