feat: 标签颜色的调整
This commit is contained in:
@@ -145,15 +145,15 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-else-if="entry.type === 'list'" class="content-body-list-card" :style="contentBodyListCardStyle">
|
||||
<view v-else-if="entry.type === 'list'" class="content-body-list-card" :style="getContentBodyListCardStyle(entry.key)">
|
||||
<view v-for="(item, index) in entry.value" :key="index" class="content-body-list-item">
|
||||
<view class="content-body-list-text">
|
||||
<ChatMarkdown
|
||||
class="content-body-markdown"
|
||||
:text="formatLeafValue(item)"
|
||||
:theme-color="contentBodyMarkdownColor"
|
||||
:font-color="contentBodyMarkdownColor"
|
||||
:font-sub-color="contentBodyMarkdownColor"
|
||||
:theme-color="getContentBodyMarkdownColor(entry.key)"
|
||||
:font-color="getContentBodyMarkdownColor(entry.key)"
|
||||
:font-sub-color="getContentBodyMarkdownColor(entry.key)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
@@ -164,11 +164,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, defineProps, ref } from "vue";
|
||||
import { computed, defineProps } from "vue";
|
||||
import { SEND_MESSAGE_CONTENT_TEXT } from "@/constant/constant";
|
||||
import { getAccessToken } from "@/constant/token";
|
||||
import { navigateTo } from "@/router";
|
||||
import { getRandomTagToneStyle } from "@/utils/tagTone";
|
||||
import { buildTagToneStyle } from "@/utils/tagTone";
|
||||
import ChatMarkdown from "../ChatMarkdown/index.vue";
|
||||
import {
|
||||
LONG_TEXT_KEYS,
|
||||
@@ -188,12 +188,29 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const contentBodyListToneStyle = ref(getRandomTagToneStyle({ borderAlpha: 1, borderWidth: 4 }));
|
||||
const contentBodyListCardStyle = computed(() => ({
|
||||
borderLeft: contentBodyListToneStyle.value.border,
|
||||
background: contentBodyListToneStyle.value.background,
|
||||
}));
|
||||
const contentBodyMarkdownColor = computed(() => contentBodyListToneStyle.value.color);
|
||||
const LIST_WARNING_TONE_COLOR = "#f59e0b";
|
||||
const LIST_DEFAULT_TONE_COLOR = "#10b981";
|
||||
const LIST_TONE_OPTIONS = { borderAlpha: 1, borderWidth: 4 };
|
||||
|
||||
const getContentBodyListToneStyle = (key) => {
|
||||
const toneColor = String(key || "").toLowerCase().includes("warning")
|
||||
? LIST_WARNING_TONE_COLOR
|
||||
: LIST_DEFAULT_TONE_COLOR;
|
||||
|
||||
return buildTagToneStyle(toneColor, LIST_TONE_OPTIONS);
|
||||
};
|
||||
|
||||
const getContentBodyListCardStyle = (key) => {
|
||||
const toneStyle = getContentBodyListToneStyle(key);
|
||||
return {
|
||||
borderLeft: toneStyle.border,
|
||||
background: toneStyle.background,
|
||||
};
|
||||
};
|
||||
|
||||
const getContentBodyMarkdownColor = (key) => {
|
||||
return getContentBodyListToneStyle(key).color;
|
||||
};
|
||||
|
||||
const IGNORED_FIELD_KEYS = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user