Commit 2e55a343 authored by hewenhao's avatar hewenhao

Merge branch 'feature/2024-04-17-v1.2' into 'master'

Feature/2024 04 17 v1.2 See merge request !11
parents 99aed970 367ee46a
......@@ -6,7 +6,7 @@ BUILD_MODE=development
# 微信小程序appid
WEAPP_ID=wx693fe3460124d84b
# 服务器接口地址
SERVER_ENDPOINT=http://172.10.62.80
SERVER_ENDPOINT=http://172.16.62.125
# 腾讯地图接口 api key
TARO_TECENT_LBS_KEY=X3OBZ-OKM3D-I2A4L-P3LQY-7C7ZZ-3KBFG
......
......@@ -6,7 +6,7 @@ BUILD_MODE=production
# 微信小程序appid
WEAPP_ID=wx693fe3460124d84b
# 服务器接口地址
SERVER_ENDPOINT=http://172.10.62.80
SERVER_ENDPOINT=http://172.16.62.123
# 天御验证码App id
TARO_T_CAPTCHA_APP_ID=2034167834
......
......@@ -81,7 +81,12 @@ const config = {
}
},
framework: 'preact',
compiler: 'webpack5',
compiler: {
type: 'webpack5',
prebundle: {
enable: true
}
},
cache: {
enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
},
......
......@@ -39,6 +39,12 @@ declare namespace JSX {
},
HTMLElement
>,
'game-pk-rank': React.DetailedHTMLProps<
React.HTMLAttributes<HTMLElement> & {
list: any[]
},
HTMLElement
>,
'pk-record': React.DetailedHTMLProps<
React.HTMLAttributes<HTMLElement> & {
list: any[];
......
......@@ -21,20 +21,20 @@
"dependencies": {
"@babel/runtime": "^7.7.7",
"@geek/skynet-client-wxmini": "^1.1.12",
"@tarojs/components": "3.6.2",
"@tarojs/helper": "3.6.2",
"@tarojs/plugin-framework-react": "3.6.2",
"@tarojs/plugin-inject": "^3.6.4",
"@tarojs/plugin-platform-alipay": "3.6.2",
"@tarojs/plugin-platform-h5": "3.6.2",
"@tarojs/plugin-platform-jd": "3.6.2",
"@tarojs/plugin-platform-qq": "3.6.2",
"@tarojs/plugin-platform-swan": "3.6.2",
"@tarojs/plugin-platform-tt": "3.6.2",
"@tarojs/plugin-platform-weapp": "3.6.2",
"@tarojs/runtime": "3.6.2",
"@tarojs/shared": "3.6.2",
"@tarojs/taro": "3.6.2",
"@tarojs/components": "3.6.26",
"@tarojs/helper": "3.6.26",
"@tarojs/plugin-framework-react": "3.6.26",
"@tarojs/plugin-inject": "^3.6.26",
"@tarojs/plugin-platform-alipay": "3.6.26",
"@tarojs/plugin-platform-h5": "3.6.26",
"@tarojs/plugin-platform-jd": "3.6.26",
"@tarojs/plugin-platform-qq": "3.6.26",
"@tarojs/plugin-platform-swan": "3.6.26",
"@tarojs/plugin-platform-tt": "3.6.26",
"@tarojs/plugin-platform-weapp": "3.6.26",
"@tarojs/runtime": "3.6.26",
"@tarojs/shared": "3.6.26",
"@tarojs/taro": "3.6.26",
"easy-peasy": "^5.2.0",
"html-parse-stringify": "^3.0.1",
"preact": "^10.5.15",
......@@ -49,13 +49,13 @@
"@prefresh/babel-plugin": "^0.4.1",
"@prefresh/core": "^1.3.4",
"@prefresh/webpack": "^3.2.3",
"@tarojs/cli": "3.6.2",
"@tarojs/webpack5-runner": "3.6.2",
"@tarojs/cli": "3.6.26",
"@tarojs/webpack5-runner": "3.6.26",
"@types/react": "^18.0.0",
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"babel-preset-taro": "3.6.2",
"babel-preset-taro": "3.6.26",
"base-x": "^4.0.0",
"copy-dir": "^1.3.0",
"cos-nodejs-sdk-v5": "^2.11.4",
......@@ -63,7 +63,7 @@
"dotenv": "^9.0.2",
"eslint": "^8.12.0",
"eslint-config-standard": "^17.0.0",
"eslint-config-taro": "3.6.2",
"eslint-config-taro": "3.6.26",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-promise": "^6.0.0",
......
......@@ -5,6 +5,7 @@
/* Do not edit this file. It is a file generated by script/config-pkgs.js */
export default {
__usePrivacyCheck__: true,
pages: [
'pages/main/main',
'pages/accept-pk/index',
......
const fs = require('fs')
const path = require('path')
const execa = require('execa')
const chalk = require('chalk').default
const address = require('address')
const chokidar = require('chokidar')
const configEnv = require('./config-env')
......@@ -69,7 +68,7 @@ if (watch) {
timer = setTimeout(() => {
timer = null
if (child && child.kill('SIGKILL')) {
console.log(`${chalk.blue('重启mock服务中...')}`)
console.log('重启mock服务中...')
}
child = createMock()
}, restartMockDuration)
......
......@@ -97,6 +97,17 @@ export type NextStep = {
nextStepReward: number;
nextStepTime: number
}
export type PKRank = {
loseNum: number;
me: boolean;
nickName: string;
no: number;
secondName: string;
userId: number;
winNum: number;
}
export interface StageDetail extends Stage {
aTime: number;
bTime: number;
......@@ -105,6 +116,7 @@ export interface StageDetail extends Stage {
content: string;
bestResultTime: number;
ranks?: StageRank[];
pkRanks?: PKRank[];
groupRanks?: StageRank[];
questionNum: number;
nextSteps?: NextStep[];
......@@ -124,7 +136,7 @@ export function getStageList () {
return requestAfterSilentLogin<Stage[], { chapter: number; userId?: number }>(userInfo => ({
method: 'GET',
url: '/service-idea/stage/listStages',
data: { chapter: 2, userId: userInfo?.userId }
data: { chapter: 3, userId: userInfo?.userId }
}))
}
......
import { baseUrl } from './server'
const _baseUrl = process.env.SERVER_ENDPOINT === 'https://geek.jkwljy.com' ? baseUrl : 'http://172.10.61.134'
const _baseUrl = process.env.SERVER_ENDPOINT === 'https://geek.jkwljy.com' ? baseUrl : 'http://172.16.62.123'
export const SkynetConfig = {
appId: 'learn-math',
......
@import '@/styles/mixins.scss';
.thead {
height: 40PX;
background: #F7F9FC;
display: flex;
align-items: center;
font-size: 12PX;
padding: 0 32px;
color: rgba(70,81,100,0.5);
&_index {
width: 80px;
text-align: center;
padding-left: 3PX;
margin-right: 23PX;
}
&_username {
flex: 1;
}
&_result {
display: flex;
align-items: center;
font-size: 12PX;
font-weight: 400;
gap: 6PX;
color: rgba(70,81,100,0.7);
&_best {
font-size: 32px;
font-weight: 600;
color: #FE9B45;
}
}
}
.empty {
color: #9999;
font-size: 14PX;
margin: 24PX 0;
text-align: center;
}
.spinWrap {
color: #9999;
padding: 12PX 0;
text-align: center;
}
.item {
display: flex;
padding: 30px 32px;
align-items: center;
&.active {
background-color: #E4F1FF;
}
&_rank {
margin-right: 20px;
@include flexLayout(row, center);
&_icon {
width: 80px;
height: 80px;
margin: -17px 0;
display: block;
}
&_index {
display: block;
text-align: center;
width: 80px;
font-size: 36px;
font-weight: 500;
color: rgba(70,81,100,0.5);
}
}
&_username {
display: flex;
flex: 1;
align-items: center;
padding-right: 4PX;
&_text {
font-size: 14PX;
font-weight: 600;
color: #465164;
}
&_crown {
width: 36px;
height: 36px;
position: relative;
top: -1PX;
}
}
&_result {
@include flexLayout(row, center, center);
font-size: 12PX;
font-weight: 400;
gap: 6PX;
color: rgba(70,81,100,0.7);
&_best {
font-size: 32px;
font-weight: 600;
color: #FE9B45;
}
}
}
.spin {
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.spinIcon {
border: 4px solid #1786F7;
border-top-color: inherit;
border-radius: 50%;
animation: spin 1s linear infinite;
width: 18PX;
height: 18PX;
}
.spinText {
font-size: 14PX;
margin-left: 12PX;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
import assets from '@/assets/oss/assets-group'
import styles from './index.module.scss'
const PageSize = 10
// @ts-ignore
Component({
properties: {
list: {
type: Array,
value: []
}
},
data: {
styles,
assets,
realList: [],
me: null,
loading: false
},
attached () {
this._hasNextPage = true
this._loading = false
this._currentPage = 0
this.loadMore()
const me = this.data.list?.find(c => c.me)
if (me && me.no > 3) {
this.setData({
me
})
}
},
methods: {
async loadMore () {
if (this._loading || !this._hasNextPage) return
this._loading = true
this.setData({ loading: true })
await new Promise(resolve => setTimeout(resolve, 300))
const { list } = this.data
const currentPage = this._currentPage
const nextPage = currentPage + 1
let max = nextPage * PageSize
let hasNextPage = true
if (max >= list.length) {
max = list.length
hasNextPage = false
}
const start = currentPage * PageSize
const newList = list.slice(start, max)
const opts = {} as any
newList.forEach((item, index) => {
opts[`realList[${index + start}]`] = item
})
opts.loading = false
this.setData(opts, () => {
this._loading = false
this._currentPage = nextPage
this._hasNextPage = hasNextPage
})
}
}
})
<template name="rankItem">
<view class="{{styles.item}} {{ item.me ? styles.active : '' }}">
<view class="{{styles.item_rank}}">
<image
wx:if="{{item.no === 1}}"
class="{{styles.item_rank_icon}}"
src="{{assets['rank-1.png'].u}}"
/>
<image
wx:elif="{{item.no === 2}}"
class="{{styles.item_rank_icon}}"
src="{{assets['rank-2.png'].u}}"
/>
<image
wx:elif="{{item.no === 3}}"
class="{{styles.item_rank_icon}}"
src="{{assets['rank-3.png'].u}}"
/>
<text wx:else class="{{styles.item_rank_index}}">{{item.no}}</text>
</view>
<view class="{{styles.item_username}}">
<view class="{{styles.item_username_text}}">
{{item.nickName || '-'}} <text wx:if="{{item.me}}">(你)</text>
</view>
<image
wx:if="{{item.identity === 'LEADER'}}"
class="{{styles.item_username_crown}}"
src="{{assets['crown-small.png'].u}}"
/>
</view>
<view class="{{styles.item_result}}">
<text class="{{styles.item_result_first}}">{{item.loseNum}}</text>
<text>|</text>
<text class="{{styles.item_result_best}}">{{item.winNum}}</text>
</view>
</view>
</template>
<view class="{{styles.thead}}">
<text class="{{styles.thead_index}}">名次</text>
<text class="{{styles.thead_username}}">用户名</text>
<view class="{{styles.thead_result}}">
<text class="{{styles.thead_result_first}}">负场</text>
<text>|</text>
<text class="{{styles.thead_result_best}}">胜场</text>
</view>
</view>
<template is="rankItem" wx:if="{{me}}" data="{{ styles, item: me, assets }}"/>
<block wx:for="{{ realList }}" wx:key="userId">
<template is="rankItem" data="{{ styles, item, assets }}"/>
</block>
<view class="{{styles.spinWrap}}" wx:if="{{loading}}">
<view class="{{styles.spin}}">
<view class="{{styles.spinIcon}}"></view><View class="{{styles.spinText}}">加载中</View>
</view>
</view>
<view class="{{styles.empty}}" wx:if="{{list.length < 1}}">暂无数据</view>
import { View, RootPortal, Image, Button, ButtonProps, CommonEventFunction, Input } from '@tarojs/components'
import classNames from 'classnames'
import { useCallback, useRef, useState } from 'react'
import { useCallback, useState } from 'react'
import { EyeProtectionView } from '@/components'
import { useBoolean } from '@/hooks'
import { useStoreActions } from '@/store/hooks'
import { getNickNameWords, type NickNameWord } from '@/api'
// import { useBoolean } from '@/hooks'
// import { getNickNameWords, type NickNameWord } from '@/api'
import assetsPk from '@/assets/oss/assets-pk'
import assetsGuide from '@/assets/oss/assets-guide'
// import assetsGuide from '@/assets/oss/assets-guide'
import { report, SkynetEvent } from '@/utils/skynet'
import styles from './modal-name.module.scss'
const randomPick = (arr: string[]) => {
const len = arr.length
const randomIndex = Math.floor(Math.random() * len)
return arr[randomIndex]
}
// const randomPick = (arr: string[]) => {
// const len = arr.length
// const randomIndex = Math.floor(Math.random() * len)
// return arr[randomIndex]
// }
const ModalName = ({
isVisible,
......@@ -26,39 +26,39 @@ const ModalName = ({
onClose: () => void;
onFinish: () => void;
}) => {
const [name, setName] = useState('小明')
const [generating, { setTrue, setFalse }] = useBoolean(false)
const dataRef = useRef<NickNameWord>({ noun: [], adj: [] })
const timerRef = useRef<NodeJS.Timer | null>(null)
const [name, setName] = useState('')
// const [generating, { setTrue, setFalse }] = useBoolean(false)
// const dataRef = useRef<NickNameWord>({ noun: [], adj: [] })
// const timerRef = useRef<NodeJS.Timer | null>(null)
const updateNickNameAndPhone = useStoreActions(actions => actions.userModel.updateNickNameAndPhone)
const generateName = useCallback(() => {
const { noun, adj } = dataRef.current
const nam = [randomPick(adj), randomPick(noun)].filter(Boolean).join('')
setName(nam)
}, [])
// const generateName = useCallback(() => {
// const { noun, adj } = dataRef.current
// const nam = [randomPick(adj), randomPick(noun)].filter(Boolean).join('')
// setName(nam)
// }, [])
const getNameWords = useCallback(async () => {
const words = await getNickNameWords()
dataRef.current = words
generateName()
}, [generateName])
// const getNameWords = useCallback(async () => {
// const words = await getNickNameWords()
// dataRef.current = words
// generateName()
// }, [generateName])
const handleGenerate = useCallback(() => {
setTrue()
if (dataRef.current.adj.length < 1) {
getNameWords()
} else {
generateName()
}
if (timerRef.current) {
clearTimeout(timerRef.current)
}
timerRef.current = setTimeout(() => {
setFalse()
timerRef.current = null
}, 1000)
}, [generateName, setTrue, setFalse, getNameWords])
// const handleGenerate = useCallback(() => {
// setTrue()
// if (dataRef.current.adj.length < 1) {
// getNameWords()
// } else {
// generateName()
// }
// if (timerRef.current) {
// clearTimeout(timerRef.current)
// }
// timerRef.current = setTimeout(() => {
// setFalse()
// timerRef.current = null
// }, 1000)
// }, [generateName, setTrue, setFalse, getNameWords])
const [loading, setLoading] = useState(false)
const handleGetPhone = useCallback<CommonEventFunction<ButtonProps.onGetPhoneNumberEventDetail>>((e) => {
......@@ -78,7 +78,7 @@ const ModalName = ({
setLoading(false)
console.log(err)
})
}, [onClose, updateNickNameAndPhone, onFinish, name, loading])
}, [updateNickNameAndPhone, onFinish, name, loading])
return (
<RootPortal>
......@@ -95,22 +95,23 @@ const ModalName = ({
/>
<View className={styles.title}>请问大侠,尊姓大名</View>
<View className={styles.tips}>
请输入您的角色名(7字以内)
请输入您的姓名(7字以内)
</View>
<View className={styles.input}>
<Input
className={styles.inputName}
value={name as string}
placeholder="请输入"
onInput={(e) => setName(e.detail.value)}
/>
<Image
{/* <Image
src={assetsGuide['touzi.png'].u}
className={classNames(
styles.inputIcon,
generating && styles.generating
)}
onClick={handleGenerate}
></Image>
></Image> */}
</View>
<View className={styles.footer}>
<Button
......
......@@ -26,7 +26,7 @@ export type TutorialRef = {
}
const Tutorial = () => {
const joinDefered = useStoreState(state => state.userModel.joinDefered)
const joinDeferred = useStoreState(state => state.userModel.joinDefered)
const updateUserInfo = useStoreActions(actions => actions.userModel.updateUserInfo)
const updateGuideActive = useStoreActions(actions => actions.guideModel.updateGuideActive)
const isMainGuideComplete = useStoreState(state => state.guideModel.isMainGuideComplete)
......@@ -46,10 +46,10 @@ const Tutorial = () => {
const isFocus = useFocus()
useEffect(() => {
if (!joinDefered) {
if (!joinDeferred) {
setEnable(false)
} else {
joinDefered.getPromise().then(() => {
joinDeferred.getPromise().then(() => {
setEnable(true)
})
}
......@@ -57,7 +57,7 @@ const Tutorial = () => {
return () => {
setEnable(false)
}
}, [joinDefered])
}, [joinDeferred])
const [data, setData] = useState<AreaAndGrades>({ areas: [], grades: [] })
......@@ -107,7 +107,9 @@ const Tutorial = () => {
if (isLoadRef.current) {
return
}
if (!userInfo.city || !userInfo.grade) {
isLoadRef.current = true
}
// 没选择城市
if (!userInfo.city) {
setStep(1)
......@@ -119,13 +121,14 @@ const Tutorial = () => {
if (stageList.length < 1) {
return
}
isLoadRef.current = true
const index = stageList.findIndex(c => c.status === StageStatus.CURRENT)
if (!isMainGuideComplete && index === 0) {
updateGuideActive(true)
}
}
}
}, [isFocus, data.areas, isMainGuideComplete, updateGuideActive, loadData, userInfo.city, userInfo.grade, stageList])
}, [isFocus, data.areas, isMainGuideComplete, updateGuideActive, loadData, userInfo.city, userInfo, stageList])
if (!enable) {
return null
......
......@@ -57,7 +57,7 @@ const Guide = (props: GuideProps) => {
// <Scene3 spriteTop={spriteTop} isCurrent={step === 2} onNext={(val: number) => { setStep(3); setTime(val) }} key={3} />,
// <Scene4 spriteTop={spriteTop} isCurrent={step === 3} onNext={() => setStep(4)} time={time} key={4} />,
<Scene5 spriteTop={spriteTop} isCurrent={step === 2} onNext={() => setStep(3)} key={2} />,
<Scene6 spriteTop={spriteTop} onNext={onDone} key={3} />
<Scene6 spriteTop={spriteTop} isCurrent={step === 3} onNext={onDone} key={3} />
]
}, [onDone, spriteTop, step])
......
import { View, Input, Image, ScrollView, Button, CommonEventFunction, ButtonProps } from '@tarojs/components'
import classNames from 'classnames'
import { useState, useCallback, useEffect, useRef, useMemo } from 'react'
import { useState, useCallback, useMemo, useEffect } from 'react'
import { useStoreActions } from '@/store/hooks'
import { showToast } from '@tarojs/taro'
import assets from '@/assets/oss/assets-guide'
import { useBoolean } from '@/hooks'
// import { useBoolean } from '@/hooks'
import { report, SkynetEvent } from '@/utils/skynet'
import { getNickNameWords, type NickNameWord } from '@/api'
// import { getNickNameWords, type NickNameWord } from '@/api'
import cs from './index.module.scss'
import styles from './scene-6.module.scss'
type Scene6Props = {
spriteTop: number;
onNext: () => void;
isCurrent: boolean;
}
const randomPick = (arr: string[]) => {
const len = arr.length
const randomIndex = Math.floor(Math.random() * len)
return arr[randomIndex]
}
// const randomPick = (arr: string[]) => {
// const len = arr.length
// const randomIndex = Math.floor(Math.random() * len)
// return arr[randomIndex]
// }
const Scene6 = (props: Scene6Props) => {
const { spriteTop, onNext } = props
const { spriteTop, onNext, isCurrent } = props
const [name, setName] = useState('')
const dataRef = useRef<NickNameWord>({ noun: [], adj: [] })
const timerRef = useRef<NodeJS.Timer | null>(null)
// const dataRef = useRef<NickNameWord>({ noun: [], adj: [] })
// const timerRef = useRef<NodeJS.Timer | null>(null)
const [loading, setLoading] = useState(false)
const [isGenerating, genActions] = useBoolean(false)
const [focus, setFocus] = useState(false)
// const [isGenerating, genActions] = useBoolean(false)
const genName = useCallback(() => {
const { noun, adj } = dataRef.current
const nam = [randomPick(adj), randomPick(noun)].filter(Boolean).join('')
setName(nam)
}, [])
// const genName = useCallback(() => {
// const { noun, adj } = dataRef.current
// const nam = [randomPick(adj), randomPick(noun)].filter(Boolean).join('')
// setName(nam)
// }, [])
useEffect(() => {
let timer: NodeJS.Timer
if (isCurrent) {
timer = setTimeout(() => {
setFocus(true)
}, 1000)
}
return () => {
if (timer) {
clearTimeout(timer)
}
}
}, [isCurrent])
const updateNickNameAndPhone = useStoreActions(actions => actions.userModel.updateNickNameAndPhone)
......@@ -56,31 +72,31 @@ const Scene6 = (props: Scene6Props) => {
})
}, [updateNickNameAndPhone, onNext, name, loading])
const _getNickNameWords = useCallback(async () => {
const words = await getNickNameWords()
dataRef.current = words
genName()
}, [genName])
const handleGen = useCallback(() => {
genActions.setTrue()
if (dataRef.current.adj.length < 1) {
_getNickNameWords()
} else {
genName()
}
if (timerRef.current) {
clearTimeout(timerRef.current)
}
timerRef.current = setTimeout(() => {
genActions.setFalse()
timerRef.current = null
}, 1000)
}, [genName, genActions, _getNickNameWords])
useEffect(() => {
_getNickNameWords()
}, [_getNickNameWords])
// const _getNickNameWords = useCallback(async () => {
// const words = await getNickNameWords()
// dataRef.current = words
// genName()
// }, [genName])
// const handleGen = useCallback(() => {
// genActions.setTrue()
// if (dataRef.current.adj.length < 1) {
// _getNickNameWords()
// } else {
// genName()
// }
// if (timerRef.current) {
// clearTimeout(timerRef.current)
// }
// timerRef.current = setTimeout(() => {
// genActions.setFalse()
// timerRef.current = null
// }, 1000)
// }, [genName, genActions, _getNickNameWords])
// useEffect(() => {
// _getNickNameWords()
// }, [_getNickNameWords])
const handleInput = useCallback((e) => {
setName(e.detail.value)
......@@ -104,25 +120,25 @@ const Scene6 = (props: Scene6Props) => {
<View className={classNames(cs.sprite, cs.step_static)} style={{ paddingTop: `${spriteTop}px` }}>
<Image src={assets['cat-5.png'].u} className={cs.cat} />
<View className={styles.modal_4} style={{ marginTop: `${spriteTop}px` }}>
<View>请输入你的角色名(7字以内)</View>
<View className={styles.tips}>*仅用于排行榜展示哦</View>
<View>请填写你的真实姓名</View>
<View className={styles.tips}>*将用于最后的结果与奖品发放哦</View>
</View>
</View>
<View className={styles.top}></View>
<View>
<View className={styles.input}>
<View className={styles.input_item}>
<Input value={name} className={styles.input_inner} onInput={handleInput}></Input>
<Input value={name} className={styles.input_inner} focus={focus} placeholder="请输入姓名" onInput={handleInput}></Input>
</View>
<Image
{/* <Image
src={assets['touzi.png'].u}
className={classNames(styles.input_icon, isGenerating && styles.is_gen)}
onClick={handleGen}
id="main_guide_6_gen_name"
></Image>
></Image> */}
</View>
<View className={styles.input_tip}>
* 可点击右侧按钮随机生成昵称
{/* * 可点击右侧按钮随机生成昵称 */}
</View>
</View>
<View className={styles.bottom}></View>
......@@ -143,6 +159,7 @@ const Scene6 = (props: Scene6Props) => {
<Button
openType="getPhoneNumber"
onGetPhoneNumber={handleGetPhone}
onAgreePrivacyAuthorization={console.log}
className={cs.btn}
loading={loading}
disabled={loading}
......
......@@ -33,7 +33,7 @@ const MainHeader = () => {
<Image src={assetsMainNext['page-head-2.png'].u} mode="widthFix" className={styles.bg}></Image>
<View className={styles.chapterContent}>
<View className={styles.chapterName}>
地心历险记
计算小勇士
</View>
</View>
{!isAddDeskTopGuideComplete && (
......
......@@ -35,7 +35,7 @@ const ModalAuthPhoneBefore = (props: ModalAuthPhoneBeforeProps) => {
为了让阿喵老师能给你发放礼品,需要你进行授权哦。
<View>
<Text className={styles.em}>授权成功后,</Text>还可以
<Text className={styles.em}>获得100水晶</Text>奖励哦!
<Text className={styles.em}>获得20水晶</Text>奖励哦!
</View>
</View>
<View className={styles.continue}>
......
......@@ -98,7 +98,7 @@ const ModalReceivePoint = (props: ReceivePointProps) => {
return (
<View className={styles.modal} catchMove>
<Image src={giftAssets['point-receive.png'].u} className={styles.icon}></Image>
<View className={styles.count}>水晶 +100</View>
<View className={styles.count}>水晶 +20</View>
<View className={styles.tips}>阿喵老师的奖励,继续加油哦~</View>
{useInfo.authPhone === 'Y'
? (
......
import { PropsWithChildren } from 'react'
import { View, RootPortal, Image, Text } from '@tarojs/components'
import { switchTab } from '@tarojs/taro'
import { redirectTo } from '@tarojs/taro'
import classNames from 'classnames'
import styles from './answer-card-modal.module.scss'
......@@ -23,8 +23,8 @@ const AnswerSheetModal = (props: PropsWithChildren<ModalProps>) => {
<View className={styles.tips}>可通过以下途径获得哦</View>
<View className={styles.footer}>
{children}
<View className={styles.studyTribe} onClick={() => switchTab({ url: '/pages/group/index' })}>
<Text>建设学习部落,得更多答题卡</Text>
<View className={styles.studyTribe} onClick={() => redirectTo({ url: '/pages/battles/index' })}>
<Text>发起更多PK,赢水晶</Text>
</View>
</View>
</View>
......
......@@ -3,6 +3,7 @@ export default definePageConfig({
navigationBarTitleText: 'pk-math',
navigationStyle: 'custom',
usingComponents: {
'game-rank': '@/native-components/rank/index'
'game-rank': '@/native-components/rank/index',
'game-pk-rank': '@/native-components/pk-rank/index'
}
})
......@@ -5,13 +5,11 @@ import classNames from 'classnames'
import Button from '@/components/Button'
import Loading from '@/components/Loading'
import ShareView from '@/pages/group/components/share-view'
import { useStoreState, useStoreActions } from '@/store/hooks'
import { useBoolean, useRequest, useShare } from '@/hooks'
import { pointToCard } from '@/api/account'
import assets from '@/assets/oss/assets-prepare'
import assetsGroup from '@/assets/oss/assets-group'
import { palyAudio } from '@/utils/play-audio'
import audio from '@/assets/oss/assets-audio'
import { EyeProtectionView } from '@/components'
......@@ -20,10 +18,9 @@ import tutorialAssets from '@/assets/oss/assets-tutorial'
import Tabs, { type TabItem } from './components/tabs'
import TopBar from './components/top-bar'
import MainHeader from './components/main-header'
import PkGuide from './guide/pk/scene-1'
import AnswerCardModal from './components/answer-card-modal'
import PkGuideScene from './guide/pk/scene'
import { renderTribePage, RankList } from './render'
import { RankList, PkRankList } from './render'
import styles from './index.module.scss'
......@@ -61,11 +58,9 @@ const Prepare = () => {
)
},
{
label: '学习部落排行榜',
label: 'PK排行榜',
children: (
<View className={styles.tribe}>
{renderTribePage(stageDetail?.groupRanks || [], tribeInfo?.groupNo)}
</View>
<PkRankList list={stageDetail?.pkRanks || []}></PkRankList>
)
}
]
......@@ -259,16 +254,12 @@ const Prepare = () => {
</View>
<View className={styles.footer_bar}>
{currentTab === 1 && tribeInfo && tribeInfo.id && <ShareView>
{/* <View className={styles.members_tip}>
<Image className={styles.members_tip_icon} src={require('@/pages/main/assets/score.png')} />
<Text className={styles.members_tip_text}>+100</Text>
</View> */}
{/* {currentTab === 1 && tribeInfo && tribeInfo.id && <ShareView>
<View className={styles.tribe_share}>
<Image style={{ width: 32, height: 32 }} src={assetsGroup['invite-small.png'].u} />
<Text style={{ color: '#FF7A18', fontSize: 16 }}>邀请更多好友加入学习部落</Text>
</View>
</ShareView>}
</ShareView>} */}
{!isSubmit ? renderFisrtActions() : renderAgainActions()}
</View>
......
import { View, Text, Image } from '@tarojs/components'
import { switchTab, useReachBottom, getCurrentInstance } from '@tarojs/taro'
import { useRef, useMemo } from 'react'
import { type StageRank } from '@/api/game'
import { PKRank, type StageRank } from '@/api/game'
import assets from '@/assets/oss/assets-prepare'
import styles from './index.module.scss'
......@@ -27,6 +27,27 @@ export function RankList (props: RankListProps) {
)
}
type PkRankListProps = {
list: PKRank[]
}
export function PkRankList (props: PkRankListProps) {
const { list } = props
const page = useMemo(() => getCurrentInstance()?.page, [])
const pkRank = useRef(null)
useReachBottom(() => {
if (pkRank.current) {
(page?.selectComponent?.(`#${(pkRank.current as any).uid}`) as any)?.loadMore()
}
})
return (
<game-pk-rank list={list} ref={pkRank} />
)
}
const renderEmptyTribe = () => (
<View className={styles.tribe_empty}>
<Image className={styles.tribe_empty_logo} src={assets['tribe.png'].u} mode="widthFix" />
......
......@@ -69,10 +69,11 @@ const userModel: UserModel = {
updateNickNameAndPhone: thunk(async (actions, payload, helpers) => {
try {
const defaultUserInfo = { city: '成都', grade: '二年级' }
const fns: Promise<any>[] = [
]
if (payload.name) {
fns.push(updateUserInfo({ nickName: payload.name }))
fns.push(updateUserInfo({ nickName: payload.name, ...defaultUserInfo }))
}
let authPhone
......@@ -93,7 +94,7 @@ const userModel: UserModel = {
}
if (payload.name) {
current = { ...current, nickName: payload.name }
current = { ...current, nickName: payload.name, ...defaultUserInfo }
}
updateStorage(StorageKeys.userInfo, current)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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