Commit f811cfbc by 陈超

A

parent 6285da92
...@@ -2251,6 +2251,11 @@ class HomeAction extends UserAction ...@@ -2251,6 +2251,11 @@ class HomeAction extends UserAction
break; break;
} }
$this->assign('list', $list); $this->assign('list', $list);
if (isAjax() && && $_GET['api']) {
echo json_encode(['status' => 1, 'data' => $list]);exit;
}
if (isAjax()) { if (isAjax()) {
$html = $this->fetch('exams_w3g_ajax'); $html = $this->fetch('exams_w3g_ajax');
echo json_encode(['status' => 1, 'data' => ['html' => $html]]);exit; echo json_encode(['status' => 1, 'data' => ['html' => $html]]);exit;
......
...@@ -221,11 +221,16 @@ ...@@ -221,11 +221,16 @@
} else if(this.tab == 1) { } else if(this.tab == 1) {
this.loadDownload() this.loadDownload()
} else { } else {
this.onMyTab(this.myTab)
} }
}, },
onMyTab: function(tab) { onMyTab: function(tab) {
this.myTab = tab this.myTab = tab
if(tab == 0) {
this.loadMy()
} else {
}
}, },
onCondition: function(condition) { onCondition: function(condition) {
this.condition.forEach( r => { r.select = false }) this.condition.forEach( r => { r.select = false })
...@@ -302,6 +307,32 @@ ...@@ -302,6 +307,32 @@
} }
} }
}) })
},
//加载我做过的题
loadMy: function() {
let that = this
$.ajax({
type: "GET",
url: "{:U('home/Home/exams')}" + "&api=1",
dataType: "json",
success: function(res) {
console.log(res)
return
if(res.status == 1) {
let array = res.data.data.length > 0 ? res.data.data : []
that.download = [].concat(array.map( r => {
return {
id: r.exams_paper_id,
title: r.exams_paper_title,
price: r.price,
count: r.questions_count,
time: r.reply_time,
person: r.exams_user + "已做"
}
}))
}
}
})
} }
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment