test record sort

This commit is contained in:
caoqianming 2020-03-26 12:51:23 +08:00
parent a604d1448a
commit 5698e0b2a2
16 changed files with 43 additions and 36 deletions

View File

@ -183,7 +183,7 @@ export const asyncRoutes = [
path: 'chart', path: 'chart',
name: 'chart', name: 'chart',
component: () => import('@/views/analyse/chart.vue'), component: () => import('@/views/analyse/chart.vue'),
meta: { title: '图分析', icon: '', perms: ['chart_manage'] } meta: { title: '图分析', icon: '', perms: ['chart_manage'] }
}, },
] ]
}, },

View File

@ -87,10 +87,10 @@
<el-table-column align="header-center" label="手机号"> <el-table-column align="header-center" label="手机号">
<template slot-scope="scope">{{ scope.row.username }}</template> <template slot-scope="scope">{{ scope.row.username }}</template>
</el-table-column> </el-table-column>
<el-table-column align="header-center" label="openid"> <el-table-column align="header-center" label="小程序OpenId">
<template slot-scope="scope">{{ scope.row.openid }}</template> <template slot-scope="scope">{{ scope.row.openid }}</template>
</el-table-column> </el-table-column>
<el-table-column align="header-center" label="nickname"> <el-table-column align="header-center" label="微信昵称">
<template slot-scope="scope">{{ scope.row.nickname }}</template> <template slot-scope="scope">{{ scope.row.nickname }}</template>
</el-table-column> </el-table-column>
<el-table-column align="header-center" label="单位"> <el-table-column align="header-center" label="单位">

View File

@ -70,6 +70,7 @@
:data="tableData" :data="tableData"
style="width: 100%;margin-top:10px;" style="width: 100%;margin-top:10px;"
border border
stripe
fit fit
v-loading="listLoading" v-loading="listLoading"
highlight-current-row highlight-current-row

View File

@ -45,7 +45,7 @@
<view class="weui-article__h2">正确答案是{{currentTm.right}},你的答案是{{currentTm.user_answer}}</view> <view class="weui-article__h2">正确答案是{{currentTm.right}},你的答案是{{currentTm.user_answer}}</view>
<view class="weui-article__title"> <view class="weui-article__title">
<span style="color:blue">解析: </span> <span style="color:blue">解析: </span>
<span wx:if="{{currentTm.resolution != null}}">{{currentTm.resolution}}</span> <span wx:if="{{currentTm.resolution}}">{{currentTm.resolution}}</span>
<span wx:else>无</span> <span wx:else>无</span>
</view> </view>
</view> </view>

View File

@ -53,6 +53,7 @@ Page({
questioncat['id'] = res.data[i].id questioncat['id'] = res.data[i].id
questioncat['name'] = res.data[i].name questioncat['name'] = res.data[i].name
questioncat['tmtotal'] = res.data[i].tmtotal questioncat['tmtotal'] = res.data[i].tmtotal
questioncat['type'] = res.data[i].type
questioncat['ydtmtotal'] = 0 questioncat['ydtmtotal'] = 0
questioncatData.push(questioncat) questioncatData.push(questioncat)
} }

View File

@ -11,7 +11,8 @@
<view class="weui-media-box__bd"> <view class="weui-media-box__bd">
<h4 class="weui-media-box__title">{{item.name}}</h4> <h4 class="weui-media-box__title">{{item.name}}</h4>
<view class="weui-media-box__desc"> <view class="weui-media-box__desc">
<span style="color:orange;font-weight:bold">{{item.type}}</span>
--共
<span style="color:darkblue;font-weight:bold">{{item.tmtotal}}</span> <span style="color:darkblue;font-weight:bold">{{item.tmtotal}}</span>
道/已答 道/已答
<span style="color:darkblue;font-weight:bold">{{item.ydtmtotal}}</span> <span style="color:darkblue;font-weight:bold">{{item.ydtmtotal}}</span>

View File

@ -41,7 +41,7 @@
<view class="weui-article__h2">正确答案是{{tm_current.right}},你的答案是{{tm_current.user_answer}}</view> <view class="weui-article__h2">正确答案是{{tm_current.right}},你的答案是{{tm_current.user_answer}}</view>
<view class="weui-article__title"> <view class="weui-article__title">
<span style="color:blue">解析: </span> <span style="color:blue">解析: </span>
<span wx:if="{{tm_current.resolution != null}}">{{tm_current.resolution}}</span> <span wx:if="{{tm_current.resolution}}">{{tm_current.resolution}}</span>
<span wx:else>无</span> <span wx:else>无</span>
</view> </view>
</view> </view>

View File

@ -36,15 +36,15 @@
</checkbox-group> </checkbox-group>
</view> </view>
<view class="weui-article"> <view class="weui-article">
<view class="weui-article__h2" wx:if="{{tm_current.is_right}}" style="color:green;font-weight:bold">回答正确!</view> <view class="weui-article__h2" wx:if="{{tm_current.is_right}}" style="color:green;font-weight:bold">回答正确!得{{tm_current.score}}分</view>
<view class="weui-article__h2" wx:else style="color:red;font-weight:bold">回答有误!</view> <view class="weui-article__h2" wx:else style="color:red;font-weight:bold">回答有误!得{{tm_current.score}}分</view>
<view class="weui-article__h2">正确答案是{{tm_current.question.right}}, <view class="weui-article__h2">正确答案是{{tm_current.question.right}},
<span wx:if="{{tm_current.user_answer}}">你的答案是{{tm_current.user_answer}}</span> <span wx:if="{{tm_current.user_answer}}">你的答案是{{tm_current.user_answer}}</span>
<span wx:else>你未作答</span> <span wx:else>你未作答</span>
</view> </view>
<view class="weui-article__title"> <view class="weui-article__title">
<span style="color:blue">解析: </span> <span style="color:blue">解析: </span>
<span wx:if="{{tm_current.question.resolution != null}}">{{tm_current.question.resolution}}</span> <span wx:if="{{tm_current.question.resolution}}">{{tm_current.question.resolution}}</span>
<span wx:else>无</span> <span wx:else>无</span>
</view> </view>
</view> </view>

View File

