一键登录
authorize.vue
<template>
<view>
<view class="logo">
<image :src="logo" mode=""></image>
<text>{
{name}}</text>
</view>
<view class="tips">
<view>申请获取以下权限</view>
<text>获得你的公开信息(昵称,头像等公开信息)</text>
</view>
<button @click="getUserInfo">一键授权</button>
</view>
</template>
<script>
import {
loginAuth, getLogo
} from '@/api/api'
import {
mapMutations
} from 'vuex'
export default {
data() {
return {
code:'',
logo:'',
name:''
}
},
onLoad(){
this.getCode()
this.loadLogo()
},
methods: {
...mapMutations('m_user', ['updateUserInfo', 'updateToken', 'updateExpiresTime']),
// 获取code
async getCode() {
const [err, res] = await