Commit 5367faf4 authored by raca's avatar raca

feat: update

parent 100bfa5b
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
export default { export default {
pages: [ pages: [
'pages/market/index',
'pages/main/main', 'pages/main/main',
'pages/market/index',
'pages/accept-pk/index', 'pages/accept-pk/index',
'pages/battles/index', 'pages/battles/index',
'pages/prepare/index', 'pages/prepare/index',
......
...@@ -11,10 +11,9 @@ import styles from './exchange-item.module.scss' ...@@ -11,10 +11,9 @@ import styles from './exchange-item.module.scss'
import styles2 from './exchange-rename-card.module.scss' import styles2 from './exchange-rename-card.module.scss'
type ExchangeItemProps = { type ExchangeItemProps = {
title: string; title: string
stepValue: number; stepValue: number
// onConfirm: (arg: number) => void; onCancel: () => void
onCancel: () => void;
} }
const randomPick = (arr: string[]) => { const randomPick = (arr: string[]) => {
...@@ -25,13 +24,17 @@ const randomPick = (arr: string[]) => { ...@@ -25,13 +24,17 @@ const randomPick = (arr: string[]) => {
const ExchangeRenameCard = (props: ExchangeItemProps) => { const ExchangeRenameCard = (props: ExchangeItemProps) => {
const { onCancel, stepValue } = props const { onCancel, stepValue } = props
const userInfo = useStoreState(state => state.userModel.userInfo) const userInfo = useStoreState((state) => state.userModel.userInfo)
const [name, setName] = useState(userInfo.nickName) const [name, setName] = useState(userInfo.nickName)
const [generating, { setTrue, setFalse }] = useBoolean(false) const [generating, { setTrue, setFalse }] = useBoolean(false)
const dataRef = useRef<NickNameWord>({ noun: [], adj: [] }) const dataRef = useRef<NickNameWord>({ noun: [], adj: [] })
const timerRef = useRef<NodeJS.Timer | null>(null) const timerRef = useRef<NodeJS.Timer | null>(null)
const accountExchange = useStoreActions(actions => actions.userModel.accountExchange) const accountExchange = useStoreActions(
const changeNickName = useStoreActions(actions => actions.userModel.changeNickName) (actions) => actions.userModel.accountExchange
)
const changeNickName = useStoreActions(
(actions) => actions.userModel.changeNickName
)
const generateName = useCallback(() => { const generateName = useCallback(() => {
const { noun, adj } = dataRef.current const { noun, adj } = dataRef.current
...@@ -73,21 +76,25 @@ const ExchangeRenameCard = (props: ExchangeItemProps) => { ...@@ -73,21 +76,25 @@ const ExchangeRenameCard = (props: ExchangeItemProps) => {
num: 1, num: 1,
accountTo: 'NAME_CARD', accountTo: 'NAME_CARD',
accountFrom: 'POINT', accountFrom: 'POINT',
}).then(() => {
changeNickName(name).then(() => {
showToast({ title: '操作成功', icon: 'success' })
})
}).catch(() => {
}) })
.then(() => {
changeNickName(name).then(() => {
showToast({ title: '操作成功', icon: 'success' })
onCancel && onCancel()
})
})
.catch(() => {})
} }
return ( return (
<> <>
<View className={styles2.description}> <View className={styles2.description}>请输入您的角色名(7字以内)</View>
请输入您的角色名(7字以内)
</View>
<View className={styles2.input}> <View className={styles2.input}>
<Input className={styles2.inputName} value={name as string} onInput={e => setName(e.detail.value)} /> <Input
className={styles2.inputName}
value={name as string}
onInput={(e) => setName(e.detail.value)}
/>
<Image <Image
src={assetsGuide['touzi.png'].u} src={assetsGuide['touzi.png'].u}
className={classNames( className={classNames(
...@@ -97,10 +104,22 @@ const ExchangeRenameCard = (props: ExchangeItemProps) => { ...@@ -97,10 +104,22 @@ const ExchangeRenameCard = (props: ExchangeItemProps) => {
onClick={handleGenerate} onClick={handleGenerate}
></Image> ></Image>
</View> </View>
<View className={styles2.tips}>将消耗 <Text className={styles2.tips_val}>{stepValue}</Text> 水晶</View> <View className={styles2.tips}>
将消耗 <Text className={styles2.tips_val}>{stepValue}</Text> 水晶
</View>
<View className={styles.footer}> <View className={styles.footer}>
<View className={styles.cancel} onClick={() => onCancel()} id="market_exchange_cancel">取消</View> <View
<View className={styles.confirm} onClick={handleConfirm} data-name="兑换改名卡"> className={styles.cancel}
onClick={() => onCancel()}
id="market_exchange_cancel"
>
取消
</View>
<View
className={styles.confirm}
onClick={handleConfirm}
data-name="兑换改名卡"
>
确定 确定
</View> </View>
</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