新增管理员入口
This commit is contained in:
parent
c7451fdc08
commit
b050181c55
|
@ -70,9 +70,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 : '',
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
"pages/admin/index",
|
||||
"pages/admin/login",
|
||||
"pages/admin/exam/add",
|
||||
"pages/admin/exam/add2"
|
||||
"pages/admin/exam/detail",
|
||||
"pages/admin/exam/index"
|
||||
],
|
||||
"window": {
|
||||
"backgroundTextStyle": "light",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{
|
||||
"usingComponents": {}
|
||||
"usingComponents": {
|
||||
|
||||
}
|
||||
}
|
|
@ -41,8 +41,7 @@
|
|||
<label class="weui-label">开启时间</label>
|
||||
</view>
|
||||
<view class="weui-cell__bd">
|
||||
<input class="weui-input" placeholder="选择考试开启时间" placeholder-class="weui-input__placeholder"
|
||||
bindinput="addressInput" />
|
||||
<date-time-picker value="{{formdata.opentime}}" bind:change="handleChange">{{formdata.opentime}}</date-time-picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-cell weui-cell_active">
|
||||
|
|
|
@ -114,20 +114,42 @@ Page({
|
|||
toSubmit: Math.random()
|
||||
},
|
||||
onFormSubmit(e){
|
||||
console.log('表单提交: ', e);
|
||||
//console.log('表单提交: ', e);
|
||||
let x = {};
|
||||
x.opentime = e.daterange.startDate;
|
||||
x.endtime = e.daterange.endDate;
|
||||
x.name = e.name
|
||||
x.place = e.place
|
||||
x.chance = e.chance
|
||||
x.workscope = e.workscope
|
||||
x.proctor_name = e.proctor_name
|
||||
x.proctor_phone = e.proctor_phone
|
||||
console.log(x)
|
||||
x.opentime = e.detail.daterange.startDate;
|
||||
x.closetime = e.detail.daterange.endDate;
|
||||
x.name = e.detail.name.value
|
||||
x.place = e.detail.place.value
|
||||
x.chance = e.detail.chance.value
|
||||
x.workscope = e.detail.workscope.original.range[e.detail.workscope.idx].id
|
||||
x.proctor_name = e.detail.proctor_name.value
|
||||
x.proctor_phone = e.detail.proctor_phone.value
|
||||
wx.showModal({
|
||||
content: '确认发布考试吗',
|
||||
success (res) {
|
||||
if (res.confirm) {
|
||||
api.requesta('/examtest/exam/', 'POST', x).then(res=>{
|
||||
let rdata = res.data
|
||||
wx.showModal({
|
||||
title: '发布成功',
|
||||
content: '考试号为' + rdata.code,
|
||||
showCancel: false,
|
||||
success (res) {
|
||||
if (res.confirm) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/admin/exam/detail?id='+rdata.id,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
注意
|
||||
},
|
||||
onFormChange(e){
|
||||
console.log('表单变化: ',e);
|
||||
//console.log('表单变化: ',e);
|
||||
},
|
||||
//变更数值, 触发表单提交事件
|
||||
toSubmitChange(){
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
// pages/admin/exam/detail.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
if(options.id){
|
||||
console.log(options.id)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"usingComponents": {}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
<!--pages/admin/exam/detail.wxml-->
|
||||
<text>pages/admin/exam/detail.wxml</text>
|
|
@ -0,0 +1 @@
|
|||
/* pages/admin/exam/detail.wxss */
|
|
@ -0,0 +1,66 @@
|
|||
// pages/admin/exam/index.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"usingComponents": {}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
<!--pages/admin/exam/index.wxml-->
|
||||
<text>pages/admin/exam/index.wxml</text>
|
|
@ -0,0 +1 @@
|
|||
/* pages/admin/exam/index.wxss */
|
|
@ -35,12 +35,12 @@
|
|||
</view>
|
||||
<view class="weui-grid__label">发布考试</view>
|
||||
</navigator>
|
||||
<a class="weui-grid" bindtap="goYati">
|
||||
<navigator class="weui-grid" url="/pages/admin/exam/index">
|
||||
<view class="weui-grid__icon">
|
||||
<image src="/images/examtest.svg" alt></image>
|
||||
</view>
|
||||
<view class="weui-grid__label">考试记录</view>
|
||||
</a>
|
||||
</navigator>
|
||||
<navigator class="weui-grid" url="/pages/cuoti/index">
|
||||
<view class="weui-grid__icon">
|
||||
<image src="/images/candidate.svg" alt></image>
|
||||
|
|
|
@ -21,12 +21,20 @@ Page({
|
|||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
if(options.type=='nologin'){
|
||||
|
||||
}else{
|
||||
if(getApp().globalData.admintoken){
|
||||
wx.redirectTo({
|
||||
url: '/pages/admin/index',
|
||||
})
|
||||
}else{
|
||||
this.mplogin()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,33 +13,38 @@ Page({
|
|||
}
|
||||
},
|
||||
|
||||
idInput: function(e){
|
||||
idinput: function(e){
|
||||
this.data.form.ID_number = e.detail.value
|
||||
},
|
||||
|
||||
nametInput: function(e){
|
||||
nameinput: function(e){
|
||||
this.data.form.name = e.detail.value
|
||||
},
|
||||
|
||||
companyInput: function(e){
|
||||
companyinput: function(e){
|
||||
this.data.form.company_name = e.detail.value
|
||||
},
|
||||
deptInput: function(e){
|
||||
deptinput: function(e){
|
||||
this.data.form.deptname = e.detail.value
|
||||
},
|
||||
codeinput: function(e){
|
||||
this.data.form.code = e.detail.value
|
||||
},
|
||||
submit: function(){
|
||||
if(this.data.form.deptname&&this.data.form.code){
|
||||
var that = this
|
||||
if(this.data.form.deptname&&this.data.form.code&&this.data.form.name&&this.data.form.company_name&&this.data.form.ID_number){
|
||||
wx.showLoading({
|
||||
title: '加入考试...',
|
||||
mask:true
|
||||
})
|
||||
let data = this.data.form
|
||||
api.request('/examtest/exam/attend/','POST', data).then(res=>{
|
||||
wx.showToast({
|
||||
title: '加入考试成功',
|
||||
icon:'none'
|
||||
})
|
||||
let data = this.data.form
|
||||
api.request('/examtest/exam/attend/','POST', data).then(res=>{
|
||||
wx.showLoading({
|
||||
title: '正在组卷。。。',
|
||||
title: '正在组卷...',
|
||||
mask:true
|
||||
})
|
||||
let exam = res.data.exam
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
</view>
|
||||
<view class="weui-cell__bd">
|
||||
<!-- <span wx:if="{{userinfo.deptname}}">{{userinfo.deptname}}</span> -->
|
||||
<input class="weui-input" placeholder="填写您的部门" placeholder-class="weui-input__placeholder" bindinput="deptInput" value="{{form.deptname}}">
|
||||
<input class="weui-input" placeholder="填写您的部门" placeholder-class="weui-input__placeholder" bindinput="deptinput" value="{{form.deptname}}">
|
||||
</input>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -39,6 +39,7 @@ class ExamTest(CommonModel):
|
|||
workscope = models.ForeignKey(WorkScope, on_delete=models.SET_NULL, verbose_name='工作类别', null=True, blank=True)
|
||||
paper = models.ForeignKey(Paper, on_delete=models.SET_NULL, verbose_name='所用试卷', null=True, blank=True)
|
||||
consumer = models.ForeignKey(Consumer, on_delete=models.CASCADE, verbose_name='模考人')
|
||||
consumer_detail = JSONField('用户详情', null=True, blank=True)
|
||||
total_score = models.FloatField(default=0, verbose_name='总分')
|
||||
score = models.FloatField(default=0, verbose_name='得分')
|
||||
took = models.IntegerField(default=0, verbose_name='耗时(秒)')
|
||||
|
|
|
@ -82,7 +82,7 @@ class ExamViewSet(ModelViewSet):
|
|||
instance = serializer.save(create_admin=request.user)
|
||||
instance.code = instance.pk + 10000
|
||||
instance.save()
|
||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||
return Response({"code":instance.code, "id":instance.pk}, status=status.HTTP_201_CREATED)
|
||||
|
||||
def destroy(self, request, *args, **kwargs):
|
||||
instance = self.get_object()
|
||||
|
@ -123,6 +123,7 @@ class ExamViewSet(ModelViewSet):
|
|||
ret = {}
|
||||
if workscope.name in ['医学Ⅲ类', '非医学Ⅲ类']:
|
||||
ret['name'] = obj.name
|
||||
ret['consumer_detail'] = request.data
|
||||
ret['type'] = '正式考试' # 正式考试
|
||||
ret['exam'] = kwargs['pk']
|
||||
ret['exam_'] = ExamListSerializer(instance=obj).data
|
||||
|
|
Loading…
Reference in New Issue