|
|
<!DOCTYPE html>
|
|
|
<html>
|
|
|
<head>
|
|
|
<meta charset="UTF-8" />
|
|
|
<meta charset="UTF-8"/>
|
|
|
<title>Yoho!Buy运营平台</title>
|
|
|
<script src="/pfcms/js/include.js"></script>
|
|
|
<script src="/pfcms/js/ajaxfileupload.js"></script>
|
...
|
...
|
@@ -17,14 +17,15 @@ |
|
|
cursor: pointer;
|
|
|
text-align: center;
|
|
|
}
|
|
|
|
|
|
.btn-long:hover {
|
|
|
opacity: 0.9;
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
</head>
|
|
|
<body class="easyui-layout" >
|
|
|
<div region="north" style="height: 200px;">
|
|
|
<body class="easyui-layout">
|
|
|
<div region="north" style="height: 200px;">
|
|
|
<script>
|
|
|
document.write(addHead('运营管理', '话题管理'));
|
|
|
</script>
|
...
|
...
|
@@ -32,15 +33,15 @@ |
|
|
<div style="margin-left: 20px;margin-top: 10px">
|
|
|
|
|
|
<input class="easyui-textbox" id="topicNameParam" style="width: 140px">
|
|
|
|
|
|
|
|
|
</input>
|
|
|
|
|
|
<input class="easyui-combobox" id="statusParam" >
|
|
|
<input class="easyui-combobox" id="statusParam">
|
|
|
</input>
|
|
|
|
|
|
<input id="startTimeStr" name="startTimeStr" class="easyui-datetimebox" data-options="prompt:'开始时间'"/>
|
|
|
|
|
|
~
|
|
|
~
|
|
|
<input id="endTimeStr" name="endTimeStr" class="easyui-datetimebox" data-options="prompt:'结束时间'"/>
|
|
|
</input>
|
|
|
|
...
|
...
|
@@ -64,45 +65,45 @@ |
|
|
|
|
|
<script>
|
|
|
|
|
|
$(function() {
|
|
|
$(function () {
|
|
|
//用于页面刷新后的数据行定位
|
|
|
var index ="";
|
|
|
var index = "";
|
|
|
$("#allBtn").linkbutton({
|
|
|
iconCls : "icon-search",
|
|
|
onClick : function() {
|
|
|
iconCls: "icon-search",
|
|
|
onClick: function () {
|
|
|
$("#labelListTable").datagrid("load", {});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#topicNameParam").textbox({
|
|
|
required:false,
|
|
|
required: false,
|
|
|
prompt: "请输入话题名称"
|
|
|
});
|
|
|
|
|
|
$("#statusParam").combobox({
|
|
|
valueField : "value",
|
|
|
textField : "text",
|
|
|
required:false,
|
|
|
valueField: "value",
|
|
|
textField: "text",
|
|
|
required: false,
|
|
|
prompt: "请选择状态",
|
|
|
data:[{text:"请选择状态",value:""},{text:"进行中",value:"1"},{text:"已下架",value:"0"}]
|
|
|
data: [{text: "请选择状态", value: ""}, {text: "进行中", value: "1"}, {text: "已下架", value: "0"}]
|
|
|
});
|
|
|
|
|
|
$("#searchBtn").linkbutton({
|
|
|
iconCls : "icon-search",
|
|
|
onClick : function() {
|
|
|
var startTime="";
|
|
|
var endTime="";
|
|
|
if ($("#startTimeStr").datetimebox('getValue')!='') {
|
|
|
iconCls: "icon-search",
|
|
|
onClick: function () {
|
|
|
var startTime = "";
|
|
|
var endTime = "";
|
|
|
if ($("#startTimeStr").datetimebox('getValue') != '') {
|
|
|
startTime = parseInt(new Date($("#startTimeStr").datetimebox('getValue')).getTime() / 1000);
|
|
|
}
|
|
|
if ($("#endTimeStr").datetimebox('getValue')!='') {
|
|
|
if ($("#endTimeStr").datetimebox('getValue') != '') {
|
|
|
endTime = parseInt(new Date($("#endTimeStr").datetimebox('getValue')).getTime() / 1000);
|
|
|
}
|
|
|
$("#labelListTable").datagrid("load", {
|
|
|
topicName: $("#topicNameParam").textbox("getValue"),
|
|
|
status: $("#statusParam").combobox("getValue"),
|
|
|
startTime:startTime,
|
|
|
endTime:endTime
|
|
|
startTime: startTime,
|
|
|
endTime: endTime
|
|
|
});
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -119,10 +120,10 @@ |
|
|
fitColumns: true,
|
|
|
striped: true,
|
|
|
/*queryParams: {
|
|
|
rewardName: $("#rewardName1").textbox("getValue"),
|
|
|
status: $("#rewardstatus1").combobox("getValue"),
|
|
|
type: $("#rewardtype1").combobox("getValue")
|
|
|
},*/
|
|
|
rewardName: $("#rewardName1").textbox("getValue"),
|
|
|
status: $("#rewardstatus1").combobox("getValue"),
|
|
|
type: $("#rewardtype1").combobox("getValue")
|
|
|
},*/
|
|
|
url: serverContextPath + "/grassTopicManage/getGrassTopicList",
|
|
|
method: 'POST',
|
|
|
loadFilter: function (data) {
|
...
|
...
|
@@ -155,7 +156,7 @@ |
|
|
width: 25,
|
|
|
align: "left",
|
|
|
formatter: function (value, rowData, rowIndex) {
|
|
|
return '<a target="_blank" href="'+value+'"><img src="' + value + '" style="width: 120px;height: 120px;" /></a>';
|
|
|
return '<a target="_blank" href="' + value + '"><img src="' + value + '" style="width: 120px;height: 120px;" /></a>';
|
|
|
}
|
|
|
},
|
|
|
{
|
...
|
...
|
@@ -164,34 +165,33 @@ |
|
|
width: 25,
|
|
|
align: "left",
|
|
|
formatter: function (value, rowData, rowIndex) {
|
|
|
var str ="";
|
|
|
for (var i=0;i< value.length;i++)
|
|
|
{
|
|
|
str += value[i].labelName + " ";
|
|
|
var str = "";
|
|
|
for (var i = 0; i < value.length; i++) {
|
|
|
str += value[i].labelName + " ";
|
|
|
}
|
|
|
return str;
|
|
|
}
|
|
|
},{
|
|
|
}, {
|
|
|
title: "创建时间",
|
|
|
field: "createTimeStr",
|
|
|
width: 25,
|
|
|
align: "left"
|
|
|
},{
|
|
|
}, {
|
|
|
title: "参与人数",
|
|
|
field: "attAmount",
|
|
|
width: 25,
|
|
|
align: "left"
|
|
|
},{
|
|
|
}, {
|
|
|
title: "状态",
|
|
|
field: "status",
|
|
|
width: 25,
|
|
|
align: "left",
|
|
|
formatter: function (value, rowData, rowIndex) {
|
|
|
if(value == 1){
|
|
|
return "进行中";
|
|
|
}else{
|
|
|
return "已下架";
|
|
|
}
|
|
|
if (value == 1) {
|
|
|
return "进行中";
|
|
|
} else {
|
|
|
return "已下架";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
},
|
...
|
...
|
@@ -201,10 +201,11 @@ |
|
|
width: 40,
|
|
|
align: "center",
|
|
|
formatter: function (value, rowData, rowIndex) {
|
|
|
var str = "<a role='edit' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #31b0d5' index='"+ rowIndex +"'>编辑</a>";
|
|
|
var changeStatus = "<a role='changeStatus' style='margin-left:10px;background-color: #ffa951' changedStatus='0' dataId='"+ rowData.id +"' index='"+ rowIndex +"'>下架</a>";;
|
|
|
if(rowData.status == 0){
|
|
|
changeStatus = "<a role='changeStatus' style='margin-left:10px;background-color: #ffa951' changedStatus='1' dataId='"+ rowData.id +"' index='"+ rowIndex +"'>上架</a>";
|
|
|
var str = "<a role='edit' dataId='" + rowData.id + "' style='margin-left:10px;background-color: #31b0d5' index='" + rowIndex + "'>编辑</a>";
|
|
|
var changeStatus = "<a role='changeStatus' style='margin-left:10px;background-color: #ffa951' changedStatus='0' dataId='" + rowData.id + "' index='" + rowIndex + "'>下架</a>";
|
|
|
;
|
|
|
if (rowData.status == 0) {
|
|
|
changeStatus = "<a role='changeStatus' style='margin-left:10px;background-color: #ffa951' changedStatus='1' dataId='" + rowData.id + "' index='" + rowIndex + "'>上架</a>";
|
|
|
}
|
|
|
return str + changeStatus;
|
|
|
}
|
...
|
...
|
@@ -219,8 +220,8 @@ |
|
|
singleSelect: true,
|
|
|
onLoadSuccess: function (data) {
|
|
|
|
|
|
if(index != ""){
|
|
|
$(this).datagrid("scrollTo",index);
|
|
|
if (index != "") {
|
|
|
$(this).datagrid("scrollTo", index);
|
|
|
index = "";
|
|
|
}
|
|
|
// $(this).datagrid("getPanel").find("a[role='close']").linkbutton({
|
...
|
...
|
@@ -252,9 +253,9 @@ |
|
|
|
|
|
// 编辑
|
|
|
$(this).datagrid("getPanel").find("a[role='edit']").linkbutton({
|
|
|
iconCls : "icon-edit",
|
|
|
onClick : function() {
|
|
|
|
|
|
iconCls: "icon-edit",
|
|
|
onClick: function () {
|
|
|
|
|
|
index = $(this).attr("index");
|
|
|
var row = $("#labelListTable").datagrid('getData').rows[index];
|
|
|
getEditDialog(row);
|
...
|
...
|
@@ -263,8 +264,8 @@ |
|
|
|
|
|
// 上架下架
|
|
|
$(this).datagrid("getPanel").find("a[role='changeStatus']").linkbutton({
|
|
|
iconCls : "icon-edit",
|
|
|
onClick : function() {
|
|
|
iconCls: "icon-edit",
|
|
|
onClick: function () {
|
|
|
var index = $(this).attr("index");
|
|
|
var row = $("#labelListTable").datagrid('getData').rows[index];
|
|
|
row.status = $(this).attr("changedStatus");
|
...
|
...
|
@@ -277,60 +278,200 @@ |
|
|
|
|
|
|
|
|
// 编辑分组
|
|
|
function getEditDialog(data){
|
|
|
function getEditDialog(data) {
|
|
|
/*var labelList = $("<div id='labelList'>").appendTo($(document.body));
|
|
|
var title = data == null ? "新建话题":"修改话题";
|
|
|
var textVar = data == null ? "保存":"保存";
|
|
|
var msgVar = data == null ? "确认新增话题吗?":"确认保存话题吗?";*/
|
|
|
var topicId = data == null ? null : data.id;
|
|
|
|
|
|
//新建话题--打开一个新窗口
|
|
|
window.open(contextPath + "/html/grass/topicManage/topicEdit.html?topicId=" + topicId, "_blank");
|
|
|
|
|
|
|
|
|
/*window.self.paramObject.mkData = data;
|
|
|
$(labelList).myDialog({
|
|
|
title: title,
|
|
|
width: "70%",
|
|
|
height: "80%",
|
|
|
resizable:false,
|
|
|
buttons:[{
|
|
|
id : "saveBtn",
|
|
|
text:textVar,
|
|
|
iconCls : "icon-save",
|
|
|
handler:function(){
|
|
|
$("#activityAddForm").form("submit", {
|
|
|
url: serverContextPath + "/grassTopicManage/addUpGrassTopic",
|
|
|
onSubmit: function (param) {
|
|
|
if(data != null){
|
|
|
param.id = data.id;
|
|
|
}
|
|
|
|
|
|
if (!$("#activityAddForm").form("validate")) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
var topicDesc = $("#topicDesc").val();
|
|
|
if(topicDesc==null || topicDesc==""){
|
|
|
$.messager.alert("失败", "话题描述不能为空!", "error");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if(topicDesc.length>100){
|
|
|
$.messager.alert("失败", "话题描述不能超过100字!", "error");
|
|
|
return false;
|
|
|
}
|
|
|
// param.status = $("input[name='statusRadio'][checked]").val
|
|
|
|
|
|
|
|
|
var topicImageUrl = $("input[name='topicImageUrl']").val();
|
|
|
if(topicImageUrl == null || topicImageUrl ==""){
|
|
|
$.messager.alert("失败", "提交失败,请选择图片", "error");
|
|
|
return false;
|
|
|
}
|
|
|
// debugger
|
|
|
var relatedLabels = "";
|
|
|
$("#taglist").find("span[name=choosedTag]").each(function () {
|
|
|
var choosedTagId = $(this).attr("data-labelid");
|
|
|
relatedLabels +=choosedTagId+",";
|
|
|
});
|
|
|
if(relatedLabels == ""){
|
|
|
$.messager.alert("失败", "提交失败,请至少选择一个标签", "error");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
param.relatedLabels = relatedLabels;
|
|
|
|
|
|
|
|
|
$.messager.progress({
|
|
|
title: "正在执行",
|
|
|
msg: "正在执行,请稍后..."
|
|
|
});
|
|
|
return true;
|
|
|
},
|
|
|
success: function (data) {
|
|
|
$.messager.progress("close");
|
|
|
data = JSON.parse(data);
|
|
|
if (data.code == 200) {
|
|
|
$(labelList).dialog("close");
|
|
|
$("#labelListTable").datagrid("reload");
|
|
|
$.messager.show({
|
|
|
title: "提示",
|
|
|
msg: title + "成功!",
|
|
|
height: 120
|
|
|
});
|
|
|
} else {
|
|
|
$.messager.alert("失败", data.message, "error");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
text: "关闭",
|
|
|
iconCls: "icon-cancel",
|
|
|
handler: function () {
|
|
|
$.messager.confirm("确认", "确认关闭吗?", function (flag) {
|
|
|
if(flag){
|
|
|
$(labelList).dialog("close");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}],
|
|
|
modal: true,
|
|
|
href: contextPath + "/html/grass/topicManage/topicEdit.html",
|
|
|
});*/
|
|
|
}
|
|
|
|
|
|
|
|
|
// 上架下架
|
|
|
function changeStatus(data) {
|
|
|
|
|
|
var param = {
|
|
|
id: data.id,
|
|
|
status: data.status
|
|
|
};
|
|
|
|
|
|
$.post(serverContextPath + "/grassTopicManage/addUpGrassTopic", param, function (data) {
|
|
|
//数据填到框框里面
|
|
|
// debugger
|
|
|
if (data.code == 200) {
|
|
|
//刷新table
|
|
|
$("#labelListTable").datagrid("reload");
|
|
|
$.messager.show({
|
|
|
title: "提示",
|
|
|
msg: "更新成功!",
|
|
|
height: 120
|
|
|
});
|
|
|
|
|
|
|
|
|
} else {//
|
|
|
$.messager.alert("失败", "更新失败,请稍后再试!", "error");
|
|
|
}
|
|
|
|
|
|
}, "json");
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
// 编辑分组
|
|
|
function getEditDialog(data) {
|
|
|
var labelList = $("<div id='labelList'>").appendTo($(document.body));
|
|
|
var title = data == null ? "新建话题":"修改话题";
|
|
|
var textVar = data == null ? "保存":"保存";
|
|
|
var msgVar = data == null ? "确认新增话题吗?":"确认保存话题吗?";
|
|
|
var title = data == null ? "新建话题" : "修改话题";
|
|
|
var textVar = data == null ? "保存" : "保存";
|
|
|
var msgVar = data == null ? "确认新增标签吗?" : "确认保存标签吗?";
|
|
|
|
|
|
window.self.paramObject.mkData = data;
|
|
|
$(labelList).myDialog({
|
|
|
title: title,
|
|
|
width: "70%",
|
|
|
height: "80%",
|
|
|
resizable:false,
|
|
|
buttons:[{
|
|
|
id : "saveBtn",
|
|
|
text:textVar,
|
|
|
iconCls : "icon-save",
|
|
|
handler:function(){
|
|
|
$("#activityAddForm").form("submit", {
|
|
|
resizable: false,
|
|
|
buttons: [{
|
|
|
id: "saveBtn",
|
|
|
text: textVar,
|
|
|
iconCls: "icon-save",
|
|
|
handler: function () {
|
|
|
|
|
|
$("#topicForm").form("submit", {
|
|
|
url: serverContextPath + "/grassTopicManage/addUpGrassTopic",
|
|
|
onSubmit: function (param) {
|
|
|
if(data != null){
|
|
|
if (data != null) {
|
|
|
param.id = data.id;
|
|
|
}
|
|
|
|
|
|
if (!$("#activityAddForm").form("validate")) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
var topicDesc = $("#topicDesc").val();
|
|
|
if(topicDesc==null || topicDesc==""){
|
|
|
$.messager.alert("失败", "话题描述不能为空!", "error");
|
|
|
//1)表单基本检查
|
|
|
if (!$("#topicForm").form("validate")) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if(topicDesc.length>100){
|
|
|
$.messager.alert("失败", "话题描述不能超过100字!", "error");
|
|
|
//2)是否上传了图片
|
|
|
var imageCount = 0;
|
|
|
$("input[name='topicImageUrl']").each(function (j, item) {
|
|
|
var url = item.value;
|
|
|
if (url != '') {
|
|
|
imageCount++;
|
|
|
}
|
|
|
});
|
|
|
if (imageCount == 0) {
|
|
|
$.messager.alert("保存失败", "至少要选择一张图片", "error");
|
|
|
return false;
|
|
|
}
|
|
|
// param.status = $("input[name='statusRadio'][checked]").val
|
|
|
|
|
|
|
|
|
var topicImageUrl = $("input[name='topicImageUrl']").val();
|
|
|
if(topicImageUrl == null || topicImageUrl ==""){
|
|
|
$.messager.alert("失败", "提交失败,请选择图片", "error");
|
|
|
return false;
|
|
|
}
|
|
|
// debugger
|
|
|
//3)是否选择了标签
|
|
|
var relatedLabels = "";
|
|
|
$("#taglist").find("span[name=choosedTag]").each(function () {
|
|
|
var choosedTagId = $(this).attr("data-labelid");
|
|
|
relatedLabels +=choosedTagId+",";
|
|
|
var tagCount = 0;
|
|
|
$("#labelListDiv").find("span[role='choose']").each(function (item, index) {
|
|
|
debugger
|
|
|
var tempId = $(this).attr('data-labelid');
|
|
|
if (tempId != null) {
|
|
|
tagCount++;
|
|
|
relatedLabels += tempId + ",";
|
|
|
}
|
|
|
});
|
|
|
if(relatedLabels == ""){
|
|
|
$.messager.alert("失败", "提交失败,请至少选择一个标签", "error");
|
|
|
|
|
|
if (tagCount == 0 || tagCount > 5) {
|
|
|
$.messager.alert("保存失败", "至少选择一个标签,最多5个", "error");
|
|
|
return false;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -355,7 +496,7 @@ |
|
|
height: 120
|
|
|
});
|
|
|
} else {
|
|
|
$.messager.alert("失败", data.message, "error");
|
|
|
$.messager.alert("失败", "操作失败", "error");
|
|
|
}
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -365,7 +506,7 @@ |
|
|
iconCls: "icon-cancel",
|
|
|
handler: function () {
|
|
|
$.messager.confirm("确认", "确认关闭吗?", function (flag) {
|
|
|
if(flag){
|
|
|
if (flag) {
|
|
|
$(labelList).dialog("close");
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -376,37 +517,6 @@ |
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
// 上架下架
|
|
|
function changeStatus(data){
|
|
|
|
|
|
var param = {
|
|
|
id : data.id,
|
|
|
status : data.status
|
|
|
};
|
|
|
|
|
|
$.post(serverContextPath + "/grassTopicManage/addUpGrassTopic", param,function (data) {
|
|
|
//数据填到框框里面
|
|
|
// debugger
|
|
|
if(data.code ==200){
|
|
|
//刷新table
|
|
|
$("#labelListTable").datagrid("reload");
|
|
|
$.messager.show({
|
|
|
title: "提示",
|
|
|
msg: "更新成功!",
|
|
|
height: 120
|
|
|
});
|
|
|
|
|
|
|
|
|
}else{//
|
|
|
$.messager.alert("失败", "更新失败,请稍后再试!", "error");
|
|
|
}
|
|
|
|
|
|
}, "json");
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
...
|
...
|
|