Commit 1e5570ed authored by hewenhao's avatar hewenhao

Merge branch 'master' of dev.jiuaoedu.com:hewenhao/GeekLearnMathWeapp

parents 87507f15 6c2da8ab
{
"ad": ["你的"],
"none": ["我的"]
"adj": [
"快乐的",
"智慧的",
"勤奋的",
"阳光的",
"活力的",
"奇妙的",
"积极的",
"友善的",
"有趣的",
"创新的",
"勇敢的",
"自信的",
"合作的",
"发现的",
"好奇的",
"探险的",
"快速的",
"乐观的",
"独特的",
"热情的",
"聪明的",
"热爱的",
"团结的",
"充满活力的",
"勤学的",
"有才华的",
"自主的",
"坚韧的",
"追求的",
"善良的",
"敏锐的",
"进取的",
"愉快的",
"研究的",
"专注的",
"激情的",
"奋斗的",
"互助的",
"关爱的",
"探索的",
"实践的",
"耐心的",
"鼓励的",
"领先的",
"美丽的",
"幸福的",
"快乐的",
"自由的",
"坚强的",
"勇敢的",
"温暖的",
"清新的",
"活力的",
"活泼的",
"青春的",
"智慧的",
"聪明的",
"热情的",
"真诚的",
"诚实的",
"安静的",
"优雅的",
"舒适的",
"轻松的",
"愉悦的",
"满足的",
"安心的",
"放松的",
"有趣的",
"充实的",
"丰富的",
"平静的",
"祥和的",
"融洽的",
"美好的",
"纯真的",
"温馨的",
"亲切的",
"体贴的",
"善良的",
"慷慨的",
"宽容的",
"心灵的",
"灵活的",
"灵敏的",
"灵感的",
"机智的",
"洞察的",
"求知的",
"独立的",
"坦率的",
"无畏的",
"勤奋的",
"拼搏的",
"奋斗的",
"努力的",
"好学的",
"有爱的",
"心善的",
"谦虚的",
"低调的",
"好客的",
"热心的",
"敬业的",
"专注的",
"睿智的",
"天才的",
"创新的",
"匠心的",
"有趣的",
"幽默的",
"可爱的",
"动人的",
"高尚的",
"现代的",
"前卫的",
"时尚的",
"独特的",
"初心的",
"好看的",
"优美的",
"精致的",
"细腻的",
"优秀的",
"卓越的",
"杰出的",
"无敌的",
"顶尖的",
"强大的",
"不败的",
"无限的",
"神奇的",
"无比的",
"神圣的",
"神秘的",
"神速的",
"惊人的",
"惊喜的",
"惊艳的",
"惊奇的"
],
"noun": [
"小天才",
"求知者",
"小发现者",
"智者",
"探险家",
"发现者",
"领航员",
"建设者",
"实践家",
"创新者",
"勇敢者",
"智慧者",
"友谊园",
"进步站",
"学问堡",
"快乐屋",
"智慧树",
"成长苑",
"探索岛",
"进步园",
"奋斗湾",
"启迪坊",
"拓展区",
"创意轩",
"成功街",
"理想家",
"友爱巷",
"智者梯",
"合作楼",
"幸福阁",
"梦想窗",
"阳光河",
"绿色园",
"希望港",
"小探险家",
"小学者",
"小思考者",
"小解决者",
"小领导者",
"小战士",
"小导师",
"小启蒙者",
"小团队",
"小伙伴",
"小梦想家",
"小建设者",
"小创作者",
"小勇士",
"小超人",
"小明星",
"小实践者",
"小观察家",
"小发明家",
"小合作者",
"小成就者",
"小聆听者",
"小领袖",
"小改革者",
"小示范者",
"小敢于者",
"小尝试者",
"小协作者",
"小规划者",
"小目标者",
"小奋进者",
"小责任者",
"小挑战者",
"小乐观者",
"小学习者",
"小坚持者",
"小成长者",
"小表达者",
"小思维者",
"小引导者",
"小庆祝者",
"小鼓舞者",
"小突破者",
"小合群者",
"小原则者",
"小支持者"
]
}
......@@ -70,12 +70,10 @@ export type NickNameWord = {
adj: string[];
}
const NickNameUrl = 'https://cdn.jkwljy.com/pk-math/setting/nickname-words.json'
export function getNickNameWords () {
export function getNickNameWords (url = 'nickname-words') {
return requesNative<NickNameWord>({
method: 'GET',
url: `${NickNameUrl}?d=${Date.now()}`,
url: `https://cdn.jkwljy.com/pk-math/setting/${url}.json?d=${Date.now()}`,
header: { 'Cache-Control': 'no-cache' },
timeout: 800
}).then(({ data }) => data)
......
......@@ -59,8 +59,8 @@
padding: 11px 28px;
background: rgba(0,0,0,0.2);
border-radius: 36px;
}
&_text {
color: #fff;
font-size: 40px;
......@@ -74,12 +74,28 @@
}
&_today, &_invite {
opacity: 0;
@include flexLayout(column, center);
gap: 6px;
}
&_disabled {
opacity: 0.8;
.is_show {
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 {
......@@ -124,13 +140,23 @@
transform: translateY(0);
}
50% {
transform: translateY(-20px);
transform: translateY(-10px);
}
100% {
transform: translateY(0);
}
}
.upDownAnimation {
animation: upDown 2s infinite ease-in-out;
@keyframes fadeIn {
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
import { useState } from 'react'
import { View, Text, Image } from '@tarojs/components'
import { showToast } from '@tarojs/taro'
import classNames from 'classnames'
import { useStoreActions, useStoreState } from '@/store/hooks'
import { useRequest } from '@/hooks'
import { postTribePoint, type PointType } from '@/api/group'
import { palyAudio } from '@/utils/play-audio'
import assets from '@/assets/oss/assets-group'
import audio from '@/assets/oss/assets-audio'
import TextPrinter from './text-printer'
import styles from './header.module.scss'
......@@ -23,10 +25,11 @@ const renderCreator = () => (
)
const CroupHeader = ({ groupNo }: { groupNo: string }) => {
const [hideIndex, setHideIndex] = useState(-1)
const queryTribePoint = useStoreActions(actions => actions.groupModel.queryTribePoint)
const points = useStoreState(state => state.groupModel.points)
const { run } = useRequest(postTribePoint, {
const { run, loading } = useRequest(postTribePoint, {
immediate: false,
throttleDelay: 1000,
onSuccess: () => {
......@@ -35,21 +38,30 @@ const CroupHeader = ({ groupNo }: { groupNo: string }) => {
}
})
const renderItem = (item: PointType) => (
const renderItem = (item: PointType, index) => {
return (
<View
className={classNames({
[styles.members_today]: item.type === 'MEMBERNUM',
[styles.members_invite]: item.type === 'MEMBERJOIN',
[styles.members_disabled]: !item.point,
[styles.is_show]: item.point,
[styles.fadeInUpDowAnimate]: item.point,
[styles.none]: index === hideIndex && !loading && !item.point,
})}
onClick={() => item.point && run({ type: item.type })}
onClick={() => {
if (item.point) {
setHideIndex(index)
palyAudio(audio['点领取水晶部落.wav'].u)
run({ type: item.type })
}
}}
>
<View className={styles.members_score}>
<View className={classNames(styles.members_score)}>
<Image
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}
</Text>
</View>
......@@ -58,6 +70,7 @@ const CroupHeader = ({ groupNo }: { groupNo: string }) => {
</Text>
</View>
)
}
const renderMembers = () => (
<View className={styles.members}>
......
......@@ -39,6 +39,20 @@
padding: 28px 32px 26px;
align-items: center;
opacity: 0;
transform: translateX(100%);
transition: all 0.3s ease-out;
&.show {
opacity: 1;
transform: translateX(0);
}
&.hide {
opacity: 0;
transform: translateX(100%);
}
&.active {
background-color: #E4F1FF;
}
......@@ -96,6 +110,15 @@
}
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
&_invite {
position: fixed;
left: 60px;
......@@ -108,6 +131,7 @@
padding: 0 30px;
display: flex;
align-items: center;
animation: fadeIn 1s ease-in-out forwards;
}
&_share {
......
import { useEffect, useState } from 'react'
import { View, Image, Text } from '@tarojs/components'
import classNames from 'classnames'
import { type MemberItem } from '@/api/group'
import { useStoreState } from '@/store/hooks'
import { palyAudio } from '@/utils/play-audio'
import assets from '@/assets/oss/assets-group'
import audio from '@/assets/oss/assets-audio'
import styles from './members.module.scss'
const Members = () => {
const [showIndex, setShowIndex] = useState<number>(-1)
const userInfo = useStoreState(state => state.userModel.userInfo)
const { groupMembers, isEmpty } = useStoreState(state => state.groupModel)
useEffect(() => {
palyAudio(audio['部门排行榜出现.wav'].u)
startAnimation(showIndex)
}, [])
const startAnimation = (currentIndex) => {
if (currentIndex < groupMembers.length - 1) {
requestAnimationFrame(() => {
const timer = setTimeout(() => {
setShowIndex(currentIndex + 1)
startAnimation(currentIndex + 1)
}, 300)
return () => clearTimeout(timer)
})
}
}
const renderItem = (item: MemberItem, index: number) => {
const isCurrent = userInfo.userId === item.memberId
const me = userInfo.userId === item.memberId
return (
<View key={item.memberId} className={classNames(styles.item, { [styles.active]: isCurrent })}>
<View
key={item.memberId}
className={classNames(
styles.item,
{
[styles.active]: me,
[styles.show]: index <= showIndex,
}
)}
>
<View className={styles.item_rank}>
{[1, 2, 3].includes(index + 1)
? <Image className={styles.item_rank_icon} src={assets[`rank-${index + 1}.png`].u} />
......@@ -25,7 +55,7 @@ const Members = () => {
<View className={styles.avatar}>
<Text className={styles.nickname}>
{item.memberName || '-'}
{isCurrent && <Text>(你)</Text>}
{me && <Text>(你)</Text>}
</Text>
{item.identity === 'LEADER' && <Image className={styles.crown} src={assets['crown-small.png'].u} />}
</View>
......
[
"快乐学堂",
"小天才俱乐部",
"阳光小学霸",
"知识小勇士",
"童话学习园",
"学习小精灵",
"天才小书虫",
"梦想学习园",
"童心书屋",
"快乐成长树",
"学习的小蜜蜂",
"小小探险家",
"彩虹学习园",
"知识小花园",
"童趣学习宝",
"笑脸学习站",
"阳光小学堂",
"学习宝贝岛",
"智慧小博士",
"成长快车道",
"快乐学习团",
"童年学习梦",
"稚趣学园",
"学习小蜗牛",
"智力小超人",
"小小地球村",
"学习乐园",
"梦想小舞台",
"小小数学家",
"知识小火车",
"爱心学习站",
"快乐学习家",
"学习小翅膀",
"童年智慧树",
"快乐小天使",
"学习的小精灵",
"阳光学习园",
"快乐读书房",
"童梦学习园",
"智慧的种子",
"爱学习的小熊",
"学习小动力",
"彩虹小学者",
"幸福学习屋",
"快乐小导航",
"学习的小苹果",
"知识小宇宙",
"笑声学习岛",
"学习小奇迹",
"学习小小鸟",
"勇敢学习者",
"童话小学者",
"智慧小花朵",
"快乐成长班",
"快乐学习派",
"快乐学习小组",
"成长的脚印",
"智慧之光",
"勤学好问团",
"阳光小伙伴",
"小小智者",
"知识宝石",
"快乐成长园",
"智慧小鸟",
"梦想之船",
"学习天地",
"小状元家",
"知识小宝藏",
"快乐蜜蜂",
"智慧小农场",
"学海探险队",
"快乐小学堂",
"奇思妙想团",
"成长快乐屋",
"智慧星空",
"宝贝学习站",
"知识探险家",
"勇敢小学霸",
"快乐学习岛",
"成长奇迹",
"智慧之星",
"快乐小蜜蜂",
"宝贝学习园",
"学习小导航",
"智慧之树",
"学习小战士",
"知识小天地",
"快乐探索家",
"智慧之路",
"学习快车",
"成长幸福园",
"快乐小学者",
"知识小宇宙",
"学习之旅",
"发现之星",
"梦想成真",
"学习小天地",
"知识小导航",
"学习之星",
"勤奋小蜗牛",
"智慧小花园",
"成长之梦",
"快乐学习舞台",
"知识小岛",
"学习之路",
"勇敢的小学者",
"快乐小王子",
"知识宝库",
"智慧之源",
"成长快乐站",
"快乐学习宝",
"知识小精灵",
"学习小天使",
"智慧小神童",
"成长快乐家",
"快乐学习园",
"知识小飞侠",
"学习小助手",
"智慧小导航",
"成长快乐岛",
"快乐学习派",
"学习小能手",
"智慧小熊",
"成长的天空",
"快乐小书虫",
"知识小助手",
"学习小飞侠",
"智慧小花朵",
"成长的舞台",
"快乐学习星",
"知识小导航",
"学习小蜜蜂",
"智慧小太阳",
"成长的翅膀",
"快乐小学习",
"知识小天才",
"学习小超人",
"智慧小奇迹",
"成长的日记",
"知识小状元",
"学习小梦想",
"智慧小神童",
"成长的足迹",
"快乐小状元",
"知识小舞台",
"学习小宝贝",
"智慧小蜜蜂",
"成长的歌声",
"快乐学习园",
"知识小能手",
"学习小快乐",
"智慧小天空",
"成长的种子",
"快乐小智者",
"知识小战士",
"学习小发现",
"智慧小冒险家",
"成长的航道",
"快乐小发现",
"知识小探险家",
"学习小太阳",
"智慧小星星",
"成长的瞬间",
"快乐小小熊",
"知识小英雄",
"学习小快车",
"智慧小脚印",
"成长的花园",
"快乐小奇迹"
]
\ No newline at end of file
......@@ -7,7 +7,7 @@
@include flexLayout(_, center, space-between);
background-color: #F0F2F9;
border-radius: 48px;
padding: 18px 32px 18px 40px;
padding: 20px 32px 19px 40px;
}
&_input {
......
import { View, Image, Input, ScrollView, Text } from '@tarojs/components'
import { useDidShow, getCurrentInstance, getTabBar, getMenuButtonBoundingClientRect, showModal, useShareAppMessage, showLoading, hideLoading } from '@tarojs/taro'
import { useMemo, useState, useEffect } from 'react'
import { useDidShow, getCurrentInstance, getTabBar, getMenuButtonBoundingClientRect, showModal, useShareAppMessage } from '@tarojs/taro'
import { useMemo, useState, useEffect, useRef, useCallback } from 'react'
import Modal from '@/components/Modal'
import Button from '@/components/Button'
......@@ -8,6 +8,7 @@ import { useBoolean, useRequest } from '@/hooks'
import { createTribe } from '@/api/group'
import { useStoreActions, useStoreState } from '@/store/hooks'
import type { TabbarRef } from '@/custom-tab-bar/index'
import { getNickNameWords, type NickNameWord } from '@/api'
import assets from '@/assets/oss/assets-group'
......@@ -20,16 +21,19 @@ import ShareButton from './components/share-button'
import styles from './index.module.scss'
import memberStyles from './components/members.module.scss'
import groupNames from './data.json'
const randomPick = (arr: string[]) => {
const len = arr.length
const randomIndex = Math.floor(Math.random() * len)
return arr[randomIndex]
}
const Group = () => {
const randomIndex = Math.floor(Math.random() * groupNames.length)
const page = useMemo(() => getCurrentInstance().page, [])
const [nav] = useState(getMenuButtonBoundingClientRect())
const [isVisible, { setTrue, setFalse }] = useBoolean(false)
const [groupNo, setGroupNo] = useState<string>(groupNames[randomIndex])
const dataRef = useRef<NickNameWord>({ noun: [], adj: [] })
const [groupNo, setGroupNo] = useState('')
const [refresher, { toggle }] = useBoolean(false)
const [isLoad, { toggle: toggleLoad }] = useBoolean(true)
const userInfo = useStoreState(state => state.userModel.userInfo)
const tribeInfo = useStoreState(state => state.groupModel.tribeInfo)
......@@ -40,17 +44,30 @@ const Group = () => {
return nav.height + nav.top + 5
}, [nav])
const getGroupNo = useCallback(() => {
const { noun, adj } = dataRef.current
const nam = `${randomPick(adj)}${randomPick(noun)}`
setGroupNo(nam)
}, [])
useEffect(() => {
const fn = async () => {
const words = await getNickNameWords('words')
dataRef.current = words
getGroupNo()
}
fn()
}, [getGroupNo])
useDidShow(async () => {
const tabbar = getTabBar<TabbarRef>(page)
tabbar?.setSelected(1)
queryTribePoint()
toggleLoad()
await fetchTribeInfo()
toggleLoad()
})
useEffect(() => {
Promise.all([queryTribePoint(), fetchTribeInfo()])
}, [queryTribePoint, fetchTribeInfo])
useShareAppMessage(() => {
return {
title: '来看看这个有趣的页面!',
......@@ -84,14 +101,6 @@ const Group = () => {
}
}
useEffect(() => {
isLoad && hideLoading()
}, [isLoad, hideLoading])
if (!isLoad) {
return showLoading()
}
return (
<View>
<TopHeader />
......@@ -114,14 +123,9 @@ const Group = () => {
<Modal isVisible={isVisible} tilte="学习部落名" onClose={setFalse}>
<View className={styles.modal}>
<View className={styles.modal_body}>
<View className={styles.modal_body} onClick={getGroupNo}>
<Input className={styles.modal_input} disabled value={groupNo} />
<Image
className={styles.modal_refresh}
mode="widthFix"
src={assets['refresh.png'].u}
onClick={() => setGroupNo(groupNames[randomIndex])}
/>
<Image className={styles.modal_refresh} mode="widthFix" src={assets['refresh.png'].u} />
</View>
<Text className={styles.modal_description}>
* 可点击右侧按钮随机生成名字
......
......@@ -117,7 +117,7 @@ const MainHeader = () => {
<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} />
</View>
), [stageDetail?.sTime, stageDetail?.aTime, stageDetail?.bTime])
), [stageDetail, stageDetail?.sTime, stageDetail?.aTime, stageDetail?.bTime])
const renderAgain = useCallback(() => (
<View className={styles.details}>
......@@ -125,7 +125,7 @@ const MainHeader = () => {
<RequireItem key={item.nextStep} u={renderNextStep(item)} v={item.nextStepReward} t={item.nextStepTime} />
))}
</View>
), [stageDetail?.nextSteps])
), [stageDetail?.nextSteps, renderNextStep])
if (!stageDetail) {
return null
......@@ -144,7 +144,9 @@ const MainHeader = () => {
<Text className={styles.label}>共 {stageDetail.questionNum} 题</Text>
</View>
{!stageDetail.firstTime && <View className={styles.replay}>
{(stageDetail.firstTime || !stageDetail.level)
? null
: <View className={styles.replay}>
<View className={styles.performance}>
<Text>最佳表现</Text>
<View className={styles.details}>
......@@ -166,11 +168,11 @@ const MainHeader = () => {
<View className={styles.header}>
<View className={styles.line}></View>
<Text className={styles.text}>
{stageDetail.firstTime ? '通关要求' : '继续努力,赢更多成就'}
{stageDetail.firstTime || !stageDetail.level ? '通关要求' : '继续努力,赢更多成就'}
</Text>
<View className={styles.line}></View>
</View>
{stageDetail.firstTime ? renderFirst() : isKing ? null : renderAgain()}
{stageDetail.firstTime || !stageDetail.level ? renderFirst() : isKing ? null : renderAgain()}
</View>}
</View>
)
......
......@@ -128,7 +128,7 @@
.tribe_share {
border-radius: 10PX;
margin: 0 80px;
margin-bottom: 56px;
margin-bottom: 32px;
height: 88px;
border: 2PX solid #465164;
gap: 8PX;
......@@ -218,6 +218,7 @@
&_loading {
opacity: 0.8;
pointer-events: none;
}
&_spin {
......@@ -249,6 +250,7 @@
}
.buy_card_disabled {
pointer-events: none;
background-image: url('./assets/btn-disabled.png');
color: #C2C8D1;
}
\ No newline at end of file
......@@ -35,11 +35,11 @@ const Prepare = () => {
const isSubmit = useStoreState(state => state.gameModel.isSubmit)
const tribeInfo = useStoreState(state => state.groupModel.tribeInfo)
const stageList = useStoreState(state => state.mainModel.stageList)
const setting = useStoreState(state => state.userModel.setting)
const getStageDetail = useStoreActions(actions => actions.gameModel.getStageDetail)
const getQuestionList = useStoreActions(actions => actions.gameModel.getQuestionList)
const updateState = useStoreActions(actions => actions.gameModel.updateState)
const getSetting = useStoreActions(actions => actions.userModel.getSetting)
const setting = useStoreState(state => state.userModel.setting)
const tabs: TabItem[] = [
{
......@@ -50,7 +50,7 @@ const Prepare = () => {
label: '学习部落排行榜',
children: (
<View className={styles.tribe}>
{renderTribePage(stageDetail?.groupRanks || [])}
{renderTribePage(stageDetail?.groupRanks || [], tribeInfo?.groupNo)}
</View>
)
}
......@@ -85,6 +85,7 @@ const Prepare = () => {
const { run: exchange, loading: spinning } = useRequest(pointToCard, {
immediate: false,
throttleDelay: 1000,
onSuccess: () => {
getQuestionList(+router.params.id || 1).then(() => {
setFalse()
......@@ -166,7 +167,7 @@ const Prepare = () => {
useEffect(() => {
isLoad && hideLoading()
}, [isLoad, hideLoading])
}, [isLoad])
if (!isLoad) {
return showLoading()
......
......@@ -57,17 +57,19 @@ const renderEmptyTribe = () => (
</View>
)
const renderTribeList = (list: StageRank[]) => (
<View style={{ paddingBottom: 100 }}>
<Text className={styles.tribe_title}>极客学霸俱乐部</Text>
const renderTribeList = (list: StageRank[], groupNo?: string) => {
return (
<View style={{ paddingBottom: 70 }}>
<Text className={styles.tribe_title}>{groupNo}部落</Text>
{renderList(list)}
</View>
)
)
}
export const renderTribePage = (list: StageRank[] = []) => {
export const renderTribePage = (list: StageRank[] = [], groupNo?: string) => {
return (
<View className={styles.tribe}>
{list.length > 0 ? renderTribeList(list) : renderEmptyTribe()}
{list.length > 0 ? renderTribeList(list, groupNo) : renderEmptyTribe()}
</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