@ -36,23 +36,17 @@ Page({
getList: function () { getList: function () {
var that = this var that = this
api.request('examtest/myexamtest/', 'GET', that.data.query).then(res => { api.request('examtest/myexamtest/', 'GET', that.data.query).then(res => {
if(res.data.length==0){ if (that.data.query.page == 1) {
wx.showToast({ that.data.results = res.data.results
title: '没有更多了', } else {
icon:'' that.data.results = that.data.results.concat(res.data.results)
})
}else{
if (that.data.query.page == 1){
that.data.results = res.data.results
}else{
that.data.results = that.data.results.concat(res.data.results)
}
that.setData({
results:that.data.results,
count:res.data.count
})
} }
that.setData({
results: that.data.results,
count: res.data.count
})
}) })
}, },
/** /**
@ -83,8 +77,17 @@ Page({
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function () {
that.data.query.page = that.data.query.page + 1 var that=this
that.getList() if(that.data.count<=that.data.query.page*that.data.query.limit){
wx.showToast({
title: '没有更多了',
icon: 'none'
})
}else{
that.data.query.page = that.data.query.page + 1
that.getList()
}
}, },
/** /**

View File

@ -6,18 +6,18 @@
<navigator url="detail?id={{item.id}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active"> <navigator url="detail?id={{item.id}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg"> <view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
<view class="weui-media-box__title">{{item.name}}</view> <view class="weui-media-box__title">{{item.name}}</view>
<view class="weui-media-box__desc" style="color:orange"> <view class="weui-media-box__desc">
<span style="font-weight:bold;color:white;background-color:orange;">{{item.type}}</span> <span style="font-weight:bold;color:white;background-color:orange;">{{item.type}}</span>
<span>-</span> <span>-</span>
<span style="font-weight:bold;color:white;background-color:green;" wx:if="{{item.is_pass}}">通过</span> <span style="font-weight:bold;color:white;background-color:green;" wx:if="{{item.is_pass}}">通过</span>
<span style="font-weight:bold;color:white;background-color:red;" wx:else>未通过</span> <span style="font-weight:bold;color:white;background-color:red;" wx:else>未通过</span>
(得分 (得分
<span style="color:green;font-weight:bold" wx:if="{{item.is_pass}}">{{item.score}}</span> <span style="color:green;" wx:if="{{item.is_pass}}">{{item.score}}</span>
<span style="color:red;font-weight:bold" wx:else>{{item.score}}</span> <span style="color:red;" wx:else>{{item.score}}</span>
-满分 -满分
<span style="font-weight:bold">{{item.total_score}})</span> <span style="font-weight:bold">{{item.total_score}})</span>
</view> </view>
<view class="weui-media-box__desc" style="color:orange"> <view class="weui-media-box__desc">
耗时:{{item.took}}s 耗时:{{item.took}}s
开始答题:{{item.start_time}} 开始答题:{{item.start_time}}
</view> </view>

View File

@ -9,6 +9,7 @@ Page({
data: { data: {
tms:[], tms:[],
tm_index: 0, tm_index: 0,
ctms:[],
}, },
radioChange: function (e) { radioChange: function (e) {
var that = this var that = this
@ -143,6 +144,7 @@ Page({
if(tm_current.right.indexOf(tm_current.user_answer[i])!=-1){ if(tm_current.right.indexOf(tm_current.user_answer[i])!=-1){
score = score + 1 score = score + 1
}else{ }else{
score = 0
break; break;
} }
} }
@ -248,7 +250,6 @@ Page({
}else{ }else{
that.data.monitest.is_pass = false that.data.monitest.is_pass = false
} }
console.log(that.data.tms)
that.data.monitest.questions = that.data.tms that.data.monitest.questions = that.data.tms
that.data.monitest.start_time = util.formatTime(new Date(that.data.starttimes)) that.data.monitest.start_time = util.formatTime(new Date(that.data.starttimes))
that.data.monitest.end_time = util.formatTime(new Date()) that.data.monitest.end_time = util.formatTime(new Date())

View File

@ -17,7 +17,7 @@ Page({
var that = this var that = this
try { try {
var value = wx.getStorageSync('nowSubject') var value = wx.getStorageSync('nowSubject')
if (value) { if (value.id) {
api.request('examtest/workscope/', 'GET', { subject:value.id}).then(res => { api.request('examtest/workscope/', 'GET', { subject:value.id}).then(res => {
that.setData({ that.setData({
workData:res.data workData:res.data

View File

@ -59,7 +59,7 @@ class MyExamTestView(APIView):
authentication_classes = [ConsumerTokenAuthentication] authentication_classes = [ConsumerTokenAuthentication]
permission_classes = [] permission_classes = []
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
queryset = ExamTest.objects.filter(consumer=request.user) queryset = ExamTest.objects.filter(consumer=request.user).order_by('-create_time')
pg = CommonPagination() pg = CommonPagination()
p = pg.paginate_queryset(queryset=queryset,request=request,view=self) p = pg.paginate_queryset(queryset=queryset,request=request,view=self)
serializer = ExamTestListSerializer(instance=p,many=True) serializer = ExamTestListSerializer(instance=p,many=True)
@ -72,7 +72,7 @@ class MyExamTestFxView(APIView):
queryset = ExamTest.objects.filter(consumer=request.user) queryset = ExamTest.objects.filter(consumer=request.user)
ret = {} ret = {}
ret['total'] = queryset.count() ret['total'] = queryset.count()
ret['avg_score'] = queryset.aggregate(avg=Avg('score'))['avg'] ret['avg_score'] = round(queryset.aggregate(avg=Avg('score'))['avg'])
ret['pass_rate'] = round(((queryset.filter(is_pass=True).count())/ret['total'])*100) if ret['total'] else 0 ret['pass_rate'] = round(((queryset.filter(is_pass=True).count())/ret['total'])*100) if ret['total'] else 0
return Response(ret) return Response(ret)

View File

@ -34,5 +34,5 @@ urlpatterns = [
path('token/remove/', UserLogoutView.as_view()), path('token/remove/', UserLogoutView.as_view()),
path('uploadfile/', UploadFileView.as_view()), path('uploadfile/', UploadFileView.as_view()),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('docs/', include_docs_urls(title="API文档",authentication_classes=[], permission_classes=[])), path('docs/', include_docs_urls(title="答题平台接口文档",authentication_classes=[], permission_classes=[])),
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)