zyejMAll-mobile/sheep/components/s-user-card/s-user-card.vue

228 lines
5.4 KiB
Vue
Raw Normal View History

2024-08-07 10:31:42 +08:00
<!-- 装修用户组件用户卡片 -->
<template>
2024-10-14 19:12:22 +08:00
<view class="ss-user-info-wrap ss-p-t-50" style="z-index: 9999;">
<image class="seckill" src="@/static/images/seckilbg.png" v-if="state.themeType == ''"></image>
<image class="seckill" src="https://zysc.fjptzykj.com:3000/shangcheng/7925fd9e2c1df9cd29462c946f7c54d89d148b03d5fd366864636c3343282a2b.png" v-if="state.themeType == 'lv'"></image>
<image class="seckill" src="https://zysc.fjptzykj.com:3000/shangcheng/b350b54f38628fcb465805b81d624717dc83598604c4e58c674ae8558dc7386c.png" v-if="state.themeType == 'blue'"></image>
2024-10-11 16:07:43 +08:00
<view class="ss-flex ss-col-center ss-row-between ">
2024-09-24 18:42:45 +08:00
<view class="left-box ss-flex ss-col-center ss-m-l-36">
<view class="avatar-box ss-m-r-24">
<image class="avatar-img" :src="
2024-10-24 18:04:16 +08:00
isLogin
? sheep.$url.cdn(userInfo.avatar)
: defaultAvatar
" mode="aspectFill" @tap="sheep.$router.go('/pages/user/info')"></image>
<image v-if="userInfo.activate && userInfo.activate != 4" class="vipCard"
2024-10-24 18:04:16 +08:00
src="https://zysc.fjptzykj.com:3000/shangcheng/8064149c53fe05f8d20263fba31992da2d24a751877a4ddcc696d7f53b5cc771.png">
</image>
2024-09-24 18:42:45 +08:00
</view>
2024-10-24 18:04:16 +08:00
<view style="z-index:22222;">
2024-09-24 18:42:45 +08:00
<view class="nickname-box ss-flex ss-col-center">
<view class="nick-name ss-m-r-20">{{ userInfo?.nickname || nickname }}</view>
<view class="vipImg" v-if="userInfo.activate && userInfo.activate != 4">
2024-10-24 18:04:16 +08:00
<image class="img"
src="https://zysc.fjptzykj.com:3000/shangcheng/0419db3d6a991486176256374c05c2834006fd42b3f5f80e3ff385b027b7c34f.png" />
</view>
2024-09-24 18:42:45 +08:00
</view>
<view class="nickname-box ss-flex ss-col-center">
<view class="nick-name ss-m-r-20">{{ userInfo?.mobile || mobile }}</view>
</view>
2024-09-24 18:42:45 +08:00
</view>
</view>
<view class="right-box ss-m-r-52">
2024-10-21 17:47:58 +08:00
<!-- <button class="ss-reset-button" @tap="showShareModal">
2024-09-24 18:42:45 +08:00
<text class="sicon-qrcode"></text>
2024-10-21 17:47:58 +08:00
</button> -->
2024-09-24 18:42:45 +08:00
<!-- <view class="qiandao" @click="sheep.$router.go('/pages/app/sign');">
签到
</view> -->
</view>
</view>
<!-- 提示绑定手机号 先隐藏 yudao 需要再修改 -->
<!-- <view class="bind-mobile-box ss-flex ss-row-between ss-col-center" v-if="isLogin && !userInfo.mobile">
2024-09-24 18:42:45 +08:00
<view class="ss-flex">
<text class="cicon-mobile-o" />
<view class="mobile-title ss-m-l-20"> 点击绑定手机号确保账户安全 </view>
</view>
<button class="ss-reset-button bind-btn" @tap="onBind">去绑定</button>
</view> -->
2024-09-24 18:42:45 +08:00
</view>
2024-08-07 10:31:42 +08:00
</template>
<script setup>
2024-09-19 17:57:12 +08:00
// 使用 import
import defaultAvatar from '@/static/images/default_avatar.png';
2024-09-24 18:42:45 +08:00
/**
* 用户卡片
*
* @property {Number} leftSpace - 容器左间距
* @property {Number} rightSpace - 容器右间距
*
* @property {String} avatar - 头像
* @property {String} nickname - 昵称
* @property {String} vip - 等级
* @property {String} collectNum - 收藏数
* @property {String} likeNum - 点赞数
*
*
*/
import {
computed,
reactive
} from 'vue';
import sheep from '@/sheep';
import {
showShareModal,
showAuthModal
} from '@/sheep/hooks/useModal';
const app = computed(() => sheep.$store('app'));
const state = reactive({
themeType: app.value.platform.themeType
});
2024-09-24 18:42:45 +08:00
// 用户信息
const userInfo = computed(() => sheep.$store('user').userInfo);
console.log('用户信息', userInfo);
2024-08-07 10:31:42 +08:00
2024-09-24 18:42:45 +08:00
// 是否登录
const isLogin = computed(() => sheep.$store('user').isLogin);
// 接收参数
const props = defineProps({
background: {
type: String,
default: '',
},
// 头像
avatar: {
type: String,
default: '',
},
nickname: {
type: String,
default: '请先登录',
},
vip: {
type: [String, Number],
default: '1',
},
collectNum: {
type: [String, Number],
default: '1',
},
likeNum: {
type: [String, Number],
default: '1',
},
});
2024-08-07 10:31:42 +08:00
2024-09-24 18:42:45 +08:00
function onBind() {
showAuthModal('changeMobile');
}
2024-08-07 10:31:42 +08:00
</script>
<style lang="scss" scoped>
2024-10-24 18:04:16 +08:00
.vipImg {
width: 42px;
height: 16px;
.img {
width: 100%;
height: 100%;
}
}
.qiandao {
2024-09-24 18:42:45 +08:00
width: 50px;
height: 30px;
background: yellow;
text-align: center;
line-height: 30px;
font-weight: 700;
border-radius: 30px 0px 30px 30px;
font-size: 15px;
}
.ss-user-info-wrap {
box-sizing: border-box;
2024-08-07 10:31:42 +08:00
2024-09-24 18:42:45 +08:00
.avatar-box {
width: 100rpx;
height: 100rpx;
overflow: hidden;
2024-10-24 18:04:16 +08:00
position: relative;
2024-08-07 10:31:42 +08:00
2024-09-24 18:42:45 +08:00
.avatar-img {
2024-10-24 18:04:16 +08:00
width: 97%;
height: 93%;
left: 1px;
top: 1px;
border-radius: 50%;
display: block;
margin: 0 auto;
position: absolute;
}
.vipCard {
2024-09-24 18:42:45 +08:00
width: 100%;
height: 100%;
2024-10-24 18:04:16 +08:00
position: absolute;
left: 0;
top: -2px;
2024-09-24 18:42:45 +08:00
}
}
2024-08-07 10:31:42 +08:00
2024-09-24 18:42:45 +08:00
.nick-name {
font-size: 34rpx;
font-weight: 400;
color: white;
line-height: normal;
}
2024-08-07 10:31:42 +08:00
2024-09-24 18:42:45 +08:00
.vip-img {
width: 30rpx;
height: 30rpx;
}
2024-08-07 10:31:42 +08:00
2024-09-24 18:42:45 +08:00
.sicon-qrcode {
font-size: 40rpx;
}
}
2024-08-07 10:31:42 +08:00
2024-09-24 18:42:45 +08:00
.bind-mobile-box {
width: 100%;
height: 84rpx;
padding: 0 34rpx 0 44rpx;
box-sizing: border-box;
background: #ffffff;
box-shadow: 0px -8rpx 9rpx 0px rgba(#e0e0e0, 0.3);
2024-08-07 10:31:42 +08:00
2024-09-24 18:42:45 +08:00
.cicon-mobile-o {
font-size: 30rpx;
color: #ff690d;
}
2024-08-07 10:31:42 +08:00
2024-09-24 18:42:45 +08:00
.mobile-title {
font-size: 24rpx;
font-weight: 500;
color: #ff690d;
}
2024-08-07 10:31:42 +08:00
2024-09-24 18:42:45 +08:00
.bind-btn {
width: 100rpx;
height: 50rpx;
background: #ff6100;
border-radius: 25rpx;
font-size: 24rpx;
font-weight: 500;
color: #ffffff;
}
}
2024-10-24 18:04:16 +08:00
2024-10-14 19:12:22 +08:00
.seckill {
width: 100%;
position: absolute;
2024-10-24 18:04:16 +08:00
top: 0;
left: 0;
height: 217px;
z-index: 0;
2024-10-14 19:12:22 +08:00
}
2024-09-24 18:42:45 +08:00
</style>