123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <template>
- <view>
- <u-modal :show="showAuthorizePhone" :showConfirmButton="false">
- <view class="slot-content">
- <view class="auth-card">
- <view class="img">
- <img class="avatar-img" src="@/static/logo.png" mode="widthFix">
- </view>
- <view class="content">{{content}}</view>
- </view>
- <view class="auth-btncard">
- <view class="btn-unok">
- <u-button :customStyle="customStyleUnOk" @click="showAuthorizePhone=false" :plain="true">
- 拒绝</u-button>
- </view>
- <view class="btn-ok">
- <u-button :customStyle="customStyleOk"
- @click="toDetail"> 立即登录</u-button>
- <!-- <u-button :customStyle="customStyleOk" open-type="getPhoneNumber"
- @getphonenumber="getPhoneNumber"> 立即登录</u-button> -->
- </view>
- </view>
- </view>
- </u-modal>
- <u-modal :show="showAuthorizeUser" :showConfirmButton="false">
- <view class="slot-content">
- <view class="auth-card">
- <view class="img">
- <img class="avatar-img" src="@/static/logo.png" mode="widthFix">
- </view>
- <view class="content">邀请您补全个人信息<br></br>(昵称、头像)</view>
- <view style="margin-left: 100rpx;margin-right: 100rpx">
- <u-form :model="userInfo" ref="uForm">
- <u-form-item label="头像">
- <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar"
- slot="right">
- <image class="avatar"
- :src="userInfo.head?userInfo.head:'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'">
- </image>
- </button>
- </u-form-item>
- <u-form-item label="昵称">
- <u-input inputAlign='right' v-model="userInfo.nickname" class="weui-input"
- @blur="userNameInput" placeholder="请输入昵称" border="false" />
- <!-- <input type="nickname" :value="userInfo.nickname" class="weui-input" @blur="userNameInput" placeholder="请输入昵称"/> -->
- </u-form-item>
- </u-form>
- </view>
- </view>
- <view class="auth-btncard">
- <view class="btn-unok"><u-button :customStyle="customStyleUnOk" @click="authUser(0)">
- 拒绝</u-button>
- </view>
- <view class="btn-ok">
- <u-button :customStyle="customStyleOk" @click="authUser(1)"> 允许</u-button>
- </view>
- </view>
- </view>
- </u-modal>
- </view>
- </template>
- <script>
- var that
- import {
- pathToBase64,
- base64ToPath
- } from 'image-tools'
- export default {
- data() {
- return {
- showAuthorizePhone:false,
- showAuthorizeUser:false,
- userInfo: {
- head: '',
- nickname: '',
- phone: '',
- },
- customStyleUnOk: {
- marginTop: '20rpx',
- color: '#eaad1a',
- // border: '2px solid #eaad1a',
- "font-weight": 'bold',
- "background":'#F2F2F2',
- "border-radius": "10px",
- fontSize: "32rpx"
- },
- customStyleOk: {
- marginTop: '20rpx',
- color: '#fff',
- // border: '2px solid #eaad1a',
- "font-weight": 'bold',
- "background":'#F2F2F2',
- "border-radius": "10px",
- fontSize: "32rpx",
- padding:'0 20rpx',
- background: "#eaad1a"
- },
- };
- },
- props: {
- content: {
- type: String,
- default: ""
- },
- },
-
- watch:{
- },
-
- mounted() {
- that = this
- },
- computed: {
- },
- methods: {
- open(){
- this.showAuthorizePhone=true
- },
- toDetail(){
- this.showAuthorizePhone = false
- uni.navigateTo({
- url:'/pageA/login/index'
- })
- },
- async getPhoneNumber(e) {
- console.log(0)
- that.userInfo = await this.$request.wxlogin()
- console.log(that.userInfo,1111)
- that.userInfo.phone = await this.$request.getPhone(e, that.userInfo)
- console.log(that.userInfo,2222)
- this.showAuthorizePhone = false
- this.showAuthorizeUser = true
-
- },
- async authUser(type) {
- //同步信息,没有头像和昵称自动生成
- this.userInfo = await this.$request.syncInfo(this.userInfo)
- if (this.userInfo.openId) {
- uni.setStorageSync("userInfo", that.userInfo)
- that.showAuthorizeUser = false
- // that.mescroll.resetUpScroll()
- }
- },
- //获取昵称输入内容
- userNameInput(e) {
- this.userInfo.nickname = e.detail.value
- },
- async onChooseAvatar(e) {
- this.$set(this.userInfo, "head", await this.toBase64(e.detail.avatarUrl))
- },
- toBase64(url) {
- return new Promise(resolve => {
- pathToBase64(url).then(path => {
- resolve(path);
- }).catch(error => {
- console.log(error)
- })
- })
- },
-
- }
- }
- </script>
- <style lang='scss' scoped>
- .auth-btncard {
- display: flex !important;
- justify-content: space-between !important;
-
- .btn-unok {
- width: 40%;
- }
-
- .btn-ok {
- width: 40%;
- }
- }
-
- .auth-card {
- text-align: center;
-
- .avatar-img {
- width: 200rpx;
- }
-
- .title {
- font-size: 20rpx;
- }
-
- .content {
- font-size: 32rpx;
- font-weight: bold;
- color: #1A1A1A;
- margin-bottom: 30rpx;
- }
- }
-
- .avatar-wrapper {
- color: #333 !important;
- border: none !important;
- border-radius: 0 !important;
- background-color: transparent !important;
- padding: 0;
- }
-
- .avatar-wrapper::after {
- border: none !important;
- }
-
- .avatar {
- width: 100rpx;
- height: 100rpx;
- overflow: hidden;
- border-radius: 100%;
- }
-
- /deep/.u-popup__content {
- border-radius: 20rpx !important;
- }
- /deep/.u-button--normal{
- padding: 0 5px;
- }
- .slot-content{
- width: 100%;
- }
- </style>
|