选课调整

This commit is contained in:
hebo 2025-09-02 22:01:34 +08:00
parent f40d2cdd87
commit af3656ca98

View File

@ -0,0 +1,174 @@
<template>
<view class="rich-text-content" v-html="processedContent"></view>
</template>
<script lang="ts" setup>
import { computed } from "vue";
import { formatRichTextForDisplay } from "@/utils/richText";
interface Props {
content: string;
fontSize?: string;
lineHeight?: string;
color?: string;
}
const props = withDefaults(defineProps<Props>(), {
fontSize: "14px",
lineHeight: "1.6",
color: "#666"
});
//
const processedContent = computed(() => {
return formatRichTextForDisplay(props.content);
});
</script>
<style lang="scss" scoped>
.rich-text-content {
font-size: v-bind(fontSize);
line-height: v-bind(lineHeight);
color: v-bind(color);
//
:deep(p) {
margin: 8px 0;
text-align: justify;
}
//
:deep(img) {
max-width: 100%;
height: auto;
display: block;
margin: 10px auto;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
//
:deep(.image-container) {
text-align: center;
margin: 15px 0;
}
:deep(strong) {
font-weight: 600;
color: #333;
}
:deep(ol) {
margin: 10px 0;
padding-left: 20px;
}
:deep(li) {
margin: 5px 0;
line-height: 1.5;
}
:deep(h1), :deep(h2), :deep(h3), :deep(h4), :deep(h5), :deep(h6) {
margin: 15px 0 10px 0;
font-weight: 600;
color: #333;
}
//
:deep(.highlight) {
background-color: #fff3cd;
padding: 2px 4px;
border-radius: 3px;
}
//
:deep(p + p) {
margin-top: 12px;
}
//
:deep(ol > li) {
position: relative;
padding-left: 5px;
}
:deep(ol > li::marker) {
font-weight: 600;
color: #1890ff;
}
//
:deep(blockquote) {
margin: 10px 0;
padding: 10px 15px;
background-color: #f8f9fa;
border-left: 4px solid #1890ff;
border-radius: 4px;
}
//
:deep(table) {
width: 100%;
border-collapse: collapse;
margin: 10px 0;
}
:deep(th), :deep(td) {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
:deep(th) {
background-color: #f5f5f5;
font-weight: 600;
}
//
:deep(code) {
background-color: #f1f3f4;
padding: 2px 4px;
border-radius: 3px;
font-family: 'Courier New', monospace;
font-size: 0.9em;
}
:deep(pre) {
background-color: #f1f3f4;
padding: 10px;
border-radius: 4px;
overflow-x: auto;
code {
background: none;
padding: 0;
}
}
}
//
@media (max-width: 375px) {
.rich-text-content {
font-size: 13px;
:deep(ol) {
padding-left: 15px;
}
:deep(table) {
font-size: 12px;
}
:deep(th), :deep(td) {
padding: 6px;
}
//
:deep(img) {
margin: 8px auto;
border-radius: 6px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}
}
}
</style>