hookehuyr

调整时间相关逻辑

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-10-31 18:37:02 4 + * @LastEditTime: 2022-10-31 19:15:12
5 * @FilePath: /swx/src/components/activity-card.vue 5 * @FilePath: /swx/src/components/activity-card.vue
6 * @Description: 活动卡片组件 6 * @Description: 活动卡片组件
7 --> 7 -->
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
20 <van-tag v-if="data.mode === 'online'" :round="true" color="#E9FAF4" text-color="#199A74" size="large">线上活动</van-tag> 20 <van-tag v-if="data.mode === 'online'" :round="true" color="#E9FAF4" text-color="#199A74" size="large">线上活动</van-tag>
21 <van-tag v-if="formatStatus(data) === '未发布'" :round="true" color="#FFF5E4" text-color="#FF7300" size="large">{{ formatStatus(data) }}</van-tag> 21 <van-tag v-if="formatStatus(data) === '未发布'" :round="true" color="#FFF5E4" text-color="#FF7300" size="large">{{ formatStatus(data) }}</van-tag>
22 <van-tag v-else-if="formatStatus(data) === '已结束'" :round="true" color="#EDEDED" text-color="#909090" size="large">{{ formatStatus(data) }}</van-tag> 22 <van-tag v-else-if="formatStatus(data) === '已结束'" :round="true" color="#EDEDED" text-color="#909090" size="large">{{ formatStatus(data) }}</van-tag>
23 - <van-tag v-else :round="true" color="#D7FFD7" text-color="#019200" size="large">{{ formatStatus(data) }}</van-tag> 23 + <van-tag v-else-if="formatStatus(data)" :round="true" color="#D7FFD7" text-color="#019200" size="large">{{ formatStatus(data) }}</van-tag>
24 </view> 24 </view>
25 <view style="font-size: 0.95rem;"> 25 <view style="font-size: 0.95rem;">
26 <van-icon name="clock-o" color="#BBBBBB" />&nbsp;{{ formatDate(data.activity_time) }} 26 <van-icon name="clock-o" color="#BBBBBB" />&nbsp;{{ formatDate(data.activity_time) }}
...@@ -82,17 +82,18 @@ const formatDate = (date) => { ...@@ -82,17 +82,18 @@ const formatDate = (date) => {
82 } 82 }
83 83
84 const formatStatus = (item) => { 84 const formatStatus = (item) => {
85 + console.warn(item);
85 if (item?.is_end) { 86 if (item?.is_end) {
86 return '已结束'; 87 return '已结束';
87 } else if (item?.status === 'disable') { 88 } else if (item?.status === 'disable') {
88 return '未发布'; 89 return '未发布';
89 - } else if (+new Date(item.server_time) > +new Date(item.reg_begin_time)) { 90 + } else if (+new Date(item.server_time) < +new Date(item.reg_begin_time)) {
90 return '报名未开始'; 91 return '报名未开始';
91 } else if (+new Date(item.reg_begin_time) > +new Date(item.server_time) && +new Date(item.server_time) > +new Date(item.reg_end_time)) { 92 } else if (+new Date(item.reg_begin_time) > +new Date(item.server_time) && +new Date(item.server_time) > +new Date(item.reg_end_time)) {
92 return '报名中'; 93 return '报名中';
93 - } else if (+new Date(item.reg_end_time) > +new Date(item.server_time) && +new Date(item.server_time) > +new Date(item.activity_time)) { 94 + } else if (+new Date(item.server_time) > +new Date(item.reg_end_time)) {
94 return '报名结束'; 95 return '报名结束';
95 - } else if (+new Date(item.activity_time) > +new Date(item.server_time)) { 96 + } else if (+new Date(item.activity_time) < +new Date(item.server_time)) {
96 return '活动进行中'; 97 return '活动进行中';
97 } 98 }
98 } 99 }
......
1 <!-- 1 <!--
2 * @Date: 2022-09-21 14:51:44 2 * @Date: 2022-09-21 14:51:44
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-10-31 17:31:18 4 + * @LastEditTime: 2022-10-31 19:06:46
5 * @FilePath: /swx/src/pages/my/index.vue 5 * @FilePath: /swx/src/pages/my/index.vue
6 * @Description: 我的页面 6 * @Description: 我的页面
7 --> 7 -->
...@@ -164,9 +164,9 @@ export default { ...@@ -164,9 +164,9 @@ export default {
164 if (code) { 164 if (code) {
165 data.activity_list.forEach(item => { 165 data.activity_list.forEach(item => {
166 item.server_time = data.server_time; 166 item.server_time = data.server_time;
167 - item.reg_begin_time = this.formatDate(data.reg_begin_time); 167 + item.reg_begin_time = this.formatDate(item.reg_begin_time);
168 - item.reg_end_time = this.formatDate(data.reg_end_time); 168 + item.reg_end_time = this.formatDate(item.reg_end_time);
169 - item.activity_time = this.formatDate(data.activity_time); 169 + item.activity_time = this.formatDate(item.activity_time);
170 }) 170 })
171 this.activity_list = data.activity_list; 171 this.activity_list = data.activity_list;
172 this.nickname = data.user.nickname; 172 this.nickname = data.user.nickname;
......
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-10-31 17:16:06 4 + * @LastEditTime: 2022-10-31 19:20:15
5 * @FilePath: /swx/src/pages/myCreateActivity/index.vue 5 * @FilePath: /swx/src/pages/myCreateActivity/index.vue
6 * @Description: 创建的活动页面 6 * @Description: 创建的活动页面
7 --> 7 -->
...@@ -164,6 +164,9 @@ export default { ...@@ -164,6 +164,9 @@ export default {
164 this.volunteer_count = data.volunteer_count ? data.volunteer_count : 0; 164 this.volunteer_count = data.volunteer_count ? data.volunteer_count : 0;
165 this.player_count = data.player_count ? data.player_count : 0; 165 this.player_count = data.player_count ? data.player_count : 0;
166 this.server_time = this.formatDate(data.server_time); 166 this.server_time = this.formatDate(data.server_time);
167 + this.activity_list.forEach(item => {
168 + item.server_time = this.server_time
169 + });
167 this.page = this.page + 1; 170 this.page = this.page + 1;
168 } 171 }
169 }, 172 },
...@@ -246,6 +249,9 @@ export default { ...@@ -246,6 +249,9 @@ export default {
246 this.player_count = data.player_count ? data.player_count : 0; 249 this.player_count = data.player_count ? data.player_count : 0;
247 this.page = this.page + 1; 250 this.page = this.page + 1;
248 this.flag = true; 251 this.flag = true;
252 + this.activity_list.forEach(item => {
253 + item.server_time = this.server_time
254 + });
249 } else { 255 } else {
250 Toast('没有数据') 256 Toast('没有数据')
251 } 257 }
......