富文本错误

This commit is contained in:
caoqianming 2021-03-13 23:00:22 +08:00
parent e868df3a4b
commit b920e6f701
27 changed files with 72 additions and 45 deletions

View File

@ -69,9 +69,9 @@ App({
globalData: {
userInfo: {},
userinfo: {}, // 服务器传回的消费者信息
//host: 'https://apitest.ahctc.cn',
host: 'https://apitest.ahctc.cn',
mediahost: 'https://apitest.ahctc.cn',
host: 'http://127.0.0.1:8000',
//host: 'http://127.0.0.1:8000',
//mediahost: 'http://127.0.0.1:8000',
token : '',
}

View File

@ -0,0 +1,8 @@
"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}/*!
* mp-html v2.0.5
* https://github.com/jin-yufeng/mp-html
*
* Released under the MIT license
* Author: Jin Yufeng
*/
var t=require("./parser"),n=[];Component({data:{nodes:[]},properties:{content:{type:String,value:"",observer:function(e){this.setContent(e)}},copyLink:{type:Boolean,value:!0},domain:String,errorImg:String,lazyLoad:Boolean,loadingImg:String,pauseVideo:{type:Boolean,value:!0},previewImg:{type:Boolean,value:!0},scrollTable:Boolean,selectable:null,setTitle:{type:Boolean,value:!0},showImgMenu:{type:Boolean,value:!0},tagStyle:Object,useAnchor:null},created:function(){this.plugins=[];for(var e=n.length;e--;)this.plugins.push(new n[e](this))},detached:function(){clearInterval(this._timer),this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){var o=this;return new Promise(function(i,r){if(!o.data.useAnchor)return r("Anchor is disabled");var a=wx.createSelectorQuery().in(o._in?o._in.page:o).select((o._in?o._in.selector:"._root")+(t?"".concat(">>>","#").concat(t):"")).boundingClientRect();o._in?a.select(o._in.selector).scrollOffset().select(o._in.selector).boundingClientRect():a.selectViewport().scrollOffset(),a.exec(function(t){if(!t[0])return r("Label not found");var a=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(o.data.useAnchor)||0);o._in?o._in.page.setData(e({},o._in.scrollTop,a)):wx.pageScrollTo({scrollTop:a,duration:300}),i()})})},getText:function(e){var t="";return function e(n){for(var o=0;o<n.length;o++){var i=n[o];if("text"==i.type)t+=i.text.replace(/&amp;/g,"&");else if("br"==i.name)t+="\n";else{var r="p"==i.name||"div"==i.name||"tr"==i.name||"li"==i.name||"h"==i.name[0]&&i.name[1]>"0"&&i.name[1]<"7";r&&t&&"\n"!=t[t.length-1]&&(t+="\n"),i.children&&e(i.children),r&&"\n"!=t[t.length-1]?t+="\n":"td"!=i.name&&"th"!=i.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){var e=this;return new Promise(function(t,n){wx.createSelectorQuery().in(e).select("._root").boundingClientRect().exec(function(e){return e[0]?t(e[0]):n("Root label not found")})})},setContent:function(e,n){var o=this;this.imgList&&n||(this.imgList=[]),this._videos=[];var i={},r=new t(this).parse(e);if(n)for(var a=this.data.nodes.length,l=r.length;l--;)i["nodes[".concat(a+l,"]")]=r[l];else i.nodes=r;this.setData(i,function(){o._hook("onLoad"),o.triggerEvent("load")});var s;clearInterval(this._timer),this._timer=setInterval(function(){o.getRect().then(function(e){e.height==s&&(o.triggerEvent("ready",e),clearInterval(o._timer)),s=e.height}).catch(function(){})},350)},_hook:function(e){for(var t=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.detail.root=this}}});

View File

@ -0,0 +1 @@
{"component":true,"usingComponents":{"node":"./node/node"}}

View File

@ -0,0 +1 @@
<view class="_root {{selectable?'_select':''}}"><slot wx:if="{{!nodes[0]}}"/><node id="_root" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg,showImgMenu]}}" catchadd="_add"/></view>

View File

@ -0,0 +1 @@
._root{padding:1px 0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}._select{-webkit-user-select:text;user-select:text}

View File

@ -0,0 +1 @@
"use strict";function t(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}Component({data:{ctrl:{}},properties:{childs:Array,opts:Array},attached:function(){this.triggerEvent("add",this,{bubbles:!0,composed:!0})},methods:{noop:function(){},getNode:function(t){for(var e=t.split("_"),i=this.data.childs[e[0]],r=1;r<e.length;r++)i=i.children[e[r]];return i},play:function(t){if(this.root.data.pauseVideo){for(var e=!1,i=t.target.id,r=this.root._videos.length;r--;)this.root._videos[r].id==i?e=!0:this.root._videos[r].pause();if(!e){var s=wx.createVideoContext(i,this);s.id=i,this.root._videos.push(s)}}},imgTap:function(t){var e=this.getNode(t.target.dataset.i);if(e.a)return this.linkTap(e.a);if(!e.attrs.ignore&&(this.root.triggerEvent("imgtap",e.attrs),this.root.data.previewImg)){var i=this.root.imgList[e.i];wx.previewImage({current:i,urls:this.root.imgList})}},imgLoad:function(e){var i,r=e.target.dataset.i,s=this.getNode(r);s.w?(this.data.opts[1]&&!this.data.ctrl[r]||-1==this.data.ctrl[r])&&(i=1):i=e.detail.width,i&&this.setData(t({},"ctrl."+r,i))},linkTap:function(t){var e=t.currentTarget?this.getNode(t.currentTarget.dataset.i):{},i=e.attrs||t,r=i.href;this.root.triggerEvent("linktap",Object.assign({innerText:this.root.getText(e.children||[])},i)),r&&("#"==r[0]?this.root.navigateTo(r.substring(1)).catch(function(){}):r.includes("://")?this.root.data.copyLink&&wx.setClipboardData({data:r,success:function(){return wx.showToast({title:"链接已复制"})}}):wx.navigateTo({url:r,fail:function(){wx.switchTab({url:r,fail:function(){}})}}))},mediaError:function(e){var i=e.target.dataset.i,r=this.getNode(i);if("video"==r.name||"audio"==r.name){var s=(this.data.ctrl[i]||0)+1;if(s>r.src.length&&(s=0),s<r.src.length)return this.setData(t({},"ctrl."+i,s))}else"img"==r.name&&this.data.opts[2]&&this.setData(t({},"ctrl."+i,-1));this.root&&this.root.triggerEvent("error",{source:r.name,attrs:r.attrs,errMsg:e.detail.errMsg})}}});

View File

@ -0,0 +1 @@
{"component":true,"usingComponents":{"node":"./node"}}

View File

@ -0,0 +1 @@
<wxs module="use">var e={abbr:!0,b:!0,big:!0,code:!0,del:!0,em:!0,i:!0,ins:!0,label:!0,q:!0,small:!0,span:!0,strong:!0,sub:!0,sup:!0};module.exports=function(n){return!(e[n.name]||n.children&&-1!=(n.attrs.style||"").indexOf("inline"))&&!n.c};</wxs><template name="el"><block wx:if="{{n.name=='img'}}"><image wx:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix"/><image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{ctrl[i]==-1?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{n.h?'':'widthFix'}}" lazy-load="{{opts[0]}}" webp="{{n.webp}}" show-menu-by-longpress="{{opts[3]&&!n.attrs.ignore}}" data-i="{{i}}" bindload="imgLoad" binderror="mediaError" catchtap="imgTap" bindlongpress="noop"/></block><text wx:elif="{{n.type=='text'}}" user-select="{{n.us}}" decode>{{n.text}}</text><text wx:elif="{{n.name=='br'}}">\n</text><view wx:elif="{{n.name=='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchtap="linkTap"><node childs="{{n.children}}" opts="{{opts}}" style="display:inherit"/></view><video wx:elif="{{n.name=='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><audio wx:elif="{{n.name=='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" bindplay="play" binderror="mediaError"/><rich-text wx:else id="{{n.attrs.id}}" style="{{n.f}}" nodes="{{[n]}}"/></template><block wx:for="{{childs}}" wx:for-item="n1" wx:for-index="i1" wx:key="i1"><template wx:if="{{use(n1)}}" is="el" data="{{n:n1,i:''+i1,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n1.attrs.id}}" class="_{{n1.name}} {{n1.attrs.class}}" style="{{n1.attrs.style}}"><block wx:for="{{n1.children}}" wx:for-item="n2" wx:for-index="i2" wx:key="i2"><template wx:if="{{use(n2)}}" is="el" data="{{n:n2,i:i1+'_'+i2,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n2.attrs.id}}" class="_{{n2.name}} {{n2.attrs.class}}" style="{{n2.attrs.style}}"><block wx:for="{{n2.children}}" wx:for-item="n3" wx:for-index="i3" wx:key="i3"><template wx:if="{{use(n3)}}" is="el" data="{{n:n3,i:i1+'_'+i2+'_'+i3,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n3.attrs.id}}" class="_{{n3.name}} {{n3.attrs.class}}" style="{{n3.attrs.style}}"><block wx:for="{{n3.children}}" wx:for-item="n4" wx:for-index="i4" wx:key="i4"><template wx:if="{{use(n4)}}" is="el" data="{{n:n4,i:i1+'_'+i2+'_'+i3+'_'+i4,opts:opts,ctrl:ctrl}}"/><view wx:else id="{{n4.attrs.id}}" class="_{{n4.name}} {{n4.attrs.class}}" style="{{n4.attrs.style}}"><block wx:for="{{n4.children}}" wx:for-item="n5" wx:for-index="i5" wx:key="i5"><template wx:if="{{use(n5)}}" is="el" data="{{n:n5,i:i1+'_'+i2+'_'+i3+'_'+i4+'_'+i5,opts:opts,ctrl:ctrl}}"/><node wx:else id="{{n5.attrs.id}}" class="_{{n5.name}} {{n5.attrs.class}}" style="{{n5.attrs.style}}" childs="{{n5.children}}" opts="{{opts}}"/></block></view></block></view></block></view></block></view></block>

View File

@ -0,0 +1 @@
._a{padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._img{max-width:100%;-webkit-touch-callout:none}._b,._strong{font-weight:700}._code{font-family:monospace}._del{text-decoration:line-through}._em,._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,._h2,._h3,._h4,._h5,._h6{display:block;font-weight:700}._ins{text-decoration:underline}._li{display:list-item}._ol{list-style-type:decimal}._ol,._ul{display:block;padding-left:40px;margin:1em 0}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}._tbody,._tfoot,._thead{display:table-row-group}._tr{display:table-row}._td,._th{display:table-cell;vertical-align:middle}._th{font-weight:700;text-align:center}._ul{list-style-type:disc}._ul ._ul{margin:0;list-style-type:circle}._ul ._ul ._ul{list-style-type:square}._abbr,._b,._code,._del,._em,._i,._ins,._label,._q,._span,._strong,._sub,._sup{display:inline}._blockquote,._div,._p{display:block}

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{
"usingComponents": {
"parser": "/components/parser/parser"
"mp-html": "/components/mp-html/index"
}
}

View File

@ -8,7 +8,7 @@
<span class="page__desc">{{ifrom}}</span>
</view>
<view class="weui-article__p">
<parser html="{{content}}" domain="{{domain}}" selectable/>
<mp-html content="{{content}}" domain="{{domain}}"/>
</view>
</view>
</view>

View File

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

View File

@ -8,7 +8,7 @@
<span style="color:gray"> {{tm_current.questioncat_name}}</span>
</view>
<view class="weui-article__title">
<rich-text nodes="{{tm_current.name}}"></rich-text>
<mp-html content="{{tm_current.name}}" domain="{{domain}}"/>
</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%"><rich-text nodes="{{item.value}}"></rich-text></view>
<view style="float:left;width:90%">
<mp-html content="{{item.value}}" domain="{{domain}}"/>
</view>
</view>
<view class="weui-cell__ft">
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
@ -32,7 +34,9 @@
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
<view style="float:left;width:90%">
<mp-html content="{{item.value}}" domain="{{domain}}"/>
</view>
</view>
<view class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>

View File

@ -1,6 +1,6 @@
{
"usingComponents": {
"parser": "/components/parser/parser"
"mp-html": "/components/mp-html/index"
},
"navigationBarTitleText": "错题集"
}

View File

@ -14,7 +14,7 @@
<span style="color:gray"> {{currentTm.questioncat_name}}</span>
</view>
<view class="weui-article__title">
<rich-text nodes="{{currentTm.name}}"></rich-text>
<mp-html content="{{currentTm.name}}" domain="{{domain}}"/>
</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%"><rich-text nodes="{{item.value}}"></rich-text></view>
<view style="float:left;width:90%"><mp-html content="{{item.value}}" domain="{{domain}}"/></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%"><rich-text nodes="{{item.value}}"></rich-text></view>
<view style="float:left;width:90%"><mp-html content="{{item.value}}" domain="{{domain}}"/></view>
</view>
<view class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>

View File

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

View File

@ -13,8 +13,7 @@
<span class="txlabel">{{tm_current.type}}</span>
</view>
<view class="weui-article__title">
<!-- <parser html="{{tm_current.name}}" domain="{{domain}}" selectable/> -->
<rich-text nodes="{{tm_current.name}}"></rich-text>
<mp-html content="{{tm_current.name}}" />
</view>
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
</view>
@ -25,15 +24,13 @@
<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 /> -->
<rich-text nodes="{{item.value}}"></rich-text>
<mp-html content="{{item.value}}" />
</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 /> -->
<rich-text nodes="{{item.value}}"></rich-text>
<mp-html content="{{item.value}}" />
</view>
</view>
</view>
@ -52,15 +49,13 @@
<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%">
<rich-text nodes="{{item.value}}"></rich-text>
<!-- <parser html="{{item.value}}" domain="{{domain}}" selectable /> -->
<mp-html content="{{item.value}}" domain="{{domain}}"/>
</view>
</view>
<view wx:else>
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%">
<rich-text nodes="{{item.value}}"></rich-text>
<!-- <parser html="{{item.value}}" domain="{{domain}}" selectable /> -->
<mp-html content="{{item.value}}" domain="{{domain}}"/>
</view>
</view>
</view>

View File

@ -1,5 +1,5 @@
{
"usingComponents": {
"parser": "/components/parser/parser"
"mp-html": "/components/mp-html/index"
}
}

View File

@ -8,7 +8,7 @@
<span style="color:gray"> {{tm_current.questioncat_name}}</span>
</view>
<view class="weui-article__title">
<rich-text nodes="{{tm_current.name}}"></rich-text>
<mp-html content="{{tm_current.name}}" domain="{{domain}}"/>
</view>
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
</view>
@ -18,7 +18,7 @@
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%">
<rich-text nodes="{{item.value}}"></rich-text>
<mp-html content="{{item.value}}" domain="{{domain}}"/>
</view>
</view>
<view class="weui-cell__ft">
@ -34,7 +34,7 @@
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
<view style="float:left;width:90%"><mp-html content="{{item.value}}" domain="{{domain}}"/></view>
</view>
<view class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>

View File

@ -1,5 +1,5 @@
{
"usingComponents": {
"parser": "/components/parser/parser"
"mp-html": "/components/mp-html/index"
}
}

View File

@ -8,8 +8,7 @@
<span style="color:gray">({{tm_current.question.questioncat_name}})</span>
</view>
<view class="weui-article__title">
<!-- <parser html="{{tm_current.question.name}}" domain="{{domain}}" selectable/> -->
<rich-text nodes="{{tm_current.question.name}}"></rich-text>
<mp-html content="{{tm_current.question.name}}" domain="{{domain}}"/>
</view>
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
</view>
@ -18,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%"><rich-text nodes="{{item.value}}"></rich-text></view>
<view style="float:left;width:90%"><mp-html content="{{item.value}}" domain="{{domain}}"/></view>
</view>
<view class="weui-cell__ft">
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
@ -33,7 +32,7 @@
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
<view style="float:left;width:90%"><mp-html content="{{item.value}}" domain="{{domain}}"/></view>
</view>
<view class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>

View File

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

View File

@ -17,7 +17,7 @@
<span style="color:gray">({{tm_current.questioncat_name}})</span>
</view>
<view class="weui-article__title">
<rich-text nodes="{{tm_current.name}}"></rich-text>
<mp-html content="{{tm_current.name}}" domain="{{domain}}"/>
</view>
<view wx:if="{{tm_current.img}}" style="text-align:center"><image src="{{tm_current.img}}" mode="aspectFit"></image></view>
</view>
@ -26,7 +26,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%"><rich-text nodes="{{item.value}}"></rich-text></view>
<view style="float:left;width:90%">
<mp-html content="{{item.value}}" domain="{{domain}}"/>
</view>
</view>
<view class="weui-cell__ft">
<radio class="weui-check" value="{{item.key}}" checked="{{item.checked}}" />
@ -41,7 +43,9 @@
<view class="weui-cell__bd">
<view style="float:left;width:10%">{{item.key}}:</view>
<view style="float:left;width:90%"><rich-text nodes="{{item.value}}"></rich-text></view>
<view style="float:left;width:90%">
<mp-html content="{{item.value}}" domain="{{domain}}"/>
</view>
</view>
<view class="weui-cell__hd">
<checkbox class="weui-check" value="{{item.key}}" checked="{{item.checked}}"/>

View File

@ -21,15 +21,13 @@
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useMultiFrameRuntime": false,
"useApiHook": true,
"useApiHostProcess": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"bundle": false,
"useIsolateContext": true,
"useCompilerModule": true,

View File

@ -6,6 +6,10 @@ from crm.models import Consumer
from .models_paper import WorkScope, Paper
class Exam(CommonModel):
pass
class ExamTest(CommonModel):
'''
考试记录表
@ -47,4 +51,4 @@ class Banner(CommonModel):
name = models.CharField(max_length=200, verbose_name='名称')
path = models.CharField(max_length=1000, null=True, blank=True, verbose_name='图片地址')
url = models.CharField(max_length=1000, null=True, blank=True, verbose_name='链接地址')
sort = models.IntegerField(default=1, verbose_name='排序数字')
sort = models.IntegerField(default=1, verbose_name='排序数字')

View File

@ -87,7 +87,7 @@ class QuestioncatViewSet(ModelViewSet):
serializer = QuestioncatSerializer(instance=queryset,many=True)
return Response(serializer.data)
from django.db.models import Q
class QuestionViewSet(ModelViewSet):
"""
题目增删改查
@ -126,12 +126,19 @@ class QuestionViewSet(ModelViewSet):
@action(methods=['get'], detail=False,
url_path='correct', url_name='correct_question', permission_classes=[IsAuthenticated])
def correct(self, request):
for i in Question.objects.all():
# for i in Question.objects.all():
# options = i.options
# for k in options:
# options[k] = str(options[k]).replace('<p>','').replace('</p>','')\
# .replace('&times;','×').replace('&beta;','β').replace('&alpha;','α')\
# .replace('&gamma;','γ').replace('&nbsp;',' ')
# i.options = options
# i.save()
for i in Question.objects.filter(Q(options__A__contains='&mu;')|Q(options__B__contains='&mu;')|Q(options__C__contains='&mu;')|Q(options__D__contains='&mu;')|Q(options__E__contains='&mu;')|Q(options__F__contains='&mu;')):
print(i)
options = i.options
for k in options:
options[k] = str(options[k]).replace('<p>','').replace('</p>','')\
.replace('&times;','×').replace('&beta;','β').replace('&alpha;','α')\
.replace('&gamma;','γ').replace('&nbsp;',' ')
options[k] = str(options[k]).replace('&mu;','μ')
i.options = options
i.save()
return Response()