123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <template>
- <view>
- <view class="no-login" v-if="!userinfo.token" @click="goLogin">
- <view class="avatar"><image src="../../static/no-login.png"></image></view>
- <view class="context">您好,请授权登录</view>
- </view>
- <view class="login" @click="getnickName" v-else>
- <view class="avatar">
- <image :src="userinfo.avatar ? userinfo.avatar : defaultimg"></image>
- </view>
- <image src="../../static/edit.png" v-if="keys==2" class="edit"></image>
- <view class="info">
- <view class="top">
- <view class="name">{{userinfo.nickName || '小狸'}}</view>
- <view class="join">
- <image src="../../static/ucenter/icon1.png"></image>
- <view class="days">已加入{{days}}天</view>
- </view>
- </view>
- <view class="phone">
- <view><image src="../../static/ucenter/icon2.png"></image></view>
- <view>{{userinfo.telephone}}</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name:"top-box",
- props:['userinfo','days','keys'],
- data(){
- return{
- defaultimg:'../../static/no-login.png',
- editLogo:'../../static/edit-logo.png'
- }
- },
- methods:{
- getnickName(){
- // this.$store.state.users.avatar == null &&
- if(this.keys ==2){
- uni.navigateTo({
- url:'/pages/ucenter/set_avatar'
- })
- }
- },
- goLogin(){
- uni.navigateTo({
- url:'/pages/public/login'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .no-login{
- margin-top: 15rpx;
- display: flex;
- .avatar image{
- width: 70rpx;
- height: 70rpx;
- margin: 0 20rpx;
- }
- .context{
- color: #58be6b;
- font-size: 32rpx;
- font-weight: bold;
- line-height: 70rpx;
- }
- }
- .login{
- margin-top: 15rpx;
- display: flex;
- position: relative;
- .avatar{
- image:first-child{
- width: 110rpx;
- height: 110rpx;
- margin-left: 30rpx;
- margin-right: 10rpx;
- border-radius: 50%;
- }
- }
- .edit{
- width: 36rpx;
- height: 36rpx;
- position:absolute;
- left: 100rpx;
- bottom: 5rpx;
- }
- .info{
- display: flex;
- flex-direction: column;
- height: 100rpx;
- justify-content:space-between;
- padding-top: 10rpx;
- margin-left: 5rpx;
- .top{
- display: flex;
- .join{
- display: flex;
- margin-left: 12rpx;
- position: relative;
- image{
- width: 42rpx;
- height: 48rpx;
- position: absolute;
- }
- .days{
- background-color: #f5f5f5;
- height: 44rpx;
- padding: 0 20rpx;
- margin-left: 20rpx;
- margin-top: 5rpx;
- border-top-right-radius:20rpx;
- border-bottom-right-radius:20rpx;
- font-size: 24rpx;
- color: #86909c;
- line-height: 44rpx;
- }
- }
- .name{
- color: #1d2129;
- font-size: 36rpx;
- font-weight: bold;
- }
- }
- .phone{
- display: flex;
- font-size: 24rpx;
- color: #86909c;
- line-height: 36rpx;
- image{
- width: 36rpx;
- height: 36rpx;
- }
- }
- }
- }
- </style>
|