| | |
| | | <u-navbar :custom-back="back" title="小程序登录"></u-navbar> |
| | | <u-modal v-model="phoneAuthPopup" :mask-close-able="true" :title="projectName+'商城'" |
| | | :show-confirm-button="false"> |
| | | |
| | | <div class="tips"> |
| | | 为了更好地用户体验,需要您授权手机号 |
| | | </div> |
| | |
| | | <view class="logo-info"> |
| | | <text class="title">欢迎进入{{ projectName }}</text> |
| | | </view> |
| | | <!-- <input ref="nicknameInput" type="nickname"/> |
| | | <button type="default" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">选择</button> --> |
| | | <view class="small-tips"> |
| | | <view>为您提供优质服务,{{ projectName }}需要获取以下信息</view> |
| | | <view>您的公开信息(昵称、头像)</view> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import '@/components/uview-components/uview-ui'; |
| | | import { |
| | | mpAutoLogin |
| | | } from "@/api/connect.js"; |
| | |
| | | url: `/pages/tabbar/home/index`, |
| | | }); |
| | | }, |
| | | |
| | | |
| | | |
| | | |
| | | onChooseAvatar(e){ |
| | | console.log(e.detail.avatarUrl) |
| | | }, |
| | | //获取用户信息 |
| | | getUserProfile(e) { |
| | | if(!this.checked){ |
| | |
| | | desc: "用于完善会员资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 |
| | | success: (res) => { |
| | | console.log("success", res) |
| | | // this.$refs.nicknameInput.focus(); |
| | | |
| | | |
| | | this.nickName = res.userInfo.nickName; |
| | | this.image = res.userInfo.avatarUrl; |
| | | |
| | | // 打印微信名称 |
| | | console.log("微信昵称:", this.nickName); |
| | | /** |
| | | * 根据公有的配置设置登录方式 |
| | | */ |
| | |
| | | image, |
| | | nickName, |
| | | }).then((apiRes) => { |
| | | console.log(apiRes) |
| | | storage.setAccessToken(apiRes.data.result.accessToken); |
| | | storage.setRefreshToken(apiRes.data.result.refreshToken); |
| | | // 登录成功 |
| | |
| | | title: "登录成功!", |
| | | icon: "none", |
| | | }); |
| | | |
| | | //获取用户信息 |
| | | getUserInfo().then((user) => { |
| | | storage.setUserInfo(user.data.result); |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | let code = this.code; |
| | | let image = this.image; |
| | | let nickName = this.nickName; |
| | |
| | | image, |
| | | nickName, |
| | | }).then((res) => { |
| | | console.log(res) |
| | | storage.setAccessToken(res.data.result.accessToken); |
| | | storage.setRefreshToken(res.data.result.refreshToken); |
| | | // 登录成功 |
| | |
| | | }); |
| | | //获取用户信息 |
| | | getUserInfo().then((user) => { |
| | | console.log(user) |
| | | storage.setUserInfo(user.data.result); |
| | | storage.setHasLogin(true); |
| | | |