|
@@ -17,7 +17,9 @@ Page({
|
|
|
key2: '', //活动地点
|
|
|
key3: '', //活动开始时间
|
|
|
key4: '', //活动结束时间
|
|
|
- key5: '' //活动描述
|
|
|
+ key5: '', //活动描述
|
|
|
+ money: 0,
|
|
|
+ num: 30
|
|
|
},
|
|
|
isShowForm: {
|
|
|
key1: false,
|
|
@@ -45,7 +47,13 @@ Page({
|
|
|
userInfo: {},
|
|
|
//编辑
|
|
|
actid: '',
|
|
|
- actiddetail: {}
|
|
|
+ actiddetail: {},
|
|
|
+ switch1Checked: false
|
|
|
+ },
|
|
|
+ switch1Change(e){
|
|
|
+ this.setData({
|
|
|
+ switch1Checked: e.detail.value
|
|
|
+ })
|
|
|
},
|
|
|
async getPhoneNumber(e) {
|
|
|
const that = this;
|
|
@@ -79,10 +87,10 @@ Page({
|
|
|
"starttime": this.data.form.key3,
|
|
|
"endtime": this.data.form.key4 || this.data.form.key3,
|
|
|
"deadline": this.data.form.key3,
|
|
|
- "capacity": 50,
|
|
|
+ "capacity": this.data.form.num,
|
|
|
"content": this.data.form.key5,
|
|
|
"images": this.data.imgList.length ? this.data.imgList.join(';') : '',
|
|
|
- "attendfee": 30,
|
|
|
+ "attendfee": this.data.form.money,
|
|
|
"organizer": app.globalData.userInfo.phone,
|
|
|
"private": privateObj.private
|
|
|
};
|
|
@@ -125,24 +133,26 @@ Page({
|
|
|
if (!this.data.imgList.length) return util.myShowToast('至少上传一张图片!');
|
|
|
|
|
|
|
|
|
- const that = this;
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '是否公开您发起的活动?',
|
|
|
- cancelText: '否',
|
|
|
- confirmText: '是',
|
|
|
- success (res) {
|
|
|
- if (res.confirm) {
|
|
|
- that.isOpen({
|
|
|
- private: 0 //不公开
|
|
|
- });
|
|
|
- } else if (res.cancel) {
|
|
|
- that.isOpen({
|
|
|
- private: 1
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ this.isOpen({
|
|
|
+ private: this.data.switch1Checked?1:0 //不公开
|
|
|
+ });
|
|
|
+ // wx.showModal({
|
|
|
+ // title: '提示',
|
|
|
+ // content: '是否公开您发起的活动?',
|
|
|
+ // cancelText: '否',
|
|
|
+ // confirmText: '是',
|
|
|
+ // success (res) {
|
|
|
+ // if (res.confirm) {
|
|
|
+ // that.isOpen({
|
|
|
+ // private: 0 //不公开
|
|
|
+ // });
|
|
|
+ // } else if (res.cancel) {
|
|
|
+ // that.isOpen({
|
|
|
+ // private: 1
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
|
|
|
|
|
|
|
|
@@ -197,39 +207,45 @@ Page({
|
|
|
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
|
sourceType: ['album', 'camera'],
|
|
|
success: function (res) {
|
|
|
- var tempFilePaths = res.tempFilePaths;
|
|
|
- var tempFilesSize = res.tempFiles[0].size;
|
|
|
+ // var tempFilePaths = res.tempFilePaths;
|
|
|
+ const tempFilesSize = res.tempFiles[0].size;
|
|
|
|
|
|
- wx.showLoading({
|
|
|
- title: '上传中...',
|
|
|
- });
|
|
|
+ // wx.showLoading({
|
|
|
+ // title: '上传中...',
|
|
|
+ // });
|
|
|
if (tempFilesSize > 2000000) { //图片小于或者等于1M时 可以执行获取图片
|
|
|
return wx.showToast({
|
|
|
title: '上传图片不能大于2M!', //标题
|
|
|
icon: 'none' //图标 none不使用图标,详情看官方文档
|
|
|
})
|
|
|
}
|
|
|
- wx.uploadFile({
|
|
|
- url: 'https://hw.cirray.cn/api/upload_image', //仅为示例,非真实的接口地址
|
|
|
- filePath: tempFilePaths[0],
|
|
|
- name: 'file',
|
|
|
- formData: {},
|
|
|
- success: function (res) {
|
|
|
- // wx.hideLoading()
|
|
|
- let imgList = [...that.data.imgList, res.data];
|
|
|
- that.setData({
|
|
|
- imgList
|
|
|
- });
|
|
|
- wx.hideLoading()
|
|
|
- },
|
|
|
- fail(e) {
|
|
|
- wx.showToast({
|
|
|
- title: '上传失败,请稍后重试!',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- // wx.hideLoading()
|
|
|
- }
|
|
|
+ const src = res.tempFilePaths[0];
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '../upload/index?src=' + src
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
+ // wx.uploadFile({
|
|
|
+ // url: 'https://hw.cirray.cn/api/upload_image', //仅为示例,非真实的接口地址
|
|
|
+ // filePath: tempFilePaths[0],
|
|
|
+ // name: 'file',
|
|
|
+ // formData: {},
|
|
|
+ // success: function (res) {
|
|
|
+ // // wx.hideLoading()
|
|
|
+ // let imgList = [...that.data.imgList, res.data];
|
|
|
+ // that.setData({
|
|
|
+ // imgList
|
|
|
+ // });
|
|
|
+ // wx.hideLoading()
|
|
|
+ // },
|
|
|
+ // fail(e) {
|
|
|
+ // wx.showToast({
|
|
|
+ // title: '上传失败,请稍后重试!',
|
|
|
+ // icon: 'none'
|
|
|
+ // })
|
|
|
+ // // wx.hideLoading()
|
|
|
+ // }
|
|
|
+ // })
|
|
|
}
|
|
|
})
|
|
|
},
|