Authored by 王钱钧

添加静态文件功能模块

... ... @@ -176,32 +176,38 @@ $(document).on('click', 'input[name="brandType"]', function () {
function plusStarOP(prefix, url, item) {
var a = new common.edit('#templete-top');
common.dialog.confirm(prefix+'品牌', common.util.__template2($("#template").html(), item), function () {
return a.submit(url,function(option){
//设置图片
if(imgArr.length) {
option.data.activityImg = imgArr.toString();
}
imgArr = [];
option.success=function(res){
res=res.data;
if(res.code=="200"){
a.$tip("提交成功", function() {
g.reload();
}, 'growl-success');
}else{
console.log('type' + $('#brandType').val());
var type = $('#brandType').val();
if(type) {
return a.submit(url,function(option){
//设置图片
if(imgArr.length) {
option.data.activityImg = imgArr.toString();
}
imgArr = [];
option.success=function(res){
res=res.data;
if(res.code=="200"){
a.$tip("提交成功", function() {
g.reload();
}, 'growl-success');
}else{
a.$tip(res.message);
}
return false;
};
option.error=function(res){
a.$tip(res.message);
}
return false;
},
option.error=function(res){
a.$tip(res.message);
}
});
});
} else {
a.$tip('类型不能为空');
return;
}
});
... ...
/**
* Created by wangqianjun on 16/5/16.
* 静态文件管理
*/
var $ = require('jquery');
common = require('../common/common');
datepicker = require('../util/datepicker');
require('../common/umeditor.config');
require('../common/umeditor');
require('../common/zh-cn');
var baidu;
var ENUM = {
AuditEnum: {
'0': '待审核',
'1': '审核通过',
'2': '审核失败',
},
RecommendEnum: {
true: '已推荐',
false: '未推荐'
},
RewardEnum: {
false: '未发送奖励',
true: '奖励已发放'
}
};
var g = new common.grid({
el: '#basicTable',
size: 10,
parms: function () {
return {
status: $('#status').val(),
recomReward: $('#recomReward').val(),
hasImage: $('#hasImage').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')
};
},
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: '审核返币',
render: function (item) {
return "<p>" + ENUM.RewardEnum[item.shareReward] + "</p>";
}
},
{
display: '推荐状态',
render: function (item) {
return "<p>" + ENUM.RecommendEnum[item.recomReward] + "</p>";
}
}, {
display: "创建时间",
render: function (item) {
var t = new Date(item.createTime * 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-danger btn-xs info-del">删除</a>');
return HtmArr.join('');
}
}
]
});
g.init('/shareOrder/shareOrderList');
//添加
$(document).on('click', '#add', function () {
staticFileOP("新增", '', {});
});
//删除
$(document).on('click', '.info-del', function () {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("温馨提示", "确定要删除吗?", function () {
common.util.__ajax({
url: '',
data: {
uid: item.uid,
}
}, function (res) {
if (res.code == 200) {
g.reload();
} else {
common.util.__tip(res.message);
}
});
});
});
$(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);
});
function staticFileOP(prefix, url, item) {
var a = new common.edit(".confirm", {
//"bucket" : "author"
});
//下拉框
new common.dropDown({
el: "#type"
});
var dialog = new common.dialog({
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);
}
}
});
return false;
}
}]
});
baidu && baidu.destroy();
baidu = UM.getEditor('baidueditor');
//baidu.setContent(module.contentData.data.text);
a.init();
}
\ No newline at end of file
... ...
/**
* Created by wangqianjun on 16/5/16.
*/
exports.domain = require('../config/common.js').domain;
exports.res = [
{//逛-> 资讯管理 空白页
route: '/operations/staticFileManager/index',
method: 'GET',
view: 'pages/operations/staticFileManager',
src: '/operations/staticFileManager',
data: {
iscreate: true
}
}
];
... ...
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="">运营管理</a></li>
<li>静态文件管理</li>
</ul>
<div>
<div style="width: 30%;float: left;">
<h4>静态文件管理</h4>
</div>
</div>
</div>
</div>
</div>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<div class="form-inline">
<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>
</select>
</div>
<div class="form-group">
<input type="text" id="beginTime" class="form-control panel-input hasDatepicker" name="start_time"
placeholder="开始时间" value="" kl_vkbd_parsed="true">
</div>
<div class="form-group">
<input type="text" id="endTime" class="form-control panel-input hasDatepicker" name="end_time"
placeholder="结束时间" value="" kl_vkbd_parsed="true">
</div>
<button type="submit" id="filter" class="btn btn-info">查询</button>
<button type="submit" id="all" class="btn btn-info">全部</button>
<button type="submit" id="add" class="btn btn-info">新增</button>
</div>
</div>
</div>
<div class="panel panel-primary-head">
<div id="basicTable_wrapper" class="dataTables_wrapper no-footer">
<div class="dataTables_length" id="basicTable">
</div>
<nav>
<ul id="pagination" class="pagination pagination-lg"></ul>
</nav>
</div>
</div>
</div>
<script type="text/template" id="template">
<div class="form-group">
<label for="type" class="col-sm-2 control-label">静态文件类型:</label>
<div class="col-sm-8">
<select class="form-control" value="[[adsImgSize]]" id="type">
<option value="">选择类型</option>
<option value="10881088">1088X1088</option>
<option value="1088680">1088X680</option>
<option value="1088340">1088X340</option>
</select>
</div>
</div>
<div class="form-group">
<label for="authorDesc" 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">
</div>
</div>
<div class="form-group">
<label for="authorDesc" 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">
</div>
</div>
<div class="form-group">
<label for="authorDesc" 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">
</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>
</div>
</script>
... ...