diff --git a/test_client/src/api/examtest.js b/test_client/src/api/examtest.js
index 061ba7c..318b7a8 100644
--- a/test_client/src/api/examtest.js
+++ b/test_client/src/api/examtest.js
@@ -68,4 +68,19 @@ export function deleteWorkScope(id) {
url: `/examtest/workscope/${id}/`,
method: 'delete',
})
+}
+
+export function getExamTestlist(query) {
+ return request({
+ url: '/examtest/examtest/',
+ method: 'get',
+ params: query
+ })
+}
+
+export function getExamTestDetail(id){
+ return request({
+ url: `/examtest/examtest/${id}/`,
+ method: 'get',
+ })
}
\ No newline at end of file
diff --git a/test_client/src/router/index.js b/test_client/src/router/index.js
index 6d40e3e..beff052 100644
--- a/test_client/src/router/index.js
+++ b/test_client/src/router/index.js
@@ -174,10 +174,10 @@ export const asyncRoutes = [
meta: { title: '统计分析', icon: 'chart'},
children: [
{
- path: 'djlist',
- name: 'djlist',
- component: () => import('@/views/analyse/djlist.vue'),
- meta: { title: '答卷列表', icon: '', perms: ['djlist_manage'] }
+ path: 'examtest',
+ name: 'ExamTest',
+ component: () => import('@/views/analyse/examtest.vue'),
+ meta: { title: '答卷列表', icon: '', perms: ['examtest_list'] }
},
{
path: 'chart',
diff --git a/test_client/src/views/analyse/djlist.vue b/test_client/src/views/analyse/djlist.vue
deleted file mode 100644
index e69de29..0000000
diff --git a/test_client/src/views/analyse/examtest.vue b/test_client/src/views/analyse/examtest.vue
new file mode 100644
index 0000000..44582aa
--- /dev/null
+++ b/test_client/src/views/analyse/examtest.vue
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+ {{ scope.row.type }}
+
+
+ {{ scope.row.consumer_name }}
+
+
+ {{ scope.row.workscope_name }}
+
+
+ {{ scope.row.paper_name }}
+
+
+ {{ scope.row.score }}
+
+
+ {{ scope.row.took }}
+
+
+ {{ scope.row.start_time }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test_client/src/views/examtest/paper.vue b/test_client/src/views/examtest/paper.vue
index e69de29..44582aa 100644
--- a/test_client/src/views/examtest/paper.vue
+++ b/test_client/src/views/examtest/paper.vue
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+ {{ scope.row.type }}
+
+
+ {{ scope.row.consumer_name }}
+
+
+ {{ scope.row.workscope_name }}
+
+
+ {{ scope.row.paper_name }}
+
+
+ {{ scope.row.score }}
+
+
+ {{ scope.row.took }}
+
+
+ {{ scope.row.start_time }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test_client/src/views/system/banner.vue b/test_client/src/views/system/banner.vue
index 6821c5e..72fb1f3 100644
--- a/test_client/src/views/system/banner.vue
+++ b/test_client/src/views/system/banner.vue
@@ -138,9 +138,9 @@ export default {
this.banner.path = res.data.path
},
beforeImgUpload(file) {
- const isLt2M = file.size / 1024 / 1024 < 0.5;
+ const isLt2M = file.size / 1024 / 1024 < 0.6;
if (!isLt2M) {
- this.$message.error("上传图片大小不能超过 500KB!");
+ this.$message.error("上传图片大小不能超过 600KB!");
}
return isLt2M;
},
diff --git a/test_mini/app.js b/test_mini/app.js
index e440f67..97d8a49 100644
--- a/test_mini/app.js
+++ b/test_mini/app.js
@@ -11,7 +11,7 @@ App({
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
- api.request('crm/consumer/mplogin/','POST', {code:res.code}).then(res=>{
+ api.request('/crm/consumer/mplogin/','POST', {code:res.code}).then(res=>{
if(res.code==200){
this.globalData.token = res.data.token
this.globalData.userinfo = res.data.userinfo
@@ -48,10 +48,10 @@ App({
globalData: {
userInfo: null,
userinfo: null, // 服务器传回的消费者信息
- host: 'https://apitest.ctcshe.com/',
- mediahost: 'https://apitest.ctcshe.com/',
- // host: 'http://127.0.0.1:8000/',
- // mediahost: 'http://127.0.0.1:8000/',
+ // host: 'https://apitest.ctcshe.com',
+ mediahost: 'https://apitest.ctcshe.com',
+ host: 'http://127.0.0.1:8000',
+ // mediahost: 'http://127.0.0.1:8000',
token : '',
subject:null,
}
diff --git a/test_mini/pages/collect/main.js b/test_mini/pages/collect/main.js
index f02f87f..2e89be4 100644
--- a/test_mini/pages/collect/main.js
+++ b/test_mini/pages/collect/main.js
@@ -30,7 +30,7 @@ Page({
onLoad: function () {
var that = this
wx.showLoading({})
- api.request('crm/consumer/collects/', 'GET').then(res => {
+ api.request('/crm/consumer/collects/', 'GET').then(res => {
that.data.sctms = res.data
that.setData({
tmtotal:res.data.length
@@ -187,7 +187,7 @@ Page({
remove: function () {
var that = this
var index = that.data.tm_index
- api.request('crm/consumer/collects/', 'DELETE', { question: that.data.tm_current.id }).then(res => {
+ api.request('/crm/consumer/collects/', 'DELETE', { question: that.data.tm_current.id }).then(res => {
that.data.sctms.splice(index, 1)
if (that.data.sctms.length > index) {
that.showTm(index)
diff --git a/test_mini/pages/lianxi/index.js b/test_mini/pages/lianxi/index.js
index f6454de..c5b1647 100644
--- a/test_mini/pages/lianxi/index.js
+++ b/test_mini/pages/lianxi/index.js
@@ -43,7 +43,7 @@ Page({
getList: function () {
var that = this
if (that.data.workscopeId) {
- api.request('question/questioncat/workscope/', 'GET', { 'id': that.data.workscopeId }).then(res => {
+ api.request('/question/questioncat/workscope/', 'GET', { 'id': that.data.workscopeId }).then(res => {
let questioncatData = []
if (res.data.length > 0) {
for (var i = 0; i < res.data.length; i++) {
diff --git a/test_mini/pages/lianxi/main.js b/test_mini/pages/lianxi/main.js
index 8b3ca35..e5ebb3d 100644
--- a/test_mini/pages/lianxi/main.js
+++ b/test_mini/pages/lianxi/main.js
@@ -66,7 +66,7 @@ Page({
questioncat: that.data.questioncat,
ydtms: that.data.ydtms_old
}
- api.request('question/question/exercise/?limit=10&page='+that.data.page, 'POST', query).then(res => {
+ api.request('/question/question/exercise/?limit=10&page='+that.data.page, 'POST', query).then(res => {
that.data.tms = that.data.tms.concat(res.data.results)
that.showTm(that.data.tm_index) //展示题目和答案
that.setData({
@@ -218,7 +218,7 @@ Page({
var that = this
var tm_current = that.data.tm_current
if (tm_current.is_collect) {
- api.request('crm/consumer/collects/', 'DELETE', { question: tm_current.id }).then(res => {
+ api.request('/crm/consumer/collects/', 'DELETE', { question: tm_current.id }).then(res => {
wx.showToast({
title: '已取消!',
icon: 'none'
@@ -230,7 +230,7 @@ Page({
})
} else {
- api.request('crm/consumer/collects/', 'POST', { question: tm_current.id }).then(res => {
+ api.request('/crm/consumer/collects/', 'POST', { question: tm_current.id }).then(res => {
wx.showToast({
title: '收藏成功!',
icon: 'none'
diff --git a/test_mini/pages/login/login.js b/test_mini/pages/login/login.js
index 64e9181..cacd932 100644
--- a/test_mini/pages/login/login.js
+++ b/test_mini/pages/login/login.js
@@ -66,7 +66,7 @@ Page({
sendMsg : function (){
var that = this
if(that.isPhone(that.data.form.phone)){
- api.request('crm/consumer/sendcode', 'GET', { phone: that.data.form.phone }).then(res => {
+ api.request('/crm/consumer/sendcode', 'GET', { phone: that.data.form.phone }).then(res => {
wx.showToast({
title: '验证码发送成功!注意查收',
icon: 'none'
diff --git a/test_mini/pages/main/main.js b/test_mini/pages/main/main.js
index c6e1361..0f63e9e 100644
--- a/test_mini/pages/main/main.js
+++ b/test_mini/pages/main/main.js
@@ -1,62 +1,44 @@
// pages/main/main.js
const app = getApp()
+const api = require("../../utils/request.js");
Page({
/**
* 页面的初始数据
*/
data: {
- // Banner数据
- images: [],
- // 是否显示面板指示点
+ Hei:0,
+ background: [],
indicatorDots: true,
- // 滑动方向是否为纵向
vertical: false,
- // 自动切换
autoplay: true,
- // 采用衔接滑动
- circular: true,
- // 自动切换时间间隔2s
- interval: 8000,
- // 滑动动画时长0.5s
+ interval: 7000,
duration: 1500,
- // 前边距,可用于露出前一项的一小部分,接受 px 和 rpx 值
- previousMargin: 0,
- // 后边距,可用于露出后一项的一小部分,接受 px 和 rpx 值
- nextMargin: 0,// Banner数据
- images: [],
- // 是否显示面板指示点
- indicatorDots: false,
- // 滑动方向是否为纵向
- vertical: false,
- // 自动切换
- autoplay: true,
- // 采用衔接滑动
- circular: true,
- // 自动切换时间间隔2s
- interval: 6000,
- // 滑动动画时长0.5s
- duration: 1500,
- // 前边距,可用于露出前一项的一小部分,接受 px 和 rpx 值
- previousMargin: 0,
- // 后边距,可用于露出后一项的一小部分,接受 px 和 rpx 值
- nextMargin: 0,
nowWork:null
},
-
+ imgH: function (e) {
+ let winWid = wx.getSystemInfoSync().windowWidth;
+ console.log(e) //获取当前屏幕的宽度
+ let imgh = e.detail.height; //图片高度
+ let imgw = e.detail.width;
+ let swiperH = winWid * imgh / imgw + "px";
+ this.setData({
+ Hei: swiperH //设置高度
+ })
+ },
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this
- let images = [
- app.globalData.mediahost + 'media/banner/1.jpg',
- app.globalData.mediahost + 'media/banner/2.jpg',
- app.globalData.mediahost + 'media/banner/3.jpg',
- app.globalData.mediahost + 'media/banner/4.jpg',
- ]
- that.setData({
- images: images
+ api.request('/examtest/banner/', 'GET').then(res => {
+ let images = []
+ for(var i=0;i
-
-
-
-
-
-
-
-
-
-
- 欢迎使用中科辐射学堂!
-
- 开通权限请联系课程顾问师老师
- 18355135390(微信同号)
-
+
+
+
+
+
+
+
+
-
diff --git a/test_mini/pages/main/main.wxss b/test_mini/pages/main/main.wxss
index 85813dd..e69de29 100644
--- a/test_mini/pages/main/main.wxss
+++ b/test_mini/pages/main/main.wxss
@@ -1,27 +0,0 @@
-/* pages/main/main.wxss */
-.swiper-item-images{
- width: 100%;
- height: 300rpx;
-}
-/*横向布局 */
-.layout_horizontal{
- height: 200rpx;
- display: flex;
- /*row 横向 column 列表 */
- flex-direction: row;
- padding:4rpx
-}
-.swiper_container {
-background-color: #e7e6e6;
-height: 50rpx;
-width: 100%;
-text-align: center
-}
-.swiper_item {
-font-size: 30rpx;
-font-weight: bold;
-color:darkblue;
-overflow: hidden;
-text-overflow: ellipsis;
-white-space: nowrap;
-}
\ No newline at end of file
diff --git a/test_mini/pages/moni/index.js b/test_mini/pages/moni/index.js
index 4cac9c9..b530383 100644
--- a/test_mini/pages/moni/index.js
+++ b/test_mini/pages/moni/index.js
@@ -77,7 +77,7 @@ Page({
wx.showLoading({
title: '正在生成试卷',
})
- api.request('examtest/workscope/' + this.data.workId + '/monitest', 'GET').then(res => {
+ api.request('/examtest/workscope/' + this.data.workId + '/monitest', 'GET').then(res => {
try {
wx.setStorageSync('monitest', res.data)
} catch (e) { }
diff --git a/test_mini/pages/my/index.js b/test_mini/pages/my/index.js
index e5998a3..c803e42 100644
--- a/test_mini/pages/my/index.js
+++ b/test_mini/pages/my/index.js
@@ -32,7 +32,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
- api.request('examtest/myexamtestfx', 'GET').then(res => {
+ api.request('/examtest/myexamtestfx', 'GET').then(res => {
this.setData(res.data)
})
},
diff --git a/test_mini/pages/subject/index.js b/test_mini/pages/subject/index.js
index feb7574..97201fc 100644
--- a/test_mini/pages/subject/index.js
+++ b/test_mini/pages/subject/index.js
@@ -14,9 +14,9 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
- api.request('question/subject/', 'GET').then(res => {
+ api.request('/question/subject/', 'GET').then(res => {
var subjectData = res.data
- api.request('crm/consumer/subjectpaid', 'GET').then(res => {
+ api.request('/crm/consumer/subjectpaid', 'GET').then(res => {
for(var i=0;i {
+ api.request('/examtest/answerdetail/', 'GET', query).then(res => {
that.data.results= res.data
that.showTm(0)
that.setData({
diff --git a/test_mini/pages/test/list.js b/test_mini/pages/test/list.js
index 23c789d..68672e5 100644
--- a/test_mini/pages/test/list.js
+++ b/test_mini/pages/test/list.js
@@ -35,7 +35,7 @@ Page({
},
getList: function () {
var that = this
- api.request('examtest/myexamtest/', 'GET', that.data.query).then(res => {
+ api.request('/examtest/myexamtest/', 'GET', that.data.query).then(res => {
if (that.data.query.page == 1) {
that.data.results = res.data.results
} else {
diff --git a/test_mini/pages/test/list.wxml b/test_mini/pages/test/list.wxml
index fb86eec..09ecf60 100644
--- a/test_mini/pages/test/list.wxml
+++ b/test_mini/pages/test/list.wxml
@@ -7,10 +7,10 @@
{{item.name}}
- {{item.type}}
+ {{item.type}}
-
- 通过
- 未通过
+ 通过
+ 未通过
(得分
{{item.score}}
{{item.score}}
diff --git a/test_mini/pages/test/test.js b/test_mini/pages/test/test.js
index 8820ced..fb3167d 100644
--- a/test_mini/pages/test/test.js
+++ b/test_mini/pages/test/test.js
@@ -254,7 +254,7 @@ Page({
that.data.monitest.start_time = util.formatTime(new Date(that.data.starttimes))
that.data.monitest.end_time = util.formatTime(new Date())
that.data.monitest.took = Math.floor(((new Date()).getTime() - this.data.starttimes) / 1000)
- api.request('examtest/monitest/', 'POST', that.data.monitest).then(res => {
+ api.request('/examtest/monitest/', 'POST', that.data.monitest).then(res => {
getApp().globalData.testData = res.data
try {
wx.removeStorageSync('monitest')
diff --git a/test_mini/pages/workscope/index.js b/test_mini/pages/workscope/index.js
index 939bde1..a9ed760 100644
--- a/test_mini/pages/workscope/index.js
+++ b/test_mini/pages/workscope/index.js
@@ -18,7 +18,7 @@ Page({
try {
var value = wx.getStorageSync('nowSubject')
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({
workData:res.data
})
diff --git a/test_server/examtest/models_paper.py b/test_server/examtest/models_paper.py
index 7d5a079..8074f94 100644
--- a/test_server/examtest/models_paper.py
+++ b/test_server/examtest/models_paper.py
@@ -40,4 +40,13 @@ class WorkScope(SoftCommonModel):
return self.name
class Paper(SoftCommonModel):
- name = models.CharField(max_length=200, verbose_name='名称')
\ No newline at end of file
+ name = models.CharField(max_length=200, verbose_name='名称')
+ questions = models.ManyToManyField(Question, through='PaperQuestions')
+ limit = models.IntegerField(default=0, verbose_name='限时(分钟)')
+ total_score = models.FloatField(default=0, verbose_name='满分')
+ pass_score = models.FloatField(default=0, verbose_name='及格分数')
+
+class PaperQuestions(CommonModel):
+ paper = models.ForeignKey(Paper, on_delete=models.CASCADE, verbose_name='试卷')
+ question = models.ForeignKey(Question, on_delete=models.CASCADE, verbose_name='试题')
+ score = models.FloatField(default=0, verbose_name='满分')
\ No newline at end of file
diff --git a/test_server/examtest/serializers.py b/test_server/examtest/serializers.py
index 8f738e3..f7df2bd 100644
--- a/test_server/examtest/serializers.py
+++ b/test_server/examtest/serializers.py
@@ -2,7 +2,7 @@ from rest_framework import serializers
from question.models import Questioncat
from crm.models import Consumer
from .models import ExamTest, AnswerDetail, Banner
-from .models_paper import TestRule, WorkScope
+from .models_paper import TestRule, WorkScope, Paper, PaperQuestions
class BannerSerializer(serializers.ModelSerializer):
@@ -53,12 +53,16 @@ class ExamTestListSerializer(serializers.ModelSerializer):
"""
start_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S")
end_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S")
- create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
- update_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
+ workscope_name = serializers.StringRelatedField(source='workscope', read_only=True)
+ paper_name = serializers.StringRelatedField(source='papaer', read_only=True)
+ consumer_name = serializers.SerializerMethodField()
class Meta:
model = ExamTest
- fields = '__all__'
+ exclude = ('detail',)
+ def get_consumer_name(self, obj):
+ return obj.consumer.name
+
class AnswerDetailSerializer(serializers.ModelSerializer):
class Meta:
model = AnswerDetail
@@ -69,3 +73,10 @@ class AnswerDetailCreateSerializer(serializers.ModelSerializer):
class Meta:
model = AnswerDetail
fields = '__all__'
+
+class PaperSerializer(serializers.ModelSerializer):
+ create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
+ update_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
+ class Meta:
+ model = Paper
+ exclude = ('questions',)
\ No newline at end of file
diff --git a/test_server/examtest/urls.py b/test_server/examtest/urls.py
index 600bacf..cd8fbc1 100644
--- a/test_server/examtest/urls.py
+++ b/test_server/examtest/urls.py
@@ -1,5 +1,5 @@
from django.urls import path,include
-from .views import TestRuleViewSet, MoniTestView, MyExamTestView, AnswerDetailView, MyExamTestFxView, WorkScopeViewSet, BannerViewSet
+from .views import TestRuleViewSet, MoniTestView, MyExamTestView, AnswerDetailView, MyExamTestFxView, WorkScopeViewSet, BannerViewSet, ExamTestViewSet, PaperViewSet
from rest_framework import routers
@@ -7,6 +7,8 @@ router = routers.DefaultRouter()
router.register('testrule', TestRuleViewSet, basename="testrule")
router.register('workscope', WorkScopeViewSet, basename="workscope")
router.register('banner', BannerViewSet, basename='banner')
+router.register('examtest', ExamTestViewSet, basename='examtest')
+router.register('paper', PaperViewSet, basename='paper')
urlpatterns = [
path('monitest/',MoniTestView.as_view()),
diff --git a/test_server/examtest/views.py b/test_server/examtest/views.py
index a36e9be..3c554dd 100644
--- a/test_server/examtest/views.py
+++ b/test_server/examtest/views.py
@@ -17,8 +17,10 @@ from rbac.permission import RbacPermission
from question.models import Question
from question.serializers import QuestionSerializer
from .models import ExamTest, AnswerDetail, Banner
-from .models_paper import TestRule, WorkScope
-from .serializers import TestRuleSerializer, MoniTestSerializer, AnswerDetailSerializer, ExamTestListSerializer, AnswerDetailCreateSerializer, WorkScopeSerializer, BannerSerializer
+from .models_paper import TestRule, WorkScope, Paper
+from .serializers import (TestRuleSerializer, MoniTestSerializer, AnswerDetailSerializer,
+ ExamTestListSerializer, AnswerDetailCreateSerializer, WorkScopeSerializer,
+ BannerSerializer, PaperSerializer)
from server import settings
from crm.authentication import ConsumerTokenAuthentication
from utils.custom import CommonPagination
@@ -222,3 +224,31 @@ class TestRuleViewSet(ModelViewSet):
self.permission_classes = []
return [permission() for permission in self.permission_classes]
+class ExamTestViewSet(ModelViewSet):
+ """
+ 考试记录列表和详情
+ """
+ perms_map = (
+ {'*': 'admin'}, {'*': 'ExamTest_all'}, {'get': 'ExamTest_list'})
+ pagination_class = CommonPagination
+ queryset = ExamTest.objects.filter(is_delete=0).all().order_by("id")
+ serializer_class = ExamTestListSerializer
+ ordering_fields = ('id',)
+ ordering = ['id']
+ search_fields = ('^name',)
+ filter_backends = [DjangoFilterBackend, SearchFilter, OrderingFilter]
+ filterset_fields = ['type','is_pass']
+
+
+class PaperViewSet(ModelViewSet):
+ """
+ 押题卷增删改查
+ """
+ perms_map = (
+ {'*': 'admin'}, {'*': 'Paper_all'}, {'get': 'Paper_list'}, {'post': 'Paper_create'},
+ {'put': 'Paper_update'}, {'delete': 'Paper_delete'})
+ queryset = Paper.objects.filter(is_delete=0).all().order_by("id")
+ serializer_class = PaperSerializer
+ ordering_fields = ('id',)
+ ordering = ['id']
+ search_fields = ('^name',)
\ No newline at end of file