|
@@ -37,6 +37,7 @@
|
|
|
:file-list="fileList"
|
|
|
@after-read="uploadRYXXZP"
|
|
|
:show-upload="true"
|
|
|
+ accept="media"
|
|
|
/>
|
|
|
</div>
|
|
|
</li>
|
|
@@ -83,9 +84,9 @@
|
|
|
<div class="detailLi2Box">
|
|
|
<van-uploader
|
|
|
:max-count="6"
|
|
|
- @delete="deleteRYXXZP"
|
|
|
- :file-list="fileList"
|
|
|
- @after-read="uploadRYXXZP"
|
|
|
+ @delete="deleteRYXXZP2"
|
|
|
+ :file-list="fileList2"
|
|
|
+ @after-read="uploadRYXXZP2"
|
|
|
:show-upload="true"
|
|
|
/>
|
|
|
</div>
|
|
@@ -105,11 +106,11 @@
|
|
|
<span style="color: red">*</span> 活动地址
|
|
|
</span>
|
|
|
<div class="placeBox">
|
|
|
- <input placeholder="使用地图拾取" class="timeIpt" v-model="form.activityAddress" disabled>
|
|
|
+ <input placeholder="使用地图拾取" class="locationIpt" v-model="form.activityAddress" disabled>
|
|
|
<van-icon name="location" style="color: rgba(51, 51, 51, 0.90);font-size: 30rpx" @tap="toMap"/>
|
|
|
</div>
|
|
|
<div class="placeBox">
|
|
|
- <input placeholder="请补充详细地址,如楼栋-门牌号" class="timeIpt" v-model="form.activityAddressDetail">
|
|
|
+ <input placeholder="请补充详细地址,如楼栋-门牌号" class="locationIpt" v-model="form.activityAddressDetail">
|
|
|
</div>
|
|
|
</li>
|
|
|
</ul>
|
|
@@ -134,7 +135,7 @@
|
|
|
<span style="color: red">*</span> 报名时间
|
|
|
</span>
|
|
|
<div class="choosTimeBox">
|
|
|
- <input placeholder="请选择年月日时分" class="timeIpt" disabled v-model="regTime1" @click="showTime('regStartTime')">
|
|
|
+ <input placeholder="请选择年月日时分" class="timeIpt" disabled v-model="form.registrationStartTime" @click="showTime('regStartTime')">
|
|
|
<span class="midZ">至</span>
|
|
|
<input placeholder="自动带出" class="timeIpt" disabled v-model="form.activityStartTime" style="background: white">
|
|
|
<!-- <span>活动开始时间</span>-->
|
|
@@ -156,8 +157,8 @@
|
|
|
</ul>
|
|
|
</div>
|
|
|
<div class="buttonBox">
|
|
|
- <button class="btn zcBtn">暂存</button>
|
|
|
- <button class="btn fbBtn" @tap="submit('发布')">发布</button>
|
|
|
+ <button class="btn zcBtn" @tap="submit('0')">暂存</button>
|
|
|
+ <button class="btn fbBtn" @tap="submit('1')">发布</button>
|
|
|
</div>
|
|
|
<van-popup
|
|
|
:show="timeShow"
|
|
@@ -175,7 +176,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import {getByCodes} from "@/js_sdk/http";
|
|
|
+import { getByCodes,insertHomeCommunityActivity, getUserLocalStorageInfo} from "@/js_sdk/http";
|
|
|
export default {
|
|
|
data(){
|
|
|
return {
|
|
@@ -185,11 +186,11 @@ export default {
|
|
|
isCheck2:false,
|
|
|
time1Str:'',
|
|
|
time2Str:'',
|
|
|
- regTime1:'',
|
|
|
regTime1Str:'',
|
|
|
place:'',
|
|
|
currentDate: new Date().getTime(),
|
|
|
form:{
|
|
|
+ createdBy:getUserLocalStorageInfo().userId,
|
|
|
activityName:'',
|
|
|
activityType:'3',
|
|
|
activityPhone: '',
|
|
@@ -203,16 +204,38 @@ export default {
|
|
|
activityQuota:'',
|
|
|
longitude:'',
|
|
|
latitude:'',
|
|
|
+ registrationStartTime:'',
|
|
|
+ registrationEndTime:'',
|
|
|
+ annex:'',
|
|
|
+ releaseUserName:'',
|
|
|
},
|
|
|
phone:'',
|
|
|
tabList:[],
|
|
|
fileList:[],
|
|
|
+ fileList2:[],
|
|
|
optionsType:'',
|
|
|
timePickerType:'',
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
- console.log('options',options);
|
|
|
+ if (options.item){
|
|
|
+ const form = JSON.parse(options.item)
|
|
|
+ this.form = form
|
|
|
+ this.fileList = JSON.parse(form.annex)
|
|
|
+ const fileId = form.activityContentPicture.split(',')
|
|
|
+ fileId.forEach(item=>{
|
|
|
+ this.fileList2.push({
|
|
|
+ imgUrl: "/FileController/download/" + item,
|
|
|
+ id: item,
|
|
|
+ url:
|
|
|
+ this.$constant.BASE_URI +
|
|
|
+ "/FileController/download/" +
|
|
|
+ item,
|
|
|
+ type:'image',
|
|
|
+ isImage:true,
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
onShow(){
|
|
|
this.getByCodes()
|
|
@@ -293,10 +316,10 @@ export default {
|
|
|
this.$showToast("请选择合理时间");
|
|
|
return
|
|
|
}else{
|
|
|
- this.regTime1 = dateString
|
|
|
+ this.form.registrationStartTime = dateString
|
|
|
}
|
|
|
}else{
|
|
|
- this.regTime1 = dateString
|
|
|
+ this.form.registrationStartTime = dateString
|
|
|
}
|
|
|
}
|
|
|
this.timeShow = false
|
|
@@ -316,7 +339,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- submit(e){
|
|
|
+ submit(ele){
|
|
|
const _this = this;
|
|
|
if (_this.form.activityName === "") {
|
|
|
this.$showToast("请填写活动主题");
|
|
@@ -330,10 +353,6 @@ export default {
|
|
|
this.$showToast("请选择报名开始时间");
|
|
|
return;
|
|
|
}
|
|
|
- if (_this.form.registrationEndTime === "") {
|
|
|
- this.$showToast("请选择报名结束时间");
|
|
|
- return;
|
|
|
- }
|
|
|
if (_this.form.activityStartTime === "") {
|
|
|
this.$showToast("请选择活动开始时间");
|
|
|
return;
|
|
@@ -346,6 +365,10 @@ export default {
|
|
|
this.$showToast("请上传主题图");
|
|
|
return;
|
|
|
}
|
|
|
+ if (!_this.fileList2.length) {
|
|
|
+ this.$showToast("请上传活动内容图片");
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (_this.form.activityPhone === "") {
|
|
|
this.$showToast("请输入联系电话");
|
|
|
return;
|
|
@@ -354,14 +377,50 @@ export default {
|
|
|
this.$showToast("请输入活动地址");
|
|
|
return;
|
|
|
}
|
|
|
+ if (!_this.form.registrationConditions) {
|
|
|
+ this.$showToast("请输入报名条件");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!_this.form.activityAddressDetail) {
|
|
|
+ this.$showToast("请补充详细地址");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!_this.form.registrationStartTime) {
|
|
|
+ this.$showToast("请选择报名开始时间");
|
|
|
+ return;
|
|
|
+ }
|
|
|
// 差报名条件等必填
|
|
|
- console.log(_this.form)
|
|
|
+ // console.log(_this.form)
|
|
|
+ _this.form.registrationEndTime = this.form.activityStartTime
|
|
|
+ _this.form.annex = JSON.stringify(_this.fileList);
|
|
|
+ _this.form.releaseStatus = ele;
|
|
|
+ if (ele==='1'){
|
|
|
+ _this.form.releaseUserName = getUserLocalStorageInfo().username
|
|
|
+ }
|
|
|
+ const arr = []
|
|
|
+ _this.fileList2.forEach(e=>{
|
|
|
+ arr.push(e.id)
|
|
|
+ })
|
|
|
+ _this.form.activityContentPicture = arr.toString()
|
|
|
+ console.log('_this.form',_this.form)
|
|
|
+ insertHomeCommunityActivity(_this.form).then(res=>{
|
|
|
+ if (res.errno == 0){
|
|
|
+ this.$showToast("提交成功");
|
|
|
+ uni.navigateBack()
|
|
|
+ }else{
|
|
|
+ this.$showToast(res.errMsg);
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
deleteRYXXZP(event) {
|
|
|
this.fileList.splice(event.detail.index, 1);
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
+ deleteRYXXZP2(event) {
|
|
|
+ this.fileList2.splice(event.detail.index, 1);
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
uploadRYXXZP(event) {
|
|
|
// console.log(event)
|
|
|
let that = this;
|
|
@@ -402,6 +461,46 @@ export default {
|
|
|
fail(res) {},
|
|
|
});
|
|
|
},
|
|
|
+ uploadRYXXZP2(event) {
|
|
|
+ // console.log(event)
|
|
|
+ let that = this;
|
|
|
+ const { file } = event.detail;
|
|
|
+ console.log(event.detail)
|
|
|
+ uni.uploadFile({
|
|
|
+ url: that.$constant.BASE_URI + "/wx/fileController/upload",
|
|
|
+ filePath: file.url,
|
|
|
+ name: "file",
|
|
|
+ formData: { user: "test" },
|
|
|
+ success(res) {
|
|
|
+ // 上传完成需要更新 fileList
|
|
|
+ let data = JSON.parse(res.data);
|
|
|
+ if (event.detail.file.type==='image'){
|
|
|
+ that.fileList2.push({
|
|
|
+ imgUrl: "/FileController/download/" + data.data[0],
|
|
|
+ id: data.data[0],
|
|
|
+ url:
|
|
|
+ that.$constant.BASE_URI +
|
|
|
+ "/FileController/download/" +
|
|
|
+ data.data[0],
|
|
|
+ type:event.detail.file.type,
|
|
|
+ isImage:true,
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ that.fileList2.push({
|
|
|
+ imgUrl: "/FileController/download/" + data.data[0],
|
|
|
+ id: data.data[0],
|
|
|
+ url:
|
|
|
+ that.$constant.BASE_URI +
|
|
|
+ "/FileController/download/" +
|
|
|
+ data.data[0],
|
|
|
+ type:event.detail.file.type,
|
|
|
+ isVideo:true
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail(res) {},
|
|
|
+ });
|
|
|
+ },
|
|
|
// 时间选择单位
|
|
|
formatter(type, val) {
|
|
|
if (type === 'year') {
|
|
@@ -537,6 +636,14 @@ export default {
|
|
|
align-items: center;
|
|
|
font-size: 32rpx;
|
|
|
margin: 12rpx 0;
|
|
|
+ .locationIpt{
|
|
|
+ width: 600rpx;
|
|
|
+ height: 96rpx;
|
|
|
+ font-size: 32rpx;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ padding: 0 20rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|