diff --git a/test_mini/app.js b/test_mini/app.js
index 614fe1f..05eae33 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/pages/admin/exam/detail.js b/test_mini/pages/admin/exam/detail.js
index 582b516..c3a9dc1 100644
--- a/test_mini/pages/admin/exam/detail.js
+++ b/test_mini/pages/admin/exam/detail.js
@@ -1,11 +1,13 @@
// pages/admin/exam/detail.js
+const api = require("../../../utils/request.js");
Page({
/**
* 页面的初始数据
*/
data: {
-
+ exam:{},
+ tests:[]
},
/**
@@ -13,7 +15,17 @@ Page({
*/
onLoad: function (options) {
if(options.id){
- console.log(options.id)
+ let id = options.id
+ api.requesta(`/examtest/exam/${id}/`, 'GET').then(res=>{
+ this.setData({
+ exam:res.data
+ })
+ })
+ api.requesta('/examtest/examtest/', 'GET', {exam:id, pageoff:true}).then(res=>{
+ this.setData({
+ tests:res.data
+ })
+ })
}
},
diff --git a/test_mini/pages/admin/exam/detail.wxml b/test_mini/pages/admin/exam/detail.wxml
index 27e8263..160b04d 100644
--- a/test_mini/pages/admin/exam/detail.wxml
+++ b/test_mini/pages/admin/exam/detail.wxml
@@ -1,2 +1,51 @@
-
-pages/admin/exam/detail.wxml
+
+
+
+
+ {{exam.name}}
+
+
+
+
+ 考试地点:{{exam.place}}
+
+
+ 开关时间:{{exam.opentime}}-{{exam.closetime}}
+
+
+ 监考人:{{exam.proctor_name}}-{{exam.proctor_phone}}
+
+
+
+
+
+ 共{{tests.count}}人员参加考试
+
+
+
+
+ 考试地点:{{item.place}}
+
+
+ 开关时间:{{item.opentime}}-{{item.closetime}}
+
+
+ 监考人:{{item.proctor_name}}-{{item.proctor_phone}}
+
+
+
+
+ 到底了
+
+
+
+
+
\ No newline at end of file
diff --git a/test_mini/pages/admin/exam/index.js b/test_mini/pages/admin/exam/index.js
index 90549b5..779b458 100644
--- a/test_mini/pages/admin/exam/index.js
+++ b/test_mini/pages/admin/exam/index.js
@@ -6,22 +6,44 @@ Page({
* 页面的初始数据
*/
data: {
-
+ page:1,
+ isLoadedAll:false,
+ count:0,
+ results:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
- wx.showLoading({
- title: '正在查询...',
- })
- api.requesta('/examtest/exam/', 'GET').then(res=>{
- wx.hideLoading()
- this.setData(res.data)
- }).catch(wx.hideLoading())
+ this.getList(1)
+ },
+ getList: function(page) {
+ wx.showLoading({
+ title: '正在加载...',
+ })
+ api.requesta('/examtest/exam/', 'GET', {page:page}).then(res=>{
+ wx.hideLoading()
+ let results = this.data.results
+ let isLoadedAll = false
+ if(res.data.results){
+ if(page==1){results=res.data.results}else{
+ results = results.concat(res.data.results)
+ }
+ }
+ if(!res.data.next){
+ isLoadedAll = true
+ }
+ this.setData({
+ count:res.data.count,
+ results:results,
+ page:page,
+ isLoadedAll: isLoadedAll
+ })
+ }).catch(
+ wx.hideLoading()
+ )
},
-
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -54,14 +76,17 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+ this.getList(1)
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+ if(!this.data.isLoadedAll){
+ this.data.page=this.data.page+1
+ this.getList(this.data.page)
+ }
},
/**
diff --git a/test_mini/pages/admin/exam/index.json b/test_mini/pages/admin/exam/index.json
index 8835af0..eb97555 100644
--- a/test_mini/pages/admin/exam/index.json
+++ b/test_mini/pages/admin/exam/index.json
@@ -1,3 +1,4 @@
{
- "usingComponents": {}
+ "usingComponents": {},
+ "enablePullDownRefresh":true
}
\ No newline at end of file
diff --git a/test_mini/pages/admin/exam/index.wxml b/test_mini/pages/admin/exam/index.wxml
index db32933..11267ff 100644
--- a/test_mini/pages/admin/exam/index.wxml
+++ b/test_mini/pages/admin/exam/index.wxml
@@ -2,7 +2,7 @@
已发布的考试,共{{count}}场
-
+
+
+
+ 到底了
+