Fix(用户):[#1899]设置昵称限制最多12个字,不能输入超过12字

This commit is contained in:
lifizer
2024-06-28 16:07:36 +08:00
parent 609b8a8b60
commit e5ce19539d
2 changed files with 9 additions and 2 deletions
+1
View File
@@ -53,6 +53,7 @@
</button> </button>
<input <input
type="nickname" type="nickname"
maxlength="12"
class="input-wrapper" class="input-wrapper"
placeholder="请输入昵称" placeholder="请输入昵称"
@input="inputName" @input="inputName"
+8 -2
View File
@@ -20,7 +20,11 @@
<view class="flex ai-center"> <view class="flex ai-center">
<view class="title">昵称</view> <view class="title">昵称</view>
<view class="value"> <view class="value">
<input type="text" v-model="userInfo.nickname"/> <input
v-model="nickname"
type="text"
maxlength="12"
/>
</view> </view>
</view> </view>
<view class="icon"> <view class="icon">
@@ -122,6 +126,7 @@ export default {
return { return {
webUrl: this.$VUE_APP_RESOURCES_URL, webUrl: this.$VUE_APP_RESOURCES_URL,
avatar: '', avatar: '',
nickname: '',
isWeixin: false, isWeixin: false,
currentAccounts: 0, currentAccounts: 0,
switchUserInfo: [], switchUserInfo: [],
@@ -138,6 +143,7 @@ export default {
computed: mapGetters(['userInfo']), computed: mapGetters(['userInfo']),
mounted: function () { mounted: function () {
this.avatar = this.userInfo.avatar this.avatar = this.userInfo.avatar
this.nickname = this.userInfo.nickname
this.form.gender = this.userInfo.gender this.form.gender = this.userInfo.gender
this.form.birthday = this.userInfo.birthday || '' this.form.birthday = this.userInfo.birthday || ''
this.isWeixin = isWeixin() this.isWeixin = isWeixin()
@@ -194,7 +200,7 @@ export default {
submit: function () { submit: function () {
const that = this const that = this
postUserEdit({ postUserEdit({
nickname: trim(this.userInfo.nickname), nickname: trim(this.nickname),
avatar: this.avatar, avatar: this.avatar,
gender: this.form.gender, gender: this.form.gender,
birthday: this.form.birthday birthday: this.form.birthday