Commit 5367faf4 authored by raca's avatar raca

feat: update

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