|
|
|
@ -2,7 +2,7 @@ import {useState} from "react"; |
|
|
|
|
import {Profile} from '@/store' |
|
|
|
|
import avatar from "@/static/img/avatar.png" |
|
|
|
|
import PopPut from "@/components/popPut/popPut"; |
|
|
|
|
import {Button, Input, View} from "@tarojs/components"; |
|
|
|
|
import {Input, View} from "@tarojs/components"; |
|
|
|
|
import Taro from "@tarojs/taro"; |
|
|
|
|
import {userApi} from "@/api"; |
|
|
|
|
import styles from './userInfo.module.scss' |
|
|
|
@ -29,8 +29,8 @@ const List = () => { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function putName() { |
|
|
|
|
if (!name) { |
|
|
|
|
Taro.showToast({title: "名称不能为空", icon: 'error'}) |
|
|
|
|
if (!name && name.length < 2) { |
|
|
|
|
Taro.showToast({title: "名称不能小于2个字", icon: 'error'}) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
const res = await userApi.putName(user?.id!, name) |
|
|
|
@ -41,6 +41,15 @@ const List = () => { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function outLogin() { |
|
|
|
|
Taro.showModal({ |
|
|
|
|
title: '是否确定退出登录', |
|
|
|
|
success({confirm}) { |
|
|
|
|
confirm && empty() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
@ -48,7 +57,7 @@ const List = () => { |
|
|
|
|
<PopPut title='头像' image={avatar} chevron no_border/> |
|
|
|
|
<PopPut title='手机号' content={user?.phone_number} chevron no_border/> |
|
|
|
|
<PopPut title='昵称' content={user?.name} isProp show={show} no_border> |
|
|
|
|
<View className='py-4 px-3'> |
|
|
|
|
<View className='p-2'> |
|
|
|
|
<View className='text-center font-weigh mb-3'>修改昵称</View> |
|
|
|
|
<Input className='input' |
|
|
|
|
placeholder='请输入昵称' |
|
|
|
@ -56,15 +65,15 @@ const List = () => { |
|
|
|
|
cursorSpacing={110} |
|
|
|
|
value={name} |
|
|
|
|
/> |
|
|
|
|
<View className='text-muted my-3 font-24'>限制4-20个字符,可由中英文、数字、“_”、“-”组成</View> |
|
|
|
|
<Button className={styles.button} onClick={putName}>确定</Button> |
|
|
|
|
<View className='text-muted my-3 font-24'>限制2-20个字符,可由中英文、数字、“_”、“-”组成</View> |
|
|
|
|
<MyButton onClick={putName}>确定</MyButton> |
|
|
|
|
</View> |
|
|
|
|
</PopPut> |
|
|
|
|
|
|
|
|
|
<PopPut title='解绑微信' onClick={unbind} no_border/> |
|
|
|
|
</View> |
|
|
|
|
<View className={styles.buttonFixed}> |
|
|
|
|
<MyButton onClick={empty}>退出登录</MyButton> |
|
|
|
|
<MyButton onClick={outLogin}>退出登录</MyButton> |
|
|
|
|
</View> |
|
|
|
|
</> |
|
|
|
|
) |
|
|
|
|