Commit 681ddb8a by 赵雅纹

Merge branch 'feature-zyw-sc' into 'dev_7.1.0'

Feature zyw sc

See merge request !78
parents 999b9cf4 27bc66e2
......@@ -25,44 +25,13 @@ Component({
*/
methods: {
onTapLike(e){
console.log(e)
const { memberId } = wx.getStorageSync('_baseUserInfo')
var params = {
let params = {
contentId: e.currentTarget.dataset.id,
type: e.currentTarget.dataset.type,
userId: memberId
}
if (!e.currentTarget.dataset.type){
wxService.post(`/merchant/contentMobileTerminal/operationSave`, params).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
wx.showToast({
title: '点赞成功',
icon: 'none'
})
}
}).finally(() => {
})
}else{
wxService.post(`/merchant/contentMobileTerminal/operationDelete`, {
contentId: e.currentTarget.dataset.id,
userId: memberId
}).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
wx.showToast({
title: '取消点赞成功',
icon: 'none'
})
}
}).finally(() => {
})
}
this.triggerEvent('updataLike', params)
},
//详情
......
......@@ -19,7 +19,7 @@
<view class="item-title">{{headline}}</view>
</view>
<view class="share-wrap">
<view class="share-oprate" bindtap="onTapLike" data-id="{{id}}" data-type="{{type}}">
<view class="share-oprate" catchtap="onTapLike" data-id="{{id}}" data-type="{{type}}">
<image class="share-img" src="{{type ? '/assets/imgs/heart-primary.png' : '/assets/imgs/heart-default.png'}}"></image>
<text class="share-number">{{enjoySum || 0}}</text>
</view> <view class="share-oprate">
......
......@@ -150,7 +150,7 @@ wxService.page({
currentTab:data[0].id
})
getContentList(data[0].id)
this.getContentList(data[0].id)
}
}).finally(() => {
......@@ -182,6 +182,45 @@ wxService.page({
}).finally(() => {
})
},
// 点赞
gotoLike(e){
console.log(e.detail)
let params = e.detail
if (!e.detail.type){
wxService.post(`/merchant/contentMobileTerminal/operationSave`, params).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
wx.showToast({
title: '点赞成功',
icon: 'none'
})
this.getContentList(this.data.currentTab)
}
}).finally(() => {
})
}else{
wxService.post(`/merchant/contentMobileTerminal/operationDelete`, {
contentId: e.detail.contentId,
userId: e.detail.userId
}).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
wx.showToast({
title: '取消点赞成功',
icon: 'none'
})
this.getContentList(this.data.currentTab)
}
}).finally(() => {
})
}
},
/**
* 页面相关事件处理函数--监听用户下拉动作
......
......@@ -8,10 +8,15 @@
</view>
<scroll-view scroll-y >
<view class="main-content" wx:if="{{contentList.length > 0}}">
<water-flow-layout image-data="{{contentList}}"/>
<water-flow-layout image-data="{{contentList}}" bind:updataLike="gotoLike"/>
</view>
<view class="empty" wx:if="{{!contentList || contentList.length < 1}}">
暂无内容哦~
</view>
</scroll-view>
</view>
......@@ -12,7 +12,7 @@ wxService.page({
contentInfo:[],
id:'',
pageNo:1,
pageSize:30,
pageSize:100,
proList:[]
},
......@@ -55,17 +55,59 @@ wxService.page({
var params = {
productIds: this.data.contentInfo.productIds
}
wxService.post(`/sale/product/buyer/listPageByCategoryId?pageNo=${this.data.pageNo}&pageSize=${this.data.pageSize}`, params).then(res => {
wxService.post(`/sale/product/buyer/listPage?pageNo=${this.data.pageNo}&pageSize=${this.data.pageSize}`, params).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
if (result == 0 && data.content) {
this.setData({
proList: data
proList: data.content
})
}
}).finally(() => {
})
},
// 点赞
gotoLike(){
const { memberId } = wx.getStorageSync('_baseUserInfo')
let params = {
contentId: this.data.contentInfo.id,
type: this.data.contentInfo.currentType,
userId: memberId
}
if (!this.data.contentInfo.currentType) {
wxService.post(`/merchant/contentMobileTerminal/operationSave`, params).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
wx.showToast({
title: '点赞成功',
icon: 'none'
})
this.getContentList(this.data.currentTab)
}
}).finally(() => {
})
} else {
wxService.post(`/merchant/contentMobileTerminal/operationDelete`, {
contentId: this.data.contentInfo.id,
userId: memberId
}).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
wx.showToast({
title: '取消点赞成功',
icon: 'none'
})
this.getContentList(this.data.currentTab)
}
}).finally(() => {
})
}
}
......
......@@ -7,7 +7,7 @@
<view class="buy-desc">
<view>{{contentInfo.describe}}</view>
<view class="share-wrap">
<view class="share-oprate">
<view class="share-oprate" bindtap="gotoLike">
<image class="share-img" src="{{contentInfo.currentType ? '/assets/imgs/heart-primary.png' : '/assets/imgs/heart-default.png'}}"></image>
<text class="share-number">{{contentInfo.enjoySum || 0}}</text>
</view>
......@@ -20,34 +20,21 @@
</view>
<view class="buy-product-wrap">
<view class="buy-product-content">
<view class="buy-list">
<view class="prod-img">
<image src="/assets/imgs/avatar.png"></image>
</view>
<view class="prod-info">
<view class="prod-name">商品名称商品名称商品名称商品名称商品名称</view>
<view class="sale-btn">限时特价</view>
<view class="bottom-price">
<text class="price">¥299</text>
<text class="cost-price">¥456</text>
<view class="look-over">查看详情</view>
</view>
</view>
</view>
<view class="buy-list">
<view class="buy-list" wx:for="{{proList}}" wx:key="{{index}}">
<view class="prod-img">
<image src="/assets/imgs/avatar.png"></image>
<image src="{{item.indexUrl}}"></image>
</view>
<view class="prod-info">
<view class="prod-name">商品名称商品名称商品名称商品名称商品名称</view>
<view class="sale-btn">限时特价</view>
<view class="prod-name">{{item.productName}}</view>
<!-- <view class="sale-btn">限时特价</view> -->
<view class="bottom-price">
<text class="price">¥299</text>
<text class="cost-price">¥456</text>
<text class="price">¥{{item.minSalePrice}}</text>
<!-- <text class="cost-price">¥456</text> -->
<view class="look-over">查看详情</view>
</view>
</view>
</view>
</view>
</view>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment