@@ -0,0 +1,253 @@
|
||||
<!-- 页面 -->
|
||||
<template>
|
||||
<view class="ss-user-info-wrap ss-p-t-50">
|
||||
<view class="ss-flex ss-col-center ss-row-between ss-m-b-20">
|
||||
<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="
|
||||
isLogin
|
||||
? sheep.$url.cdn(userInfo.avatar)
|
||||
: sheep.$url.static('/assets/addons/shopro/uniapp/default_avatar.png')
|
||||
"
|
||||
mode="aspectFill"
|
||||
@tap="sheep.$router.go('/pages/user/info')"
|
||||
></image>
|
||||
</view>
|
||||
<view class="user-meta">
|
||||
<view class="nickname-box ss-flex ss-col-center">
|
||||
<view class="nick-name ss-m-r-20">{{ userInfo?.nickname || nickname }}</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="isLogin && showIdentityBadges"
|
||||
class="identity-row ss-flex ss-col-center ss-flex-wrap"
|
||||
@tap="onBadgeTap"
|
||||
>
|
||||
<view v-if="isTasterOnly" class="identity-tag taster-tag">品酒师</view>
|
||||
<template v-else-if="isPartner">
|
||||
<view class="identity-tag partner-tag">合伙股东</view>
|
||||
<view v-if="makerLevelName" class="identity-tag maker-tag">{{ makerLevelName }}</view>
|
||||
<view v-if="hasVenue" class="identity-tag venue-tag">酒道馆</view>
|
||||
<view v-if="hasCounty" class="identity-tag county-tag">区县</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right-box ss-m-r-52">
|
||||
<button class="ss-reset-button" @tap="showShareModal">
|
||||
<text class="sicon-qrcode"></text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="bind-mobile-box ss-flex ss-row-between ss-col-center"
|
||||
v-if="isLogin && !userInfo.verification?.mobile"
|
||||
>
|
||||
<view class="ss-flex">
|
||||
<text class="cicon-mobile-o"></text>
|
||||
<view class="mobile-title ss-m-l-20"> 点击绑定手机号确保账户安全 </view>
|
||||
</view>
|
||||
<button class="ss-reset-button bind-btn" @tap="onBind">去绑定</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* 用户卡片
|
||||
*
|
||||
* @property {Number} leftSpace - 容器左间距
|
||||
* @property {Number} rightSpace - 容器右间距
|
||||
*
|
||||
* @property {String} avatar - 头像
|
||||
* @property {String} nickname - 昵称
|
||||
* @property {String} vip - 等级
|
||||
* @property {String} collectNum - 收藏数
|
||||
* @property {String} likeNum - 点赞数
|
||||
*
|
||||
*
|
||||
*/
|
||||
import { computed } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import { showShareModal, showAuthModal } from '@/sheep/hooks/useModal';
|
||||
|
||||
// 用户信息
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
|
||||
// 是否登录
|
||||
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',
|
||||
},
|
||||
});
|
||||
|
||||
const identities = computed(() =>
|
||||
Array.isArray(userInfo.value?.identities) ? userInfo.value.identities : [],
|
||||
);
|
||||
|
||||
const identityText = computed(() => userInfo.value?.identity_text || '');
|
||||
|
||||
const isPartner = computed(() => {
|
||||
if (userInfo.value?.is_partner) return true;
|
||||
if (identities.value.some((item) => ['maker', 'venue', 'county'].includes(item))) return true;
|
||||
return ['合伙股东', '创客', '酒道馆', '区县'].some((key) => identityText.value.includes(key));
|
||||
});
|
||||
|
||||
const isTasterOnly = computed(() => {
|
||||
if (isPartner.value) return false;
|
||||
if (identities.value.includes('taster')) return true;
|
||||
return identityText.value === '品酒师';
|
||||
});
|
||||
|
||||
const makerLevelName = computed(() => userInfo.value?.maker_level_name || '');
|
||||
|
||||
const hasVenue = computed(
|
||||
() => identities.value.includes('venue') || identityText.value.includes('酒道馆'),
|
||||
);
|
||||
|
||||
const hasCounty = computed(
|
||||
() => identities.value.includes('county') || identityText.value.includes('区县'),
|
||||
);
|
||||
|
||||
const showIdentityBadges = computed(() => isTasterOnly.value || isPartner.value);
|
||||
|
||||
function onBind() {
|
||||
showAuthModal('changeMobile');
|
||||
}
|
||||
|
||||
function onBadgeTap() {
|
||||
if (!isLogin.value) {
|
||||
showAuthModal();
|
||||
return;
|
||||
}
|
||||
sheep.$router.go('/pages/commission/index');
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ss-user-info-wrap {
|
||||
box-sizing: border-box;
|
||||
|
||||
.avatar-box {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
|
||||
.avatar-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.user-meta {
|
||||
max-width: 430rpx;
|
||||
}
|
||||
|
||||
.nick-name {
|
||||
font-size: 34rpx;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.identity-row {
|
||||
margin-top: 10rpx;
|
||||
max-width: 430rpx;
|
||||
}
|
||||
|
||||
.identity-tag {
|
||||
font-size: 20rpx;
|
||||
line-height: 32rpx;
|
||||
padding: 0 12rpx;
|
||||
border-radius: 16rpx;
|
||||
margin: 0 8rpx 8rpx 0;
|
||||
}
|
||||
|
||||
.taster-tag {
|
||||
color: #8a5a2b;
|
||||
background: #f3e4cd;
|
||||
}
|
||||
|
||||
.partner-tag {
|
||||
color: #ffffff;
|
||||
background: #ff6000;
|
||||
}
|
||||
|
||||
.maker-tag {
|
||||
color: #692e04;
|
||||
background: #ffd9a8;
|
||||
}
|
||||
|
||||
.venue-tag,
|
||||
.county-tag {
|
||||
color: #ffffff;
|
||||
background: #c48a3a;
|
||||
}
|
||||
|
||||
.vip-img {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
}
|
||||
|
||||
.sicon-qrcode {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.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);
|
||||
|
||||
.cicon-mobile-o {
|
||||
font-size: 30rpx;
|
||||
color: #ff690d;
|
||||
}
|
||||
|
||||
.mobile-title {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ff690d;
|
||||
}
|
||||
|
||||
.bind-btn {
|
||||
width: 100rpx;
|
||||
height: 50rpx;
|
||||
background: #ff6100;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户