This commit is contained in:
caoqianming 2020-09-14 15:42:29 +08:00
parent 4c1edc9f9c
commit 3c49d1b729
19 changed files with 410 additions and 131 deletions

View File

@ -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 &nbsp; 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>

View File

@ -134,10 +134,11 @@
:visible.sync="dialogVisible"
width="30%">
<div>{{question.type}}</div>
<div>{{question.name}}</div>
<div v-html="question.name"></div>
<ul id="repeat">
<li v-for="(value,key,index) in question.options">
{{ key }}:{{value}}
{{ key }}:
<span v-html="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">
<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 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" >
<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 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 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 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 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 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 label="正确答案" v-if="Form.type =='多选'">
<el-checkbox-group v-model="Form.right">
@ -104,11 +104,13 @@
</div>
</template>
<script>
import Tinymce2 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 },
data() {
return {
upHeaders: { Authorization: "JWT " + getToken() },
@ -164,6 +166,10 @@ export default {
if (valid) {
this.submitLoding = true
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){
if(!this.Form.options[key]){
delete this.Form.options[key]

View File

@ -1,37 +1,28 @@
<template>
<div class="app-container">
<el-form
:model="Form"
:rules="rules"
ref="Form"
label-width="100px"
status-icon
>
<el-form :model="Form" :rules="rules" ref="Form" label-width="100px" status-icon>
<el-form-item label="题型" prop="type">
<el-select
v-model="Form.type"
style="width: 400px"
:disabled="true"
>
<el-option
v-for="item in typeOptions"
:key="item.key"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-select v-model="Form.type" style="width: 400px" :disabled="true">
<el-option
v-for="item in typeOptions"
:key="item.key"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="分类" prop="type">
<el-cascader
v-model="Form.questioncat"
:options="catOptions"
:show-all-levels="false"
clearable
style="width: 400px"
></el-cascader>
v-model="Form.questioncat"
:options="catOptions"
:show-all-levels="false"
clearable
style="width: 400px"
></el-cascader>
</el-form-item>
<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 label="题干图片" prop="img" >
<el-upload
@ -47,24 +38,28 @@
<el-button size="small" type="primary" v-else>点击上传</el-button>
</el-upload>
<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 label="选项B" prop="optionB" >
<el-input v-model="Form.options.B" style="width:600px" :disabled="inputDisable"></el-input>
<el-form-item label="选项A" prop="optionA">
<tinymce2 v-model="Form.options.A" height="30" width="800px" :disabled="inputDisable" />
</el-form-item>
<el-form-item label="选项C" v-show="Form.type!='判断'">
<el-input v-model="Form.options.C" style="width:600px"></el-input>
<el-form-item label="选项B" prop="optionB">
<tinymce2 v-model="Form.options.B" height="30" width="800px" :disabled="inputDisable" />
</el-form-item>
<el-form-item label="选项D" v-show="Form.type!='判断'">
<el-input v-model="Form.options.D" style="width:600px"></el-input>
<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" 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 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 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 label="正确答案" v-if="Form.type =='多选'">
<el-checkbox-group v-model="Form.right">
@ -93,7 +88,7 @@
</el-radio-group>
</el-form-item>
<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-button type="primary" @click="submitForm('Form')" :loading="submitLoding">保存</el-button>
@ -103,11 +98,13 @@
</div>
</template>
<script>
import Tinymce2 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 },
data() {
return {
upHeaders: { Authorization: "JWT " + getToken() },
@ -167,6 +164,10 @@ export default {
if(this.Form.questioncat instanceof Array){
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){
if(!this.Form.options[key]){
delete this.Form.options[key]
@ -206,5 +207,5 @@ export default {
});
},
}
};
}
</script>

View File

@ -11,7 +11,8 @@ Page({
tm_index: 0,
is_right: false,
answerP: false,
tmtotal: 0
tmtotal: 0,
domain:getApp().globalData.mediahost,
},
radioChange: function (e) {
var that = this
@ -176,7 +177,7 @@ Page({
for (let key in tm_current.options) {
let option = {}
option.key = key
option.value = key + ':' + tm_current.options[key]
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
@ -186,6 +187,7 @@ Page({
}
options.push(option)
}
console.log(options)
this.setData({
options: options
})

View File

@ -1,4 +1,6 @@
{
"usingComponents": {},
"usingComponents": {
"parser": "/components/parser/parser"
},
"navigationBarTitleText": "收藏集"
}

View File

@ -7,14 +7,17 @@
<span class="txlabel">{{tm_current.type}}</span>
<span style="color:gray"> {{tm_current.questioncat_name}}</span>
</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>
<view class="weui-cells weui-cells_radio">
<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">
<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 class="weui-cell__ft">
<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">
<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 class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>

View File

@ -15,6 +15,7 @@ Page({
tm_index: 0,
answerP: false,
page:1,
domain:getApp().globalData.mediahost,
},
radioChange: function(e) {
var that = this
@ -228,7 +229,7 @@ Page({
for (let key in tm_current.options) {
let option = {}
option.key = key
option.value = key + ':' + tm_current.options[key]
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

@ -1,4 +1,6 @@
{
"usingComponents": {},
"usingComponents": {
"parser": "/components/parser/parser"
},
"navigationBarTitleText": "练习"
}

View File

@ -6,14 +6,17 @@
<view class="weui-article__h2">{{tm_index+1}}.
<span class="txlabel">{{tm_current.type}}</span>
</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>
<view class="weui-cells weui-cells_radio">
<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">
<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 class="weui-cell__ft">
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
@ -26,8 +29,9 @@
<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">
<view class="weui-cell__bd">
<view>{{item.value}}</view>
<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>
<view class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>

View File

@ -251,7 +251,7 @@ Page({
api.request('/question/question/', 'GET', {search:value}).then(res => {
if(res.data && res.data.results){
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
}
resolve(res.data.results)

View File

@ -106,6 +106,9 @@ Page({
this.setData({
results:this.data.results
})
api.request('/cms/material/'+e.currentTarget.dataset.id+'/down/', 'GET').then(res=>{
}).catch(e=>{})
},
pause:function(e){
let index = e.currentTarget.dataset.index

View File

@ -8,6 +8,7 @@
bindpause="pause"
bindended="pause"
data-index = "{{index}}"
data-id="{{item.id}}"
>
<view class='txv-video-slot' wx:if="{{item.showTitle}}">
<span style="margin-left:6px">{{item.name}}</span>

View File

@ -10,6 +10,7 @@ Page({
tms:[],
tm_index: 0,
ctms:[],
domain:getApp().globalData.mediahost,
},
radioChange: function (e) {
var that = this
@ -181,7 +182,7 @@ Page({
for (let key in tm_current.options) {
let option = {}
option.key = key
option.value = key + ':' + tm_current.options[key]
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

@ -1,4 +1,6 @@
{
"usingComponents": {},
"usingComponents": {
"parser": "/components/parser/parser"
},
"navigationBarTitleText": "答题中"
}

View File

@ -16,14 +16,17 @@
<span>({{tm_current.total_score}}分)</span>
<span style="color:gray">({{tm_current.questioncat_name}})</span>
</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>
<view class="weui-cells weui-cells_radio">
<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">
<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 class="weui-cell__ft">
<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">
<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 class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>

View File

@ -1,65 +1,65 @@
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": true,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": []
},
"compileType": "miniprogram",
"libVersion": "2.10.3",
"appid": "wxf1e9471c93f05ad6",
"projectname": "test_mini",
"debugOptions": {
"hidedInDevtools": []
},
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": true,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": false,
"useIsolateContext": true,
"packNpmManually": false,
"packNpmRelationList": []
},
"compileType": "miniprogram",
"libVersion": "2.10.3",
"appid": "wxf1e9471c93f05ad6",
"projectname": "test_mini",
"debugOptions": {
"hidedInDevtools": []
},
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
}

View File

@ -26,4 +26,5 @@ class ConsultViewSet(ModelViewSet):
serializer_class = ConsultSerializer
pagination_class = CommonPagination
filter_backends = [DjangoFilterBackend,SearchFilter, OrderingFilter]
search_fields = ['name','tests', 'phone']
search_fields = ['name','tests', 'phone']
ordering=['-pk']

View File

@ -238,7 +238,7 @@ class ExerciseView(APIView):
perms_map=[{'post':'exercise'}]
def post(self, request):
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']:
queryset = queryset.exclude(id__in = request.data['ydtms'])
if 'ydtms_' in request.data and request.data['ydtms_']: