-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
80 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
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,22 @@ | ||
import { drawPrizeApi } from '@/api/activity' | ||
import type { DrawPrizeItem } from './types' | ||
|
||
/** | ||
* 抽奖列表数据 | ||
*/ | ||
export const useDrawPrizeList = () => { | ||
const drawPrizeList = ref<DrawPrizeItem[]>([]) | ||
|
||
const loadPrizeData = async () => { | ||
const data = await drawPrizeApi.all<DrawPrizeItem[]>() | ||
drawPrizeList.value = data | ||
} | ||
|
||
const onClickItem = (item: DrawPrizeItem) => { | ||
uni.navigateTo({ | ||
url: `/pages/activity/draw-prize/index?id=${item.id}` | ||
}) | ||
} | ||
|
||
return { drawPrizeList, loadPrizeData, onClickItem } | ||
} |
Empty file.
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,32 @@ | ||
<script lang="ts" setup> | ||
import { toast } from '@/utils/function' | ||
import { useDrawPrizeList } from './hooks' | ||
const [loading, setLoading] = useVisible(true) | ||
const { drawPrizeList, loadPrizeData, onClickItem } = useDrawPrizeList() | ||
useSilentAuth(async () => { | ||
await loadPrizeData() | ||
setLoading(false) | ||
}) | ||
</script> | ||
|
||
<template> | ||
<view class="p-30 w-100vw h-100vh flex flex-column flex-dc bg-white" v-if="!loading"> | ||
<view class="m-b-20 bg-color-f5 p-30 w-fill flex flex-sb flex-dc br-8" v-for="(item, index) in drawPrizeList" :key="index" @click="onClickItem(item)"> | ||
<view class="flex-1"> | ||
<view class="color-85 m-b-10">名称:{{ item.name }}</view> | ||
<view class="color-45">开始时间:{{ item.startTime }}</view> | ||
<view class="color-45">结束时间:{{ item.endTime }}</view> | ||
</view> | ||
<view> | ||
<image class="w-40 h-40 m-l-10" src="/static/icon/arrow-right.png" mode="widthFix"></image> | ||
</view> | ||
</view> | ||
</view> | ||
<loading-page :loading="loading" /> | ||
</template> | ||
|
||
<style lang="less" scoped> | ||
@import './index.less'; | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* 抽奖活动 | ||
*/ | ||
export interface DrawPrizeItem { | ||
id: number | ||
name: string | ||
desc: string | ||
startTime: string | ||
endTime: String | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.