Commit 5e8ed125 authored by m's avatar m

feat: update

parent b3f19187
import { useState } from 'react'
import { View, Text, Image } from '@tarojs/components' import { View, Text, Image } from '@tarojs/components'
import { showToast } from '@tarojs/taro' import { showToast } from '@tarojs/taro'
import classNames from 'classnames' import classNames from 'classnames'
import { useStoreActions, useStoreState } from '@/store/hooks' import { useStoreActions, useStoreState } from '@/store/hooks'
import { useRequest, useBoolean } from '@/hooks' import { useRequest } from '@/hooks'
import { postTribePoint, type PointType } from '@/api/group' import { postTribePoint, type PointType } from '@/api/group'
import { palyAudio } from '@/utils/play-audio' import { palyAudio } from '@/utils/play-audio'
import assets from '@/assets/oss/assets-group' import assets from '@/assets/oss/assets-group'
...@@ -25,22 +25,21 @@ const renderCreator = () => ( ...@@ -25,22 +25,21 @@ const renderCreator = () => (
) )
const CroupHeader = ({ groupNo }: { groupNo: string }) => { const CroupHeader = ({ groupNo }: { groupNo: string }) => {
const [hideIndex, setHideIndex] = useState(-1)
const queryTribePoint = useStoreActions(actions => actions.groupModel.queryTribePoint) const queryTribePoint = useStoreActions(actions => actions.groupModel.queryTribePoint)
const points = useStoreState(state => state.groupModel.points) const points = useStoreState(state => state.groupModel.points)
const [active, { setTrue }] = useBoolean(false)
const { run } = useRequest(postTribePoint, { const { run, loading } = useRequest(postTribePoint, {
immediate: false, immediate: false,
throttleDelay: 1000, throttleDelay: 1000,
onSuccess: () => { onSuccess: () => {
palyAudio(audio['点领取水晶部落.wav'].u) palyAudio(audio['点领取水晶部落.wav'].u)
setTrue()
showToast({ title: '领取成功' }) showToast({ title: '领取成功' })
queryTribePoint() queryTribePoint()
} }
}) })
const renderItem = (item: PointType) => { const renderItem = (item: PointType, index) => {
return ( return (
<View <View
className={classNames({ className={classNames({
...@@ -48,9 +47,14 @@ const CroupHeader = ({ groupNo }: { groupNo: string }) => { ...@@ -48,9 +47,14 @@ const CroupHeader = ({ groupNo }: { groupNo: string }) => {
[styles.members_invite]: item.type === 'MEMBERJOIN', [styles.members_invite]: item.type === 'MEMBERJOIN',
[styles.is_show]: item.point, [styles.is_show]: item.point,
[styles.fadeInUpDowAnimate]: item.point, [styles.fadeInUpDowAnimate]: item.point,
[styles.none]: active && !item.point, [styles.none]: index === hideIndex && !loading && !item.point,
})} })}
onClick={() => item.point && run({ type: item.type })} onClick={() => {
if (item.point) {
setHideIndex(index)
run({ type: item.type })
}
}}
> >
<View className={classNames(styles.members_score)}> <View className={classNames(styles.members_score)}>
<Image <Image
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment