Authored by 王钱钧

添加静态文件检查功能代码

... ... @@ -14,119 +14,90 @@ require('../common/zh-cn');
var baidu;
var ENUM = {
AuditEnum: {
'0': '待审核',
'1': '审核通过',
'2': '审核失败',
},
RecommendEnum: {
true: '已推荐',
false: '未推荐'
},
RewardEnum: {
false: '未发送奖励',
true: '奖励已发放'
FileTypeEnum: {
'1': '频道',
'2': '专题',
'3': '邮件',
'4': '推广'
}
};
new common.dropDown({
el: "#sel-type"
});
//日期插件
$('.hasDatepicker').fdatepicker({
format: 'yyyy-mm-dd'
});
var g = new common.grid({
el: '#basicTable',
size: 10,
parms: function () {
return {
status: $('#status').val(),
recomReward: $('#recomReward').val(),
hasImage: $('#hasImage').val(),
fileType: $('#sel-type').val(),
beginTime: common.util.__input('beginTime'),
endTime: common.util.__input('endTime'),
uid: common.util.__input('uid'),
productName: common.util.__input('productName'),
productSkn: common.util.__input('productSkn'),
orderCode: common.util.__input('orderCode')
endTime: common.util.__input('endTime')
};
},
columns: [{
display: '订单号',
name: "orderId"
}, {
display: '商品名称',
render: function (item) {
var goods = item.goods;
if (goods != null) {
productHref = "http://item.yohobuy.com/product/pro_" + item.productId + "_" + goods.goodsId + "/" + goods.cnAlphabet + ".html";
}
return '<a href="' + item.productHref + '">' + item.productName + '</a>'
}
}, {
display: '用户id',
name: "uid"
}, {
display: '商品图片',
render: function (item) {
var goods = item.goods;
var goodImgUrl = "";
if (goods != null && goods.goodsImg != null && goods.goodsImg.length > 0) {
goodImgUrl = goods.goodsImg[0].imageUrl;
}
return '<img src="' + goodImgUrl + '" width="100" height="60"/>'
}
}, {
display: "评价图片",
render: function (item) {
//item.url = common.util.__template(item.url,{mode:2,width:100,height:100});
return '<img src="' + item.url + '" width="100" height="60"/>'
}
}, {
display: '评价内容',
name: "content",
//width:'15%',
style: "width:15%; word-break:break-all;"
}
, {
display: '评价星级',
name: "satisfied"
}, {
display: '审核状态',
render: function (item) {
return "<p>" + ENUM.AuditEnum[item.status] + "</p>";
}
},
display: 'ID',
name: "id"
}, {
display: '标题',
name: "pageTitle"
},
{
display: '审核返币',
display: '类型',
render: function (item) {
return "<p>" + ENUM.RewardEnum[item.shareReward] + "</p>";
return "<p>" + ENUM.FileTypeEnum[item.fileType] + "</p>";
}
},
//{
// display: '审核返币',
// render: function (item) {
// return "<p>" + ENUM.RewardEnum[item.shareReward] + "</p>";
// }
//},
//{
// display: '推荐状态',
// render: function (item) {
// return "<p>" + ENUM.RecommendEnum[item.recomReward] + "</p>";
// }
//},
{
display: '推荐状态',
display: "添加时间",
render: function (item) {
return "<p>" + ENUM.RecommendEnum[item.recomReward] + "</p>";
var t = new Date(item.createTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
return "<p>" + formatted + "</p>";
}
}, {
display: "创建时间",
},{
display: "修改时间",
render: function (item) {
var t = new Date(item.createTime * 1000);
var t = new Date(item.updateTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
return "<p>" + formatted + "</p>";
}
}, {
display: '备注',
name: "remark"
}, {
},
{
display: '操作',
//}
render: function (items) {
var HtmArr = [];
HtmArr.push('<a data-index="' + items.__index + '" style="margin-bottom:10px;" href="JavaScript:;" class="btn btn-info btn-xs info-modify">编辑</a>');
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-info btn-xs info-modify">编辑</a>');
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>');
return HtmArr.join('');
... ... @@ -134,12 +105,12 @@ var g = new common.grid({
}
]
});
g.init('/shareOrder/shareOrderList');
g.init('/staticFileManage/queryByCondition');
//添加
$(document).on('click', '#add', function () {
staticFileOP("新增", '', {});
staticFileOP("新增", '/staticFileManage/add', {});
});
... ... @@ -149,9 +120,9 @@ $(document).on('click', '.info-del', function () {
common.dialog.confirm("温馨提示", "确定要删除吗?", function () {
common.util.__ajax({
url: '',
url: '/staticFileManage/deleteById',
data: {
uid: item.uid,
id: item.id
}
}, function (res) {
if (res.code == 200) {
... ... @@ -163,19 +134,16 @@ $(document).on('click', '.info-del', function () {
});
});
// 查询
$(document).on('click', '#filter', function () {
g.reload();
});
$(document).on('click', '#add', function () {
g.reload();
});
//编辑
$(document).on('click', '.info-modify', function () {
var item = g.rows[$(this).data("index")];
staticFileOP("编辑", '/guang/relationship/updateRel', item);
staticFileOP("编辑", '/staticFileManage/update', item);
});
function staticFileOP(prefix, url, item) {
... ... @@ -184,29 +152,32 @@ function staticFileOP(prefix, url, item) {
//"bucket" : "author"
});
//下拉框
new common.dropDown({
el: "#type"
});
var dialog = new common.dialog({
width: '70%',
title: prefix + '静态文件',
content: common.util.__template2($("#template").html(), item),
button: [{
value: '提交',
callback: function () {
a.submit(url, function (option) {
//option.data.
option.success = function (res) {
res = res.data;
if (res.code == 200) {
a.$tip('提交成功', function () {
g.reload();
})
} else {
a.$tip(res.message);
}
common.util.__ajax({
url:url,
data:{
id: $('#id').val(),
fileType: $('#fileType').val(),
pageTitle: $('#pageTitle').val(),
keyWord: $('#keyWord').val(),
pageDesc: $('#pageDesc').val(),
content: baidu.getContent()
}
}, function (res) {
//res=res.data;
if(res.code=="200"){
dialog.close();
g.reload();
return true;
}else{
return false;
}
});
... ... @@ -216,9 +187,23 @@ function staticFileOP(prefix, url, item) {
});
////下拉框
//new common.dropDown({
// el: "#fileType"
//});
baidu && baidu.destroy();
baidu = UM.getEditor('baidueditor');
//baidu.setContent(module.contentData.data.text);
baidu = UM.getEditor('content');
if (prefix == '编辑') {
baidu.setContent(item.content);
//$("#fileType option").each(function() {
// return this.text == ENUM.FileTypeEnum[item.fileType];
//}).prop('selected', true);
}
a.init();
}
\ No newline at end of file
... ...
... ... @@ -12,6 +12,47 @@ exports.res = [
data: {
iscreate: true
}
}, { // 新增
route: '/staticFileManage/add',
method: 'POST',
url: '/staticFileManage/add',
params: [
{name: 'fileType', type: 'Number'},
{name: 'pageTitle', type: 'String'},
{name: 'keyWord', type: 'String'},
{name: 'pageDesc', type: 'String'},
{name: 'content', type: 'String'}
]
}, { // 删除
route: '/staticFileManage/deleteById',
method: 'POST',
url: '/staticFileManage/deleteById',
params: [
{name: 'id', type: 'Number'}
]
}, { // 修改
route: '/staticFileManage/update',
method: 'POST',
url: '/staticFileManage/update',
params: [
{name: 'id', type: 'Number'},
{name: 'fileType', type: 'Number'},
{name: 'pageTitle', type: 'String'},
{name: 'keyWord', type: 'String'},
{name: 'pageDesc', type: 'String'},
{name: 'content', type: 'String'}
]
}, { // 查询
route: '/staticFileManage/queryByCondition',
method: 'POST',
url: '/staticFileManage/queryByCondition',
params: [
{name: 'fileType', type: 'Number'},
{name: 'beginTime', type: 'String'},
{name: 'endTime', type: 'String'},
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'}
]
}
];
... ...
... ... @@ -28,8 +28,10 @@
<div class="form-group">
<select id="sel-type" class="form-control" style="width:120px">
<option value="">选择类型</option>
<option value="0">专题</option>
<option value="1">有图</option>
<option value="1">频道</option>
<option value="2">专题</option>
<option value="3">邮件</option>
<option value="4">推广</option>
</select>
</div>
... ... @@ -44,7 +46,7 @@
</div>
<button type="submit" id="filter" class="btn btn-info">查询</button>
<button type="submit" id="all" class="btn btn-info">全部</button>
<a type="submit" href="" id="all" class="btn btn-info">全部</a>
<button type="submit" id="add" class="btn btn-info">新增</button>
</div>
... ... @@ -64,43 +66,45 @@
<script type="text/template" id="template">
<input type="text" hidden="true" id="id" value="[[id]]"/>
<div class="form-group">
<label for="type" class="col-sm-2 control-label">静态文件类型:</label>
<label for="fileType" class="col-sm-2 control-label">静态文件类型:</label>
<div class="col-sm-8">
<select class="form-control" value="[[adsImgSize]]" id="type">
<select class="form-control" value="[[fileType]]" id="fileType">
<option value="">选择类型</option>
<option value="10881088">1088X1088</option>
<option value="1088680">1088X680</option>
<option value="1088340">1088X340</option>
<option value="1">频道</option>
<option value="2">专题</option>
<option value="3">邮件</option>
<option value="4">推广</option>
</select>
</div>
</div>
<div class="form-group">
<label for="authorDesc" class="col-sm-2 control-label">页面标题:</label>
<label for="pageTitle" class="col-sm-2 control-label">页面标题:</label>
<div class="col-sm-10">
<input type="text" value="[[authorDesc]]" name="content" id="authorDesc" placeholder="页面标题" required="required" class="form-control">
<input type="text" value="[[pageTitle]]" name="pageTitle" id="pageTitle" placeholder="页面标题" required="required" class="form-control">
</div>
</div>
<div class="form-group">
<label for="authorDesc" class="col-sm-2 control-label">页面关键词:</label>
<label for="keyWord" class="col-sm-2 control-label">页面关键词:</label>
<div class="col-sm-10">
<input type="text" value="[[authorDesc]]" name="content" id="authorDesc" placeholder="页面关键词" required="required" class="form-control">
<input type="text" value="[[keyWord]]" name="keyWord" id="keyWord" placeholder="页面关键词" required="required" class="form-control">
</div>
</div>
<div class="form-group">
<label for="authorDesc" class="col-sm-2 control-label">页面介绍:</label>
<label for="pageDesc" class="col-sm-2 control-label">页面介绍:</label>
<div class="col-sm-10">
<input type="text" value="[[authorDesc]]" name="content" id="authorDesc" placeholder="页面介绍" required="required" class="form-control">
<input type="text" value="[[pageDesc]]" name="pageDesc" id="pageDesc" placeholder="页面介绍" required="required" class="form-control">
</div>
</div>
<div class="rows">
<label for="baidueditor" class="col-sm-2 control-label">内容:</label>
<script id="baidueditor" style="width: 100%;" name="content" type="text/plain"></script>
<label for="content" class="col-sm-2 control-label">内容:</label>
<script id="content" style="width: 100%;" name="content" type="text/plain"></script>
</div>
... ...