Commit c152f698 authored by raca's avatar raca

feat: update

parent 7efaa0a2
...@@ -50,8 +50,17 @@ export function updateUserInfo (nickName: string) { ...@@ -50,8 +50,17 @@ export function updateUserInfo (nickName: string) {
})) }))
} }
export type SettintType = {
pointToCard: number,
aPoint?: number,
bPoint?: number,
sPoint?: number,
createGroupPoint?: number
joinGroupPoint?: number
}
export function getSetting () { export function getSetting () {
return requestAfterSilentLogin<{pointToCard: number}, {}>(() => ({ return requestAfterSilentLogin<SettintType, {}>(() => ({
method: 'GET', method: 'GET',
url: '/service-idea/inlet/config/getConfig', url: '/service-idea/inlet/config/getConfig',
data: {} data: {}
......
import { View, Text, Image } from '@tarojs/components' import { View, Text, Image } from '@tarojs/components'
import { useEffect } from 'react' import { useEffect } from 'react'
import { useStoreState } from '@/store/hooks'
import classNames from 'classnames' import classNames from 'classnames'
import Button from '@/components/Button' import Button from '@/components/Button'
import { useBoolean } from '@/hooks' import { useBoolean } from '@/hooks'
...@@ -29,6 +30,7 @@ const renderImage = (url) => <Image className={styles.icon} src={assets[`${url}. ...@@ -29,6 +30,7 @@ const renderImage = (url) => <Image className={styles.icon} src={assets[`${url}.
const Creator = ({ onClick }: { onClick: () => void }) => { const Creator = ({ onClick }: { onClick: () => void }) => {
const [playAnimation, { setTrue }] = useBoolean(false) const [playAnimation, { setTrue }] = useBoolean(false)
const setting = useStoreState(state => state.userModel.setting)
useEffect(() => { useEffect(() => {
const triggerAnimation = requestAnimationFrame(() => { const triggerAnimation = requestAnimationFrame(() => {
...@@ -61,7 +63,7 @@ const Creator = ({ onClick }: { onClick: () => void }) => { ...@@ -61,7 +63,7 @@ const Creator = ({ onClick }: { onClick: () => void }) => {
<Button image={styles.btn_image} hoverImage={styles.btn_hover_image} size="large" onClick={onClick}> <Button image={styles.btn_image} hoverImage={styles.btn_hover_image} size="large" onClick={onClick}>
立即创建你的部落 立即创建你的部落
<Image className={styles.action_icon} src={require('@/pages/main/assets/score.png')} /> <Image className={styles.action_icon} src={require('@/pages/main/assets/score.png')} />
+20 +{setting.createGroupPoint}
</Button> </Button>
</View> </View>
</View> </View>
......
import { View, Image, Text } from '@tarojs/components' import { View, Image, Text } from '@tarojs/components'
import { useStoreState } from '@/store/hooks'
import assets from '@/assets/oss/assets-group' import assets from '@/assets/oss/assets-group'
import ShareView from './share-view' import ShareView from './share-view'
import styles from './members.module.scss' import styles from './members.module.scss'
export default () => { export default () => {
const setting = useStoreState(state => state.userModel.setting)
return ( return (
<ShareView className={styles.members_share}> <ShareView className={styles.members_share}>
<View className={styles.members_tip}> <View className={styles.members_tip}>
<Image className={styles.members_tip_icon} src={require('@/pages/main/assets/score.png')} /> <Image className={styles.members_tip_icon} src={require('@/pages/main/assets/score.png')} />
<Text className={styles.members_tip_text}>+100</Text> <Text className={styles.members_tip_text}>+{setting.joinGroupPoint}</Text>
</View> </View>
<Image className={styles.members_icon} src={assets['invite-small.png'].u} /> <Image className={styles.members_icon} src={assets['invite-small.png'].u} />
<Text className={styles.members_text}>邀请好友加入学习部落,一起PK math</Text> <Text className={styles.members_text}>邀请好友加入学习部落,一起PK math</Text>
......
...@@ -40,6 +40,7 @@ const Group = () => { ...@@ -40,6 +40,7 @@ const Group = () => {
const fetchTribeInfo = useStoreActions(actions => actions.groupModel.fetchTribeInfo) const fetchTribeInfo = useStoreActions(actions => actions.groupModel.fetchTribeInfo)
const queryTribePoint = useStoreActions(actions => actions.groupModel.queryTribePoint) const queryTribePoint = useStoreActions(actions => actions.groupModel.queryTribePoint)
const fetchAccount = useStoreActions(actions => actions.userModel.fetchAccount) const fetchAccount = useStoreActions(actions => actions.userModel.fetchAccount)
const getSetting = useStoreActions(actions => actions.userModel.getSetting)
const tabBarHeight = useMemo(() => { const tabBarHeight = useMemo(() => {
return nav.height + nav.top + 5 return nav.height + nav.top + 5
...@@ -66,6 +67,10 @@ const Group = () => { ...@@ -66,6 +67,10 @@ const Group = () => {
Promise.all([queryTribePoint(), fetchTribeInfo(), fetchAccount()]) Promise.all([queryTribePoint(), fetchTribeInfo(), fetchAccount()])
}) })
useEffect(() => {
getSetting()
}, [getSetting])
const getShareParams = useCallback(() => { const getShareParams = useCallback(() => {
return { return {
pageParams: { groupId: tribeInfo?.id ?? '', shareUserId: userInfo.userId }, pageParams: { groupId: tribeInfo?.id ?? '', shareUserId: userInfo.userId },
......
...@@ -9,7 +9,7 @@ import styles from './scene-1.module.scss' ...@@ -9,7 +9,7 @@ import styles from './scene-1.module.scss'
const Text1 = [ const Text1 = [
{ text: '嗨,' }, { text: '嗨,' },
{ text: '你好,' }, { text: '你好!' },
{ text: '我是高斯。' }, { text: '我是高斯。' },
] ]
...@@ -19,7 +19,7 @@ const Text2 = [ ...@@ -19,7 +19,7 @@ const Text2 = [
] ]
// text="我已经帮助很多同学,喜欢上数学,提升数学能力了。" // text="我已经帮助很多同学,喜欢上数学,提升数学能力了。"
const Text3 = [ const Text3 = [
{ text: '我已经帮助很多同学,' }, { text: '我已经帮助很多同学' },
{ text: '喜欢上数学,' }, { text: '喜欢上数学,' },
{ text: '提升数学能力了。' }, { text: '提升数学能力了。' },
] ]
......
...@@ -11,6 +11,7 @@ import { formatNextStep, formatLevelAchieve, formatTopAchieve, formatType } from ...@@ -11,6 +11,7 @@ import { formatNextStep, formatLevelAchieve, formatTopAchieve, formatType } from
const MainHeader = () => { const MainHeader = () => {
const stageDetail = useStoreState(state => state.gameModel.stageDetail) const stageDetail = useStoreState(state => state.gameModel.stageDetail)
const stageDetailPre = useStoreState(state => state.gameModel.stageDetailPre) const stageDetailPre = useStoreState(state => state.gameModel.stageDetailPre)
const setting = useStoreState(state => state.userModel.setting)
const isKing = useMemo(() => { // 王者 const isKing = useMemo(() => { // 王者
return stageDetail?.level === StageLevel.S && String(stageDetail?.gear) === StageGear.TOP10 return stageDetail?.level === StageLevel.S && String(stageDetail?.gear) === StageGear.TOP10
...@@ -46,9 +47,9 @@ const MainHeader = () => { ...@@ -46,9 +47,9 @@ const MainHeader = () => {
? null ? null
: ( : (
<View className={styles.details}> <View className={styles.details}>
{renderItem({ u: assets['level-big-s.png'].u, v: 10, t: stageDetail.sTime })} {renderItem({ u: assets['level-big-s.png'].u, v: setting.sPoint!, t: stageDetail.sTime })}
{renderItem({ u: assets['level-big-a.png'].u, v: 5, t: stageDetail.aTime })} {renderItem({ u: assets['level-big-a.png'].u, v: setting.aPoint!, t: stageDetail.aTime })}
{renderItem({ u: assets['level-big-b.png'].u, v: 1, t: stageDetail.bTime })} {renderItem({ u: assets['level-big-b.png'].u, v: setting.bPoint!, t: stageDetail.bTime })}
</View> </View>
), [stageDetail, stageDetail?.sTime, stageDetail?.aTime, stageDetail?.bTime]) ), [stageDetail, stageDetail?.sTime, stageDetail?.aTime, stageDetail?.bTime])
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
&_index { &_index {
width: 80px; width: 80px;
text-align: center;
padding-left: 3PX; padding-left: 3PX;
margin-right: 23PX; margin-right: 23PX;
} }
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
} }
&_rank { &_rank {
margin-right: 40px; margin-right: 20px;
@include flexLayout(row, center); @include flexLayout(row, center);
&_icon { &_icon {
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
&_index { &_index {
display: block; display: block;
text-align: center; text-align: center;
width: 60px; width: 80px;
font-size: 36px; font-size: 36px;
font-weight: 500; font-weight: 500;
color: rgba(70,81,100,0.5); color: rgba(70,81,100,0.5);
......
import { import {
action, Action, Thunk, thunk, State action, Action, Thunk, thunk, State
} from 'easy-peasy' } from 'easy-peasy'
import { getAccountInfo, getSetting, updateUserInfo, updateUserPhone } from '@/api' import { getAccountInfo, getSetting, type SettintType, updateUserInfo, updateUserPhone } from '@/api'
import type { UserInfo } from '@/types' import type { UserInfo } from '@/types'
import { pointToCard } from '@/api/account' import { pointToCard } from '@/api/account'
import { showModal, showToast, showLoading, hideLoading } from '@tarojs/taro' import { showModal, showToast, showLoading, hideLoading } from '@tarojs/taro'
...@@ -14,7 +14,7 @@ export interface UserModel { ...@@ -14,7 +14,7 @@ export interface UserModel {
point: number; point: number;
updateState: Action<UserModel, Partial<State<UserModel>>>; updateState: Action<UserModel, Partial<State<UserModel>>>;
fetchAccount: Thunk<UserModel, void, void, AppStoreModel>; fetchAccount: Thunk<UserModel, void, void, AppStoreModel>;
setting: { pointToCard: number }; setting: SettintType;
getSetting: Thunk<UserModel, void, void, AppStoreModel>; getSetting: Thunk<UserModel, void, void, AppStoreModel>;
// updateUserInfo: Thunk<UserModel, string, void, AppStoreModel>; // updateUserInfo: Thunk<UserModel, string, void, AppStoreModel>;
...@@ -27,7 +27,7 @@ const userModel: UserModel = { ...@@ -27,7 +27,7 @@ const userModel: UserModel = {
userInfo: getStorage(StorageKeys.userInfo)!, userInfo: getStorage(StorageKeys.userInfo)!,
cardNum: 0, cardNum: 0,
point: 0, point: 0,
setting: { pointToCard: Infinity }, setting: { pointToCard: Infinity, aPoint: 0, bPoint: 0, sPoint: 0 },
updateNickNameAndPhone: thunk(async (actions, payload, helpers) => { updateNickNameAndPhone: thunk(async (actions, payload, helpers) => {
try { try {
......
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