ソースを参照

小程序开发~

release/210823_需求对对碰
王饶冀 3年前
コミット
43660b2a6d

+ 15
- 1
pages/myModule/components/myRelease/myRelease.js ファイルの表示

} }
}) })
this.setData({ this.setData({
listData
listData
}) })
} }
}).catch(error => { }).catch(error => {
wx.hideLoading() wx.hideLoading()
}) })
}, },
// 修改需求
productEdit(e){
let item = e.currentTarget.dataset.item;
let that = this;
wx.navigateTo({
url: '/pages/releaseModule/index',
success: function (res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('acceptDataFromOpenerPage', { listDetail: item })
}
})
},
// 数据加载提示 // 数据加载提示
showLoading(title) { showLoading(title) {
wx.showLoading({ wx.showLoading({
mask: true mask: true
}) })
}, },

getListData() { getListData() {
let { page, size, customerId, keyword, currentTab } = this.data; let { page, size, customerId, keyword, currentTab } = this.data;
$request.get('/businessCommunicationDemand/getDemandByStateAndCustomerId.action', $request.get('/businessCommunicationDemand/getDemandByStateAndCustomerId.action',

+ 1
- 1
pages/myModule/components/myRelease/myRelease.wxml ファイルの表示

> >
{{ item.isOnTop ? '取消置顶' : '置顶' }} {{ item.isOnTop ? '取消置顶' : '置顶' }}
</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="productEdit">修改</van-button>
<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>

+ 60
- 27
pages/releaseModule/index.js ファイルの表示

selectedTag: [], selectedTag: [],
detailValue: "", detailValue: "",
saveLoading:false, saveLoading:false,
businessCommunicationDemandId:null,
}, },


/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad() { onLoad() {
const eventChannel = this.getOpenerEventChannel()
if(eventChannel.on){
// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
eventChannel.on('acceptDataFromOpenerPage', data => {
let listDetail = data.listDetail;
this.setData({
detailValue: listDetail.info,
selectedTag: listDetail.type,
businessCommunicationDemandId:listDetail.businessCommunicationDemandId
})
})
}
this.getTags(); this.getTags();
}, },
// 输入框输入 // 输入框输入
el.isActive = 'active' + selectedTag.indexOf(el.typeName); el.isActive = 'active' + selectedTag.indexOf(el.typeName);
} }
}) })
console.log(tags)
this.setData({ this.setData({
selectedTag, selectedTag,
tags tags
this.setData({ this.setData({
saveLoading:true saveLoading:true
}) })
let { selectedTag, detailValue } = this.data;
let { selectedTag, detailValue,businessCommunicationDemandId } = this.data;
let param = { let param = {
customerId: 666967, customerId: 666967,
info: this.trimRight(detailValue), info: this.trimRight(detailValue),
type: selectedTag.join(','), type: selectedTag.join(','),
businessCommunicationDemandId: null,
businessCommunicationDemandId,
}; };
$request.post('/businessCommunicationDemand/saveDemand.action', param).then(res => { $request.post('/businessCommunicationDemand/saveDemand.action', param).then(res => {
this.setData({ this.setData({
}) })
let that = this; let that = this;
if (res.status == 0) { if (res.status == 0) {
wx.showModal({
title: '发布成功',
content: "请关注平台公众号,如有咨询,可及时接收消息通知!",
confirmText: "去关注",
cancelText:"关闭",
success (res1) {
if (res1.confirm) {
that.clearData();
console.log('用户点击确定')
} else if (res1.cancel) {
let listDetail = res.data;
if (typeof listDetail.type == 'string') {
listDetail.type = listDetail.type.split(',');
}
that.clearData();
wx.navigateTo({
url: '/pages/index/components/listDetails/Details',
success: function (res2) {
// 通过eventChannel向被打开页面传送数据
res2.eventChannel.emit('acceptDataFromOpenerPage', { listDetail })
if(!businessCommunicationDemandId){
wx.showModal({
title: '发布成功',
content: "请关注平台公众号,如有咨询,可及时接收消息通知!",
confirmText: "去关注",
cancelText:"关闭",
success (res1) {
if (res1.confirm) {
that.clearData();
console.log('用户点击确定')
} else if (res1.cancel) {
let listDetail = res.data;
if (typeof listDetail.type == 'string') {
listDetail.type = listDetail.type.split(',');
} }
})
that.clearData();
wx.navigateTo({
url: '/pages/index/components/listDetails/Details',
success: function (res2) {
// 通过eventChannel向被打开页面传送数据
res2.eventChannel.emit('acceptDataFromOpenerPage', { listDetail })
}
})
}
} }
}
})
})
}else{
wx.showLoading({
title: '修改成功',
mask: true
})
setTimeout(() => {
wx.hideLoading()
// wx.navigateBack()
}, 1000);
}
} else if (res.status == 501) { } else if (res.status == 501) {
wx.showModal({ wx.showModal({
title: '发布失败', title: '发布失败',
}) })
}, },
clearData(){ clearData(){
let tags = this.data.tags;
tags.forEach(el => {
el.isActive = '';
})
this.setData({ this.setData({
selectedTag:[], selectedTag:[],
detailValue:"", detailValue:"",
tags
}) })
}, },
trimRight(s) { trimRight(s) {
}) })
if (res.status == 0) { if (res.status == 0) {
let datas = res.data; let datas = res.data;
let selectedTag = this.data.selectedTag;
datas.forEach(el => { datas.forEach(el => {
el.isActive = false;
el.isActive = "";
if (selectedTag.indexOf(el.typeName) != -1) {
el.isActive = 'active' + selectedTag.indexOf(el.typeName);
}
}) })
this.setData({ this.setData({
tags: datas, tags: datas,

+ 1
- 1
pages/releaseModule/index.wxml ファイルの表示

<view wx:else> <view wx:else>
<!-- 顶部 --> <!-- 顶部 -->
<view class="section"> <view class="section">
<textarea class="section-textarea" bindinput="textareaInput" maxlength="{{ max }}" placeholder="请输入你的需求详情~ " />
<textarea class="section-textarea" value="{{ detailValue }}" bindinput="textareaInput" maxlength="{{ max }}" placeholder="请输入你的需求详情~ " />
<view class="limit">{{min}}/{{max}}</view> <view class="limit">{{min}}/{{max}}</view>
</view> </view>
<view class="tags-view"> <view class="tags-view">

読み込み中…
キャンセル
保存