Pārlūkot izejas kodu

临时提交代码~

release/210823_需求对对碰
王饶冀 pirms 3 gadiem
vecāks
revīzija
762979fa77

+ 67
- 8
pages/myModule/components/myRelease/myRelease.js Parādīt failu

@@ -76,34 +76,91 @@ Page({
},
// 上架/下架需求
productRelease(e) {
let item = e.currentTarget.dataset.item;
let that = this;
if (item.state == 0) {
wx.showModal({
title: '提示',
content: "是否确认下架?",
confirmText: "确认",
cancelText: "取消",
success(res) {
if (res.confirm) {
that.productReleasePost(item);
}
}
})
} else {
that.productReleasePost(item);
}
},
productReleasePost(item) {
wx.showLoading({
title: '加载中',
mask:true
})
let { businessCommunicationDemandId, state } = item;
$request.post(`/businessCommunicationDemand/outDemand.action`,
{ businessCommunicationDemandId, state }
).then(res => {
wx.hideLoading()
if (res.status == 0) {
wx.showToast({
title: state == 0 ? '下架' : '上架' + '成功',
icon: 'success',
duration: 2000
})
let listData = this.data.listData;
listData.forEach(el => {
if (el.businessCommunicationDemandId == businessCommunicationDemandId) {
el.state = state == 0 ? 1 : 0;
}
})
this.setData({
listData
})
}
}).catch(error => {
console.log(error, 'error appletLogin')
wx.hideLoading()
})
},
// 删除需求
productDel(e) {
let item = e.currentTarget.dataset.item;
let that = this;
wx.showModal({
title: '提示',
content: "是否确认下架?",
content: "是否确认删除?",
confirmText: "确认",
cancelText: "取消",
success(res) {
if (res.confirm) {
that.productReleasePost(item);
that.productDelPost(item);
}
}
})
},
productReleasePost(item) {
let { businessCommunicationDemandId, state } = item;
$request.post(`/businessCommunicationDemand/outDemand.action`, { businessCommunicationDemandId, state }
productDelPost(item) {
let { businessCommunicationDemandId } = item;
wx.showLoading({
title: '加载中',
mask:true
})
$request.post(`/businessCommunicationDemand/deleteDemand.action`,
{ businessCommunicationDemandId }
).then(res => {
wx.hideLoading()
if (res.status == 0) {
wx.showToast({
title: state == 0 ? '下架' : '上架' + '成功',
title: '删除成功',
icon: 'success',
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({
@@ -112,6 +169,7 @@ Page({
}
}).catch(error => {
console.log(error, 'error appletLogin')
wx.hideLoading()
})
},
getListData() {
@@ -163,6 +221,7 @@ Page({
console.log(error, 'error appletLogin')
})
},
//
/**
* 页面上拉触底事件的处理函数
*/

+ 1
- 1
pages/myModule/components/myRelease/myRelease.wxml Parādīt failu

@@ -36,7 +36,7 @@
<van-button plain type="info" size="small" round class="foot-van-btn" data-item="{{ item }}" bindtap="productRelease">
{{ item.state == 0 ? '下架' : '上架' }}
</van-button>
<van-button plain type="info" size="small" round class="foot-van-btn">删除</van-button>
<van-button plain type="info" size="small" round class="foot-van-btn" data-item="{{ item }}" bindtap="productDel">删除</van-button>
</view>
</view>
<view class="text-center" wx:if="{{ itemLoading }}">

+ 1
- 1
utils/request.js Parādīt failu

@@ -12,7 +12,7 @@ const request = async (url, options, contentType) => {
}
}, 500);
})
!!contentType?contentType:contentType="application/json"
!!contentType?contentType:contentType="application/x-www-form-urlencoded'"
return new Promise( (resolve, reject) => {
wx.request({
url: `${app.mangerUrl}${url}?openId=${openId}`,//获取域名接口地址

Notiek ielāde…
Atcelt
Saglabāt