Commit 2ea31414 authored by 罗超's avatar 罗超

2

parent 1e6ff93a
......@@ -31,7 +31,7 @@
.Order_Number {
color: #0000ff;
font-size: 28rpx;
font-size: 24rpx;
}
.courseName {
......
<template>
<view class="indexassembly">
<view class="indexassembly" :style="{width:width,height:height}">
<view>
<slot>
登录
</slot>
<button class="hotsopt" style="" open-type="getUserInfo" @tap="getUserProfile()" @click="getCode"></button>
<button class="hotsopt" :style="{width:width,height:height}" open-type="getUserInfo" @tap="getUserProfile()"
@click="getCode"></button>
</view>
<van-popup :show="showPhone">
<view
style="width: 70vw;background: #FFF;display: flex;flex-direction: column;align-items: center;padding-bottom: 20px;border-radius: 8px;">
......@@ -46,12 +46,24 @@
name: "",
props: {
state: String,
width: {
type: String,
default: '100rpx'
},
height: {
type: String,
default: '100rpx'
},
},
components: {},
setup(props,{attrs,slots,emit}) {
setup(props, {
attrs,
slots,
emit
}) {
const pages = getCurrentPages() // 获取栈实例
const currentRoute = pages[pages.length-1].route; // 获取当前页面路由
const currentRoute = pages[pages.length - 1].route; // 获取当前页面路由
let Toast = inject("$toast");
let data = reactive({
......@@ -60,7 +72,7 @@
Photo: '',
},
showPhone: false,
showLogin:true,//多次点击
showLogin: true, //多次点击
});
let methods = {
getUserProfile() {
......@@ -72,8 +84,8 @@
data.obj.Name = info.userInfo.nickName;
data.obj.Photo = info.userInfo.avatarUrl;
data.showPhone = true; //显示获取手机号码弹窗
if(currentRoute=="pages/index/index"){
uni.hideTabBar()//手机授权弹窗出现 隐藏tabbar
if (currentRoute == "pages/index/index") {
uni.hideTabBar() //手机授权弹窗出现 隐藏tabbar
}
},
fail: () => {
......@@ -95,7 +107,7 @@
data.obj.iv = e.detail.iv
data.obj.encryptedData = e.detail.encryptedData
// that.getCode()
that.parsePhoneNum(data.obj.encryptedData, data.obj.iv,data.obj.code)
that.parsePhoneNum(data.obj.encryptedData, data.obj.iv, data.obj.code)
}
},
getCode() { //获取code
......@@ -144,16 +156,16 @@
data.obj.unionid = res.Data.unionid
that.phoneNumLogin()
let obj = {
Account :data.obj.phoneNum,
WeChatName :data.obj.Name,
WeChatPhoto :data.obj.Photo,
Account: data.obj.phoneNum,
WeChatName: data.obj.Name,
WeChatPhoto: data.obj.Photo,
OpenId: data.obj.openid,
unionid: data.obj.unionid,
}
try {
uni.setStorageSync("temporarydh", obj);
} catch (e) {
console.log(e,'eeeeeee')
console.log(e, 'eeeeeee')
}
} else {
......@@ -169,7 +181,7 @@
OpenId: data.obj.openid,
unionid: data.obj.unionid,
})
if (res.Code==1) {
if (res.Code == 1) {
uni.hideLoading();
data.showLogin = true; //防止多次点击登录
res.Data.Account = data.obj.phoneNum;
......@@ -178,14 +190,14 @@
emit('success')
data.showPhone = false
uni.showTabBar()
}else{
} else {
data.showLogin = true; //防止多次点击登录
data.showPhone = false
if(currentRoute=="pages/index/index"){
uni.showTabBar()//手机授权弹窗出现 隐藏tabbar
if (currentRoute == "pages/index/index") {
uni.showTabBar() //手机授权弹窗出现 隐藏tabbar
}
uni.hideLoading();
if(res.Data.Error==-1){//如果没找到电话号码 就跳入登录
if (res.Data.Error == -1) { //如果没找到电话号码 就跳入登录
// setTimeout(() => {
// uni.reLaunch({
......@@ -212,8 +224,6 @@
</script>
<style scoped>
.indexassembly {
width: 110rpx;
height: 90rpx;
line-height: 90rpx;
position: relative;
}
......@@ -226,9 +236,6 @@
opacity: 0;
left: 0;
top: 0;
width: 280rpx;
height: 90rpx;
}
.btn {
......
......@@ -18,21 +18,22 @@
</van-field>
</van-cell-group>
</view>
<view class="flex flex_between_center btnBox">
<view class="loginBtn flex flex_center_center" @click="login">账号登录</view>
<view class="phoneBtn flex flex_center_center" @click="show=true">游客登录</view>
<!-- <button class="phoneBtn flex flex_center_center" open-type="getPhoneNumber" @getphonenumber="getphonenumber" @click="login2">手机号一键登录</button> -->
<view class="btnBox" @click="login">
账号登录
</view>
<view class="flex_center_center">
<indexassembly width="440rpx" height="90rpx" @success='againdata' >
<view class="btnBox authBtn" >
授权登录
</view>
<view class="btnBox" style="margin:20rpx auto 0;">
<indexassembly @success='againdata' >
<view class="loginBtn flex flex_center_center" style="background-color:#4C50E7;">授权登录</view>
</indexassembly>
</view>
<view class="visitor" @click="show=true">
游客登录
</view>
<van-toast id="van-toast" />
<van-dialog :show='show' title="提示" message='游客登录,不能使用全部功能!' show-cancel-button @cancel='show = false'
@confirm='login3'>
</van-dialog>
</view>
</template>
......@@ -304,14 +305,30 @@
}
.btnBox {
width: 600rpx;
width: 440rpx;
height: 90rpx;
border-radius: 12rpx;
border-radius: 45rpx;
overflow: hidden;
margin: 0 auto;
font-size: 32rpx;
margin-bottom: 55rpx;
background-color: #4C50E8;
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 500;
color: #ffffff;
color: #FFFFFF;
text-align: center;
line-height: 88rpx;
}
.authBtn{
background-color: #EDEDFD !important;
color: #4C50E8 !important;
}
.visitor{
text-align: center;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 500;
color: #BEBEBE;
margin-top: 55rpx;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment