diff --git a/mini/package.json b/mini/package.json index a6e252f8711a9b70eadfda37b7757e6d43b9889c..d10a0b613f58e1115c0c38814f352523bd6c7a3a 100644 --- a/mini/package.json +++ b/mini/package.json @@ -30,7 +30,7 @@ "license": "MIT", "dependencies": { "@babel/runtime": "7.7.7", - "@discuzqsdk/design": "1.3.30", + "@discuzqsdk/design": "1.3.32", "@discuzqsdk/discuz-babel-plugin-import": "0.0.2", "@discuzqsdk/discuz-plugin-loader": "2.1.31", "@discuzqsdk/plugin-center": "2.0.38", diff --git a/mini/src/components/user-center-edit-header/index.jsx b/mini/src/components/user-center-edit-header/index.jsx index 9f4a765a9e5e0c356715a55c6b8df7ba5073751c..1252624b32dfe651e192eb65a0219dfc6dca8814 100644 --- a/mini/src/components/user-center-edit-header/index.jsx +++ b/mini/src/components/user-center-edit-header/index.jsx @@ -5,6 +5,7 @@ import Avatar from '@components/avatar'; import UserCenterHeaderImage from '@components/user-center-header-images'; import Icon from '@discuzqsdk/design/dist/components/icon/index'; import Input from '@discuzqsdk/design/dist/components/input/index'; +import Button from '@discuzqsdk/design/dist/components/button/index'; import { inject, observer } from 'mobx-react'; import { ACCEPT_IMAGE_TYPES } from '@common/constants/thread-post'; import { View, Text, Canvas } from '@tarojs/components'; @@ -35,10 +36,17 @@ export default class index extends Component { this.hiddenElement = React.createRef(); } + onChooseAvatar = (e) => { + const { avatarUrl } = e.detail + console.log(avatarUrl) + this.onAvatarChange(avatarUrl); + }; + handleAvatarUpload = () => { Taro.chooseImage({ count: 1, success: (res) => { + console.log(res.tempFiles) this.onAvatarChange(res.tempFiles); }, }); @@ -162,7 +170,7 @@ export default class index extends Component { // const file = await this.getCanvasImg(fileList[0]); const uploadRes = await Taro.uploadFile({ url: `${this.config.COMMON_BASE_URL}/api/v3/users/avatar`, - filePath: fileList[0].path, + filePath: fileList, header: { 'Content-Type': 'multipart/form-data', authorization: `Bearer ${token}`, @@ -365,9 +373,11 @@ export default class index extends Component { {/* 相机图标 */} - + {/* 上传中样式处理 */} {isUploadAvatarUrl && ( diff --git a/mini/src/components/user-center-edit-info/index.jsx b/mini/src/components/user-center-edit-info/index.jsx index 3dc9b0ab3a15e03b754276d1dbbe94af200b7e7d..ea3f86f0ff468eca0dab988fe0af131da877a95f 100644 --- a/mini/src/components/user-center-edit-info/index.jsx +++ b/mini/src/components/user-center-edit-info/index.jsx @@ -65,6 +65,12 @@ class index extends Component { handleChangeNickName = (e) => { const { value } = e.target; this.props.user.editNickName = value; + + }; + + handleInputNickName = (e) => { + const { value } = e.detail; + this.props.user.editNickName = value; }; handleBlurNickName = (e) => { @@ -149,6 +155,8 @@ class index extends Component { focus maxLength={10} value={this.user.editNickName} + miniType="nickname" + onInput={this.handleInputNickName} onChange={this.handleChangeNickName} onBlur={this.handleBlurNickName} /> diff --git a/mini/src/components/user-center-edit-username/index.jsx b/mini/src/components/user-center-edit-username/index.jsx index 19c659c6a36dbc7b860f799797a873cacb0257a7..13ac71397107dee13501f1134187a0f2b66669de 100644 --- a/mini/src/components/user-center-edit-username/index.jsx +++ b/mini/src/components/user-center-edit-username/index.jsx @@ -25,7 +25,14 @@ export default class index extends Component { }; handleChangeNewUserName = (e) => { - this.props.user.editUserName = e.target.value; + if (e.target.value){ + this.props.user.editUserName = e.target.value; + } + }; + + handleInputNickName = (e) => { + const { value } = e.detail; + this.props.user.editUserName = value; }; handleSubmit = async () => { @@ -66,6 +73,8 @@ export default class index extends Component {