上传签到和现场图片
This commit is contained in:
parent
1d9c3b2fc8
commit
ee8c64f169
|
|
@ -70,9 +70,9 @@ App({
|
||||||
globalData: {
|
globalData: {
|
||||||
userInfo: {},
|
userInfo: {},
|
||||||
userinfo: {}, // 服务器传回的消费者信息
|
userinfo: {}, // 服务器传回的消费者信息
|
||||||
host: 'https://apitest.ahctc.cn',
|
//host: 'https://apitest.ahctc.cn',
|
||||||
mediahost: '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',
|
//mediahost: 'http://127.0.0.1:8000',
|
||||||
token : '',
|
token : '',
|
||||||
rlogin:true
|
rlogin:true
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,8 @@
|
||||||
"pages/admin/exam/index",
|
"pages/admin/exam/index",
|
||||||
"pages/candidate/show",
|
"pages/candidate/show",
|
||||||
"pages/admin/candidate/index",
|
"pages/admin/candidate/index",
|
||||||
"pages/candidate/my"
|
"pages/candidate/my",
|
||||||
|
"pages/admin/exam/upimg"
|
||||||
],
|
],
|
||||||
"window": {
|
"window": {
|
||||||
"backgroundTextStyle": "light",
|
"backgroundTextStyle": "light",
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,7 @@ Page({
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
if(options.id){
|
if(options.id){
|
||||||
let id = options.id
|
let id = options.id
|
||||||
api.requesta(`/examtest/exam/${id}/`, 'GET').then(res=>{
|
that.data.exam.id = id
|
||||||
this.setData({
|
|
||||||
exam:res.data
|
|
||||||
})
|
|
||||||
})
|
|
||||||
api.requesta('/examtest/examtest/', 'GET', {exam:id, pageoff:true}).then(res=>{
|
api.requesta('/examtest/examtest/', 'GET', {exam:id, pageoff:true}).then(res=>{
|
||||||
this.setData({
|
this.setData({
|
||||||
tests:res.data
|
tests:res.data
|
||||||
|
|
@ -28,6 +24,14 @@ Page({
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getExam: function(){
|
||||||
|
let id = this.data.exam.id
|
||||||
|
api.requesta(`/examtest/exam/${id}/`, 'GET').then(res=>{
|
||||||
|
this.setData({
|
||||||
|
exam:res.data
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
issue: function(){
|
issue: function(){
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '正在生成...',
|
title: '正在生成...',
|
||||||
|
|
@ -45,7 +49,7 @@ Page({
|
||||||
* 生命周期函数--监听页面显示
|
* 生命周期函数--监听页面显示
|
||||||
*/
|
*/
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
|
this.getExam()
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -108,5 +112,10 @@ Page({
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/candidate/show?id='+candidate_.id,
|
url: '/pages/candidate/show?id='+candidate_.id,
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
upImg: function(){
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/admin/exam/upimg?id='+this.data.exam.id,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -19,6 +19,9 @@
|
||||||
监考人:{{exam.proctor_name}}-{{exam.proctor_phone}}
|
监考人:{{exam.proctor_name}}-{{exam.proctor_phone}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view style="text-align:right;padding-right:8rpx">
|
||||||
|
<button type="primary" size="mini" bindtap="upImg" data-id="{{exam.id}}">上传图片</button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-panel weui-panel_access">
|
<view class="weui-panel weui-panel_access">
|
||||||
|
|
@ -47,9 +50,12 @@
|
||||||
<text style="color:darkblue">{{item.candidate_.number}}</text>
|
<text style="color:darkblue">{{item.candidate_.number}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view style="text-align:right;padding-right:8rpx">
|
<view style="text-align:right;padding-right:8rpx">
|
||||||
<button type="default" size="mini" bindtap="goCandidate" style="margin-left:4px" data-id="{{item.id}}" data-candidate_="{{item.candidate_}}" wx:if="{{item.candidate_}}">查看证书</button>
|
<button type="default" size="mini" bindtap="goCandidate" style="margin-left:4px" data-id="{{item.id}}"
|
||||||
<button type="primary" size="mini" bindtap="issue" data-id="{{item.id}}" data-index="{{index}}" wx:else>颁发证书</button>
|
data-candidate_="{{item.candidate_}}" wx:if="{{item.candidate_}}">查看证书</button>
|
||||||
<button type="default" size="mini" bindtap="godetail" style="margin-left:4px" data-id="{{item.id}}">答卷详情</button>
|
<button type="primary" size="mini" bindtap="issue" data-id="{{item.id}}" data-index="{{index}}"
|
||||||
|
wx:else>颁发证书</button>
|
||||||
|
<button type="default" size="mini" bindtap="godetail" style="margin-left:4px"
|
||||||
|
data-id="{{item.id}}">答卷详情</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,207 @@
|
||||||
|
// pages/admin/exam/u'p.js
|
||||||
|
const api = require("../../../utils/request.js");
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
exam:0,
|
||||||
|
qdimgs: [],
|
||||||
|
xcimgs: [],
|
||||||
|
upqdimgs:[],
|
||||||
|
upxcimgs:[]
|
||||||
|
},
|
||||||
|
chooseImage: function (e) {
|
||||||
|
var that = this;
|
||||||
|
wx.chooseImage({
|
||||||
|
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||||
|
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||||
|
success: function (res) {
|
||||||
|
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
||||||
|
console.log(e.currentTarget.dataset.type)
|
||||||
|
if(e.currentTarget.dataset.type == 'qdimgs'){
|
||||||
|
that.setData({
|
||||||
|
qdimgs: that.data.qdimgs.concat(res.tempFilePaths)
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
that.setData({
|
||||||
|
xcimgs: that.data.xcimgs.concat(res.tempFilePaths)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
previewImage: function (e) {
|
||||||
|
if(e.currentTarget.dataset.type=='qdimgs'){
|
||||||
|
wx.previewImage({
|
||||||
|
current: e.currentTarget.id, // 当前显示图片的http链接
|
||||||
|
urls: this.data.qdimgs // 需要预览的图片http链接列表
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
wx.previewImage({
|
||||||
|
current: e.currentTarget.id, // 当前显示图片的http链接
|
||||||
|
urls: this.data.xcimgs // 需要预览的图片http链接列表
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad: function (options) {
|
||||||
|
this.data.exam = options.id
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
deleteImg: function(e){
|
||||||
|
var that = this
|
||||||
|
wx.showModal({
|
||||||
|
content: '确认删除该图片?',
|
||||||
|
success (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
if(e.currentTarget.dataset.type=='qdimgs'){
|
||||||
|
var qdimgs = that.data.qdimgs
|
||||||
|
qdimgs.splice(e.currentTarget.dataset.index, 1);
|
||||||
|
that.setData({
|
||||||
|
qdimgs:qdimgs
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
var xcimgs = that.data.xcimgs
|
||||||
|
xcimgs.splice(e.currentTarget.dataset.index, 1);
|
||||||
|
that.setData({
|
||||||
|
xcimgs:xcimgs
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
confirm: function(){
|
||||||
|
if(this.data.upqdimgs.length>0 && this.data.upxcimgs.length>0){
|
||||||
|
let formdata={
|
||||||
|
qdimgs:this.data.upqdimgs,
|
||||||
|
xcimgs:this.data.upxcimgs
|
||||||
|
}
|
||||||
|
let id = this.data.exam
|
||||||
|
wx.showLoading({
|
||||||
|
title: '正在提交...',
|
||||||
|
})
|
||||||
|
api.requesta(`/examtest/exam/${id}/upimgs/`,'POST', formdata).then(res=>{
|
||||||
|
wx.hideLoading({
|
||||||
|
success: (res) => {},
|
||||||
|
})
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: 0,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else if(this.data.qdimgs.length>0 && this.data.xcimgs.length>0){
|
||||||
|
this.upImgx(0, 'qdimgs')
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
wx.showToast({
|
||||||
|
title: '图片信息不全',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
upImgx: function(index, type){
|
||||||
|
var that = this
|
||||||
|
if(type=='qdimgs'){
|
||||||
|
let x = index+1
|
||||||
|
wx.showLoading({
|
||||||
|
title: '正在上传签到图片',
|
||||||
|
})
|
||||||
|
wx.uploadFile({
|
||||||
|
filePath: that.data.qdimgs[index],
|
||||||
|
name: 'file',
|
||||||
|
url: getApp().globalData.host+'/uploadfile/',
|
||||||
|
header:{
|
||||||
|
'Authorization': 'JWT ' + getApp().globalData.admintoken
|
||||||
|
},
|
||||||
|
success (res){
|
||||||
|
wx.hideLoading()
|
||||||
|
let data = JSON.parse(res.data);
|
||||||
|
that.data.upqdimgs.push(data.data.path)
|
||||||
|
if(x == that.data.qdimgs.length){
|
||||||
|
that.upImgx(0, 'xcimgs')
|
||||||
|
}else{
|
||||||
|
that.upImgx(index+1, 'qdimgs')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
let x = index+1
|
||||||
|
wx.showLoading({
|
||||||
|
title: '正在上传现场图片',
|
||||||
|
})
|
||||||
|
wx.uploadFile({
|
||||||
|
filePath: that.data.xcimgs[index],
|
||||||
|
name: 'file',
|
||||||
|
url: getApp().globalData.host+'/uploadfile/',
|
||||||
|
header:{
|
||||||
|
'Authorization': 'JWT ' + getApp().globalData.admintoken
|
||||||
|
},
|
||||||
|
success (res){
|
||||||
|
wx.hideLoading()
|
||||||
|
let data = JSON.parse(res.data);
|
||||||
|
that.data.upxcimgs.push(data.data.path)
|
||||||
|
if(x == that.data.xcimgs.length){
|
||||||
|
that.confirm()
|
||||||
|
}else{
|
||||||
|
that.upImgx(index+1, 'xcimgs')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
<view class="page">
|
||||||
|
<view class="page__bd">
|
||||||
|
<view class="weui-cells">
|
||||||
|
<view class="weui-cell">
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<view class="weui-uploader">
|
||||||
|
<view class="weui-uploader__hd">
|
||||||
|
<view class="weui-uploader__overview">
|
||||||
|
<view class="weui-uploader__title">签到表图片</view>
|
||||||
|
<!-- <view class="weui-uploader__info">{{files.length}}/2</view> -->
|
||||||
|
</view>
|
||||||
|
<view class="weui-uploader__tips">
|
||||||
|
长按删除
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-uploader__bd">
|
||||||
|
<view class="weui-uploader__files" id="uploaderFiles">
|
||||||
|
<block wx:for="{{qdimgs}}" wx:key="*this">
|
||||||
|
<view class="weui-uploader__file" bindtap="previewImage" id="{{item}}" data-type="qdimgs" bindlongpress="deleteImg"
|
||||||
|
data-index="{{index}}">
|
||||||
|
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" />
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<view class="weui-uploader__input-box">
|
||||||
|
<view class="weui-uploader__input" bindtap="chooseImage" data-type="qdimgs"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell">
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
<view class="weui-uploader">
|
||||||
|
<view class="weui-uploader__hd">
|
||||||
|
<view class="weui-uploader__overview">
|
||||||
|
<view class="weui-uploader__title">现场照片</view>
|
||||||
|
<!-- <view class="weui-uploader__info">{{files.length}}/2</view> -->
|
||||||
|
</view>
|
||||||
|
<view class="weui-uploader__tips">
|
||||||
|
长按删除
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="weui-uploader__bd">
|
||||||
|
<view class="weui-uploader__files" id="uploaderFiles">
|
||||||
|
<block wx:for="{{xcimgs}}" wx:key="*this">
|
||||||
|
<view class="weui-uploader__file" bindtap="previewImage" id="{{item}}" data-type="xcimgs" bindlongpress="deleteImg"
|
||||||
|
data-index="{{index}}">
|
||||||
|
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" />
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<view class="weui-uploader__input-box">
|
||||||
|
<view class="weui-uploader__input" bindtap="chooseImage" data-type="xcimgs"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view style="margin-top:4px">
|
||||||
|
<button type="primary" bindtap="confirm" >确定上传</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
/* pages/admin/exam/u'p.wxss */
|
||||||
|
|
@ -23,20 +23,20 @@
|
||||||
"compileHotReLoad": false,
|
"compileHotReLoad": false,
|
||||||
"useMultiFrameRuntime": true,
|
"useMultiFrameRuntime": true,
|
||||||
"useApiHook": true,
|
"useApiHook": true,
|
||||||
"useApiHostProcess": false,
|
|
||||||
"babelSetting": {
|
"babelSetting": {
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"disablePlugins": [],
|
"disablePlugins": [],
|
||||||
"outputPath": ""
|
"outputPath": ""
|
||||||
},
|
},
|
||||||
"enableEngineNative": false,
|
"bundle": false,
|
||||||
"useIsolateContext": true,
|
"useIsolateContext": true,
|
||||||
"useCompilerModule": true,
|
"useCompilerModule": true,
|
||||||
"userConfirmedUseCompilerModuleSwitch": false,
|
"userConfirmedUseCompilerModuleSwitch": false,
|
||||||
"userConfirmedBundleSwitch": false,
|
"userConfirmedBundleSwitch": false,
|
||||||
"packNpmManually": false,
|
"packNpmManually": false,
|
||||||
"packNpmRelationList": [],
|
"packNpmRelationList": [],
|
||||||
"minifyWXSS": true
|
"minifyWXSS": true,
|
||||||
|
"useApiHostProcess": false
|
||||||
},
|
},
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "2.15.0",
|
"libVersion": "2.15.0",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Generated by Django 3.0.4 on 2021-06-13 14:29
|
||||||
|
|
||||||
|
import django.contrib.postgres.fields.jsonb
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('examtest', '0030_examtest_consumer_detail'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='examtest',
|
||||||
|
name='qdimgs',
|
||||||
|
field=django.contrib.postgres.fields.jsonb.JSONField(default=list, verbose_name='签到图片'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='examtest',
|
||||||
|
name='xcimgs',
|
||||||
|
field=django.contrib.postgres.fields.jsonb.JSONField(default=list, verbose_name='现场图片'),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
# Generated by Django 3.0.4 on 2021-06-13 14:34
|
||||||
|
|
||||||
|
import django.contrib.postgres.fields.jsonb
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('examtest', '0031_auto_20210613_2229'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='examtest',
|
||||||
|
name='qdimgs',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='examtest',
|
||||||
|
name='xcimgs',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='exam',
|
||||||
|
name='qdimgs',
|
||||||
|
field=django.contrib.postgres.fields.jsonb.JSONField(default=list, verbose_name='签到图片'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='exam',
|
||||||
|
name='xcimgs',
|
||||||
|
field=django.contrib.postgres.fields.jsonb.JSONField(default=list, verbose_name='现场图片'),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -21,6 +21,8 @@ class Exam(CommonModel):
|
||||||
create_admin = models.ForeignKey(UserProfile, on_delete=models.SET_NULL, null=True, blank=True, related_name='exam_create_admin')
|
create_admin = models.ForeignKey(UserProfile, on_delete=models.SET_NULL, null=True, blank=True, related_name='exam_create_admin')
|
||||||
chance = models.IntegerField('考试机会', default=3)
|
chance = models.IntegerField('考试机会', default=3)
|
||||||
|
|
||||||
|
qdimgs = JSONField('签到图片', default=list)
|
||||||
|
xcimgs = JSONField('现场图片', default=list)
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
@ -49,6 +51,7 @@ class ExamTest(CommonModel):
|
||||||
is_pass = models.BooleanField(default=True, verbose_name='是否通过')
|
is_pass = models.BooleanField(default=True, verbose_name='是否通过')
|
||||||
|
|
||||||
exam = models.ForeignKey(Exam, verbose_name='关联的正式考试', null=True, blank=True, related_name='examtest_exam', on_delete= models.SET_NULL)
|
exam = models.ForeignKey(Exam, verbose_name='关联的正式考试', null=True, blank=True, related_name='examtest_exam', on_delete= models.SET_NULL)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = '模拟考试'
|
verbose_name = '模拟考试'
|
||||||
verbose_name_plural = verbose_name
|
verbose_name_plural = verbose_name
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,13 @@ class ExamViewSet(ModelViewSet):
|
||||||
return Response(ret)
|
return Response(ret)
|
||||||
return Response({'error':'生成试卷失败'})
|
return Response({'error':'生成试卷失败'})
|
||||||
|
|
||||||
|
@action(methods=['post'], detail = True ,perms_map=[{'post':'exam_update'}])
|
||||||
|
def upimgs(self, request, *args, **kwargs):
|
||||||
|
obj = self.get_object()
|
||||||
|
obj.qdimgs = request.data.get('qdimgs', [])
|
||||||
|
obj.xcimgs = request.data.get('xcimgs', [])
|
||||||
|
obj.save()
|
||||||
|
return Response()
|
||||||
|
|
||||||
|
|
||||||
class AnswerDetailView(APIView):
|
class AnswerDetailView(APIView):
|
||||||
|
|
@ -392,6 +399,7 @@ class ExamTestViewSet(PageOrNot, ModelViewSet):
|
||||||
filterset_fields = ['type','is_pass', 'exam']
|
filterset_fields = ['type','is_pass', 'exam']
|
||||||
|
|
||||||
def get_serializer_class(self):
|
def get_serializer_class(self):
|
||||||
|
if self.request:
|
||||||
if self.request.query_params.get('exam', None) or self.request.query_params.get('type') == '正式考试':
|
if self.request.query_params.get('exam', None) or self.request.query_params.get('type') == '正式考试':
|
||||||
return ExamTestExamListSerializer
|
return ExamTestExamListSerializer
|
||||||
return ExamTestListSerializer
|
return ExamTestListSerializer
|
||||||
|
|
@ -536,6 +544,7 @@ class ExamTestViewSet(PageOrNot, ModelViewSet):
|
||||||
candidate.save()
|
candidate.save()
|
||||||
return Response({"id":candidate.pk, "number":candidate.number})
|
return Response({"id":candidate.pk, "number":candidate.number})
|
||||||
|
|
||||||
|
|
||||||
class PaperViewSet(ModelViewSet):
|
class PaperViewSet(ModelViewSet):
|
||||||
"""
|
"""
|
||||||
押题卷增删改查
|
押题卷增删改查
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue