diff --git a/frontend/src/views/Room/TextMessage.vue b/frontend/src/views/Room/TextMessage.vue index cd5669e..33060d4 100644 --- a/frontend/src/views/Room/TextMessage.vue +++ b/frontend/src/views/Room/TextMessage.vue @@ -5,6 +5,9 @@ {{time}} {{authorName}} {{content}} + @@ -16,6 +19,8 @@ const AUTHOR_TYPE_TO_TEXT = [ 'moderator', // 房管 'owner' // 主播 ] +const REPEATED_MARK_COLOR_START = [0x21, 0x96, 0xF3] +const REPEATED_MARK_COLOR_END = [0xFF, 0x57, 0x22] export default { name: 'TextMessage', @@ -24,12 +29,40 @@ export default { time: String, authorName: String, authorType: Number, - content: String + content: String, + repeated: Number }, computed: { authorTypeText() { return AUTHOR_TYPE_TO_TEXT[this.authorType] + }, + repeatedMarkColor() { + let color + if (this.repeated <= 2) { + color = REPEATED_MARK_COLOR_START + } else if (this.repeated >= 10) { + color = REPEATED_MARK_COLOR_END + } else { + color = [0, 0, 0] + let t = (this.repeated - 2) / (10 - 2) + for (let i = 0; i < 3; i++) { + color[i] = REPEATED_MARK_COLOR_START[i] + (REPEATED_MARK_COLOR_END[i] - REPEATED_MARK_COLOR_START[i]) * t + } + } + return `rgb(${color.join(', ')})` } } } + + diff --git a/frontend/src/views/Room/index.vue b/frontend/src/views/Room/index.vue index 64cf2a2..ec5f68e 100644 --- a/frontend/src/views/Room/index.vue +++ b/frontend/src/views/Room/index.vue @@ -18,7 +18,7 @@