temp
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
// index.js
|
||||
const defaultAvatarUrl =
|
||||
"https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0";
|
||||
import { getPhone } from '../../utils/get-phone.js';
|
||||
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0';
|
||||
Page({
|
||||
data: {
|
||||
motto: "Hello World",
|
||||
motto: 'Hello World',
|
||||
userInfo: {
|
||||
avatarUrl: defaultAvatarUrl,
|
||||
nickName: "",
|
||||
nickName: '',
|
||||
},
|
||||
hasUserInfo: false,
|
||||
canIUseGetUserProfile: xhs.canIUse("getUserProfile"),
|
||||
canIUseNicknameComp: xhs.canIUse("input.type.nickname"),
|
||||
canIUseGetUserProfile: xhs.canIUse('getUserProfile'),
|
||||
canIUseNicknameComp: xhs.canIUse('input.type.nickname'),
|
||||
},
|
||||
bindViewTap() {},
|
||||
onChooseAvatar(e) {
|
||||
const { avatarUrl } = e.detail;
|
||||
const { nickName } = this.data.userInfo;
|
||||
this.setData({
|
||||
"userInfo.avatarUrl": avatarUrl,
|
||||
'userInfo.avatarUrl': avatarUrl,
|
||||
hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
|
||||
});
|
||||
},
|
||||
@@ -25,12 +25,12 @@ Page({
|
||||
const nickName = e.detail.value;
|
||||
const { avatarUrl } = this.data.userInfo;
|
||||
this.setData({
|
||||
"userInfo.nickName": nickName,
|
||||
'userInfo.nickName': nickName,
|
||||
hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
|
||||
});
|
||||
},
|
||||
getUserProfile(e) {
|
||||
console.log("user -profile", e);
|
||||
console.log('user -profile', e);
|
||||
// 推荐使用xhs.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
|
||||
const userInfo = e.detail.userInfo;
|
||||
this.setData({
|
||||
@@ -38,4 +38,9 @@ Page({
|
||||
hasUserInfo: true,
|
||||
});
|
||||
},
|
||||
getPhoneNumber(e) {
|
||||
const { detail } = e;
|
||||
// console.log('e', detail);
|
||||
getPhone(detail);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user