|
@@ -63,7 +63,8 @@
|
|
|
<view class="uni-input text">{{classify}}</view>
|
|
|
</view>
|
|
|
<view class="arrow">
|
|
|
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
+ <image
|
|
|
+ src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
mode="aspectFill"></image>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -91,7 +92,8 @@
|
|
|
<view class="uni-input text">{{recruitment}}</view>
|
|
|
</view>
|
|
|
<view class="arrow">
|
|
|
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
+ <image
|
|
|
+ src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
mode="aspectFill"></image>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -117,7 +119,8 @@
|
|
|
<view class="uni-input text">{{activityform}}</view>
|
|
|
</view>
|
|
|
<view class="arrow">
|
|
|
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
+ <image
|
|
|
+ src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
mode="aspectFill"></image>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -142,7 +145,8 @@
|
|
|
<view class="uni-input text">{{address}}</view>
|
|
|
</view>
|
|
|
<view class="arrow">
|
|
|
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
+ <image
|
|
|
+ src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
mode="aspectFill"></image>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -181,23 +185,26 @@
|
|
|
活动时间
|
|
|
</text>
|
|
|
</view>
|
|
|
-
|
|
|
+
|
|
|
<view class="option_right">
|
|
|
<view class="input_details">
|
|
|
<view class="details">
|
|
|
<!-- <view class="uni-input text">{{ activityDate }}</view> -->
|
|
|
- <u-calendar :show="show" :mode="mode" @confirm="confirm" :closeOnClickOverlay="true" @close="show=false"></u-calendar>
|
|
|
+ <u-calendar :show="show" :mode="mode" @confirm="confirm" :closeOnClickOverlay="true"
|
|
|
+ @close="show=false"></u-calendar>
|
|
|
<view class="text">
|
|
|
{{ activityDate }}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="arrow">
|
|
|
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png" mode="aspectFill"></image>
|
|
|
+ <image
|
|
|
+ src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
+ mode="aspectFill"></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
+
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="userOptionsBox">
|
|
@@ -216,7 +223,8 @@
|
|
|
<view class="uni-input text">{{funds}}</view>
|
|
|
</view>
|
|
|
<view class="arrow">
|
|
|
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
+ <image
|
|
|
+ src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
mode="aspectFill"></image>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -243,7 +251,8 @@
|
|
|
<view class="uni-input text">{{ deadlineDate }}</view>
|
|
|
</view>
|
|
|
<view class="arrow">
|
|
|
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
+ <image
|
|
|
+ src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
|
|
|
mode="aspectFill"></image>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -283,7 +292,8 @@
|
|
|
<view class="popup-container" style="height: 175px;" v-show="showPopupConfirm">
|
|
|
<view class="popup">
|
|
|
<view class="header" style="margin-top: 15px;">
|
|
|
- <image src="https://teacherapi.cocorobo.cn/teaching-file/static//gou1.png" mode="aspectFill"></image>
|
|
|
+ <image src="https://teacherapi.cocorobo.cn/teaching-file/static//gou1.png" mode="aspectFill">
|
|
|
+ </image>
|
|
|
<text style="margin-bottom: 24px;">{{ poptext }}成功</text>
|
|
|
</view>
|
|
|
<view class="footer" style="padding-top: 0px;">
|
|
@@ -355,7 +365,8 @@
|
|
|
// activityDate: currentDate,
|
|
|
activityDate: '请选择',
|
|
|
deadlineDate: currentDate,
|
|
|
- activeList: []
|
|
|
+ activeList: [],
|
|
|
+ formData: {}
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -367,10 +378,13 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ clearData() {
|
|
|
+ this.$store.commit('removeData');
|
|
|
+ },
|
|
|
confirm(e) {
|
|
|
console.log(e);
|
|
|
- console.log(e[0],e[e.length-1]);
|
|
|
- this.activityDate = e[0] + '~' + e[e.length-1]
|
|
|
+ console.log(e[0], e[e.length - 1]);
|
|
|
+ this.activityDate = e[0] + '~' + e[e.length - 1]
|
|
|
this.show = false
|
|
|
},
|
|
|
editPublish() {
|
|
@@ -419,28 +433,46 @@
|
|
|
submitForm() {
|
|
|
//判断表单内容是否完整
|
|
|
const conditions = [
|
|
|
- // 添加提示信息
|
|
|
- { value: this.activitytitle.trim(), message: '请填写活动标题' },
|
|
|
- { value: this.activityintro.trim(), message: '请填写活动内容' },
|
|
|
- { value: this.classify, message: '请填写活动分类' },
|
|
|
- { value: this.recruitment, message: '请填写招募人数' },
|
|
|
- { value: this.address, message: '请填写活动地址' },
|
|
|
- { value: this.activityDate, message: '请填写活动时间' },
|
|
|
+ // 添加提示信息
|
|
|
+ {
|
|
|
+ value: this.activitytitle.trim(),
|
|
|
+ message: '请填写活动标题'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: this.activityintro.trim(),
|
|
|
+ message: '请填写活动内容'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: this.classify,
|
|
|
+ message: '请填写活动分类'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: this.recruitment,
|
|
|
+ message: '请填写招募人数'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: this.address,
|
|
|
+ message: '请填写活动地址'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: this.activityDate,
|
|
|
+ message: '请填写活动时间'
|
|
|
+ },
|
|
|
];
|
|
|
for (const condition of conditions) {
|
|
|
- if (!condition.value || condition.value === '请选择') {
|
|
|
- uni.showToast({
|
|
|
- title: condition.message,
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (!condition.value || condition.value === '请选择') {
|
|
|
+ uni.showToast({
|
|
|
+ title: condition.message,
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//判断没有填写的表单内容是否填写,如果没有替换
|
|
|
if (
|
|
|
this.imageValue == '' ||
|
|
|
- this.activityform.trim() === '请选择' ||
|
|
|
+ this.activityform === '请选择' ||
|
|
|
this.funds === '请选择'
|
|
|
) {
|
|
|
this.imageValue = 'https://teacherapi.cocorobo.cn/teaching-file/static//zanwu_img.png'
|
|
@@ -465,7 +497,7 @@
|
|
|
this.classify = 2
|
|
|
}
|
|
|
// 将文本框内容和图片链接存储在一个对象中
|
|
|
- const formData = {
|
|
|
+ this.formData = {
|
|
|
// id: this.$store.state.user.openid,
|
|
|
id: this.btntext === '修改发布' ? this.acId : this.$store.state.user.openid,
|
|
|
activitytitle: this.activitytitle,
|
|
@@ -489,20 +521,29 @@
|
|
|
if (this.btntext === '修改发布') {
|
|
|
// formData.acId = this.acId
|
|
|
// console.log(formData);
|
|
|
- this.$request('/updateMyPublish', 'POST', formData).then(res => {
|
|
|
+ this.$request('/updateMyPublish', 'POST', this.formData).then(res => {
|
|
|
console.log(res);
|
|
|
setTimeout(() => {
|
|
|
uni.navigateBack();
|
|
|
}, 500)
|
|
|
})
|
|
|
} else {
|
|
|
- this.$request('/insertActive', 'POST', formData).then(res => {
|
|
|
+ this.$request('/insertActive', 'POST', this.formData).then(res => {
|
|
|
console.log(res.data);
|
|
|
if (res.code == 200) {
|
|
|
+ this.activitytitle = ''
|
|
|
+ this.activityintro = ''
|
|
|
+ this.imageValue = ''
|
|
|
+ this.classify = '请选择'
|
|
|
+ this.recruitment = '请选择'
|
|
|
+ this.activityform = '请选择'
|
|
|
+ this.address = '请选择'
|
|
|
+ this.funds = '请选择'
|
|
|
+ this.activityDate = '请选择'
|
|
|
+ this.deadlineDate = '请选择'
|
|
|
setTimeout(() => {
|
|
|
- uni.switchTab({
|
|
|
- url: "/pages/activityPage/activityPage"
|
|
|
- })
|
|
|
+ this.clearData()
|
|
|
+ uni.navigateBack();
|
|
|
}, 500)
|
|
|
}
|
|
|
})
|
|
@@ -591,7 +632,51 @@
|
|
|
this.editPublish()
|
|
|
this.isFirstShow = false
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+ this.formData = this.$store.state.formData
|
|
|
+ console.log(this.formData);
|
|
|
+ this.activitytitle = this.formData.activitytitle
|
|
|
+ this.activityintro = this.formData.activityintro
|
|
|
+ this.imageValue = this.formData.imageValue
|
|
|
+ this.classify = this.formData.classify
|
|
|
+ this.recruitment = this.formData.recruitment
|
|
|
+ this.activityform = this.formData.activityform
|
|
|
+ this.address = this.formData.address
|
|
|
+ this.funds = this.formData.funds
|
|
|
+ this.activityDate = this.formData.activityDate
|
|
|
+ this.deadlineDate = this.formData.deadlineDate
|
|
|
+ switch (this.classify) {
|
|
|
+ case 0:
|
|
|
+ this.classify = "直播活动";
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ this.classify = "常规教研活动";
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ this.classify = "专题教研活动";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ this.classify = "请选择";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ // 在组件销毁之前保存表单数据到 Vuex 中
|
|
|
+ this.formData = {
|
|
|
+ activitytitle: this.activitytitle,
|
|
|
+ activityintro: this.activityintro,
|
|
|
+ imageValue: this.imageValue,
|
|
|
+ classify: this.classify,
|
|
|
+ recruitment: this.recruitment,
|
|
|
+ activityform: this.activityform,
|
|
|
+ address: this.address,
|
|
|
+ funds: this.funds,
|
|
|
+ activityDate: this.activityDate,
|
|
|
+ deadlineDate: this.deadlineDate
|
|
|
+ }
|
|
|
+ this.$store.commit('saveformData', this.formData);
|
|
|
+ console.log('Submitted formData:', this.formData);
|
|
|
+ console.log('Current state.formData:', this.$store.state.formData);
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|