Quellcode durchsuchen

完成上/下架 删除

release/210823_需求对对碰
王饶冀 vor 3 Jahren
Ursprung
Commit
fe6e1432da

+ 51
- 2
pages/myModule/components/myRelease/myRelease.js Datei anzeigen

@@ -74,6 +74,55 @@ Page({
})
this.getListData();
},
// 置顶/取消置顶需求
productIsOnTop(e) {
let item = e.currentTarget.dataset.item;
let that = this;
if (item.isOnTop) {
wx.showModal({
title: '提示',
content: "是否确认取消置顶?",
confirmText: "确认",
cancelText: "取消",
success(res) {
if (res.confirm) {
that.productIsOnTopPost(item);
}
}
})
} else {
that.productIsOnTopPost(item);
}
},
// 置顶/取消置顶需求Fn
productIsOnTopPost(item) {
let { businessCommunicationDemandId, isOnTop } = item;
this.showLoading();
$request.post(`/businessCommunicationDemand/setOnTopOrDown.action`,
{ businessCommunicationDemandId, isOnTop: isOnTop ? 0 : 1 }
).then(res => {
wx.hideLoading()
if (res.status == 0) {
wx.showToast({
title: isOnTop ? '取消置顶' : '置顶' + '成功',
icon: 'success',
duration: 2000
})
let listData = this.data.listData;
listData.forEach(el => {
if (el.businessCommunicationDemandId == businessCommunicationDemandId) {
el.isOnTop = isOnTop ? false : true
}
})
this.setData({
listData
})
}
}).catch(error => {
console.log(error, 'error appletLogin')
wx.hideLoading()
})
},
// 上架/下架需求
productRelease(e) {
let item = e.currentTarget.dataset.item;
@@ -109,9 +158,9 @@ Page({
duration: 2000
})
let listData = this.data.listData;
listData.forEach(el => {
listData.forEach((el, inx) => {
if (el.businessCommunicationDemandId == businessCommunicationDemandId) {
el.state = state == 0 ? 1 : 0;
listData.splice(inx, 1);
}
})
this.setData({

+ 10
- 1
pages/myModule/components/myRelease/myRelease.wxml Datei anzeigen

@@ -29,7 +29,16 @@
<view class="list-view" wx:for="{{ listData }}" wx:key="*this">
<listItem item="{{ item }}" pageStatus="myRelease"/>
<view class="foot-btn">
<van-button plain type="info" size="small" round class="foot-van-btn">
<van-button
plain
type="info"
size="small"
round
class="foot-van-btn"
data-item="{{ item }}"
bindtap="productIsOnTop"
wx:if="{{ item.state != -1 }}"
>
{{ item.isOnTop ? '取消置顶' : '置顶' }}
</van-button>
<van-button plain type="info" size="small" round class="foot-van-btn">修改</van-button>

Laden…
Abbrechen
Speichern