Jquery,seaJs非同步重新整理,複製

來源:互聯網
上載者:User

標籤:

 

 

define(function(require, exports, module) {
var $ = require("jquery")
exports.getMoreData = function(courseMineTemplate_div, currentPage,
pageSize) {
$.post("/outside/web/course/list.htm", {
currentPage : currentPage,
pageSize : pageSize

}, function(data) {
if (data.header.flag == 1 && data.content != null) {
var pagination = data.content.pagination;
var pageCount = pagination.pageCount;
var nextPage = pagination.currentPage + 1;
$("#mine_course_show_page_num").attr("value", nextPage);
var courses = data.content.courses;
if (currentPage==pageCount) {
$("#bt_more_mine").hide();
}
if (courses != null && courses.length != 0) {
for ( var i = 0; i < courses.length; i++) {
processMineCourse(courseMineTemplate_div, data,
courses[i]);
}
} else {

}
}

}, "json");

}
/** 組裝與我參與的課程* */
function processMineCourse(courseMineTemplate_div_div, data, course) {
var cloneDiv = courseMineTemplate_div_div.clone(true);
cloneDiv.find("#course_pic").find("a").attr("href", "###");
cloneDiv.find("#course_image").attr("src", course.cover);
cloneDiv.find("#mine_major_name").html(course.majorName);
cloneDiv.find("#course_name").html(course.name);
cloneDiv.find("#mine_grade_name").html(course.gradeName);
cloneDiv.find("#course_operate_time").html(
formateDateSimple(course.operateTime));

if (course.metaValue == "course") {
// cloneDiv.find("#buy_quantity").html("0");

} else if (course.metaValue == "commodity_course") {
cloneDiv.find("#buy_quantity").html(course.statistics.buyQuantity);
cloneDiv.find("#course_questionQuantity").html(
course.statistics.questionQuantity);
cloneDiv.find("#course_notesQuantity").html(
course.statistics.notesQuantity);

}

courseMineTemplate_div_div.before(cloneDiv);
cloneDiv.attr("style", "display:block");
}

/** 時間格式轉換* */
function formateDateSimple(date) {
date = date.split(" ")[0];
return date;

}

})

 

 

seajs.use(["jquery","teacher_course_mine_achieve"],function($,teacher_course_mine_achieve){

/** * 載入與自己相關的課程*/
$("#bt_more_mine").click(function(event){
var courseMineTemplate_div=$("#mine_teach_con");
var currentPage=$("#mine_course_show_page_num").val();
var pageSize=5;
teacher_course_mine_achieve.getMoreData(courseMineTemplate_div,currentPage,pageSize);

});

});

Jquery,seaJs非同步重新整理,複製

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.