Explorar el Código

写作题范文分段并缩进

natasha hace 6 meses
padre
commit
e445b48292

+ 6 - 1
components/write-picture-question/write-picture-question.vue

@@ -53,7 +53,7 @@
 					<text :class="['sample-text', show_sample_text ? 'sample-show' : 'sample-hide']"
 						@click="show_sample_text = !show_sample_text">{{ show_sample_text ? '隐藏范文' : '查看范文' }}</text>
 				</view>
-				<view class="sample-text" v-if="show_sample_text" v-html="sanitizeHTML(questionData.sample_text)"
+				<view class="sample-text article-content" v-if="show_sample_text" v-html="sanitizeHTML(show_sample_break)"
 					:ref="'richText-4-4'+questionData.question_id"
 					@longpress="previewByRichTextImg(-4,-4,questionData.question_id)"></view>
 			</view>
@@ -112,6 +112,7 @@
 				show_sample_text: true,
 				fontNumList: [],
 				messageText: '',
+				show_sample_break: '',
 			};
 		},
 		watch: {
@@ -167,6 +168,7 @@
 					};
 					this.answer_list.push(obj);
 				});
+				this.show_sample_break = this.questionData.sample_text ? this.questionData.sample_text.replace(/#/g, '</p><p>') : '';
 			},
 			changeImg(e) {
 				this.active_index = e.detail.current;
@@ -348,6 +350,9 @@
 					color: #306eff;
 				}
 			}
+			.article-content {
+			    text-indent: 2em;
+			}
 		}
 
 		.reference {

+ 6 - 1
components/write-question/write-question.vue

@@ -46,7 +46,7 @@
 				<text :class="['sample-text', show_sample_text ? 'sample-show' : 'sample-hide']"
 					@click="show_sample_text = !show_sample_text">{{ show_sample_text ? '隐藏范文' : '查看范文' }}</text>
 			</view>
-			<view class="sample-text" v-if="show_sample_text" v-html="sanitizeHTML(questionData.sample_text)"
+			<view class="sample-text article-content" v-if="show_sample_text" v-html="sanitizeHTML(show_sample_break)"
 				:ref="'richText-3-3'+questionData.question_id"
 				@longpress="previewByRichTextImg(-3,-3,questionData.question_id)"></view>
 		</view>
@@ -100,6 +100,7 @@
 				fontNum: 0,
 				messageText: '',
 				question_id: '',
+				show_sample_break: '',
 			};
 		},
 		watch: {
@@ -113,6 +114,7 @@
 					this.question_id = this.questionData.question_id;
 					this.setUserAnswer();
 					this.commonComputedAnswerControl(val);
+					this.show_sample_break = this.questionData.sample_text ? this.questionData.sample_text.replace(/#/g, '</p><p>') : '';
 				},
 				immediate: true,
 				deep: true
@@ -266,6 +268,9 @@
 					color: #306eff;
 				}
 			}
+			.article-content {
+			    text-indent: 2em;
+			}
 		}
 
 		.reference {