소스 검색

临时提交代码~

release/210823_需求对对碰
王饶冀 3 년 전
부모
커밋
762979fa77
3개의 변경된 파일69개의 추가작업 그리고 10개의 파일을 삭제
  1. 67
    8
      pages/myModule/components/myRelease/myRelease.js
  2. 1
    1
      pages/myModule/components/myRelease/myRelease.wxml
  3. 1
    1
      utils/request.js

+ 67
- 8
pages/myModule/components/myRelease/myRelease.js 파일 보기

}, },
// 上架/下架需求 // 上架/下架需求
productRelease(e) { 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 item = e.currentTarget.dataset.item;
let that = this; let that = this;
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: "是否确认下架?",
content: "是否确认删除?",
confirmText: "确认", confirmText: "确认",
cancelText: "取消", cancelText: "取消",
success(res) { success(res) {
if (res.confirm) { 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 => { ).then(res => {
wx.hideLoading()
if (res.status == 0) { if (res.status == 0) {
wx.showToast({ wx.showToast({
title: state == 0 ? '下架' : '上架' + '成功',
title: '删除成功',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}) })
let listData = this.data.listData; let listData = this.data.listData;
listData.forEach(el => {
listData.forEach((el, inx) => {
if (el.businessCommunicationDemandId == businessCommunicationDemandId) { if (el.businessCommunicationDemandId == businessCommunicationDemandId) {
el.state = state == 0 ? 1 : 0;
listData.splice(inx, 1);
} }
}) })
this.setData({ this.setData({
} }
}).catch(error => { }).catch(error => {
console.log(error, 'error appletLogin') console.log(error, 'error appletLogin')
wx.hideLoading()
}) })
}, },
getListData() { getListData() {
console.log(error, 'error appletLogin') console.log(error, 'error appletLogin')
}) })
}, },
//
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */

+ 1
- 1
pages/myModule/components/myRelease/myRelease.wxml 파일 보기

<van-button plain type="info" size="small" round class="foot-van-btn" data-item="{{ item }}" bindtap="productRelease"> <van-button plain type="info" size="small" round class="foot-van-btn" data-item="{{ item }}" bindtap="productRelease">
{{ item.state == 0 ? '下架' : '上架' }} {{ item.state == 0 ? '下架' : '上架' }}
</van-button> </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> </view>
<view class="text-center" wx:if="{{ itemLoading }}"> <view class="text-center" wx:if="{{ itemLoading }}">

+ 1
- 1
utils/request.js 파일 보기

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

Loading…
취소
저장