fuint-uniapp-master/pages/login/components/mp-weixin.vue
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<template>
<view class="container">
<view class="wechatapp">
<view class="header">
<open-data class="avatar" type="userAvatarUrl"></open-data>
</view>
</view>
<view class="auth-title">申请获取以下权限</view>
<view v-if="isProfile">
<view class="auth-subtitle">获得您微信绑定的手机号码</view>
<view class="login-btn">
<button class="button btn-normal" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">授权登录</button>
</view>
</view>
<view v-if="!isProfile">
<view class="auth-subtitle">获得你的公开信息(昵称、头像等)</view>
<view class="login-btn">
<button class="button btn-normal" @click.stop="getUserProfile">授权登录</button>
</view>
</view>
<view class="no-login-btn">
<button class="button btn-normal" @click="handleCancel">暂不登录</button>
</view>
</view>
</template>
<script>
import store from '@/store'
import * as UserApi from '@/api/user'
export default {
data() {
return {
// 微信小程序登录凭证 (code)
// 提交到后端,用于换取openid
code: '',
needPhone: false,
isProfile: false
}
},
created() {
// 获取code
this.getCode()
// 获取配置
this.getUserSetting()
},
methods: {
// 获取code
// https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html
getCode() {
return new Promise((resolve, reject) => {
uni.login({
provider: 'weixin',
success: res => {
console.log('res', res)
resolve(res.code)
后面还有 172 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。