hookehuyr

🐞 fix: 时间比对兼容性问题处理

1 <!-- 1 <!--
2 * @Date: 2022-09-20 15:39:37 2 * @Date: 2022-09-20 15:39:37
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-11-03 16:17:22 4 + * @LastEditTime: 2022-11-03 18:05:26
5 * @FilePath: /swx/src/components/activity-card.vue 5 * @FilePath: /swx/src/components/activity-card.vue
6 * @Description: 活动卡片组件 6 * @Description: 活动卡片组件
7 --> 7 -->
...@@ -82,13 +82,13 @@ const formatStatus = (item) => { ...@@ -82,13 +82,13 @@ const formatStatus = (item) => {
82 return '已结束'; 82 return '已结束';
83 } else if (item?.status === 'disable') { 83 } else if (item?.status === 'disable') {
84 return '未发布'; 84 return '未发布';
85 - } else if (+new Date(item.server_time) < +new Date(item.reg_begin_time)) { 85 + } else if (item?.server_time < item?.reg_begin_time) {
86 return '报名未开始'; 86 return '报名未开始';
87 - } else if (+new Date(item.server_time) > +new Date(item.reg_begin_time) && +new Date(item.server_time) < +new Date(item.reg_end_time)) { 87 + } else if (item?.server_time > item?.reg_begin_time && item?.server_time < item?.reg_end_time) {
88 return '报名中'; 88 return '报名中';
89 - } else if (+new Date(item.server_time) > +new Date(item.reg_end_time)) { 89 + } else if (item?.server_time > item?.reg_end_time) {
90 return '报名结束'; 90 return '报名结束';
91 - } else if (+new Date(item.activity_time) < +new Date(item.server_time)) { 91 + } else if (item?.activity_time < item?.server_time1) {
92 return '活动进行中'; 92 return '活动进行中';
93 } 93 }
94 } 94 }
......
1 <!-- 1 <!--
2 * @Date: 2022-09-26 14:36:57 2 * @Date: 2022-09-26 14:36:57
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-11-03 16:27:17 4 + * @LastEditTime: 2022-11-03 18:06:24
5 * @FilePath: /swx/src/pages/activityDetail/index.vue 5 * @FilePath: /swx/src/pages/activityDetail/index.vue
6 * @Description: 活动详情页 6 * @Description: 活动详情页
7 --> 7 -->
...@@ -625,7 +625,7 @@ export default { ...@@ -625,7 +625,7 @@ export default {
625 if (this.activity.reg_max && (this.activity.reg_count === this.activity.reg_max)) { 625 if (this.activity.reg_max && (this.activity.reg_count === this.activity.reg_max)) {
626 Toast('活动人员已满'); 626 Toast('活动人员已满');
627 return false; 627 return false;
628 - } else if (+new Date(this.server_time) > +new Date(this.activity.reg_end_time)) { 628 + } else if (this.server_time > this.activity.reg_end_time) {
629 Toast('报名已结束'); 629 Toast('报名已结束');
630 return false; 630 return false;
631 } else if (type === 'join') { 631 } else if (type === 'join') {
......
1 <!-- 1 <!--
2 * @Date: 2022-09-21 16:04:10 2 * @Date: 2022-09-21 16:04:10
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-11-03 15:47:28 4 + * @LastEditTime: 2022-11-03 18:07:08
5 * @FilePath: /swx/src/pages/createActivity/index.vue 5 * @FilePath: /swx/src/pages/createActivity/index.vue
6 * @Description: 创建活动页面 6 * @Description: 创建活动页面
7 --> 7 -->
...@@ -722,11 +722,11 @@ const validForm = () => { // 校验表单 ...@@ -722,11 +722,11 @@ const validForm = () => { // 校验表单
722 Toast('报名截止时间不能为空'); 722 Toast('报名截止时间不能为空');
723 return false; 723 return false;
724 } 724 }
725 - if (+new Date(reg_begin_time.value) > +new Date(reg_end_time.value)) { 725 + if (reg_begin_time.value > reg_end_time.value) {
726 Toast('报名开始时间不能晚于报名截止时间'); 726 Toast('报名开始时间不能晚于报名截止时间');
727 return false; 727 return false;
728 } 728 }
729 - if (+new Date(activity_time.value) < +new Date(reg_begin_time.value) || +new Date(activity_time.value) > (reg_end_time.value)) { 729 + if (activity_time.value < reg_begin_time.value || activity_time.value > reg_end_time.value) {
730 Toast('活动时间请在报名时间之间'); 730 Toast('活动时间请在报名时间之间');
731 return false; 731 return false;
732 } 732 }
......
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-11-03 15:35:34 4 + * @LastEditTime: 2022-11-03 18:07:49
5 * @FilePath: /swx/src/pages/myCreateActivity/index.vue 5 * @FilePath: /swx/src/pages/myCreateActivity/index.vue
6 * @Description: 创建的活动页面 6 * @Description: 创建的活动页面
7 --> 7 -->
...@@ -228,14 +228,14 @@ export default { ...@@ -228,14 +228,14 @@ export default {
228 } 228 }
229 const { code, data } = await addListAPI(params); 229 const { code, data } = await addListAPI(params);
230 if (code) { 230 if (code) {
231 + this.server_time = formatDate(data.server_time);
232 + data.activity_list.forEach(item => {
233 + item.server_time = formatDate(data.server_time);
234 + });
231 this.activity_list = data.activity_list; 235 this.activity_list = data.activity_list;
232 this.activity_count = data.activity_count ? data.activity_count : 0; 236 this.activity_count = data.activity_count ? data.activity_count : 0;
233 this.volunteer_count = data.volunteer_count ? data.volunteer_count : 0; 237 this.volunteer_count = data.volunteer_count ? data.volunteer_count : 0;
234 this.player_count = data.player_count ? data.player_count : 0; 238 this.player_count = data.player_count ? data.player_count : 0;
235 - this.server_time = formatDate(data.server_time);
236 - this.activity_list.forEach(item => {
237 - item.server_time = this.server_time
238 - });
239 this.page = this.page + 1; 239 this.page = this.page + 1;
240 } 240 }
241 }, 241 },
...@@ -492,7 +492,7 @@ export default { ...@@ -492,7 +492,7 @@ export default {
492 this.currentEndDate = new Date().getTime(); 492 this.currentEndDate = new Date().getTime();
493 }, 493 },
494 confirmTime () { // 确认时间区间 494 confirmTime () { // 确认时间区间
495 - if (+new Date(this.filter_begin_time) > +new Date(this.filter_end_time)) { 495 + if (this.filter_begin_time > this.filter_end_time) {
496 Toast('开始时间不能大于结束时间') 496 Toast('开始时间不能大于结束时间')
497 } else { 497 } else {
498 this.show_time_popup = false; 498 this.show_time_popup = false;
......