名字加星号

This commit is contained in:
17792275749
2025-06-30 19:03:08 +08:00
parent eccb91a7c9
commit 20db1b7441
2 changed files with 22 additions and 3 deletions
@@ -376,7 +376,7 @@ export default {
if (res.success && res.result && res.result.rankList && res.result.rankList.length > 0) { // 确保有数据才赋值和滚动
_this.doingDay = res.result.doingDay === null ? "-" : res.result.doingDay;
_this.list = res.result.rankList; // 更新列表数据
_this.startDay = res.result.startDay === null ? "-" : res.result.startDay;
_this.startDay = res.result.startDay ? res.result.startDay : "-";
_this.callAndroidPostLog(`数据加载成功,列表长度:${_this.list.length}`);
_this.$nextTick(() => {
@@ -44,7 +44,7 @@
>
<div>{{ index + 1 }}</div>
<div>{{ item.departName }}</div>
<div>{{ item.userName }}</div>
<div>{{ maskUserName(item.userName) }}</div>
<div>{{ item.fraction }}</div>
</div>
</template>
@@ -631,7 +631,26 @@ export default {
// 直接调用页面切换逻辑,避免卡住
_this.pageTimerCallback();
}
},
maskUserName(fullName) {
if (!fullName || typeof fullName !== 'string' || fullName.length === 0) {
return '';
}
const len = fullName.length;
if (len === 1) {
return fullName;
} else if (len === 2) {
return fullName.charAt(0) + '*';
} else {
const firstChar = fullName.charAt(0);
const lastChar = fullName.charAt(len - 1);
const maskedPart = '*'.repeat(len - 2);
return firstChar + maskedPart + lastChar;
}
},
},
beforeDestroy: function () {
const _this = this;