diff --git a/test_mini/app.js b/test_mini/app.js
index 05eae33..614fe1f 100644
--- a/test_mini/app.js
+++ b/test_mini/app.js
@@ -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 : '',
}
diff --git a/test_mini/app.json b/test_mini/app.json
index cc7cb9c..fed93b2 100644
--- a/test_mini/app.json
+++ b/test_mini/app.json
@@ -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",
diff --git a/test_mini/pages/admin/exam/add.json b/test_mini/pages/admin/exam/add.json
index 8835af0..bc12026 100644
--- a/test_mini/pages/admin/exam/add.json
+++ b/test_mini/pages/admin/exam/add.json
@@ -1,3 +1,5 @@
{
- "usingComponents": {}
+ "usingComponents": {
+
+ }
}
\ No newline at end of file
diff --git a/test_mini/pages/admin/exam/add.wxml b/test_mini/pages/admin/exam/add.wxml
index 19c6621..f1cacf4 100644
--- a/test_mini/pages/admin/exam/add.wxml
+++ b/test_mini/pages/admin/exam/add.wxml
@@ -41,8 +41,7 @@
-
+ {{formdata.opentime}}
diff --git a/test_mini/pages/admin/exam/add2.js b/test_mini/pages/admin/exam/add2.js
index 1c62d7d..e5a592f 100644
--- a/test_mini/pages/admin/exam/add2.js
+++ b/test_mini/pages/admin/exam/add2.js
@@ -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(){
diff --git a/test_mini/pages/admin/exam/detail.js b/test_mini/pages/admin/exam/detail.js
new file mode 100644
index 0000000..582b516
--- /dev/null
+++ b/test_mini/pages/admin/exam/detail.js
@@ -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 () {
+
+ }
+})
\ No newline at end of file
diff --git a/test_mini/pages/admin/exam/detail.json b/test_mini/pages/admin/exam/detail.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/test_mini/pages/admin/exam/detail.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/test_mini/pages/admin/exam/detail.wxml b/test_mini/pages/admin/exam/detail.wxml
new file mode 100644
index 0000000..27e8263
--- /dev/null
+++ b/test_mini/pages/admin/exam/detail.wxml
@@ -0,0 +1,2 @@
+
+pages/admin/exam/detail.wxml
diff --git a/test_mini/pages/admin/exam/detail.wxss b/test_mini/pages/admin/exam/detail.wxss
new file mode 100644
index 0000000..c7c5173
--- /dev/null
+++ b/test_mini/pages/admin/exam/detail.wxss
@@ -0,0 +1 @@
+/* pages/admin/exam/detail.wxss */
\ No newline at end of file
diff --git a/test_mini/pages/admin/exam/index.js b/test_mini/pages/admin/exam/index.js
new file mode 100644
index 0000000..b22f606
--- /dev/null
+++ b/test_mini/pages/admin/exam/index.js
@@ -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 () {
+
+ }
+})
\ No newline at end of file
diff --git a/test_mini/pages/admin/exam/index.json b/test_mini/pages/admin/exam/index.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/test_mini/pages/admin/exam/index.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/test_mini/pages/admin/exam/index.wxml b/test_mini/pages/admin/exam/index.wxml
new file mode 100644
index 0000000..cc138e1
--- /dev/null
+++ b/test_mini/pages/admin/exam/index.wxml
@@ -0,0 +1,2 @@
+
+pages/admin/exam/index.wxml
diff --git a/test_mini/pages/admin/exam/index.wxss b/test_mini/pages/admin/exam/index.wxss
new file mode 100644
index 0000000..15a1dc2
--- /dev/null
+++ b/test_mini/pages/admin/exam/index.wxss
@@ -0,0 +1 @@
+/* pages/admin/exam/index.wxss */
\ No newline at end of file
diff --git a/test_mini/pages/admin/index.wxml b/test_mini/pages/admin/index.wxml
index f72b21c..6192f0e 100644
--- a/test_mini/pages/admin/index.wxml
+++ b/test_mini/pages/admin/index.wxml
@@ -35,12 +35,12 @@
发布考试
-
+
考试记录
-
+
diff --git a/test_mini/pages/admin/login.js b/test_mini/pages/admin/login.js
index c1f7ed2..5dfe75c 100644
--- a/test_mini/pages/admin/login.js
+++ b/test_mini/pages/admin/login.js
@@ -21,10 +21,18 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
+
if(options.type=='nologin'){
}else{
- this.mplogin()
+ if(getApp().globalData.admintoken){
+ wx.redirectTo({
+ url: '/pages/admin/index',
+ })
+ }else{
+ this.mplogin()
+ }
+
}
},
diff --git a/test_mini/pages/exam/index.js b/test_mini/pages/exam/index.js
index 66840ab..3339059 100644
--- a/test_mini/pages/exam/index.js
+++ b/test_mini/pages/exam/index.js
@@ -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){
- wx.showToast({
- title: '加入考试成功',
- icon:'none'
+ 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'
+ })
wx.showLoading({
- title: '正在组卷。。。',
+ title: '正在组卷...',
mask:true
})
let exam = res.data.exam
diff --git a/test_mini/pages/exam/index.wxml b/test_mini/pages/exam/index.wxml
index 0cbd729..9b49676 100644
--- a/test_mini/pages/exam/index.wxml
+++ b/test_mini/pages/exam/index.wxml
@@ -45,7 +45,7 @@
-
+
diff --git a/test_server/examtest/models.py b/test_server/examtest/models.py
index d633785..4a9b04d 100644
--- a/test_server/examtest/models.py
+++ b/test_server/examtest/models.py
@@ -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='耗时(秒)')
diff --git a/test_server/examtest/views.py b/test_server/examtest/views.py
index 12a9cfa..350a0d1 100644
--- a/test_server/examtest/views.py
+++ b/test_server/examtest/views.py
@@ -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