Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
swx_weapp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2022-10-31 19:21:07 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d6e8c760318a9ab7c543ef9e558e09bd0d57166d
d6e8c760
1 parent
84b9bae0
调整时间相关逻辑
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
10 deletions
src/components/activity-card.vue
src/pages/my/index.vue
src/pages/myCreateActivity/index.vue
src/components/activity-card.vue
View file @
d6e8c76
<!--
* @Date: 2022-09-20 15:39:37
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-31 1
8:37:0
2
* @LastEditTime: 2022-10-31 1
9:15:1
2
* @FilePath: /swx/src/components/activity-card.vue
* @Description: 活动卡片组件
-->
...
...
@@ -20,7 +20,7 @@
<van-tag v-if="data.mode === 'online'" :round="true" color="#E9FAF4" text-color="#199A74" size="large">线上活动</van-tag>
<van-tag v-if="formatStatus(data) === '未发布'" :round="true" color="#FFF5E4" text-color="#FF7300" size="large">{{ formatStatus(data) }}</van-tag>
<van-tag v-else-if="formatStatus(data) === '已结束'" :round="true" color="#EDEDED" text-color="#909090" size="large">{{ formatStatus(data) }}</van-tag>
<van-tag v-else :round="true" color="#D7FFD7" text-color="#019200" size="large">{{ formatStatus(data) }}</van-tag>
<van-tag v-else
-if="formatStatus(data)"
:round="true" color="#D7FFD7" text-color="#019200" size="large">{{ formatStatus(data) }}</van-tag>
</view>
<view style="font-size: 0.95rem;">
<van-icon name="clock-o" color="#BBBBBB" /> {{ formatDate(data.activity_time) }}
...
...
@@ -82,17 +82,18 @@ const formatDate = (date) => {
}
const formatStatus = (item) => {
console.warn(item);
if (item?.is_end) {
return '已结束';
} else if (item?.status === 'disable') {
return '未发布';
} else if (+new Date(item.server_time)
>
+new Date(item.reg_begin_time)) {
} else if (+new Date(item.server_time)
<
+new Date(item.reg_begin_time)) {
return '报名未开始';
} else if (+new Date(item.reg_begin_time) > +new Date(item.server_time) && +new Date(item.server_time) > +new Date(item.reg_end_time)) {
return '报名中';
} else if (+new Date(item.
reg_end_time) > +new Date(item.server_time) && +new Date(item.server_time) > +new Date(item.activity
_time)) {
} else if (+new Date(item.
server_time) > +new Date(item.reg_end
_time)) {
return '报名结束';
} else if (+new Date(item.activity_time)
>
+new Date(item.server_time)) {
} else if (+new Date(item.activity_time)
<
+new Date(item.server_time)) {
return '活动进行中';
}
}
...
...
src/pages/my/index.vue
View file @
d6e8c76
<!--
* @Date: 2022-09-21 14:51:44
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-31 1
7:31:18
* @LastEditTime: 2022-10-31 1
9:06:46
* @FilePath: /swx/src/pages/my/index.vue
* @Description: 我的页面
-->
...
...
@@ -164,9 +164,9 @@ export default {
if (code) {
data.activity_list.forEach(item => {
item.server_time = data.server_time;
item.reg_begin_time = this.formatDate(
data
.reg_begin_time);
item.reg_end_time = this.formatDate(
data
.reg_end_time);
item.activity_time = this.formatDate(
data
.activity_time);
item.reg_begin_time = this.formatDate(
item
.reg_begin_time);
item.reg_end_time = this.formatDate(
item
.reg_end_time);
item.activity_time = this.formatDate(
item
.activity_time);
})
this.activity_list = data.activity_list;
this.nickname = data.user.nickname;
...
...
src/pages/myCreateActivity/index.vue
View file @
d6e8c76
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-31 1
7:16:06
* @LastEditTime: 2022-10-31 1
9:20:15
* @FilePath: /swx/src/pages/myCreateActivity/index.vue
* @Description: 创建的活动页面
-->
...
...
@@ -164,6 +164,9 @@ export default {
this.volunteer_count = data.volunteer_count ? data.volunteer_count : 0;
this.player_count = data.player_count ? data.player_count : 0;
this.server_time = this.formatDate(data.server_time);
this.activity_list.forEach(item => {
item.server_time = this.server_time
});
this.page = this.page + 1;
}
},
...
...
@@ -246,6 +249,9 @@ export default {
this.player_count = data.player_count ? data.player_count : 0;
this.page = this.page + 1;
this.flag = true;
this.activity_list.forEach(item => {
item.server_time = this.server_time
});
} else {
Toast('没有数据')
}
...
...
Please
register
or
login
to post a comment