Files
huangjingfen/pro_v3.5.1/view/uniapp/components/HjfMemberBadge.vue
apple f6227c0253 feat: 黄精粉前端功能集成 + 个人中心/资产/公排页面优化 + 去除admin copyright
主要改动:
- 个人中心: 去除HjfMemberBadge徽章, 会员等级改显示vip_name,
  "我的资产"/"公排查询"导航项改为与member-points一致风格
- 我的资产页面: 去除HjfMemberBadge, 美化卡片圆角和阴影
- 公排查询页面: 美化顶部渐变和订单卡片样式
- Admin登录页和后台布局: 彻底删除footer copyright信息
- 新增黄精粉业务页面/组件/API/Mock数据(Phase 1)
- 新增PHP环境配置文档和启动脚本

Made-with: Cursor
2026-03-13 00:49:22 +08:00

186 lines
3.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="hjf-member-badge" :class="sizeClass">
<view class="badge-icon" :style="iconStyle">
<text class="icon-text">{{ levelText }}</text>
</view>
<text class="badge-name">{{ displayName }}</text>
</view>
</template>
<script>
/**
* 会员等级颜色映射0-4 对应文档 3.2.4
* @constant
* @type {Object<number, string>}
*/
const LEVEL_COLORS = {
0: '#999999', // 普通
1: '#CD7F32', // 创客
2: '#C0C0C0', // 云店
3: '#FFD700', // 服务商
4: '#8B5CF6' // 分公司
};
/**
* 等级默认名称level 无 levelName 时回退)
* @constant
* @type {string[]}
*/
const LEVEL_NAMES = ['普通', '创客', '云店', '服务商', '分公司'];
/**
* HjfMemberBadge — 会员等级徽章组件
*
* 展示会员等级图标(圆形数字徽)+ 等级名称,支持三种尺寸与五档等级颜色。
* 参考docs/frontend-new-pages-spec.md 第 3.2.4 节。
*
* @component HjfMemberBadge
* @example
* <HjfMemberBadge :level="2" levelName="云店" size="normal" />
*/
export default {
name: 'HjfMemberBadge',
props: {
/**
* 会员等级数字 (0-4)
* 0: 普通, 1: 创客, 2: 云店, 3: 服务商, 4: 分公司
* @type {number}
* @default 0
*/
level: {
type: Number,
default: 0,
validator(val) {
return val >= 0 && val <= 4;
}
},
/**
* 等级名称展示文案(可选,不传则按 level 回退为默认名称)
* @type {string}
* @default ''
*/
levelName: {
type: String,
default: ''
},
/**
* 尺寸:'small' | 'normal' | 'large'
* @type {'small'|'normal'|'large'}
* @default 'normal'
*/
size: {
type: String,
default: 'normal',
validator(val) {
return ['small', 'normal', 'large'].indexOf(val) !== -1;
}
}
},
computed: {
/** 尺寸类名,用于 .size-small / .size-normal / .size-large */
sizeClass() {
return `size-${this.size}`;
},
/** 当前等级对应的主题色 */
levelColor() {
const key = Math.min(4, Math.max(0, this.level));
return LEVEL_COLORS[key] || LEVEL_COLORS[0];
},
/** 徽章图标内联样式(背景色、边框色) */
iconStyle() {
return {
backgroundColor: this.levelColor,
borderColor: this.levelColor
};
},
/** 最终展示的等级名称(优先 levelName否则 LEVEL_NAMES[level] */
displayName() {
if (this.levelName && this.levelName.trim()) {
return this.levelName.trim();
}
const key = Math.min(4, Math.max(0, this.level));
return LEVEL_NAMES[key] || LEVEL_NAMES[0];
},
/** 徽章内显示的等级数字文案 */
levelText() {
const key = Math.min(4, Math.max(0, this.level));
return String(key);
}
}
};
</script>
<style scoped lang="scss">
.hjf-member-badge {
display: inline-flex;
align-items: center;
flex-wrap: nowrap;
.badge-icon {
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 50%;
border: 2rpx solid;
flex-shrink: 0;
.icon-text {
color: #fff;
font-weight: bold;
text-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.2);
}
}
.badge-name {
margin-left: 8rpx;
font-weight: 500;
white-space: nowrap;
}
&.size-small {
.badge-icon {
width: 32rpx;
height: 32rpx;
.icon-text {
font-size: 20rpx;
}
}
.badge-name {
font-size: 22rpx;
}
}
&.size-normal {
.badge-icon {
width: 40rpx;
height: 40rpx;
.icon-text {
font-size: 24rpx;
}
}
.badge-name {
font-size: 26rpx;
}
}
&.size-large {
.badge-icon {
width: 52rpx;
height: 52rpx;
.icon-text {
font-size: 30rpx;
}
}
.badge-name {
font-size: 30rpx;
}
}
}
</style>