@@ -19,6 +19,11 @@ Component({ | |||
type: Boolean, | |||
value:false, | |||
}, | |||
// 是否显示收藏 | |||
isShowCollect:{ | |||
type: Boolean, | |||
value:false, | |||
}, | |||
// 是否其他查看主页---用于是否显示聊一聊 | |||
isOther:{ | |||
type: Boolean, | |||
@@ -36,7 +41,6 @@ Component({ | |||
*/ | |||
data: { | |||
}, | |||
/** | |||
* 组件的方法列表 | |||
*/ |
@@ -46,7 +46,7 @@ | |||
<image class="browse-img" src="/images/home/browse-icon.png" /> | |||
{{ item.pageView || 0}}浏览量 | |||
</view> | |||
<view class="fl list-collect-view" wx:if="{{ pageStatus == 'detatil' && app.globalData.customerId != item.globalData }}" bindtap="productCollect"> | |||
<view class="fl list-collect-view" wx:if="{{ pageStatus == 'detatil' && isShowCollect }}" bindtap="productCollect"> | |||
<image class="collect-img" src="/images/home/is-collect.png" wx:if="{{ isCollect }}" /> | |||
<image class="collect-img" src="/images/home/not-collect.png" wx:else /> | |||
收藏 |
@@ -31,23 +31,22 @@ Page({ | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad(option) { | |||
const eventChannel = this.getOpenerEventChannel() | |||
// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据 | |||
eventChannel.on('acceptDataFromOpenerPage', data => { | |||
}, | |||
onShow() { | |||
const listDetail = wx.getStorageSync('listDetail') || null; | |||
this.setData({ | |||
currentData: listDetail, | |||
type: listDetail.type.join(), | |||
pageLoading: true, | |||
}) | |||
if (app.globalData.customerId) { | |||
this.setData({ | |||
currentData: data.listDetail, | |||
type: data.listDetail.type.join(), | |||
pageLoading: true, | |||
customerId: app.globalData.customerId | |||
}) | |||
if (app.globalData.customerId) { | |||
this.setData({ | |||
customerId: app.globalData.customerId | |||
}) | |||
this.getIsCollect(); | |||
}else{ | |||
this.getListData(); | |||
} | |||
}) | |||
this.getIsCollect(); | |||
} else { | |||
this.getListData(); | |||
} | |||
}, | |||
// 热门详情点击 | |||
goDetails(e) { | |||
@@ -84,7 +83,7 @@ Page({ | |||
// 切换收藏 | |||
changeCollect() { | |||
let { currentData, customerId, isCollect } = this.data; | |||
if(!customerId){ | |||
if (!customerId) { | |||
app.goLogin(); | |||
return | |||
} |
@@ -5,7 +5,12 @@ | |||
</view> | |||
<view wx:else> | |||
<view class="list-view"> | |||
<listItem item="{{ currentData }}" pageStatus="detatil" isCollect="{{ isCollect }}" bind:changeCollect="changeCollect" /> | |||
<listItem | |||
item="{{ currentData }}" | |||
pageStatus="detatil" | |||
isCollect="{{ isCollect }}" | |||
isShowCollect="{{ customerId != currentData.customerId }}" | |||
bind:changeCollect="changeCollect" /> | |||
</view> | |||
<view class="view-interested">你可能感兴趣的需求</view> | |||
<view class="not-data" wx:if="{{ listData.length < 1 }}"> |
@@ -140,12 +140,9 @@ Page({ | |||
}, | |||
// 进入详情 | |||
goDetails(e) { | |||
wx.setStorageSync('listDetail', e.detail) | |||
wx.navigateTo({ | |||
url: '/pages/index/components/listDetails/Details', | |||
success: function (res) { | |||
// 通过eventChannel向被打开页面传送数据 | |||
res.eventChannel.emit('acceptDataFromOpenerPage', { listDetail: e.detail }) | |||
} | |||
}) | |||
}, | |||
// 获取tab数据 |
@@ -65,12 +65,9 @@ Page({ | |||
// 进入详情 | |||
goDetails(e) { | |||
wx.setStorageSync('listDetail', e.detail) | |||
wx.navigateTo({ | |||
url: '/pages/index/components/listDetails/Details', | |||
success: function (res) { | |||
// 通过eventChannel向被打开页面传送数据 | |||
res.eventChannel.emit('acceptDataFromOpenerPage', { listDetail: e.detail }) | |||
} | |||
}) | |||
}, | |||
// 删除收藏 |
@@ -117,15 +117,12 @@ Page({ | |||
let listDetail = res.data; | |||
if (typeof listDetail.type == 'string') { | |||
listDetail.type = listDetail.type.split(','); | |||
listDetail.createdOn = $util.formatTime(new Date(el.createdOn), true); | |||
listDetail.createdOn = $util.formatTime(new Date(listDetail.createdOn), true); | |||
} | |||
that.clearData(); | |||
wx.navigateTo({ | |||
wx.setStorageSync('listDetail', listDetail) | |||
wx.reLaunch({ | |||
url: '/pages/index/components/listDetails/Details', | |||
success: function (res2) { | |||
// 通过eventChannel向被打开页面传送数据 | |||
res2.eventChannel.emit('acceptDataFromOpenerPage', { listDetail }) | |||
} | |||
}) | |||
} | |||
} |