-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Waiting for the development of group list component
- Loading branch information
1 parent
01b05cb
commit 20cdd4c
Showing
6 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!-- 拼团组件 --> | ||
<template> | ||
<div class="mb-4"> | ||
<n-card> | ||
<template #header> | ||
<div class="text-gray-500 text-sm"> | ||
{{ data.count }}人在拼单,可直接参与 | ||
</div> | ||
</template> | ||
<n-scrollbar style="height: 60px;"> | ||
<div class="flex items-center h-[60px] px-4" v-for="(item, index) in rows" :key="index"> | ||
<n-avatar :size="45" :src="item.users[0].avator" round></n-avatar> | ||
<span class="ml-2">{{ item.users[0].nickname ? item.users[0].nickname : | ||
item.users[0].username | ||
}}</span> | ||
|
||
<div class="ml-auto"> | ||
<p>还差 <span class="text-rose-500">{{ item.total - item.num }}人</span>拼成</p> | ||
<div class="text-xs text-gray-500 mt-1 flex items-center">剩余 | ||
<Seckill :time="item.end_time" @end="handleTimeUp(index)" /> | ||
</div> | ||
</div> | ||
<n-button type="primary" size="small" class="ml-2">去拼团</n-button> | ||
</div> | ||
|
||
</n-scrollbar> | ||
</n-card> | ||
|
||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { NCard, NScrollbar, NButton, NAvatar } from "naive-ui" | ||
|
||
const props = defineProps({ | ||
group_id: { | ||
type: Number, | ||
default: 0 | ||
} | ||
}); | ||
|
||
let { | ||
data, error | ||
} = useGetGroupWorkListApi(props.group_id) | ||
|
||
const rows = ref([]) | ||
if (!error.value) { | ||
rows.value = data.value.rows.map(o => { | ||
o.end_time = (new Date(o.created_time)).getTime() + 24 * 60 * 60 * 1000; | ||
o.loading = false; | ||
return o; | ||
}) | ||
} | ||
|
||
//移除事件 | ||
function handleTimeUp(index) { | ||
rows.value.splice(index, 1) | ||
data.value.count--; | ||
} | ||
</script> | ||
|
||
<style> | ||
|
||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters