sub sup
This commit is contained in:
parent
4c1edc9f9c
commit
3c49d1b729
|
@ -0,0 +1,244 @@
|
||||||
|
<template>
|
||||||
|
<div :class="{fullscreen:fullscreen}" class="tinymce-container" :style="{width:containerWidth}">
|
||||||
|
<textarea :id="tinymceId" class="tinymce-textarea" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* docs:
|
||||||
|
* https://panjiachen.github.io/vue-element-admin-site/feature/component/rich-editor.html#tinymce
|
||||||
|
*/
|
||||||
|
import plugins from "./plugins";
|
||||||
|
import toolbar from "./toolbar";
|
||||||
|
import load from "./dynamicLoadScript";
|
||||||
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
|
import { getToken } from "@/utils/auth";
|
||||||
|
// why use this cdn, detail see https://github.com/PanJiaChen/tinymce-all-in-one
|
||||||
|
const tinymceCDN =
|
||||||
|
"https://cdn.jsdelivr.net/npm/tinymce-all-in-one@4.9.3/tinymce.min.js";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Tinymce2",
|
||||||
|
props: {
|
||||||
|
id: {
|
||||||
|
type: String,
|
||||||
|
default: function() {
|
||||||
|
return (
|
||||||
|
"vue-tinymce-" +
|
||||||
|
+new Date() +
|
||||||
|
((Math.random() * 1000).toFixed(0) + "")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: String,
|
||||||
|
default: ""
|
||||||
|
},
|
||||||
|
toolbar: {
|
||||||
|
type: Array,
|
||||||
|
required: false,
|
||||||
|
default() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
menubar: {
|
||||||
|
type: String,
|
||||||
|
default: "file edit insert view format table"
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: [Number, String],
|
||||||
|
required: false,
|
||||||
|
default: 360
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: [Number, String],
|
||||||
|
required: false,
|
||||||
|
default: "auto"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
hasChange: false,
|
||||||
|
hasInit: false,
|
||||||
|
tinymceId: this.id,
|
||||||
|
fullscreen: false,
|
||||||
|
languageTypeList: {
|
||||||
|
en: "en",
|
||||||
|
zh: "zh_CN",
|
||||||
|
es: "es_MX",
|
||||||
|
ja: "ja"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
containerWidth() {
|
||||||
|
const width = this.width;
|
||||||
|
if (/^[\d]+(\.[\d]+)?$/.test(width)) {
|
||||||
|
// matches `100`, `'100'`
|
||||||
|
return `${width}px`;
|
||||||
|
}
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value(val) {
|
||||||
|
if (!this.hasChange && this.hasInit) {
|
||||||
|
this.$nextTick(() =>
|
||||||
|
window.tinymce.get(this.tinymceId).setContent(val || "")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
activated() {
|
||||||
|
if (window.tinymce) {
|
||||||
|
this.initTinymce();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deactivated() {
|
||||||
|
this.destroyTinymce();
|
||||||
|
},
|
||||||
|
destroyed() {
|
||||||
|
this.destroyTinymce();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init() {
|
||||||
|
// dynamic load tinymce from cdn
|
||||||
|
load(tinymceCDN, err => {
|
||||||
|
if (err) {
|
||||||
|
this.$message.error(err.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.initTinymce();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
initTinymce() {
|
||||||
|
const _this = this;
|
||||||
|
window.tinymce.init({
|
||||||
|
selector: `#${this.tinymceId}`,
|
||||||
|
language: this.languageTypeList["zh"],
|
||||||
|
height: this.height,
|
||||||
|
body_class: "panel-body ",
|
||||||
|
object_resizing: false,
|
||||||
|
toolbar: ['bold italic underline alignleft aligncenter alignright undo redo removeformat subscript superscript image charmap preview media table forecolor backcolor fullscreen'],
|
||||||
|
menubar: false,
|
||||||
|
plugins: plugins,
|
||||||
|
end_container_on_empty_block: true,
|
||||||
|
powerpaste_word_import: "clean",
|
||||||
|
code_dialog_height: 450,
|
||||||
|
code_dialog_width: 1000,
|
||||||
|
advlist_bullet_styles: "square",
|
||||||
|
advlist_number_styles: "default",
|
||||||
|
imagetools_cors_hosts: ["www.tinymce.com", "codepen.io"],
|
||||||
|
default_link_target: "_blank",
|
||||||
|
link_title: false,
|
||||||
|
nonbreaking_force_tab: true, // inserting nonbreaking space need Nonbreaking Space Plugin
|
||||||
|
init_instance_callback: editor => {
|
||||||
|
if (_this.value) {
|
||||||
|
editor.setContent(_this.value);
|
||||||
|
}
|
||||||
|
_this.hasInit = true;
|
||||||
|
editor.on("NodeChange Change KeyUp SetContent", () => {
|
||||||
|
this.hasChange = true;
|
||||||
|
this.$emit("input", editor.getContent());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setup(editor) {
|
||||||
|
editor.on("FullscreenStateChanged", e => {
|
||||||
|
_this.fullscreen = e.state;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 整合七牛上传
|
||||||
|
// images_dataimg_filter(img) {
|
||||||
|
// setTimeout(() => {
|
||||||
|
// const $image = $(img);
|
||||||
|
// $image.removeAttr('width');
|
||||||
|
// $image.removeAttr('height');
|
||||||
|
// if ($image[0].height && $image[0].width) {
|
||||||
|
// $image.attr('data-wscntype', 'image');
|
||||||
|
// $image.attr('data-wscnh', $image[0].height);
|
||||||
|
// $image.attr('data-wscnw', $image[0].width);
|
||||||
|
// $image.addClass('wscnph');
|
||||||
|
// }
|
||||||
|
// }, 0);
|
||||||
|
// return img
|
||||||
|
// },
|
||||||
|
images_upload_handler: function(blobInfo, succFun, failFun) {
|
||||||
|
var xhr, formData;
|
||||||
|
var file = blobInfo.blob(); //转化为易于理解的file对象
|
||||||
|
xhr = new XMLHttpRequest();
|
||||||
|
xhr.withCredentials = false;
|
||||||
|
xhr.open("POST", upUrl());
|
||||||
|
xhr.setRequestHeader('Authorization', 'JWT '+ getToken());
|
||||||
|
xhr.onload = function() {
|
||||||
|
var json;
|
||||||
|
if (xhr.status != 200) {
|
||||||
|
failFun("HTTP Error: " + xhr.status);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
json = JSON.parse(xhr.responseText);
|
||||||
|
succFun(json.data.path);
|
||||||
|
};
|
||||||
|
formData = new FormData();
|
||||||
|
formData.append("file", file, file.name); //此处与源文档不一样
|
||||||
|
xhr.send(formData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
destroyTinymce() {
|
||||||
|
const tinymce = window.tinymce.get(this.tinymceId);
|
||||||
|
if (this.fullscreen) {
|
||||||
|
tinymce.execCommand("mceFullScreen");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tinymce) {
|
||||||
|
tinymce.destroy();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setContent(value) {
|
||||||
|
window.tinymce.get(this.tinymceId).setContent(value);
|
||||||
|
},
|
||||||
|
getContent() {
|
||||||
|
window.tinymce.get(this.tinymceId).getContent();
|
||||||
|
},
|
||||||
|
imageSuccessCBK(arr) {
|
||||||
|
const _this = this;
|
||||||
|
arr.forEach(v => {
|
||||||
|
window.tinymce
|
||||||
|
.get(_this.tinymceId)
|
||||||
|
.insertContent(`<img class="wscnph" src="${v.url}" >`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.tinymce-container {
|
||||||
|
position: relative;
|
||||||
|
line-height: normal;
|
||||||
|
}
|
||||||
|
.tinymce-container >>> .mce-fullscreen {
|
||||||
|
z-index: 10000;
|
||||||
|
}
|
||||||
|
.tinymce-textarea {
|
||||||
|
visibility: hidden;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
.editor-custom-btn-container {
|
||||||
|
position: absolute;
|
||||||
|
right: 4px;
|
||||||
|
top: 4px;
|
||||||
|
/*z-index: 2005;*/
|
||||||
|
}
|
||||||
|
.fullscreen .editor-custom-btn-container {
|
||||||
|
z-index: 10000;
|
||||||
|
position: fixed;
|
||||||
|
}
|
||||||
|
.editor-upload-btn {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -134,10 +134,11 @@
|
||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogVisible"
|
||||||
width="30%">
|
width="30%">
|
||||||
<div>{{question.type}}</div>
|
<div>{{question.type}}</div>
|
||||||
<div>{{question.name}}</div>
|
<div v-html="question.name"></div>
|
||||||
<ul id="repeat">
|
<ul id="repeat">
|
||||||
<li v-for="(value,key,index) in question.options">
|
<li v-for="(value,key,index) in question.options">
|
||||||
{{ key }}:{{value}}
|
{{ key }}:
|
||||||
|
<span v-html="value"></span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div>正确答案{{question.right}}</div>
|
<div>正确答案{{question.right}}</div>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
></el-cascader>
|
></el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="题干" prop="name">
|
<el-form-item label="题干" prop="name">
|
||||||
<el-input v-model="Form.name" style="width:600px" type="textarea" :rows=3></el-input>
|
<tinymce2 v-model="Form.name" height="100" width="800px" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="题干图片" prop="img" >
|
<el-form-item label="题干图片" prop="img" >
|
||||||
<el-upload
|
<el-upload
|
||||||
|
@ -49,22 +49,22 @@
|
||||||
<el-button type="text" @click="delImg()" v-if="Form.img">删除</el-button>
|
<el-button type="text" @click="delImg()" v-if="Form.img">删除</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选项A" prop="optionA" >
|
<el-form-item label="选项A" prop="optionA" >
|
||||||
<el-input v-model="Form.options.A" style="width:600px" :disabled="inputDisable"></el-input>
|
<tinymce2 v-model="Form.options.A" height="30" width="800px" :disabled="inputDisable" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选项B" prop="optionB" >
|
<el-form-item label="选项B" prop="optionB" >
|
||||||
<el-input v-model="Form.options.B" style="width:600px" :disabled="inputDisable"></el-input>
|
<tinymce2 v-model="Form.options.B" height="30" width="800px" :disabled="inputDisable" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选项C" v-show="Form.type!='判断'">
|
<el-form-item label="选项C" v-show="Form.type!='判断'">
|
||||||
<el-input v-model="Form.options.C" style="width:600px"></el-input>
|
<tinymce2 v-model="Form.options.C" height="30" width="800px" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选项D" v-show="Form.type!='判断'">
|
<el-form-item label="选项D" v-show="Form.type!='判断'">
|
||||||
<el-input v-model="Form.options.D" style="width:600px"></el-input>
|
<tinymce2 v-model="Form.options.D" height="30" width="800px" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选项E" v-show="Form.type!='判断'">
|
<el-form-item label="选项E" v-show="Form.type!='判断'">
|
||||||
<el-input v-model="Form.options.E" style="width:600px"></el-input>
|
<tinymce2 v-model="Form.options.E" height="30" width="800px" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选项F" v-show="Form.type!='判断'">
|
<el-form-item label="选项F" v-show="Form.type!='判断'">
|
||||||
<el-input v-model="Form.options.F" style="width:600px"></el-input>
|
<tinymce2 v-model="Form.options.F" height="30" width="800px" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="正确答案" v-if="Form.type =='多选'">
|
<el-form-item label="正确答案" v-if="Form.type =='多选'">
|
||||||
<el-checkbox-group v-model="Form.right">
|
<el-checkbox-group v-model="Form.right">
|
||||||
|
@ -104,11 +104,13 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import Tinymce2 from '@/components/Tinymce/index2'
|
||||||
import { createQuestion,getQuestioncatAll } from "@/api/question";
|
import { createQuestion,getQuestioncatAll } from "@/api/question";
|
||||||
import { genTree, deepClone } from "@/utils";
|
import { genTree, deepClone } from "@/utils";
|
||||||
import { upUrl } from "@/api/file";
|
import { upUrl } from "@/api/file";
|
||||||
import { getToken } from "@/utils/auth";
|
import { getToken } from "@/utils/auth";
|
||||||
export default {
|
export default {
|
||||||
|
components:{ Tinymce2 },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
upHeaders: { Authorization: "JWT " + getToken() },
|
upHeaders: { Authorization: "JWT " + getToken() },
|
||||||
|
@ -164,6 +166,10 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.submitLoding = true
|
this.submitLoding = true
|
||||||
this.Form.questioncat = this.Form.questioncat.pop()
|
this.Form.questioncat = this.Form.questioncat.pop()
|
||||||
|
// this.Form.name = this.Form.name.replace('<p>','').replace('</p>','')
|
||||||
|
// for(let key in this.Form.options){
|
||||||
|
// this.Form.options[key] = this.Form.options[key].replace('<p>','').replace('</p>','')
|
||||||
|
// }
|
||||||
for(let key in this.Form.options){
|
for(let key in this.Form.options){
|
||||||
if(!this.Form.options[key]){
|
if(!this.Form.options[key]){
|
||||||
delete this.Form.options[key]
|
delete this.Form.options[key]
|
||||||
|
|
|
@ -1,37 +1,28 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form
|
<el-form :model="Form" :rules="rules" ref="Form" label-width="100px" status-icon>
|
||||||
:model="Form"
|
|
||||||
:rules="rules"
|
|
||||||
ref="Form"
|
|
||||||
label-width="100px"
|
|
||||||
status-icon
|
|
||||||
>
|
|
||||||
<el-form-item label="题型" prop="type">
|
<el-form-item label="题型" prop="type">
|
||||||
<el-select
|
<el-select v-model="Form.type" style="width: 400px" :disabled="true">
|
||||||
v-model="Form.type"
|
<el-option
|
||||||
style="width: 400px"
|
v-for="item in typeOptions"
|
||||||
:disabled="true"
|
:key="item.key"
|
||||||
>
|
:label="item.label"
|
||||||
<el-option
|
:value="item.value"
|
||||||
v-for="item in typeOptions"
|
/>
|
||||||
:key="item.key"
|
</el-select>
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分类" prop="type">
|
<el-form-item label="分类" prop="type">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
v-model="Form.questioncat"
|
v-model="Form.questioncat"
|
||||||
:options="catOptions"
|
:options="catOptions"
|
||||||
:show-all-levels="false"
|
:show-all-levels="false"
|
||||||
clearable
|
clearable
|
||||||
style="width: 400px"
|
style="width: 400px"
|
||||||
></el-cascader>
|
></el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="题干" prop="name">
|
<el-form-item label="题干" prop="name">
|
||||||
<el-input v-model="Form.name" style="width:600px" type="textarea" :rows=3></el-input>
|
<tinymce2 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>
|
||||||
<el-form-item label="题干图片" prop="img" >
|
<el-form-item label="题干图片" prop="img" >
|
||||||
<el-upload
|
<el-upload
|
||||||
|
@ -47,24 +38,28 @@
|
||||||
<el-button size="small" type="primary" v-else>点击上传</el-button>
|
<el-button size="small" type="primary" v-else>点击上传</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<el-button type="text" @click="delImg()" v-if="Form.img">删除</el-button>
|
<el-button type="text" @click="delImg()" v-if="Form.img">删除</el-button>
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="选项A" prop="optionA" >
|
|
||||||
<el-input v-model="Form.options.A" style="width:600px" :disabled="inputDisable"></el-input>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选项B" prop="optionB" >
|
<el-form-item label="选项A" prop="optionA">
|
||||||
<el-input v-model="Form.options.B" style="width:600px" :disabled="inputDisable"></el-input>
|
<tinymce2 v-model="Form.options.A" height="30" width="800px" :disabled="inputDisable" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选项C" v-show="Form.type!='判断'">
|
<el-form-item label="选项B" prop="optionB">
|
||||||
<el-input v-model="Form.options.C" style="width:600px"></el-input>
|
<tinymce2 v-model="Form.options.B" height="30" width="800px" :disabled="inputDisable" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选项D" v-show="Form.type!='判断'">
|
<el-form-item label="选项C" v-show="Form.type!='判断'">
|
||||||
<el-input v-model="Form.options.D" style="width:600px"></el-input>
|
<tinymce2 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" style="width:600px"></el-input> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="选项E" v-show="Form.type!='判断'">
|
<el-form-item label="选项E" v-show="Form.type!='判断'">
|
||||||
<el-input v-model="Form.options.E" style="width:600px"></el-input>
|
<tinymce2 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>
|
||||||
<el-form-item label="选项F" v-show="Form.type!='判断'">
|
<el-form-item label="选项F" v-show="Form.type!='判断'">
|
||||||
<el-input v-model="Form.options.F" style="width:600px"></el-input>
|
<tinymce2 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>
|
||||||
<el-form-item label="正确答案" v-if="Form.type =='多选'">
|
<el-form-item label="正确答案" v-if="Form.type =='多选'">
|
||||||
<el-checkbox-group v-model="Form.right">
|
<el-checkbox-group v-model="Form.right">
|
||||||
|
@ -93,7 +88,7 @@
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="解析">
|
<el-form-item label="解析">
|
||||||
<el-input v-model="Form.resolution" style="width:600px" type="textarea" :rows=3></el-input>
|
<el-input v-model="Form.resolution" style="width:600px" type="textarea" :rows="3"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="submitForm('Form')" :loading="submitLoding">保存</el-button>
|
<el-button type="primary" @click="submitForm('Form')" :loading="submitLoding">保存</el-button>
|
||||||
|
@ -103,11 +98,13 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import Tinymce2 from '@/components/Tinymce/index2'
|
||||||
import { createQuestion,getQuestioncatAll, getQuestion, getQuestioncatList, updateQuestion } from "@/api/question";
|
import { createQuestion,getQuestioncatAll, getQuestion, getQuestioncatList, updateQuestion } from "@/api/question";
|
||||||
import { genTree, deepClone } from "@/utils";
|
import { genTree, deepClone } from "@/utils";
|
||||||
import { upUrl } from "@/api/file";
|
import { upUrl } from "@/api/file";
|
||||||
import { getToken } from "@/utils/auth";
|
import { getToken } from "@/utils/auth";
|
||||||
export default {
|
export default {
|
||||||
|
components:{ Tinymce2 },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
upHeaders: { Authorization: "JWT " + getToken() },
|
upHeaders: { Authorization: "JWT " + getToken() },
|
||||||
|
@ -167,6 +164,10 @@ export default {
|
||||||
if(this.Form.questioncat instanceof Array){
|
if(this.Form.questioncat instanceof Array){
|
||||||
this.Form.questioncat = this.Form.questioncat.pop()
|
this.Form.questioncat = this.Form.questioncat.pop()
|
||||||
}
|
}
|
||||||
|
// this.Form.name = this.Form.name.replace('<p>','<span>').replace('</p>','</span>')
|
||||||
|
// for(let key in this.Form.options){
|
||||||
|
// this.Form.options[key] = this.Form.options[key].replace('<p>','<span>').replace('</p>','</span>')
|
||||||
|
// }
|
||||||
for(let key in this.Form.options){
|
for(let key in this.Form.options){
|
||||||
if(!this.Form.options[key]){
|
if(!this.Form.options[key]){
|
||||||
delete this.Form.options[key]
|
delete this.Form.options[key]
|
||||||
|
@ -206,5 +207,5 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
|
@ -11,7 +11,8 @@ Page({
|
||||||
tm_index: 0,
|
tm_index: 0,
|
||||||
is_right: false,
|
is_right: false,
|
||||||
answerP: false,
|
answerP: false,
|
||||||
tmtotal: 0
|
tmtotal: 0,
|
||||||
|
domain:getApp().globalData.mediahost,
|
||||||
},
|
},
|
||||||
radioChange: function (e) {
|
radioChange: function (e) {
|
||||||
var that = this
|
var that = this
|
||||||
|
@ -176,7 +177,7 @@ Page({
|
||||||
for (let key in tm_current.options) {
|
for (let key in tm_current.options) {
|
||||||
let option = {}
|
let option = {}
|
||||||
option.key = key
|
option.key = key
|
||||||
option.value = key + ':' + tm_current.options[key]
|
option.value = tm_current.options[key].toString()
|
||||||
if (tm_current.user_answer) {
|
if (tm_current.user_answer) {
|
||||||
if (key == tm_current.user_answer || tm_current.user_answer.indexOf(key) != -1) {
|
if (key == tm_current.user_answer || tm_current.user_answer.indexOf(key) != -1) {
|
||||||
option.checked = true
|
option.checked = true
|
||||||
|
@ -186,6 +187,7 @@ Page({
|
||||||
}
|
}
|
||||||
options.push(option)
|
options.push(option)
|
||||||
}
|
}
|
||||||
|
console.log(options)
|
||||||
this.setData({
|
this.setData({
|
||||||
options: options
|
options: options
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
{
|
{
|
||||||
"usingComponents": {},
|
"usingComponents": {
|
||||||
|
"parser": "/components/parser/parser"
|
||||||
|
},
|
||||||
"navigationBarTitleText": "收藏集"
|
"navigationBarTitleText": "收藏集"
|
||||||
}
|
}
|
|
@ -7,14 +7,17 @@
|
||||||
<span class="txlabel">{{tm_current.type}}</span>
|
<span class="txlabel">{{tm_current.type}}</span>
|
||||||
<span style="color:gray"> {{tm_current.questioncat_name}}</span>
|
<span style="color:gray"> {{tm_current.questioncat_name}}</span>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-article__title">{{tm_current.name}}</view>
|
<view class="weui-article__title">
|
||||||
|
<parser html="{{tm_current.name}}" domain="{{domain}}" selectable/>
|
||||||
|
</view>
|
||||||
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
|
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cells weui-cells_radio">
|
<view class="weui-cells weui-cells_radio">
|
||||||
<radio-group class="radio-group" bindchange="radioChange" wx:if="{{(tm_current.type=='单选' ||tm_current.type=='判断')}}">
|
<radio-group class="radio-group" bindchange="radioChange" wx:if="{{(tm_current.type=='单选' ||tm_current.type=='判断')}}">
|
||||||
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
|
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
|
||||||
<view class="weui-cell__bd">
|
<view class="weui-cell__bd">
|
||||||
<view>{{item.value}}</view>
|
<view style="float:left;width:10%">{{item.key}}:</view>
|
||||||
|
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell__ft">
|
<view class="weui-cell__ft">
|
||||||
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
|
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
|
||||||
|
@ -28,7 +31,8 @@
|
||||||
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
|
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
|
||||||
|
|
||||||
<view class="weui-cell__bd">
|
<view class="weui-cell__bd">
|
||||||
<view>{{item.value}}</view>
|
<view style="float:left;width:10%">{{item.key}}:</view>
|
||||||
|
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell__hd">
|
<view class="weui-cell__hd">
|
||||||
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>
|
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>
|
||||||
|
|
|
@ -15,6 +15,7 @@ Page({
|
||||||
tm_index: 0,
|
tm_index: 0,
|
||||||
answerP: false,
|
answerP: false,
|
||||||
page:1,
|
page:1,
|
||||||
|
domain:getApp().globalData.mediahost,
|
||||||
},
|
},
|
||||||
radioChange: function(e) {
|
radioChange: function(e) {
|
||||||
var that = this
|
var that = this
|
||||||
|
@ -228,7 +229,7 @@ Page({
|
||||||
for (let key in tm_current.options) {
|
for (let key in tm_current.options) {
|
||||||
let option = {}
|
let option = {}
|
||||||
option.key = key
|
option.key = key
|
||||||
option.value = key + ':' + tm_current.options[key]
|
option.value = tm_current.options[key].toString()
|
||||||
if (tm_current.user_answer) {
|
if (tm_current.user_answer) {
|
||||||
if (key == tm_current.user_answer || tm_current.user_answer.indexOf(key) != -1) {
|
if (key == tm_current.user_answer || tm_current.user_answer.indexOf(key) != -1) {
|
||||||
option.checked = true
|
option.checked = true
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
{
|
{
|
||||||
"usingComponents": {},
|
"usingComponents": {
|
||||||
|
"parser": "/components/parser/parser"
|
||||||
|
},
|
||||||
"navigationBarTitleText": "练习"
|
"navigationBarTitleText": "练习"
|
||||||
}
|
}
|
|
@ -6,14 +6,17 @@
|
||||||
<view class="weui-article__h2">{{tm_index+1}}.
|
<view class="weui-article__h2">{{tm_index+1}}.
|
||||||
<span class="txlabel">{{tm_current.type}}</span>
|
<span class="txlabel">{{tm_current.type}}</span>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-article__title">{{tm_current.name}}</view>
|
<view class="weui-article__title">
|
||||||
|
<parser html="{{tm_current.name}}" domain="{{domain}}" selectable/>
|
||||||
|
</view>
|
||||||
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
|
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cells weui-cells_radio">
|
<view class="weui-cells weui-cells_radio">
|
||||||
<radio-group class="radio-group" bindchange="radioChange" wx:if="{{(tm_current.type=='单选' ||tm_current.type=='判断')}}">
|
<radio-group class="radio-group" bindchange="radioChange" wx:if="{{(tm_current.type=='单选' ||tm_current.type=='判断')}}">
|
||||||
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
|
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
|
||||||
<view class="weui-cell__bd">
|
<view class="weui-cell__bd">
|
||||||
<view>{{item.value}}</view>
|
<view style="float:left;width:10%">{{item.key}}:</view>
|
||||||
|
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell__ft">
|
<view class="weui-cell__ft">
|
||||||
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
|
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
|
||||||
|
@ -26,8 +29,9 @@
|
||||||
<checkbox-group bindchange="checkboxChange" wx:if="{{tm_current.type=='多选'}}">
|
<checkbox-group bindchange="checkboxChange" wx:if="{{tm_current.type=='多选'}}">
|
||||||
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
|
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
|
||||||
|
|
||||||
<view class="weui-cell__bd">
|
<view class="weui-cell__bd" >
|
||||||
<view>{{item.value}}</view>
|
<view style="float:left;width:10%">{{item.key}}:</view>
|
||||||
|
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell__hd">
|
<view class="weui-cell__hd">
|
||||||
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>
|
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>
|
||||||
|
|
|
@ -251,7 +251,7 @@ Page({
|
||||||
api.request('/question/question/', 'GET', {search:value}).then(res => {
|
api.request('/question/question/', 'GET', {search:value}).then(res => {
|
||||||
if(res.data && res.data.results){
|
if(res.data && res.data.results){
|
||||||
for(var i=0; i<res.data.results.length;i++){
|
for(var i=0; i<res.data.results.length;i++){
|
||||||
res.data.results[i].text = res.data.results[i].name
|
res.data.results[i].text = res.data.results[i].name.replace('<p>','').replace('</p>','').substring(0,18)+'...'
|
||||||
res.data.results[i].value = res.data.results[i].id
|
res.data.results[i].value = res.data.results[i].id
|
||||||
}
|
}
|
||||||
resolve(res.data.results)
|
resolve(res.data.results)
|
||||||
|
|
|
@ -106,6 +106,9 @@ Page({
|
||||||
this.setData({
|
this.setData({
|
||||||
results:this.data.results
|
results:this.data.results
|
||||||
})
|
})
|
||||||
|
api.request('/cms/material/'+e.currentTarget.dataset.id+'/down/', 'GET').then(res=>{
|
||||||
|
|
||||||
|
}).catch(e=>{})
|
||||||
},
|
},
|
||||||
pause:function(e){
|
pause:function(e){
|
||||||
let index = e.currentTarget.dataset.index
|
let index = e.currentTarget.dataset.index
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
bindpause="pause"
|
bindpause="pause"
|
||||||
bindended="pause"
|
bindended="pause"
|
||||||
data-index = "{{index}}"
|
data-index = "{{index}}"
|
||||||
|
data-id="{{item.id}}"
|
||||||
>
|
>
|
||||||
<view class='txv-video-slot' wx:if="{{item.showTitle}}">
|
<view class='txv-video-slot' wx:if="{{item.showTitle}}">
|
||||||
<span style="margin-left:6px">{{item.name}}</span>
|
<span style="margin-left:6px">{{item.name}}</span>
|
||||||
|
|
|
@ -10,6 +10,7 @@ Page({
|
||||||
tms:[],
|
tms:[],
|
||||||
tm_index: 0,
|
tm_index: 0,
|
||||||
ctms:[],
|
ctms:[],
|
||||||
|
domain:getApp().globalData.mediahost,
|
||||||
},
|
},
|
||||||
radioChange: function (e) {
|
radioChange: function (e) {
|
||||||
var that = this
|
var that = this
|
||||||
|
@ -181,7 +182,7 @@ Page({
|
||||||
for (let key in tm_current.options) {
|
for (let key in tm_current.options) {
|
||||||
let option = {}
|
let option = {}
|
||||||
option.key = key
|
option.key = key
|
||||||
option.value = key + ':' + tm_current.options[key]
|
option.value = tm_current.options[key].toString()
|
||||||
if (tm_current.user_answer) {
|
if (tm_current.user_answer) {
|
||||||
if (key == tm_current.user_answer || tm_current.user_answer.indexOf(key) != -1) {
|
if (key == tm_current.user_answer || tm_current.user_answer.indexOf(key) != -1) {
|
||||||
option.checked = true
|
option.checked = true
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
{
|
{
|
||||||
"usingComponents": {},
|
"usingComponents": {
|
||||||
|
"parser": "/components/parser/parser"
|
||||||
|
},
|
||||||
"navigationBarTitleText": "答题中"
|
"navigationBarTitleText": "答题中"
|
||||||
}
|
}
|
|
@ -16,14 +16,17 @@
|
||||||
<span>({{tm_current.total_score}}分)</span>
|
<span>({{tm_current.total_score}}分)</span>
|
||||||
<span style="color:gray">({{tm_current.questioncat_name}})</span>
|
<span style="color:gray">({{tm_current.questioncat_name}})</span>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-article__title">{{tm_current.name}}</view>
|
<view class="weui-article__title">
|
||||||
|
<parser html="{{tm_current.name}}" domain="{{domain}}" selectable/>
|
||||||
|
</view>
|
||||||
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
|
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cells weui-cells_radio">
|
<view class="weui-cells weui-cells_radio">
|
||||||
<radio-group class="radio-group" bindchange="radioChange" wx:if="{{(tm_current.type=='单选' ||tm_current.type=='判断')}}">
|
<radio-group class="radio-group" bindchange="radioChange" wx:if="{{(tm_current.type=='单选' ||tm_current.type=='判断')}}">
|
||||||
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
|
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
|
||||||
<view class="weui-cell__bd">
|
<view class="weui-cell__bd">
|
||||||
<view>{{item.value}}</view>
|
<view style="float:left;width:10%">{{item.key}}:</view>
|
||||||
|
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell__ft">
|
<view class="weui-cell__ft">
|
||||||
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
|
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
|
||||||
|
@ -37,7 +40,8 @@
|
||||||
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
|
<label class="weui-cell weui-cell_active weui-check__label" wx:for="{{options}}" wx:key="key">
|
||||||
|
|
||||||
<view class="weui-cell__bd">
|
<view class="weui-cell__bd">
|
||||||
<view>{{item.value}}</view>
|
<view style="float:left;width:10%">{{item.key}}:</view>
|
||||||
|
<view style="float:left;width:90%"><parser html="{{item.value}}" domain="{{domain}}" selectable /></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell__hd">
|
<view class="weui-cell__hd">
|
||||||
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>
|
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>
|
||||||
|
|
|
@ -1,65 +1,65 @@
|
||||||
{
|
{
|
||||||
"description": "项目配置文件",
|
"description": "项目配置文件",
|
||||||
"packOptions": {
|
"packOptions": {
|
||||||
"ignore": []
|
"ignore": []
|
||||||
},
|
},
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": false,
|
"urlCheck": false,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
"enhance": true,
|
"enhance": true,
|
||||||
"postcss": true,
|
"postcss": true,
|
||||||
"preloadBackgroundData": false,
|
"preloadBackgroundData": false,
|
||||||
"minified": true,
|
"minified": true,
|
||||||
"newFeature": true,
|
"newFeature": true,
|
||||||
"coverView": true,
|
"coverView": true,
|
||||||
"nodeModules": true,
|
"nodeModules": true,
|
||||||
"autoAudits": false,
|
"autoAudits": false,
|
||||||
"showShadowRootInWxmlPanel": true,
|
"showShadowRootInWxmlPanel": true,
|
||||||
"scopeDataCheck": false,
|
"scopeDataCheck": false,
|
||||||
"uglifyFileName": false,
|
"uglifyFileName": false,
|
||||||
"checkInvalidKey": true,
|
"checkInvalidKey": true,
|
||||||
"checkSiteMap": true,
|
"checkSiteMap": true,
|
||||||
"uploadWithSourceMap": true,
|
"uploadWithSourceMap": true,
|
||||||
"compileHotReLoad": false,
|
"babelSetting": {
|
||||||
"useMultiFrameRuntime": true,
|
"ignore": [],
|
||||||
"useApiHook": false,
|
"disablePlugins": [],
|
||||||
"babelSetting": {
|
"outputPath": ""
|
||||||
"ignore": [],
|
},
|
||||||
"disablePlugins": [],
|
"useCompilerModule": true,
|
||||||
"outputPath": ""
|
"userConfirmedUseCompilerModuleSwitch": false,
|
||||||
},
|
"compileHotReLoad": false,
|
||||||
"useIsolateContext": true,
|
"useMultiFrameRuntime": true,
|
||||||
"useCompilerModule": true,
|
"useApiHook": false,
|
||||||
"userConfirmedUseCompilerModuleSwitch": false,
|
"useIsolateContext": true,
|
||||||
"packNpmManually": false,
|
"packNpmManually": false,
|
||||||
"packNpmRelationList": []
|
"packNpmRelationList": []
|
||||||
},
|
},
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "2.10.3",
|
"libVersion": "2.10.3",
|
||||||
"appid": "wxf1e9471c93f05ad6",
|
"appid": "wxf1e9471c93f05ad6",
|
||||||
"projectname": "test_mini",
|
"projectname": "test_mini",
|
||||||
"debugOptions": {
|
"debugOptions": {
|
||||||
"hidedInDevtools": []
|
"hidedInDevtools": []
|
||||||
},
|
},
|
||||||
"isGameTourist": false,
|
"isGameTourist": false,
|
||||||
"simulatorType": "wechat",
|
"simulatorType": "wechat",
|
||||||
"simulatorPluginLibVersion": {},
|
"simulatorPluginLibVersion": {},
|
||||||
"condition": {
|
"condition": {
|
||||||
"search": {
|
"search": {
|
||||||
"current": -1,
|
"current": -1,
|
||||||
"list": []
|
"list": []
|
||||||
},
|
},
|
||||||
"conversation": {
|
"conversation": {
|
||||||
"current": -1,
|
"current": -1,
|
||||||
"list": []
|
"list": []
|
||||||
},
|
},
|
||||||
"game": {
|
"game": {
|
||||||
"currentL": -1,
|
"currentL": -1,
|
||||||
"list": []
|
"list": []
|
||||||
},
|
},
|
||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"current": -1,
|
"current": -1,
|
||||||
"list": []
|
"list": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,4 +26,5 @@ class ConsultViewSet(ModelViewSet):
|
||||||
serializer_class = ConsultSerializer
|
serializer_class = ConsultSerializer
|
||||||
pagination_class = CommonPagination
|
pagination_class = CommonPagination
|
||||||
filter_backends = [DjangoFilterBackend,SearchFilter, OrderingFilter]
|
filter_backends = [DjangoFilterBackend,SearchFilter, OrderingFilter]
|
||||||
search_fields = ['name','tests', 'phone']
|
search_fields = ['name','tests', 'phone']
|
||||||
|
ordering=['-pk']
|
|
@ -238,7 +238,7 @@ class ExerciseView(APIView):
|
||||||
perms_map=[{'post':'exercise'}]
|
perms_map=[{'post':'exercise'}]
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
questioncat = request.data['questioncat']
|
questioncat = request.data['questioncat']
|
||||||
queryset = Question.objects.filter(is_delete=0,questioncat=questioncat).order_by('type','name')
|
queryset = Question.objects.filter(is_delete=0,questioncat=questioncat).order_by('type','pk', 'name')
|
||||||
if 'ydtms' in request.data and request.data['ydtms']:
|
if 'ydtms' in request.data and request.data['ydtms']:
|
||||||
queryset = queryset.exclude(id__in = request.data['ydtms'])
|
queryset = queryset.exclude(id__in = request.data['ydtms'])
|
||||||
if 'ydtms_' in request.data and request.data['ydtms_']:
|
if 'ydtms_' in request.data and request.data['ydtms_']:
|
||||||
|
|
Loading…
Reference in New Issue