导出样式调整
This commit is contained in:
parent
6c57427679
commit
e7dc7d2b04
@ -40,7 +40,7 @@
|
|||||||
class="question-item"
|
class="question-item"
|
||||||
>
|
>
|
||||||
<span class="question-index">{{ index + 1 }}.</span>
|
<span class="question-index">{{ index + 1 }}.</span>
|
||||||
<span class="question-title">{{ questionWithAnswer.question.title }}</span>
|
<span class="question-title">{{ questionWithAnswer.question.title }}:</span>
|
||||||
|
|
||||||
<!-- 帮助说明 -->
|
<!-- 帮助说明 -->
|
||||||
<span v-if="questionWithAnswer.question.helpText" class="question-help-inline">
|
<span v-if="questionWithAnswer.question.helpText" class="question-help-inline">
|
||||||
@ -243,8 +243,9 @@ const getAnswerByQuestionId = (questionId: number): Answer | undefined => {
|
|||||||
/** 获取答案显示值(兼容不同字段名) */
|
/** 获取答案显示值(兼容不同字段名) */
|
||||||
const getAnswerDisplayValue = (answer?: Answer): string => {
|
const getAnswerDisplayValue = (answer?: Answer): string => {
|
||||||
if (!answer) return ''
|
if (!answer) return ''
|
||||||
// 优先使用 answerText,其次使用 optionIds
|
// 优先使用 answerText,其次使用 optionIds,并去除前后空格和特殊字符
|
||||||
return answer.answerText || answer.optionIds || '-'
|
const value = answer.answerText || answer.optionIds || ''
|
||||||
|
return String(value).trim().replace(/^["']|["']$/g, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 问卷类型标签 */
|
/** 问卷类型标签 */
|
||||||
@ -386,7 +387,11 @@ const exportToWord = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取预览容器的HTML内容
|
// 获取预览容器的HTML内容
|
||||||
const previewHTML = previewRef.value.innerHTML
|
let previewHTML = previewRef.value.innerHTML
|
||||||
|
|
||||||
|
// 清理可能导致WPS显示引号的特殊字符
|
||||||
|
previewHTML = previewHTML.replace(/[\u201C\u201D\u2018\u2019]/g, '') // 移除中文引号
|
||||||
|
previewHTML = previewHTML.replace(/^["']|["']$/gm, '') // 移除行首尾的引号
|
||||||
|
|
||||||
// 构建完整的HTML文档,使用与预览页面一致的样式
|
// 构建完整的HTML文档,使用与预览页面一致的样式
|
||||||
const fullHTML = `
|
const fullHTML = `
|
||||||
@ -399,7 +404,6 @@ const exportToWord = async () => {
|
|||||||
body {
|
body {
|
||||||
font-family: 'Microsoft YaHei', '微软雅黑', SimSun, Arial, sans-serif;
|
font-family: 'Microsoft YaHei', '微软雅黑', SimSun, Arial, sans-serif;
|
||||||
font-size: 11pt;
|
font-size: 11pt;
|
||||||
line-height: 1.5;
|
|
||||||
margin: 15pt;
|
margin: 15pt;
|
||||||
padding: 15pt;
|
padding: 15pt;
|
||||||
}
|
}
|
||||||
@ -419,13 +423,15 @@ const exportToWord = async () => {
|
|||||||
}
|
}
|
||||||
.description-content {
|
.description-content {
|
||||||
color: #000;
|
color: #000;
|
||||||
line-height: 1.5;
|
|
||||||
font-size: 11pt;
|
font-size: 11pt;
|
||||||
|
margin-bottom: 6pt;
|
||||||
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
.instruction-content {
|
.instruction-content {
|
||||||
color: #000;
|
color: #000;
|
||||||
font-size: 11pt;
|
font-size: 11pt;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
margin-bottom: 6pt;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
.partition-title {
|
.partition-title {
|
||||||
@ -446,6 +452,7 @@ const exportToWord = async () => {
|
|||||||
.question-item {
|
.question-item {
|
||||||
font-size: 11pt;
|
font-size: 11pt;
|
||||||
color: #000;
|
color: #000;
|
||||||
|
margin-bottom: 8pt;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
page-break-inside: avoid;
|
page-break-inside: avoid;
|
||||||
}
|
}
|
||||||
@ -534,99 +541,99 @@ defineExpose({ open, exportToWord })
|
|||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
font-family: 'Microsoft YaHei', '微软雅黑', SimSun, Arial, sans-serif;
|
||||||
|
font-size: 18pt;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #000;
|
color: #000;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.section-title {
|
.section-title {
|
||||||
margin: 15px 0;
|
font-family: 'Microsoft YaHei', '微软雅黑', SimSun, Arial, sans-serif;
|
||||||
font-size: 16px;
|
margin-bottom: 15pt;
|
||||||
font-weight: 500;
|
font-size: 18pt;
|
||||||
|
font-weight: 700;
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
.description-content {
|
.description-content {
|
||||||
color: #000;
|
color: #000;
|
||||||
line-height: 1.8;
|
line-height: 3;
|
||||||
font-size: 14px;
|
font-size: 11pt;
|
||||||
}
|
}
|
||||||
.instruction-content {
|
.instruction-content {
|
||||||
color: #000;
|
color: #000;
|
||||||
font-size: 16px;
|
font-size: 11pt;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
line-height: 1.8;
|
line-height: 3;
|
||||||
}
|
}
|
||||||
.partition-title {
|
.partition-title {
|
||||||
margin-bottom: 16px;
|
margin-top: 15pt;
|
||||||
margin-top: 24px;
|
|
||||||
color: #000;
|
color: #000;
|
||||||
font-size: 15px;
|
font-size: 15pt;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
.partition-title:first-child {
|
.partition-title:first-child {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
.question-count {
|
.question-count {
|
||||||
font-size: 12px;
|
font-size: 11pt;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
margin-left: 4px;
|
margin-left: 2pt;
|
||||||
}
|
}
|
||||||
.question-item {
|
.question-item {
|
||||||
font-size: 14px;
|
font-size: 11pt;
|
||||||
color: #000;
|
color: #000;
|
||||||
line-height: 1.6;
|
line-height: 3;
|
||||||
margin-bottom: 16px;
|
|
||||||
page-break-inside: avoid;
|
page-break-inside: avoid;
|
||||||
}
|
}
|
||||||
.question-index {
|
.question-index {
|
||||||
margin-right: 4px;
|
margin-right: 2pt;
|
||||||
}
|
}
|
||||||
.question-title {
|
.question-title {
|
||||||
margin-right: 8px;
|
margin-right: 4pt;
|
||||||
}
|
}
|
||||||
.question-help-inline {
|
.question-help-inline {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
gap: 3pt;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
font-size: 13px;
|
font-size: 11pt;
|
||||||
padding: 4px 8px;
|
|
||||||
background: #f4f4f5;
|
background: #f4f4f5;
|
||||||
border-radius: 4px;
|
border-radius: 2pt;
|
||||||
margin-right: 8px;
|
margin-right: 6pt;
|
||||||
}
|
}
|
||||||
.question-options-inline {
|
.question-options-inline {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 12px;
|
gap: 8pt;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.option-item {
|
.option-item {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 3pt;
|
||||||
}
|
}
|
||||||
.question-rating-inline,
|
.question-rating-inline,
|
||||||
.question-date-inline,
|
.question-date-inline,
|
||||||
.question-number-inline {
|
.question-number-inline {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 12px;
|
gap: 8pt;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
margin-left: 8px;
|
margin-left: 3pt;
|
||||||
}
|
}
|
||||||
.rating-info,
|
.rating-info,
|
||||||
.date-info,
|
.date-info,
|
||||||
.number-info {
|
.number-info {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
gap: 16px;
|
gap: 11pt;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
font-size: 13px;
|
font-size: 11pt;
|
||||||
}
|
}
|
||||||
.question-input-inline {
|
.question-input-inline {
|
||||||
color: #000;
|
color: #000;
|
||||||
font-size: 14px;
|
font-size: 11pt;
|
||||||
line-height: 2.2;
|
line-height: 3;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user