feat: 调用云函数
This commit is contained in:
@@ -20,23 +20,31 @@ import ActiveCard from "../components/ActiveCard";
|
||||
const my = (props: any) => {
|
||||
// const [active, setActive] = react.useState(props?.active ?? 0);
|
||||
|
||||
|
||||
// 云函数,-获取手机号
|
||||
const getLogin = (e:any) => {
|
||||
Taro.cloud
|
||||
.callFunction({
|
||||
name: "getPhoneNum",
|
||||
data: {
|
||||
weRunData: Taro.cloud.CloudID(e.detail.cloudID)
|
||||
},
|
||||
})
|
||||
.then((res:any) => {
|
||||
console.log('res11')
|
||||
console.log('res',res)
|
||||
// this.setState({
|
||||
// context: res.result,
|
||||
// });
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
// 设置标题
|
||||
definePageConfig({
|
||||
navigationBarTitleText: "我的",
|
||||
});
|
||||
|
||||
// Taro.getUserProfile({
|
||||
// desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
||||
// success: (res) => {
|
||||
// // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
|
||||
// console.log('res',res)
|
||||
// // this.setState({
|
||||
// // userInfo: res.userInfo,
|
||||
// // hasUserInfo: true
|
||||
// // })
|
||||
// }
|
||||
// })
|
||||
}, []);
|
||||
|
||||
const CardCom = () => {
|
||||
@@ -63,17 +71,9 @@ const my = (props: any) => {
|
||||
|
||||
const getPhoneNumber = (e:any) => {
|
||||
console.log('点击获取手机事件', e.detail.cloudID);
|
||||
Taro.cloud.callFunction({
|
||||
name: "getPhone",
|
||||
data: {
|
||||
cloudID: e.detail.cloudID
|
||||
// weRunData
|
||||
},
|
||||
}).then((res:any) => {
|
||||
console.log(res);
|
||||
console.log(res.result.list[0].data.phoneNumber);
|
||||
|
||||
})
|
||||
// 调用云函数获取手机号
|
||||
getLogin(e)
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -83,13 +83,13 @@ const my = (props: any) => {
|
||||
{/* 头像 */}
|
||||
<View className={`myImage`}>
|
||||
{/* 微信开放api-用户头像 */}
|
||||
<OpenData type="userAvatarUrl"></OpenData>
|
||||
{/* <Image
|
||||
{/* <OpenData type="userAvatarUrl"></OpenData> */}
|
||||
<Image
|
||||
round
|
||||
width="100px"
|
||||
height="100px"
|
||||
src="cloud://cloud1-5g5xrgza12a0dd6d.636c-cloud1-5g5xrgza12a0dd6d-1253665791/images/images-2.jpg"
|
||||
/> */}
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View>
|
||||
|
||||
Reference in New Issue
Block a user