<!DOCTYPE html>
|
<html>
|
<head>
|
<meta charset="utf-8" />
|
<meta http-equiv="X-UA-Compatible" content="chrome=1"/>
|
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
|
<title>今日推荐</title>
|
<link rel="stylesheet" type="text/css" href="../../../../css/doui.min.css"/>
|
<script src="../../../../js/doui.min.js" type="text/javascript" charset="utf-8"></script>
|
<script src="../../../../js/requestHost.js" type="text/javascript" charset="utf-8"></script>
|
<script type="text/javascript">
|
doui.importLoad({
|
importArray: [
|
// 雷打不动
|
getHostPath() + "js/jquery.min.js",
|
getHostPath() + "js/vue.min.js",
|
// 字体图标
|
getHostPath() + "fontAdmin/iconfont.css",
|
getHostPath() + "font/iconfont.css",
|
// dom模板
|
getHostPath() + "css/admin-all.css",
|
getHostPath() + "js/admin-creat.js",
|
],
|
});
|
</script>
|
</head>
|
<body class="fontPC">
|
<div class="winSizeBox">
|
|
<!-- =============================================================== 搜索筛选(顶部) -->
|
<div id="thisHeader" style="width:7.5rem;"></div>
|
|
<!-- =============================================================== 表格 -->
|
<div id="thisTable" class="admin-main-overHeader"></div>
|
|
</div>
|
</body>
|
</html>
|
|
|
<script type="text/javascript">
|
|
// ==================================================================================== 页面数据
|
doui.onReady({
|
success: function ()
|
{
|
// ----------------------------------------------------- 顶部
|
// 生成顶部筛选项dom
|
adminDom.header.creat({ el: "#thisHeader" });
|
// 输入搜索
|
adminDom.header.input({ placeholder: "标题 / 内容", });
|
// 筛选项
|
adminDom.header.screen({
|
show: true,
|
list: [
|
{
|
title: "推送状态",
|
muchCheck: false, // 是否可以多选
|
child: [
|
{ key: [1], value: "已推送", check: false },
|
{ key: [0], value: "未推送", check: false },
|
],
|
input: { type: "number", num: 0 },
|
}
|
],
|
});
|
|
|
// ----------------------------------------------------- 表格
|
// 表格dom创建
|
adminDom.table.creat({
|
el: "#thisTable",
|
// 搜索触发
|
touchSearch: function (optC)
|
{
|
doui.showLoading({ content: "加载列表" });
|
doui.request({
|
type: "jsonp",
|
url: gethttp() + "/admin/new/api/v1/pushgoods/query",
|
data: {
|
pageIndex: optC.table.page, // 页码
|
pageSize: optC.table.pageSize, // 每页数量
|
key: optC.input[0].result, // 搜索关键字
|
state: optC.screen[0].result[0], // 只看哪种用户
|
},
|
success: function (res)
|
{
|
doui.hideLoading();
|
if (res.code != 0) { doui.showToast({ content: res.msg }); }
|
else
|
{
|
// 申明 表格内容数据
|
var mo_tr = []; // tr组
|
for (var i = 0, mo = res.data.result_list; i < mo.length; i++)
|
{
|
// 当前行
|
var thatTr = {
|
check: false,
|
td: [
|
{ title: "ID", key: mo[i].id, value: mo[i].id },
|
{ title: "标题", key: mo[i].title, value: mo[i].title },
|
{ title: "内容", key: mo[i].content, value: mo[i].content },
|
{ title: "状态", key: mo[i].isPush, value: mo[i].isPush },
|
{ title: "预设时间", key: mo[i].controlTime_str, value: mo[i].controlTime_str, "class": "font13 font-gray" },
|
{ title: "推送时间", key: mo[i].pushTime, value: mo[i].pushTime, "class": "font13 font-gray" },
|
{ title: "安卓推送版本", key: mo[i].listAndroid, value: "(未返回)", "class": "font-gray" },
|
{ title: "IOS推送版本", key: mo[i].listIOS, value: "(未返回)", "class": "font-gray" },
|
{ title: "推送用户", key: mo[i].uid, value: mo[i].uid },
|
],
|
};
|
// 状态分析
|
if (thatTr.td[3].key == 1) { thatTr.td[3].value = "已推送"; thatTr.td[3]["class"] = "font-green"; }
|
else if (thatTr.td[3].key == 0) { thatTr.td[3].value = "未推送"; thatTr.td[3]["class"] = "font-orange"; }
|
else if (thatTr.td[3].key == 2) { thatTr.td[3].value = "推送失败"; thatTr.td[3]["class"] = "font-red"; }
|
|
// 版本分析
|
if (thatTr.td[6].key) { thatTr.td[6].value = thatTr.td[6].key.join("—"); thatTr.td[6]["class"] = ""; }
|
if (thatTr.td[7].key) { thatTr.td[7].value = thatTr.td[7].key.join("—"); thatTr.td[7]["class"] = ""; }
|
|
// 用户分析
|
if (!thatTr.td[8].key || thatTr.td[8].key == 0 || thatTr.td[8].key == "") {
|
thatTr.td[8].value = "不限"; thatTr.td[8]["class"]="font-gray";
|
}
|
|
// 将当前行放入tr组
|
mo_tr.push(thatTr);
|
}
|
// 更新表格的数据
|
adminDom.table.opt({ pageMax: res.data.pe.totalPage }); // 最大页码
|
adminDom.table.tbody({ tr: mo_tr }); // 内容数据
|
}
|
}
|
});
|
},
|
});
|
// 表格设置
|
adminDom.table.opt({ pageSize: 20, });
|
// 表格头排
|
adminDom.table.thead({
|
th: [
|
{ title: "ID", width: "0.4rem", orderUp: "", orderDown: "" },
|
{ title: "标题", width: "0.8rem", orderUp: "", orderDown: "" },
|
{ title: "内容", width: "0.8rem", orderUp: "", orderDown: "" },
|
{ title: "状态", width: "0.4rem", orderUp: "", orderDown: "" },
|
{ title: "预设时间", width: "0.6rem", orderUp: "", orderDown: "" },
|
{ title: "推送时间", width: "0.6rem", orderUp: "", orderDown: "" },
|
{ title: "安卓推送版本", width: "0.6rem", orderUp: "", orderDown: "" },
|
{ title: "IOS推送版本", width: "0.6rem", orderUp: "", orderDown: "" },
|
{ title: "推送用户", width: "0.6rem", orderUp: "", orderDown: "" },
|
]
|
});
|
// 工具栏
|
adminDom.table.tools({
|
show: true,
|
list: [
|
{ "title": "新建", "name": "add", "icon": "fi fi-plus" },
|
{ "title": "删除", "name": "del", "icon": "fi fi-trash" },
|
{ "title": "修改", "name": "edit", "icon": "fi fi-edit-box" },
|
{ "title": "推送", "name": "work", "icon": "admin adminhuaban" },
|
],
|
touch: function (back)
|
{
|
// 新建
|
if (back.toolName == "add")
|
{
|
// 直接跳转到编辑页
|
doui.pageToUrl({
|
type: "replace",
|
url: "today_evaluate.html",
|
data: {
|
type: "new",
|
},
|
});
|
}
|
|
// 删除
|
else if (back.toolName == "del")
|
{
|
// 获取所选行的ID
|
var zu_id = new Array();
|
for (var i = 0, mo = back.list; i < mo.length; i++) { zu_id.push(mo[i][0].key); }
|
// 发起请求
|
doui.showLoading({ content: "正在删除" });
|
doui.request({
|
type: "jsonp",
|
url: gethttp() + "/admin/new/api/v1/pushgoods/delete",
|
data: { idArray: zu_id, },
|
success: function (res)
|
{
|
doui.hideLoading();
|
if (res.code != 0) { doui.showToast({ content: res.msg }); }
|
else { doui.showToast({ content: "删除成功" }); vm_table.search(); }
|
}
|
});
|
}
|
|
// 修改
|
else if (back.toolName == "edit")
|
{
|
if (back.list.length > 1) { doui.showToast({ content: "一次只能操作一个" }); return false; }
|
var item = back.list[0]; // 获取第一个选择的行
|
|
// 跳转到编辑页
|
doui.pageToUrl({
|
type: "replace",
|
url: "today_evaluate.html",
|
data: {
|
type: "updata",
|
id: item[0].key,
|
},
|
});
|
}
|
|
// 推送
|
else if (back.toolName == "work")
|
{
|
// 获取所选行的ID
|
var zu_id = new Array();
|
for (var i = 0, mo = back.list; i < mo.length; i++) { zu_id.push(mo[i][0].key); }
|
// 发起请求
|
doui.showLoading({ content: "正在推送" });
|
doui.request({
|
type: "jsonp",
|
url: gethttp() + "/admin/new/api/v1/pushgoods/push",
|
data: { idArray: zu_id, },
|
success: function (res)
|
{
|
doui.hideLoading();
|
if (res.code != 0) { doui.showToast({ content: res.msg }); }
|
else { doui.showToast({ content: "推送成功" }); vm_table.search(); }
|
}
|
});
|
}
|
|
}
|
});
|
|
|
// ----------------------------------------------------- 初始行为
|
// 模拟搜索点击
|
vm_table.search();
|
}
|
});
|
|
</script>
|