fix: 修复手机号码被截断的问题,优化一键添加微信昵称,优化一键添加微信头像

This commit is contained in:
mixtan 2025-05-12 17:02:32 +08:00
parent d663124cf4
commit f1fd270762

View File

@ -2,25 +2,22 @@
<view class="page member-user-info-container">
<view class="m-cells m-cells-form">
<view class="m-cell" style="padding: 2rpx 30rpx">
<view class="m-cell-hd"
><label class="u-label">{{ __("头像") }}</label></view
>
<view class="m-cell-hd"><label class="u-label">{{ __("头像") }}</label></view>
<view class="m-cell-bd" style="padding: 0; margin: 0; line-height: 1">
<view class="uni-uploader-body">
<view class="uni-uploader__files">
<block v-if="user_avatar">
<view class="uni-uploader__file">
<image
class="uni-uploader__img"
:src="user_avatar"
:data-src="user_avatar"
@click.stop="upImgs"
></image>
<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<block v-if="user_avatar">
<view class="uni-uploader__file">
<image class="uni-uploader__img" :src="user_avatar" :data-src="user_avatar"
@click.stop="chooseAvatar">
</image>
</view>
</block>
<view class="uni-uploader__input-box" v-else>
<view class="uni-uploader__input" @click.stop="chooseAvatar"></view>
</view>
</block>
<view class="uni-uploader__input-box" v-else>
<view class="uni-uploader__input" @click.stop="upImgs"></view>
</view>
</button>
</view>
</view>
</view>
@ -29,93 +26,48 @@
<view class="m-cell">
<view class="m-cell-hd"><label class="u-label">会员等级</label></view>
<view class="m-cell-bd">
<input
class="u-input"
type="text"
:value="user_level_name"
disabled="true"
/>
<input class="u-input" type="text" :value="user_level_name" disabled="true" />
</view>
</view>
<view class="m-cell">
<view class="m-cell-hd"
><label class="u-label">{{ __("用户编号") }}</label></view
>
<view class="m-cell-hd"><label class="u-label">{{ __("用户编号") }}</label></view>
<view class="m-cell-bd">
<input
class="u-input"
type="number"
:value="user_id"
disabled="true"
/>
<input class="u-input" type="number" :value="user_id" disabled="true" />
</view>
</view>
<view class="m-cell" v-if="false">
<view class="m-cell-hd"
><label class="u-label">{{ __("账号") }}</label></view
>
<view class="m-cell-hd"><label class="u-label">{{ __("账号") }}</label></view>
<view class="m-cell-bd">
<input
class="u-input"
type="text"
:value="user_account"
disabled="true"
/>
<input class="u-input" type="text" :value="user_account" disabled="true" />
</view>
</view>
<view class="m-cell">
<view class="m-cell-hd"
><label class="u-label">{{ __("昵称") }}</label></view
>
<view class="m-cell-hd"><label class="u-label">{{ __("昵称") }}</label></view>
<view class="m-cell-bd">
<input
class="u-input"
type="text"
:value="user_nickname"
@input="inputuser_user_nickname"
/>
<input class="u-input" type="nickname" :value="user_nickname" placeholder="请输入昵称"
@input="inputuser_user_nickname" />
</view>
</view>
<view class="m-cell">
<view class="m-cell-hd"><label class="u-label">姓名</label></view>
<view class="m-cell-bd">
<input
class="u-input"
type="text"
:value="user_realname"
:placeholder="__('请输入姓名')"
@input="inputReName"
maxlength="30"
/>
<input class="u-input" type="text" :value="user_realname" :placeholder="__('请输入姓名')" @input="inputReName"
maxlength="30" />
</view>
</view>
<view class="m-celli hide">
<view class="m-cell-hd"
><label class="u-label">{{ __("身份证") }}</label></view
>
<view class="m-cell-hd"><label class="u-label">{{ __("身份证") }}</label></view>
<view class="m-cell-bd">
<input
class="u-input"
type="idcard"
:value="user_idcard"
:placeholder="__('请输入身份证号码')"
@input="inputICard"
maxlength="18"
/>
<input class="u-input" type="idcard" :value="user_idcard" :placeholder="__('请输入身份证号码')" @input="inputICard"
maxlength="18" />
</view>
<div v-if="!isCardNo" class="m-cell-ft">
<view class="m-icon-warn uni-icon uni-icon-info" type="warn"></view>
</div>
</view>
<view
class="m-cell"
@click="showbox"
v-if="Config.PLANTFORM_FX_AGENT_ENABLE && false"
>
<view class="m-cell-hd"
><label class="u-label">{{ __("地区") }}</label></view
>
<view class="m-cell" @click="showbox" v-if="Config.PLANTFORM_FX_AGENT_ENABLE && false">
<view class="m-cell-hd"><label class="u-label">{{ __("地区") }}</label></view>
<view class="m-cell-bd">
<label>{{ seladstr }}</label>
</view>
@ -124,17 +76,9 @@
</view>
</view>
<view class="m-cell" v-if="false">
<view class="m-cell-hd"
><label class="u-label">{{ __("地址") }}</label></view
>
<view class="m-cell-hd"><label class="u-label">{{ __("地址") }}</label></view>
<view class="m-cell-bd">
<input
class="u-input"
type="text"
:value="user_address"
:placeholder="__('请输入联系地址')"
@input="onInputAddress"
/>
<input class="u-input" type="text" :value="user_address" :placeholder="__('请输入联系地址')" @input="onInputAddress" />
</view>
<view v-if="!isUserAddress" class="m-cell-ft">
<view class="m-icon-warn uni-icon uni-icon-info" type="warn"></view>
@ -143,9 +87,7 @@
</view>
<view class="m-cells m-cells-form">
<view class="m-cell">
<view class="m-cell-hd"
><label class="u-label">{{ __("生日") }}</label></view
>
<view class="m-cell-hd"><label class="u-label">{{ __("生日") }}</label></view>
<view class="m-cell-bd">
<picker mode="date" @change="bindDateChange">
<label>{{ user_birthday }}</label>
@ -154,18 +96,10 @@
<text class="m-cell-ft-right birthday-right-icon"></text>
</view>
<view class="m-cell">
<view class="m-cell-hd"
><label class="u-label">{{ __("邮箱") }}</label></view
>
<view class="m-cell-hd"><label class="u-label">{{ __("邮箱") }}</label></view>
<view class="m-cell-bd">
<input
class="u-input"
type="text"
:value="user_email"
:placeholder="__('请输入邮箱地址')"
@input="inputuser_email"
maxlength="30"
/>
<input class="u-input" type="text" :value="user_email" :placeholder="__('请输入邮箱地址')" @input="inputuser_email"
maxlength="30" />
</view>
<view v-if="!isUserEmail" class="m-cell-ft">
<view class="m-icon-warn uni-icon uni-icon-info" type="warn"></view>
@ -174,18 +108,10 @@
</view>
<view class="m-cells m-cells-form">
<view class="m-cell">
<view class="m-cell-hd"
><label class="u-label">{{ __("手机号码") }}</label></view
>
<view class="m-cell-hd"><label class="u-label">{{ __("手机号码") }}</label></view>
<view :class="['m-cell-bd', { 'phone-right-30': !isUserMobile }]">
<input
class="u-input"
type="number"
:placeholder="__('请输入手机号码')"
maxlength="11"
@input="inputphone"
:value="user_mobile"
/>
<input class="u-input" type="number" :placeholder="__('请输入手机号码')" @input="inputphone"
:value="user_mobile" />
</view>
<view v-if="!isUserMobile" class="m-cell-ft">
<view class="m-icon-warn uni-icon uni-icon-info" type="warn"></view>
@ -196,13 +122,7 @@
<label class="u-label">{{ __("验证码") }}</label>
</view>
<view class="m-cell-bd">
<input
class="u-input"
type="number"
:placeholder="__('请输入验证码')"
maxlength="6"
@input="inputcode"
/>
<input class="u-input" type="number" :placeholder="__('请输入验证码')" maxlength="6" @input="inputcode" />
</view>
<view v-if="!isCode" class="m-cell-ft">
<view class="m-icon-warn uni-icon uni-icon-info" type="warn"></view>
@ -213,19 +133,10 @@
<view v-else class="m-vcode-btn">{{ btntext }}</view>
</view>
</view>
<mpvue-city-picker
:themeColor="themeColor"
ref="mpvueCityPicker"
:pickerValueDefault="cityPickerValueDefault"
@onCancel="onCancel"
@onConfirm="onConfirm"
></mpvue-city-picker>
<mpvue-city-picker :themeColor="themeColor" ref="mpvueCityPicker" :pickerValueDefault="cityPickerValueDefault"
@onCancel="onCancel" @onConfirm="onConfirm"></mpvue-city-picker>
<button
class="u-btn u-btn-default"
@click="submitInfo"
style="margin-top: 50rpx"
>
<button class="u-btn u-btn-default" @click="submitInfo" style="margin-top: 50rpx">
{{ __("保存") }}
</button>
</view>
@ -391,11 +302,11 @@ export default {
}
this.IdentityCodeValid(e.detail.value)
? this.setData({
isCardNo: true,
})
isCardNo: true,
})
: this.setData({
isCardNo: false,
}),
isCardNo: false,
}),
this.setData({
user_idcard: e.detail.value,
});
@ -407,15 +318,15 @@ export default {
}),
that.$.isNull(e.detail.value)
? this.setData({
isUserEmail: false,
})
isUserEmail: false,
})
: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test(
e.detail.value
)
? this.setData({
e.detail.value
)
? this.setData({
isUserEmail: true,
})
: this.setData({
: this.setData({
isUserEmail: false,
});
},
@ -440,36 +351,36 @@ export default {
this.update();
/*
if (!that.$.isNull(this.user_idcard) && !this.isCardNo) {
return;
}
*/
if (!that.$.isNull(this.user_idcard) && !this.isCardNo) {
return;
}
*/
/*
if (!/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test(this.user_email))
{
this.setData({isUserEmail: false});
return
}*/
if (!/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test(this.user_email))
{
this.setData({isUserEmail: false});
return
}*/
/*
if (!that.$.isNull(this.user_mobile)) {
this.update();
} else if (that.$.isNull(this.user_mobile)) {
this.setData({
isUserMobile: false
});
} else if (!/^1[23456789]\d{9}$/.test(this.user_mobile)) {
this.setData({
isUserMobile: false
});
} else if (this.user_mobile == this.userInfo.user_mobile) {
that.$.confirm("你已经绑定过该手机!");
} else if (that.$.isNull(this.mobile_code)) {
this.setData({
isCode: false
});
} else {}
*/
if (!that.$.isNull(this.user_mobile)) {
this.update();
} else if (that.$.isNull(this.user_mobile)) {
this.setData({
isUserMobile: false
});
} else if (!/^1[23456789]\d{9}$/.test(this.user_mobile)) {
this.setData({
isUserMobile: false
});
} else if (this.user_mobile == this.userInfo.user_mobile) {
that.$.confirm("你已经绑定过该手机!");
} else if (that.$.isNull(this.mobile_code)) {
this.setData({
isCode: false
});
} else {}
*/
},
update: function () {
@ -531,42 +442,42 @@ export default {
},
IdentityCodeValid: function (e) {
var t = {
11: "北京",
12: "天津",
13: "河北",
14: "山西",
15: "内蒙古",
21: "辽宁",
22: "吉林",
23: "黑龙江 ",
31: "上海",
32: "江苏",
33: "浙江",
34: "安徽",
35: "福建",
36: "江西",
37: "山东",
41: "河南",
42: "湖北 ",
43: "湖南",
44: "广东",
45: "广西",
46: "海南",
50: "重庆",
51: "四川",
52: "贵州",
53: "云南",
54: "西藏 ",
61: "陕西",
62: "甘肃",
63: "青海",
64: "宁夏",
65: "新疆",
71: "台湾",
81: "香港",
82: "澳门",
91: "国外 ",
},
11: "北京",
12: "天津",
13: "河北",
14: "山西",
15: "内蒙古",
21: "辽宁",
22: "吉林",
23: "黑龙江 ",
31: "上海",
32: "江苏",
33: "浙江",
34: "安徽",
35: "福建",
36: "江西",
37: "山东",
41: "河南",
42: "湖北 ",
43: "湖南",
44: "广东",
45: "广西",
46: "海南",
50: "重庆",
51: "四川",
52: "贵州",
53: "云南",
54: "西藏 ",
61: "陕西",
62: "甘肃",
63: "青海",
64: "宁夏",
65: "新疆",
71: "台湾",
81: "香港",
82: "澳门",
91: "国外 ",
},
n = true;
if (
!e ||
@ -599,13 +510,13 @@ export default {
}),
that.$.isNull(e.detail.value)
? this.setData({
isUserMobile: false,
})
isUserMobile: false,
})
: /^1[23456789]\d{9}$/.test(e.detail.value)
? this.setData({
? this.setData({
isUserMobile: true,
})
: this.setData({
: this.setData({
isUserMobile: false,
});
},
@ -616,13 +527,53 @@ export default {
}),
that.$.isNull(e.detail.value)
? this.setData({
isCode: false,
})
isCode: false,
})
: this.setData({
isCode: true,
});
isCode: true,
});
},
upImgs: function (e) {
onChooseAvatar(event) {
const { avatarUrl } = event.detail
this.user_avatar = avatarUrl;
this.onUploadAvatar(avatarUrl)
},
onUploadAvatar(filePath) {
var that = this;
let ukey = uni.getStorageSync("ukey");
that.$.showLoading();
that.$.uploadFile({
url: that.Config.URL.upload,
method: "POST",
filePath,
name: "upfile",
formData: {
perm_key: ukey,
},
success: function (n) {
that.$.hideLoading();
var up_res = that.$.parseJSON(n.data);
var s = up_res.data.url;
that.setData({
user_avatar: s,
});
that.user_avatar = s;
},
fail: function (e) {
that.$.hideLoading();
},
complete: function (e) {
that.$.hideLoading();
},
});
},
chooseAvatar: function (e) {
var that = this;
let ukey = uni.getStorageSync("ukey");
that.$.chooseImage({
@ -650,6 +601,7 @@ export default {
that.setData({
user_avatar: s,
});
that.user_avatar = s;
},
fail: function (e) {
that.$.hideLoading();
@ -695,13 +647,13 @@ export default {
var r = setInterval(function () {
t > 0
? that.setData({
btntext: t-- + "s",
})
btntext: t-- + "s",
})
: (that.setData({
isSend: true,
sendTime: 120,
btntext: that.__("重新发送"),
}),
isSend: true,
sendTime: 120,
btntext: that.__("重新发送"),
}),
clearInterval(r));
}, 1e3);
} else {
@ -717,10 +669,10 @@ export default {
//
showbox() {
/*
this.setData({
isShow: true
})
*/
this.setData({
isShow: true
})
*/
this.$refs.mpvueCityPicker.show();
},
@ -796,6 +748,13 @@ export default {
float: right;
}
.avatar-wrapper {
background: none;
height: auto;
line-height: auto;
padding: 0;
}
.uni-uploader__file {
width: 80rpx;
height: 80rpx;