登录流程接口对接

This commit is contained in:
唐明明
2022-01-06 14:54:22 +08:00
parent 4709ff0c4a
commit 53a6f0b149
10 changed files with 202 additions and 60 deletions

View File

@@ -3,7 +3,6 @@
<!-- <view class="user-demo">
<view @click="$Router.push({name: 'Address'})">地址管理</view>
<view @click="$Router.push({name: 'Order'})">订单管理</view>
<view @click="$Router.push({name: 'Auth'})">登录</view>
</view> -->
<!-- 用户信息 -->
<view class="info-box">
@@ -11,10 +10,15 @@
<view class="user-flex">
<image class="cover" src="@/static/dev/cover.jpg" mode="aspectFill"></image>
<view class="user-content">
<view class="name">唐明明</view>
<view class="tabs">
<view class="tabs-item"><image src="@/static/user/icon_07.png"></image>会员</view>
</view>
<block v-if="$store.state.token != ''">
<view class="name">唐明明</view>
<view class="tabs">
<view class="tabs-item"><image src="@/static/user/icon_07.png"></image>会员</view>
</view>
</block>
<block v-else>
<view class="name" @click="Login">未登录</view>
</block>
</view>
</view>
</view>
@@ -101,11 +105,17 @@
设置
<uni-icons class="forward" type="forward" color="#999"></uni-icons>
</view>
<view class="btns-box-item" @click="logOut">
<image class="icon" src="@/static/user/icon_03.png" mode="widthFix"></image>
退出登录
<uni-icons class="forward" type="forward" color="#999"></uni-icons>
</view>
</view>
</view>
</template>
<script>
import userAuth from '@/public/userAuth'
export default {
data() {
return {
@@ -113,10 +123,20 @@
};
},
mounted() {
console.log(this.$store.state)
uni.setNavigationBarTitle({
title: "唐明明"
})
},
methods:{
// 登录
Login(){
const Auth = new userAuth()
Auth.Login()
},
// 退出登录
logOut(){
this.$store.commit('setToken', '')
}
}
}
</script>
@@ -142,28 +162,28 @@
.user-flex{
position: relative;
padding: $padding*2 $padding ($padding*2 + 60);
height: 108rpx;
height: 128rpx;
.cover{
position: absolute;
width: 108rpx;
height: 108rpx;
width: 128rpx;
height: 128rpx;
border-radius: 50%;
border:solid 6rpx white;
box-sizing: border-box;
}
.user-content{
padding-left: 128rpx;
height: 108rpx;
padding-left: 158rpx;
height: 128rpx;
display: flex;
flex-direction: column;
justify-content: center;
.name{
line-height: 40rpx;
font-weight: bold;
font-size: $title-size + 4;
font-size: $title-size + 8;
}
.tabs{
padding-top: 5rpx;
padding-top: 10rpx;
&-item{
background: rgba($color: #000000, $alpha: .3);
font-size: $title-size-sm - 4;