methods: {
//获取用户可以操作的账号列表
getUserList(){
let userid=uni.getStorageSync('userInfo').id;
request({
url:inter.getMergeAccounts,
data:{
userId:userid,
},
callback:(res)=>{
let data=res.RESULT;
let userList = this._formatData(data)
console.log('AAAAAAAA',userList);
}
})
},
// 格式化商家数据
_formatData(data) {
let self = this;
let tempArr = [];
if(data && data.length > 0) {
data = data.map(item => {
let obj = {
id: item.id,
userName: item.userName,
headImg: item.headImg,
userPhone: item.userPhone ? self.phoneEncryption(item.userPhone) : '',
userTags: item.userTags,
check: item.check, //当前身份是否需要默认选中的标识,后端返回的
};
tempArr.push(obj)
})
}
return tempArr;
},
//手机号加密
phoneEncryption(phone){
var reg = /^(\d{3})\d*(\d{4})$/;
var str2 = phone.replace(reg,'$1****$2')
return str2
},
网友评论