浏览代码

完成发布需求后跳转需求详情,且点击返回回到首页。

完成需求详情收藏显示问题
release/210823_需求对对碰
王饶冀 3 年前
父节点
当前提交
41ee477a05

+ 5
- 1
components/listItem/listItem.js 查看文件

@@ -19,6 +19,11 @@ Component({
type: Boolean,
value:false,
},
// 是否显示收藏
isShowCollect:{
type: Boolean,
value:false,
},
// 是否其他查看主页---用于是否显示聊一聊
isOther:{
type: Boolean,
@@ -36,7 +41,6 @@ Component({
*/
data: {
},

/**
* 组件的方法列表
*/

+ 1
- 1
components/listItem/listItem.wxml 查看文件

@@ -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 />
收藏

+ 15
- 16
pages/index/components/listDetails/Details.js 查看文件

@@ -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
}

+ 6
- 1
pages/index/components/listDetails/Details.wxml 查看文件

@@ -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 }}">

+ 1
- 4
pages/index/index.js 查看文件

@@ -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数据

+ 1
- 4
pages/myModule/components/myCollect/myCollect.js 查看文件

@@ -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 })
}
})
},
// 删除收藏

+ 3
- 6
pages/releaseModule/index.js 查看文件

@@ -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 })
}
})
}
}

正在加载...
取消
保存