完成供应需求API对接

dev
lynn 6 months ago
parent a67f5ffb68
commit be2b86ad2a

@ -36,7 +36,10 @@ let apiApp = {
otherUploadFile: '/api/mobile/upload-file', otherUploadFile: '/api/mobile/upload-file',
getparameter: '/api/admin/parameter/show', getparameter: '/api/admin/parameter/show',
updateDonates: '/api/mobile/user/update-donates', updateDonates: '/api/mobile/user/update-donates',
uploadFile:'/api/mobile/upload-file' uploadFile:'/api/mobile/upload-file',
// 供应需求
supplyDemandSave: '/api/mobile/supply-demand/save',
} }
// 此处第二个参数vm就是我们在页面使用的this你可以通过vm获取vuex等操作 // 此处第二个参数vm就是我们在页面使用的this你可以通过vm获取vuex等操作
@ -84,6 +87,10 @@ const install = (Vue, vm) => {
let updateDonates = (params = {}) => vm.$u.post(apiApp.updateDonates, params); let updateDonates = (params = {}) => vm.$u.post(apiApp.updateDonates, params);
let uploadFile = (params = {}) => vm.$u.post(apiApp.uploadFile, params); let uploadFile = (params = {}) => vm.$u.post(apiApp.uploadFile, params);
// 供应需求
let supplyDemandSave = (params = {}) => vm.$u.post(apiApp.supplyDemandSave, params);
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下 // 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
vm.$u.api = { vm.$u.api = {
// 用户 // 用户
@ -121,7 +128,10 @@ const install = (Vue, vm) => {
otherUploadFile, otherUploadFile,
getparameter: getparameter, getparameter: getparameter,
updateDonates:updateDonates, updateDonates:updateDonates,
uploadFile:uploadFile uploadFile:uploadFile,
// 供应需求
supplyDemandSave,
}; };
} }

@ -117,12 +117,26 @@
this.form.tags.splice(index, 1); this.form.tags.splice(index, 1);
}, },
submit() { submit() {
// const params = {
console.log(this.form) title: this.form.title,
type: this.form.type === 'supply' ? 1 : 2,
content: this.form.description,
tag: this.form.tags.join(','),
wechat: this.form.contactType === 'wechat' ? this.form.contactValue : '',
mobile: this.form.contactType === 'phone' ? this.form.contactValue : '',
email: this.form.contactType === 'email' ? this.form.contactValue : ''
};
this.$u.api.supplyDemandSave(params).then(res => {
uni.showToast({ uni.showToast({
title: '发布成功', title: '发布成功',
icon: 'success' icon: 'success',
}) success: () => {
setTimeout(() => {
uni.navigateBack();
}, 1200);
}
});
});
} }
} }
} }

Loading…
Cancel
Save