Files
ClassContent/历届学生/font-end-nine/项目练习/学生项目/杨锐/枸杞社/js/serve/index.js
2024-09-27 02:06:13 +08:00

56 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class IndexServe {
//首页
async index(data = {}) {
var ajax = new Ajax()
var res = await ajax.get({
url: config.apiList.index,
data: data,
});
ajax = null;
return res
} //
//每一页
async classListArr(data = {}) {
return await (new Ajax()).get({
url: config.apiList.classListArr,
data: data,
});
}
//导航菜单
async classList(data = {}) {
var res = await (new Ajax()).get({
url: config.apiList.classList,
data: data,
});
res.principal.unshift({
id: -1,
page: 1,
title: "首页",
}) //向res.principal数组前面追加数据(unshift)添加首页
res.principal.forEach(v => {
v.content = []; //为每条对象动态添加了content用来保存数据 默认值为空
v.page = 1;
v.total_page = 0
})
return res;
}
//详情
async info(data = {}) {
return await (new Ajax()).get({
url: config.apiList.info,
data: data,
});
}
}
var indexServe = new IndexServe()