富文本替代

This commit is contained in:
caoqianming 2021-02-22 10:15:55 +08:00
parent afeda18ce0
commit f85c0b54cb
14 changed files with 60 additions and 44 deletions

View File

@ -134,11 +134,11 @@
:visible.sync="dialogVisible"
width="30%">
<div>{{question.type}}</div>
<div v-html="question.name"></div>
<div >{{question.name}}</div>
<ul id="repeat">
<li v-for="(value,key,index) in question.options">
{{ key }}:
<span v-html="value"></span>
<span>{{value}}</span>
</li>
</ul>
<div>正确答案{{question.right}}</div>

View File

@ -30,7 +30,7 @@
></el-cascader>
</el-form-item>
<el-form-item label="题干" prop="name">
<tinymce2 v-model="Form.name" height="100" width="800px" />
<el-input v-model="Form.name" height="100" width="800px" />
</el-form-item>
<el-form-item label="题干图片" prop="img" >
<el-upload
@ -49,22 +49,22 @@
<el-button type="text" @click="delImg()" v-if="Form.img">删除</el-button>
</el-form-item>
<el-form-item label="选项A" prop="optionA" >
<tinymce2 v-model="Form.options.A" height="30" width="800px" :disabled="inputDisable" />
<el-input v-model="Form.options.A" height="30" width="800px" :disabled="inputDisable" />
</el-form-item>
<el-form-item label="选项B" prop="optionB" >
<tinymce2 v-model="Form.options.B" height="30" width="800px" :disabled="inputDisable" />
<el-input v-model="Form.options.B" height="30" width="800px" :disabled="inputDisable" />
</el-form-item>
<el-form-item label="选项C" v-show="Form.type!='判断'">
<tinymce2 v-model="Form.options.C" height="30" width="800px" />
<el-input v-model="Form.options.C" height="30" width="800px" />
</el-form-item>
<el-form-item label="选项D" v-show="Form.type!='判断'">
<tinymce2 v-model="Form.options.D" height="30" width="800px" />
<el-input v-model="Form.options.D" height="30" width="800px" />
</el-form-item>
<el-form-item label="选项E" v-show="Form.type!='判断'">
<tinymce2 v-model="Form.options.E" height="30" width="800px" />
<el-input v-model="Form.options.E" height="30" width="800px" />
</el-form-item>
<el-form-item label="选项F" v-show="Form.type!='判断'">
<tinymce2 v-model="Form.options.F" height="30" width="800px" />
<el-input v-model="Form.options.F" height="30" width="800px" />
</el-form-item>
<el-form-item label="正确答案" v-if="Form.type =='多选'">
<el-checkbox-group v-model="Form.right">
@ -104,13 +104,13 @@
</div>
</template>
<script>
import Tinymce2 from '@/components/Tinymce/index2'
// import el-input from '@/components/Tinymce/index2'
import { createQuestion,getQuestioncatAll } from "@/api/question";
import { genTree, deepClone } from "@/utils";
import { upUrl } from "@/api/file";
import { getToken } from "@/utils/auth";
export default {
components:{ Tinymce2 },
components:{ },
data() {
return {
upHeaders: { Authorization: "JWT " + getToken() },

View File

@ -21,7 +21,7 @@
></el-cascader>
</el-form-item>
<el-form-item label="题干" prop="name">
<tinymce2 v-model="Form.name" height="100" width="800px" />
<el-input v-model="Form.name" height="100" width="800px" />
<!-- <el-input v-model="Form.name" style="width:600px" type="textarea" :rows=3></el-input> -->
</el-form-item>
<el-form-item label="题干图片" prop="img" >
@ -40,25 +40,25 @@
<el-button type="text" @click="delImg()" v-if="Form.img">删除</el-button>
</el-form-item>
<el-form-item label="选项A" prop="optionA">
<tinymce2 v-model="Form.options.A" height="30" width="800px" :disabled="inputDisable" />
<el-input v-model="Form.options.A" height="30" width="800px" :disabled="inputDisable" />
</el-form-item>
<el-form-item label="选项B" prop="optionB">
<tinymce2 v-model="Form.options.B" height="30" width="800px" :disabled="inputDisable" />
<el-input v-model="Form.options.B" height="30" width="800px" :disabled="inputDisable" />
</el-form-item>
<el-form-item label="选项C" v-show="Form.type!='判断'">
<tinymce2 v-model="Form.options.C" height="30" width="800px" />
<el-input v-model="Form.options.C" height="30" width="800px" />
<!-- <el-input v-model="Form.options.C" style="width:600px"></el-input> -->
</el-form-item>
<el-form-item label="选项D" v-show="Form.type!='判断'">
<tinymce2 v-model="Form.options.D" height="30" width="800px" />
<el-input v-model="Form.options.D" height="30" width="800px" />
<!-- <el-input v-model="Form.options.D" style="width:600px"></el-input> -->
</el-form-item>
<el-form-item label="选项E" v-show="Form.type!='判断'">
<tinymce2 v-model="Form.options.E" height="30" width="800px" />
<el-input v-model="Form.options.E" height="30" width="800px" />
<!-- <el-input v-model="Form.options.E" style="width:600px"></el-input> -->
</el-form-item>
<el-form-item label="选项F" v-show="Form.type!='判断'">
<tinymce2 v-model="Form.options.F" height="30" width="800px" />
<el-input v-model="Form.options.F" height="30" width="800px" />
<!-- <el-input v-model="Form.options.F" style="width:600px"></el-input> -->
</el-form-item>
<el-form-item label="正确答案" v-if="Form.type =='多选'">
@ -98,13 +98,13 @@
</div>
</template>
<script>
import Tinymce2 from '@/components/Tinymce/index2'
// import el-input from '@/components/Tinymce/index2'
import { createQuestion,getQuestioncatAll, getQuestion, getQuestioncatList, updateQuestion } from "@/api/question";
import { genTree, deepClone } from "@/utils";
import { upUrl } from "@/api/file";
import { getToken } from "@/utils/auth";
export default {
components:{ Tinymce2 },
components:{ },
data() {
return {
upHeaders: { Authorization: "JWT " + getToken() },

View File

@ -177,7 +177,7 @@ Page({
for (let key in tm_current.options) {
let option = {}
option.key = key
option.value = '<p>' + tm_current.options[key].toString() + '</p>'
option.value = tm_current.options[key]
if (tm_current.user_answer) {
if (key == tm_current.user_answer || tm_current.user_answer.indexOf(key) != -1) {
option.checked = true

View File

@ -8,7 +8,7 @@
<span style="color:gray"> {{tm_current.questioncat_name}}</span>
</view>
<view class="weui-article__title">
<parser html="{{tm_current.name}}" domain="{{domain}}" selectable/>
<rich-text nodes="{{tm_current.name}}"></rich-text>
</view>
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
</view>
@ -17,7 +17,7 @@
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
</view>
<view class="weui-cell__ft">
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
@ -32,7 +32,7 @@
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
</view>
<view class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>

View File

@ -14,7 +14,7 @@
<span style="color:gray"> {{currentTm.questioncat_name}}</span>
</view>
<view class="weui-article__title">
<parser html="{{currentTm.name}}" domain="{{domain}}" selectable/>
<rich-text nodes="{{currentTm.name}}"></rich-text>
</view>
<view wx:if="{{currentTm.img}}" style="text-align:center"><image src="{{currentTm.img}}" mode="aspectFit"></image></view>
</view>
@ -23,7 +23,7 @@
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
</view>
<view class="weui-cell__ft">
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
@ -38,7 +38,7 @@
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
</view>
<view class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>

View File

@ -251,7 +251,8 @@ Page({
for (let key in tm_current.options) {
let option = {}
option.key = key
option.value = '<p>' + tm_current.options[key].toString() + '</p>'
// option.value = '<p>' + tm_current.options[key].toString() + '</p>'
option.value = tm_current.options[key]
option.checked = false
option.right = false
if(option.key == tm_current.right||tm_current.right.indexOf(option.key)!=-1){

View File

@ -13,7 +13,8 @@
<span class="txlabel">{{tm_current.type}}</span>
</view>
<view class="weui-article__title">
<parser html="{{tm_current.name}}" domain="{{domain}}" selectable/>
<!-- <parser html="{{tm_current.name}}" domain="{{domain}}" selectable/> -->
<rich-text nodes="{{tm_current.name}}"></rich-text>
</view>
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
</view>
@ -23,11 +24,17 @@
<view class="weui-cell__bd" >
<view style="font-weight:bold;color:green" wx:if="{{ moShi == '看题模式' && item.right}}">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%">
<!-- <parser html="{{item.value}}" domain="{{domain}}" selectable /> -->
<rich-text nodes="{{item.value}}"></rich-text>
</view>
</view>
<view wx:else>
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%">
<!-- <parser html="{{item.value}}" domain="{{domain}}" selectable /> -->
<rich-text nodes="{{item.value}}"></rich-text>
</view>
</view>
</view>
<view class="weui-cell__ft">
@ -44,11 +51,17 @@
<view class="weui-cell__bd" >
<view style="font-weight:bold;color:green" wx:if="{{ moShi == '看题模式' && item.right}}">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%">
<rich-text nodes="{{item.value}}"></rich-text>
<!-- <parser html="{{item.value}}" domain="{{domain}}" selectable /> -->
</view>
</view>
<view wx:else>
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%">
<rich-text nodes="{{item.value}}"></rich-text>
<!-- <parser html="{{item.value}}" domain="{{domain}}" selectable /> -->
</view>
</view>
</view>
<view class="weui-cell__hd">

View File

@ -139,7 +139,7 @@ Page({
for (let key in tm_current.options) {
let option = {}
option.key = key
option.value = '<p>' + tm_current.options[key].toString() + '</p>'
option.value = tm_current.options[key].toString()
if (tm_current.user_answer) {
if (key == tm_current.user_answer || tm_current.user_answer.indexOf(key) != -1) {
option.checked = true

View File

@ -8,7 +8,7 @@
<span style="color:gray"> {{tm_current.questioncat_name}}</span>
</view>
<view class="weui-article__title">
<parser html="{{tm_current.name}}" domain="{{domain}}" selectable/>
<rich-text nodes="{{tm_current.name}}"></rich-text>
</view>
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
</view>
@ -17,7 +17,9 @@
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%">
<rich-text nodes="{{item.value}}"></rich-text>
</view>
</view>
<view class="weui-cell__ft">
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
@ -32,7 +34,7 @@
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
</view>
<view class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>

View File

@ -118,7 +118,7 @@ Page({
for (let key in question_options) {
let option = {}
option.key = key
option.value = '<p>' + question_options[key] + '</p>'
option.value = question_options[key]
if (user_answer) {
if (key == user_answer || user_answer.indexOf(key) != -1) {
option.checked = true

View File

@ -18,7 +18,7 @@
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
</view>
<view class="weui-cell__ft">
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
@ -33,7 +33,7 @@
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
</view>
<view class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>

View File

@ -182,7 +182,7 @@ Page({
for (let key in tm_current.options) {
let option = {}
option.key = key
option.value = '<p>' + tm_current.options[key].toString() + '</p>'
option.value = tm_current.options[key]
if (tm_current.user_answer) {
if (key == tm_current.user_answer || tm_current.user_answer.indexOf(key) != -1) {
option.checked = true

View File

@ -17,7 +17,7 @@
<span style="color:gray">({{tm_current.questioncat_name}})</span>
</view>
<view class="weui-article__title">
<parser html="{{tm_current.name}}" domain="{{domain}}" selectable/>
<rich-text nodes="{{tm_current.name}}"></rich-text>
</view>
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
</view>
@ -26,7 +26,7 @@
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
</view>
<view class="weui-cell__ft">
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
@ -41,7 +41,7 @@
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
</view>
<view class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>