Commit d2a2b83c authored by m's avatar m

feat: 优化

parent 916e3f44
...@@ -59,8 +59,8 @@ ...@@ -59,8 +59,8 @@
padding: 11px 28px; padding: 11px 28px;
background: rgba(0,0,0,0.2); background: rgba(0,0,0,0.2);
border-radius: 36px; border-radius: 36px;
} }
&_text { &_text {
color: #fff; color: #fff;
font-size: 40px; font-size: 40px;
...@@ -74,12 +74,28 @@ ...@@ -74,12 +74,28 @@
} }
&_today, &_invite { &_today, &_invite {
opacity: 0;
@include flexLayout(column, center); @include flexLayout(column, center);
gap: 6px; gap: 6px;
} }
&_disabled { .is_show {
opacity: 0.8; opacity: 1;
}
@keyframes noneAnimate {
0% {
transform: scale(1);
opacity: 1;
}
100% {
transform: scale(0);
opacity: 0;
}
}
.none {
animation: noneAnimate 0.6s ease-out forwards;
} }
&_today { &_today {
...@@ -124,13 +140,23 @@ ...@@ -124,13 +140,23 @@
transform: translateY(0); transform: translateY(0);
} }
50% { 50% {
transform: translateY(-20px); transform: translateY(-10px);
} }
100% { 100% {
transform: translateY(0); transform: translateY(0);
} }
} }
.upDownAnimation { @keyframes fadeIn {
animation: upDown 2s infinite ease-in-out; 0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.fadeInUpDowAnimate {
animation: fadeIn 1.2s ease-in backwards, upDown 2s infinite ease-in-out;
animation-delay: 0.3s;
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ import { showToast } from '@tarojs/taro' ...@@ -3,7 +3,7 @@ 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 } from '@/hooks' import { useRequest, useBoolean } from '@/hooks'
import { postTribePoint, type PointType } from '@/api/group' import { postTribePoint, type PointType } from '@/api/group'
import assets from '@/assets/oss/assets-group' import assets from '@/assets/oss/assets-group'
import TextPrinter from './text-printer' import TextPrinter from './text-printer'
...@@ -25,31 +25,36 @@ const renderCreator = () => ( ...@@ -25,31 +25,36 @@ const renderCreator = () => (
const CroupHeader = ({ groupNo }: { groupNo: string }) => { const CroupHeader = ({ groupNo }: { groupNo: string }) => {
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 } = useRequest(postTribePoint, {
immediate: false, immediate: false,
throttleDelay: 1000, throttleDelay: 1000,
onSuccess: () => { onSuccess: () => {
setTrue()
showToast({ title: '领取成功' }) showToast({ title: '领取成功' })
queryTribePoint() queryTribePoint()
} }
}) })
const renderItem = (item: PointType) => ( const renderItem = (item: PointType) => {
return (
<View <View
className={classNames({ className={classNames({
[styles.members_today]: item.type === 'MEMBERNUM', [styles.members_today]: item.type === 'MEMBERNUM',
[styles.members_invite]: item.type === 'MEMBERJOIN', [styles.members_invite]: item.type === 'MEMBERJOIN',
[styles.members_disabled]: !item.point, [styles.is_show]: item.point,
[styles.fadeInUpDowAnimate]: item.point,
[styles.none]: active && !item.point,
})} })}
onClick={() => item.point && run({ type: item.type })} onClick={() => item.point && run({ type: item.type })}
> >
<View className={styles.members_score}> <View className={classNames(styles.members_score)}>
<Image <Image
src={require('@/pages/main/assets/score.png')} src={require('@/pages/main/assets/score.png')}
className={classNames(styles.members_icon, item.point ? styles.upDownAnimation : '')} className={classNames(styles.members_icon)}
/> />
<Text className={classNames(styles.members_number, item.point ? styles.upDownAnimation : '')}> <Text className={classNames(styles.members_number)}>
+{item.point || 0} +{item.point || 0}
</Text> </Text>
</View> </View>
...@@ -58,6 +63,7 @@ const CroupHeader = ({ groupNo }: { groupNo: string }) => { ...@@ -58,6 +63,7 @@ const CroupHeader = ({ groupNo }: { groupNo: string }) => {
</Text> </Text>
</View> </View>
) )
}
const renderMembers = () => ( const renderMembers = () => (
<View className={styles.members}> <View className={styles.members}>
......
...@@ -96,6 +96,15 @@ ...@@ -96,6 +96,15 @@
} }
} }
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
&_invite { &_invite {
position: fixed; position: fixed;
left: 60px; left: 60px;
...@@ -108,6 +117,7 @@ ...@@ -108,6 +117,7 @@
padding: 0 30px; padding: 0 30px;
display: flex; display: flex;
align-items: center; align-items: center;
animation: fadeIn 1s ease-in-out forwards;
} }
&_share { &_share {
......
...@@ -86,7 +86,7 @@ const Group = () => { ...@@ -86,7 +86,7 @@ const Group = () => {
useEffect(() => { useEffect(() => {
isLoad && hideLoading() isLoad && hideLoading()
}, [isLoad, hideLoading]) }, [isLoad])
if (!isLoad) { if (!isLoad) {
return showLoading() return showLoading()
...@@ -114,14 +114,9 @@ const Group = () => { ...@@ -114,14 +114,9 @@ const Group = () => {
<Modal isVisible={isVisible} tilte="学习部落名" onClose={setFalse}> <Modal isVisible={isVisible} tilte="学习部落名" onClose={setFalse}>
<View className={styles.modal}> <View className={styles.modal}>
<View className={styles.modal_body}> <View className={styles.modal_body} onClick={() => setGroupNo(groupNames[randomIndex])}>
<Input className={styles.modal_input} disabled value={groupNo} /> <Input className={styles.modal_input} disabled value={groupNo} />
<Image <Image className={styles.modal_refresh} mode="widthFix" src={assets['refresh.png'].u} />
className={styles.modal_refresh}
mode="widthFix"
src={assets['refresh.png'].u}
onClick={() => setGroupNo(groupNames[randomIndex])}
/>
</View> </View>
<Text className={styles.modal_description}> <Text className={styles.modal_description}>
* 可点击右侧按钮随机生成名字 * 可点击右侧按钮随机生成名字
......
...@@ -117,7 +117,7 @@ const MainHeader = () => { ...@@ -117,7 +117,7 @@ const MainHeader = () => {
<RequireItem u={assets['level-big-a.png'].u} v={5} t={stageDetail.aTime} /> <RequireItem u={assets['level-big-a.png'].u} v={5} t={stageDetail.aTime} />
<RequireItem u={assets['level-big-b.png'].u} v={1} t={stageDetail.bTime} /> <RequireItem u={assets['level-big-b.png'].u} v={1} t={stageDetail.bTime} />
</View> </View>
), [stageDetail?.sTime, stageDetail?.aTime, stageDetail?.bTime]) ), [stageDetail, stageDetail?.sTime, stageDetail?.aTime, stageDetail?.bTime])
const renderAgain = useCallback(() => ( const renderAgain = useCallback(() => (
<View className={styles.details}> <View className={styles.details}>
...@@ -125,7 +125,7 @@ const MainHeader = () => { ...@@ -125,7 +125,7 @@ const MainHeader = () => {
<RequireItem key={item.nextStep} u={renderNextStep(item)} v={item.nextStepReward} t={item.nextStepTime} /> <RequireItem key={item.nextStep} u={renderNextStep(item)} v={item.nextStepReward} t={item.nextStepTime} />
))} ))}
</View> </View>
), [stageDetail?.nextSteps]) ), [stageDetail?.nextSteps, renderNextStep])
if (!stageDetail) { if (!stageDetail) {
return null return null
...@@ -144,7 +144,9 @@ const MainHeader = () => { ...@@ -144,7 +144,9 @@ const MainHeader = () => {
<Text className={styles.label}>共 {stageDetail.questionNum} 题</Text> <Text className={styles.label}>共 {stageDetail.questionNum} 题</Text>
</View> </View>
{!stageDetail.firstTime && <View className={styles.replay}> {(stageDetail.firstTime || !stageDetail.level)
? null
: <View className={styles.replay}>
<View className={styles.performance}> <View className={styles.performance}>
<Text>最佳表现</Text> <Text>最佳表现</Text>
<View className={styles.details}> <View className={styles.details}>
...@@ -166,11 +168,11 @@ const MainHeader = () => { ...@@ -166,11 +168,11 @@ const MainHeader = () => {
<View className={styles.header}> <View className={styles.header}>
<View className={styles.line}></View> <View className={styles.line}></View>
<Text className={styles.text}> <Text className={styles.text}>
{stageDetail.firstTime ? '通关要求' : '继续努力,赢更多成就'} {stageDetail.firstTime || !stageDetail.level ? '通关要求' : '继续努力,赢更多成就'}
</Text> </Text>
<View className={styles.line}></View> <View className={styles.line}></View>
</View> </View>
{stageDetail.firstTime ? renderFirst() : isKing ? null : renderAgain()} {stageDetail.firstTime || !stageDetail.level ? renderFirst() : isKing ? null : renderAgain()}
</View>} </View>}
</View> </View>
) )
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
.tribe_share { .tribe_share {
border-radius: 10PX; border-radius: 10PX;
margin: 0 80px; margin: 0 80px;
margin-bottom: 56px; margin-bottom: 32px;
height: 88px; height: 88px;
border: 2PX solid #465164; border: 2PX solid #465164;
gap: 8PX; gap: 8PX;
......
...@@ -34,11 +34,11 @@ const Prepare = () => { ...@@ -34,11 +34,11 @@ const Prepare = () => {
const isSubmit = useStoreState(state => state.gameModel.isSubmit) const isSubmit = useStoreState(state => state.gameModel.isSubmit)
const tribeInfo = useStoreState(state => state.groupModel.tribeInfo) const tribeInfo = useStoreState(state => state.groupModel.tribeInfo)
const stageList = useStoreState(state => state.mainModel.stageList) const stageList = useStoreState(state => state.mainModel.stageList)
const setting = useStoreState(state => state.userModel.setting)
const getStageDetail = useStoreActions(actions => actions.gameModel.getStageDetail) const getStageDetail = useStoreActions(actions => actions.gameModel.getStageDetail)
const getQuestionList = useStoreActions(actions => actions.gameModel.getQuestionList) const getQuestionList = useStoreActions(actions => actions.gameModel.getQuestionList)
const updateState = useStoreActions(actions => actions.gameModel.updateState) const updateState = useStoreActions(actions => actions.gameModel.updateState)
const getSetting = useStoreActions(actions => actions.userModel.getSetting) const getSetting = useStoreActions(actions => actions.userModel.getSetting)
const setting = useStoreState(state => state.userModel.setting)
const tabs: TabItem[] = [ const tabs: TabItem[] = [
{ {
...@@ -49,7 +49,7 @@ const Prepare = () => { ...@@ -49,7 +49,7 @@ const Prepare = () => {
label: '学习部落排行榜', label: '学习部落排行榜',
children: ( children: (
<View className={styles.tribe}> <View className={styles.tribe}>
{renderTribePage(stageDetail?.groupRanks || [])} {renderTribePage(stageDetail?.groupRanks || [], tribeInfo?.groupNo)}
</View> </View>
) )
} }
...@@ -162,7 +162,7 @@ const Prepare = () => { ...@@ -162,7 +162,7 @@ const Prepare = () => {
useEffect(() => { useEffect(() => {
isLoad && hideLoading() isLoad && hideLoading()
}, [isLoad, hideLoading]) }, [isLoad])
if (!isLoad) { if (!isLoad) {
return showLoading() return showLoading()
......
...@@ -57,17 +57,19 @@ const renderEmptyTribe = () => ( ...@@ -57,17 +57,19 @@ const renderEmptyTribe = () => (
</View> </View>
) )
const renderTribeList = (list: StageRank[]) => ( const renderTribeList = (list: StageRank[], groupNo?: string) => {
<View style={{ paddingBottom: 100 }}> return (
<Text className={styles.tribe_title}>极客学霸俱乐部</Text> <View style={{ paddingBottom: 70 }}>
<Text className={styles.tribe_title}>{groupNo}部落</Text>
{renderList(list)} {renderList(list)}
</View> </View>
) )
}
export const renderTribePage = (list: StageRank[] = []) => { export const renderTribePage = (list: StageRank[] = [], groupNo?: string) => {
return ( return (
<View className={styles.tribe}> <View className={styles.tribe}>
{list.length > 0 ? renderTribeList(list) : renderEmptyTribe()} {list.length > 0 ? renderTribeList(list, groupNo) : renderEmptyTribe()}
</View> </View>
) )
} }
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