feat: 修改字段的存储长度 和 考试次数

This commit is contained in:
zty 2025-04-22 10:16:38 +08:00
parent 784bc092c0
commit 88d1bbe517
4 changed files with 36 additions and 11 deletions

View File

@ -98,8 +98,8 @@
</div> </div>
</el-dialog> </el-dialog>
<pagination <pagination
v-show="tableData.count>0" v-show="(tableData.count>0) || 0"
:total="tableData.count" :total="tableData.count || 0"
:page.sync="listQuery.page" :page.sync="listQuery.page"
:limit.sync="listQuery.limit" :limit.sync="listQuery.limit"
@pagination="getList" @pagination="getList"
@ -180,8 +180,8 @@
</div> </div>
</el-dialog> </el-dialog>
<pagination <pagination
v-show="tableData2.count>0" v-show="(tableData2.count>0) || 0"
:total="tableData2.count" :total="tableData2.count || 0"
:page.sync="listQuery2.page" :page.sync="listQuery2.page"
:limit.sync="listQuery2.limit" :limit.sync="listQuery2.limit"
@pagination="getList2" @pagination="getList2"
@ -226,8 +226,8 @@ export default {
is_show: true, is_show: true,
listLoading: true, listLoading: true,
dialogVisible: false, dialogVisible: false,
dialogType: 'new', dialogType: '',
dialogType2: 'new', dialogType2: '',
showEditor: true, showEditor: true,
dialogVisible2: false, dialogVisible2: false,
childCompy: {}, childCompy: {},
@ -289,7 +289,7 @@ export default {
this.companydata = JSON.parse(JSON.stringify(scope.row)) this.companydata = JSON.parse(JSON.stringify(scope.row))
this.showEditor = true this.showEditor = true
this.dialogVisible = true this.dialogVisible = true
this.dialogType = 'edit'
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.commonForm && this.$refs.commonForm.clearValidate() this.$refs.commonForm && this.$refs.commonForm.clearValidate()
}) })

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2.12 on 2025-04-22 02:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cms', '0020_auto_20250417_1538'),
]
operations = [
migrations.AlterField(
model_name='companyinfo',
name='remark',
field=models.TextField(blank=True, max_length=5000, null=True, verbose_name='备注'),
),
migrations.AlterField(
model_name='userpz',
name='art_remark',
field=models.TextField(blank=True, max_length=5000, null=True, verbose_name='备注'),
),
]

View File

@ -68,7 +68,7 @@ class Threshold(CommonModel):
class Userpz(CommonModel): class Userpz(CommonModel):
art_name = models.CharField('姓名', max_length=50) art_name = models.CharField('姓名', max_length=50)
art_photo = models.CharField('照片', max_length=100) art_photo = models.CharField('照片', max_length=100)
art_remark = models.TextField('备注', null=True, blank=True, max_length=1000) art_remark = models.TextField('备注', null=True, blank=True, max_length=5000)
def __str__(self): def __str__(self):
return self.art_name return self.art_name
@ -80,7 +80,7 @@ class CompanyInfo(CommonModel):
co_sponsor_points = models.FloatField('协办大赛积分', null=True, blank=True) co_sponsor_points = models.FloatField('协办大赛积分', null=True, blank=True)
sum_points = models.FloatField('总积分', null=True, blank=True) sum_points = models.FloatField('总积分', null=True, blank=True)
photo = models.CharField('公司图片', null=True, blank=True, max_length=100) photo = models.CharField('公司图片', null=True, blank=True, max_length=100)
remark = models.TextField('备注', null=True, blank=True, max_length=1000) remark = models.TextField('备注', null=True, blank=True, max_length=5000)
def __str__(self): def __str__(self):
return self.company_name return self.company_name

View File

@ -39,6 +39,7 @@ from django.db import transaction
from examtest.exports import gen_candidate from examtest.exports import gen_candidate
from .services import issue from .services import issue
from django.db import transaction from django.db import transaction
from server import conf
# Create your views here. # Create your views here.
class ExamViewSet(ModelViewSet): class ExamViewSet(ModelViewSet):
@ -103,6 +104,7 @@ class ExamViewSet(ModelViewSet):
""" """
参加考试 参加考试
""" """
exam_chance = getattr(conf, 'exam_chance', 3)
consumer = request.user consumer = request.user
if request.data.get('deptname', None): if request.data.get('deptname', None):
consumer.deptname = request.data['deptname'] consumer.deptname = request.data['deptname']
@ -115,7 +117,7 @@ class ExamViewSet(ModelViewSet):
if exam.only_vip and consumer.role.name != '培训班学员': if exam.only_vip and consumer.role.name != '培训班学员':
return Response({'error':'您无法参加本场考试'}) return Response({'error':'您无法参加本场考试'})
tests = ExamTest.objects.filter(exam=exam, consumer=consumer) tests = ExamTest.objects.filter(exam=exam, consumer=consumer)
if tests.count() < exam.chance: # 还有考试机会就可以接着考 if tests.count() < exam_chance: # 还有考试机会就可以接着考
return Response({'exam':exam.pk}) return Response({'exam':exam.pk})
return Response({'error':'考试机会不足'}) return Response({'error':'考试机会不足'})
except: except: