You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.7 KiB

<template>
<view>
<u-popup v-model="showUser" mode="center" closeable="true">
<view class="userBox" style="padding: 20rpx;">
<view class="userInfoContent" style="padding: 80rpx;font-size: 28rpx;">
<text class="">为了更好的提供服务请授权您的微信昵称</text>
</view>
<view class="userBoxBottom">
<button class="userBoxBottomCol btnuserBoxBottomCol" @click="getUserProfile"
style="border-radius:0;flex:1;">授权</button>
<button class="userBoxBottomCol" @click="touserInfoClose"
style="border-radius:0;flex:1;">关闭</button>
</view>
</view>
</u-popup>
</view>
</template>
<script>
export default {
name: "wechat-auth",
data() {
return {
};
},
methods(){
touserInfoClose() {
this.showUser = false;
},
getUserProfile() {
var that = this;
weixin.getUserProfile((res) => {
weixin.request({
api: '/api/member/update-wechat-info',
method: 'POST',
data: {
nickname: res.nickName,
avatar: res.avatarUrl
},
utilSuccess: function(r) {
console.log(r)
if (r.status == 1) {
weixin.getOpenidInfo(openidInfo => {}, true)
} else {
uni.showToast({
title: r.data.msg,
duration: 2000,
icon: 'none'
})
}
}
})
})
}
}
}
</script>
<style lang="scss">
.userBoxBottom {
.userBoxBottomCol {
font-size: 28rpx;
}
.btnuserBoxBottomCol {
background: linear-gradient(90deg, #FF7E95 0%, #FF447B 100%);
border-radius: 36rpx;
font-size: 28rpx;
font-weight: 500;
text-align: center;
line-height: 72rpx;
color: #fff;
}
}
</style>