<template>
|
<u-popup :show="show" round="15" :safeAreaInsetBottom="false" :closeable="true" mode="bottom" @close="show = false">
|
<view class="login">
|
<image src="/static/images/logo@2x.png" mode="widthFix"></image>
|
<view class="login-info" @click="isAuth = !isAuth">
|
<image src="/static/icon/ic_agree@2x.png" mode="widthFix" v-if="!isAuth"></image>
|
<image src="/static/icon/cart_ic_sel@2x.png" mode="widthFix" v-else></image>
|
<view class="login-info-text">
|
我已阅读并同意<text @click.stop="jumpService(4)">《鼎元科技用户服务协议》</text>及<text @click.stop="jumpService(5)">《鼎元科技用户隐私政策》</text>
|
</view>
|
</view>
|
<button class="login-btn" @click="tishi" v-if="!isAuth">手机号快捷登录</button>
|
<button class="login-btn" open-type="getPhoneNumber" @getphonenumber="getphonenumber" v-else>手机号快捷登录</button>
|
</view>
|
</u-popup>
|
</template>
|
|
<script>
|
import { mapState } from 'vuex'
|
export default {
|
name: "login",
|
data() {
|
return {
|
show: false,
|
isAuth: false,
|
};
|
},
|
computed: {
|
...mapState(['openid', 'recshopid', 'recuserid'])
|
},
|
methods: {
|
tishi() {
|
uni.showToast({
|
title: '请先勾选同意协议',
|
icon: 'none'
|
})
|
},
|
jumpService(flag) {
|
uni.navigateTo({
|
url: '/pagesA/pages/rich-text-page/rich-text-page?flag='+flag
|
})
|
},
|
open() {
|
this.show = true
|
},
|
close() {
|
this.show = false
|
},
|
getphonenumber(e) {
|
var that = this;
|
if (e.detail.errMsg === 'getPhoneNumber:ok') {
|
uni.login({
|
provider: 'weixin',
|
success: async function (loginRes) {
|
let { code } = loginRes;
|
let res = await that.$u.api.wxLogin({ code })
|
if (res.code === 200) {
|
that.$u.api.wxPhone({
|
code: e.detail.code,
|
shopId:that.recshopid,
|
recId:that.recuserid,
|
openid: res.data.openid
|
}).then(res => {
|
if (res.code === 200) {
|
that.$store.commit('setUserInfo', res.data.member)
|
that.$store.commit('setToken', res.data.token)
|
that.$store.commit('setRecShopId','')
|
that.$store.commit('setRecUserId','')
|
that.close()
|
}
|
})
|
}
|
}
|
});
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.login {
|
width: 100%;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
flex-direction: column;
|
padding: 120rpx 48rpx 80rpx 48rpx;
|
box-sizing: border-box;
|
image {
|
width: 400rpx;
|
height: 96rpx;
|
}
|
.login-info {
|
width: 100%;
|
display: flex;
|
align-items: flex-start;
|
margin-top: 120rpx;
|
image {
|
width: 36rpx;
|
height: 36rpx;
|
flex-shrink: 0;
|
margin-right: 14rpx;
|
}
|
.login-info-text {
|
flex: 1;
|
font-weight: 400;
|
font-size: 24rpx;
|
color: #555555;
|
text {
|
color: #2E68C4;
|
}
|
}
|
}
|
.login-btn {
|
width: 100%;
|
height: 88rpx;
|
line-height: 88rpx;
|
text-align: center;
|
background: #004096;
|
border-radius: 44rpx;
|
font-weight: 600;
|
font-size: 32rpx;
|
color: #FFFFFF;
|
margin-top: 40rpx;
|
}
|
}
|
</style>
|