添加排位相框
This commit is contained in:
@@ -4,6 +4,10 @@ defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
|
frameSrc: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
onClick: {
|
onClick: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: () => {},
|
default: () => {},
|
||||||
@@ -30,8 +34,8 @@ defineProps({
|
|||||||
<template>
|
<template>
|
||||||
<view class="avatar" @click="onClick">
|
<view class="avatar" @click="onClick">
|
||||||
<image
|
<image
|
||||||
v-if="frame"
|
v-if="frameSrc || frame"
|
||||||
src="../static/avatar-frame.png"
|
:src="frameSrc || '../static/avatar-frame.png'"
|
||||||
mode="widthFix"
|
mode="widthFix"
|
||||||
:style="{
|
:style="{
|
||||||
width: Number(size) + 10 + 'px',
|
width: Number(size) + 10 + 'px',
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ watch(
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="container" :style="{ width: containerWidth }">
|
<view class="container" :style="{ width: containerWidth }">
|
||||||
<block v-if="user.id"
|
<block v-if="user.id">
|
||||||
><Avatar
|
<Avatar
|
||||||
:frame="true"
|
:frameSrc="user.lvlImage"
|
||||||
:src="user.avatar"
|
:src="user.avatar"
|
||||||
:onClick="toUserPage"
|
:onClick="toUserPage"
|
||||||
:size="42"
|
:size="42"
|
||||||
|
|||||||
@@ -59,18 +59,22 @@ export default defineStore("store", {
|
|||||||
}
|
}
|
||||||
const rankInfos = this.config.randInfos || [];
|
const rankInfos = this.config.randInfos || [];
|
||||||
let lvlName = "";
|
let lvlName = "";
|
||||||
|
let lvlImage = "";
|
||||||
if (this.user.scores) {
|
if (this.user.scores) {
|
||||||
rankInfos.some((r, index) => {
|
rankInfos.some((r, index) => {
|
||||||
lvlName = rankInfos[index].name;
|
lvlName = rankInfos[index].name;
|
||||||
|
lvlImage = rankInfos[index].icoin;
|
||||||
if (r.upgrade_scores > this.user.scores) {
|
if (r.upgrade_scores > this.user.scores) {
|
||||||
if (rankInfos[index - 1]) {
|
if (rankInfos[index - 1]) {
|
||||||
lvlName = rankInfos[index - 1].name;
|
lvlName = rankInfos[index - 1].name;
|
||||||
|
lvlImage = rankInfos[index - 1].icoin;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
this.user.lvlName = lvlName;
|
this.user.lvlName = lvlName;
|
||||||
|
this.user.lvlImage = lvlImage;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateDevice(deviceId, deviceName) {
|
updateDevice(deviceId, deviceName) {
|
||||||
@@ -81,18 +85,21 @@ export default defineStore("store", {
|
|||||||
this.config = config;
|
this.config = config;
|
||||||
const rankInfos = config.randInfos || [];
|
const rankInfos = config.randInfos || [];
|
||||||
let lvlName = "";
|
let lvlName = "";
|
||||||
|
let lvlImage = "";
|
||||||
if (this.user.scores) {
|
if (this.user.scores) {
|
||||||
rankInfos.some((r, index) => {
|
rankInfos.some((r, index) => {
|
||||||
lvlName = rankInfos[index].name;
|
lvlName = rankInfos[index].name;
|
||||||
if (r.upgrade_scores > this.user.scores) {
|
if (r.upgrade_scores > this.user.scores) {
|
||||||
if (rankInfos[index - 1]) {
|
if (rankInfos[index - 1]) {
|
||||||
lvlName = rankInfos[index - 1].name;
|
lvlName = rankInfos[index - 1].name;
|
||||||
|
lvlImage = rankInfos[index - 1].icoin;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
this.user.lvlName = lvlName;
|
this.user.lvlName = lvlName;
|
||||||
|
this.user.lvlImage = lvlImage;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user