This commit is contained in:
liuye
2024-06-12 14:03:51 +08:00
parent 1a773d10fc
commit d0727f8991
3 changed files with 92 additions and 7 deletions

View File

@@ -52,6 +52,13 @@
</div>
</div>
</div>
<!-- <div class="login-btn">
<img src="./img/question-icon.png" alt="">登录
</div> -->
<button class="login-btn" open-type="getPhoneNumber" @getphonenumber="handleAdminLogin">
<img src="./img/question-icon.png" alt="">登录
</button>
<AiLogin ref="login"/>
</div>
</template>
@@ -282,7 +289,14 @@ export default {
innerAudioContext.onStop(() => {
this.messageList[index].isPlay = false
})
}
},
handleAdminLogin({detail: {code: phoneCode}}) {
if (!this.token) {
this.autoLogin({loginWay: 'admin', phoneCode}).then(() => {
this.getUserInfo()
})
} else this.$u.toast("已登录,无需重新登录!")
},
},
}
</script>
@@ -438,7 +452,6 @@ page {
left: -12px;
}
}
}
.fixed-bottom {
@@ -502,5 +515,31 @@ page {
}
}
}
.login-btn {
position: fixed;
bottom: 500px;
left: 0;
width: 144px;
height: 64px;
background: #B8B8B8;
border-top-right-radius: 44px;
border-bottom-right-radius: 44px;
padding: 12px 16px;
box-sizing: border-box;
line-height: 40px;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 28px;
color: #FFF;
z-index: 999;
img {
width: 40px;
height: 40px;
vertical-align: bottom;
margin-right: 8px;
}
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -5,11 +5,12 @@
<div class="my-content">
<div class="user-info">
<div class="user-left">
<img src="./img/header-bg.png" alt="" class="user-img">
<img :src="user.avatarUrl" alt="" class="user-img" v-if="user.avatarUrl">
<img src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" class="user-img" v-else>
</div>
<div class="user-right">
<p>张总</p>
<div>党委书记</div>
<p>{{user.nickName || '微信用户'}}</p>
<div>{{user.departmentName || ''}}</div>
</div>
</div>
<!-- <div class="app-list">
@@ -30,6 +31,12 @@
</div>
</div>
</div> -->
<div class="login" v-if="!token">
<button class="login-btn" open-type="getPhoneNumber" @getphonenumber="handleAdminLogin">授权手机号登录</button>
</div>
<div class="login" v-else @click="onLogout">
<div class="login-btn">退出登录</div>
</div>
</div>
</div>
</template>
@@ -55,11 +62,32 @@
},
onLoad() {
},
methods: {
...mapActions(['autoLogin']),
...mapActions(['autoLogin', 'getUserInfo']),
handleAdminLogin({detail: {code: phoneCode}}) {
if (!this.token) {
this.autoLogin({loginWay: 'admin', phoneCode}).then(() => {
this.getUserInfo()
})
} else this.$u.toast("已登录,无需重新登录!")
},
onLogout() {
uni.showModal({
title: '提示',
content: "是否要退出登录",
success: res => {
if (res.confirm) {
this.$store.commit('logout')
this.$toast('退出成功');
setTimeout(() => {
this.getAuth();
}, 500)
}
}
})
},
}
}
</script>
@@ -141,5 +169,23 @@
}
}
}
.login {
width: 100%;
height: 96px;
padding: 0 32px;
box-sizing: border-box;
line-height: 96px;
text-align: center;
position: fixed;
bottom: 120px;
left: 0;
.login-btn {
background: #4181FF;
border-radius: 16px;
font-size: 34px;
font-weight: 500;
color: #fff;
}
}
}
</style>