Authored by 陶雨

1.专题管理复制链接

2.商家端app包上传
3.专题管理添加web封面图
/**
* Created by ty on 2016/6/3.
*/
var $ = require('jquery'),
common = require('../common/common');
var VersionData = {};
new common.dropDown({el: "#clientType"});
var g = new common.grid({
el: "#list-content",
parms: function () {
return {
appVersion: common.util.__input('appVersion'),
clientType: common.util.__input('clientType')
};
},
columns: [
{display: "ID", name: "id"},
{display: "APP版本", name: "version"},
{display: "提醒内容", name: "content"},
{display: "跳转链接", name: "url"},
{display: "客户端类型", name: "clientType", render: function(item) {
if(item.clientType != null && item.clientType.trim() != "") {
var platform = item.clientType;
var temp = platform.replace("iphone", "IOS手机").replace("ipad", "IOS Pad")
.replace("android", "安卓手机").replace("androidpad", "安卓Pad")
.replace(/,/g, " ");
return temp;
}
}},
{display: "状态", name: "status", render: function(item) {
if(item.status == 1) {
return "已开启";
} else if(item.status == 0) {
return "已关闭";
}
}},
{
display: "操作",name: "", render: function (item) {
var arr = [];
if(item.status == 0) {
arr.push('<a class="btn btn-danger btn-xs change-status" data-index="' + item.__index + '">开启</a>');
} else {
arr.push('<a class="btn btn-info btn-xs change-status" data-index="' + item.__index + '">关闭</a>');
}
arr.push('<a class="btn btn-primary btn-xs del" data-index="' + item.__index + '">删除</a>');
return arr.join("");
}
}
]
});
g.init('/AppVersionRest/getAppVersionList');
var Bll = {
toast:function(url, item, hint) {
var e = new common.edit2("#base-form");
var dialog = common.dialog.confirm(hint,
common.util.__template2($("#template").html(), item),
function() {
if(e.validate()) {
VersionData.status = $("#status").val();
VersionData.url = $("#url").val();
console.log(VersionData);
common.util.__ajax({
url: url,
data: VersionData
}, function (res) {
dialog.close();
g.reload();
});
}
return false;
});
$("#appFile").ajaxfileupload({
'action': '/ajax/upload',
'params': {
bucket: "yohobuyzip",
__type: "fileupload-upload"
},
onComplete: function (response) {
if (response.status && response.code == 200) {
if(response.data){
$("#url").attr("value", response.data);
}
} else {
common.util.__tip(response.message);
}
},
valid_extensions: ["ipa", "apk"]
})
new common.dropDown({el: "#types"});
e.bind();
}
};
$(document).on('click', '#addAppVersion', function() {
VersionData = {};
Bll.toast("/AppVersionRest/setAppVersion", VersionData, "上传APP包");
});
$(document).on("change", ".observe", function () {
var name = $(this).data("field");
VersionData[name] = $(this).val();
});
$(document).on("click", ".change-status", function () {
VersionData = g.rows[$(this).data("index")];
VersionData.status = 1 - VersionData.status;
common.util.__ajax({
url: "/AppVersionRest/editAppVersion",
data: {id: VersionData.id, status: VersionData.status}
}, function (res) {
g.reload();
});
});
$(document).on("click", ".del", function () {
VersionData = g.rows[$(this).data("index")];
common.dialog.confirm("警告",
"确认删除?",
function() {
common.util.__ajax({
url: "/AppVersionRest/delAppVersion",
data: {id: VersionData.id}
}, function () {
g.reload();
});
});
});
$(document).on("click", "#filter-btn", function () {
g.reload(1);
});
\ No newline at end of file
... ...
... ... @@ -63,19 +63,13 @@ var g = new common.grid({
if(!item.startTime || !item.endTime) return "";
return Bll.getLocalTime(item.startTime) + "~" + Bll.getLocalTime(item.endTime);
}},
{display: "专题链接", render: function(item) {
var arr = [];
if(!!item.url) {
arr.push('<textarea readonly style="border: 0;resize:none;outline:none;background-color: transparent;" cols="20" rows="'+ (parseInt(item.url.length/20)+1) +'" type="text" id="' + item.id + '">'+ item.url +'</textarea>');
arr.push('<a class="btn btn-primary copy" data-index="' + item.__index + '" data-id="' + item.id + '">复制链接</a>');
}
return arr.join(" ");
}},
{
display: "操作", name: "", render: function (item) {
var arr = [];
arr.push('<a class="btn btn-info add2" data-index="' + item.__index + '">编辑</a>');
arr.push('<a class="btn btn-info delbtn" data-index="' + item.__index + '">删除</a>');
arr.push("<br>");
arr.push('<a class="btn btn-info showLink" data-index="' + item.__index + '">查看链接</a>');
return arr.join("");
}
}
... ... @@ -139,6 +133,7 @@ var Bll = {
option.data.promotionName = $("#promotionName5").val() + "%Off";
}
option.data.yhChannel = option.data.yhChannel.replace(/\|/g, ",");
option.data.plateform = option.data.plateform.replace(/\|/g, ",");
option.success=function(res){
dialog.close();
... ... @@ -221,8 +216,17 @@ $(document).on("click","#filter-btn",function () {
});
$(document).on("click", ".copy", function() {
var Url2=document.getElementById($(this).data("id"));
var Url2=document.getElementById($(this).data("link"));
Url2.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
common.util.__tip("链接复制成功", "success");
});
$(document).on("click", ".showLink", function () {
var item = g.rows[$(this).data("index")];
var a=new common.dialog({
title:"\"\""+item.title + "\"\"链接",
width:"80%",
content:common.util.__template2($("#links-template").html(), item)
});
});
\ No newline at end of file
... ...
... ... @@ -26,7 +26,8 @@ var config = {
domain:'http://192.168.102.210:8088/platform',//联调
//domain: 'http://172.16.6.146:8088/platform',
//domain:'http://172.16.6.120:8080/platform',//曹艳
//domain:'http://172.16.6.231:8080/platform',//王伟
//domain:'http://172.16.6.225:8080/platform',//王伟
//domain:'http://172.16.6.190:8088/platform',
//domain: 'http://172.16.6.239:8080', //孙杰翔
//domain:'http://172.16.6.189:8088/platform', //李健1
... ...
/**
* Created by ty on 2016/6/3.
*/
exports.domain = require('../config/common.js').domain;
exports.res = [
{
route: "/operations/shopsVersionUpdate/index",
method: "GET",
view: "pages/operations/shopsVersionUpdate",
src: "/operations/shopsVersionUpdate",
},
{
route: "/AppVersionRest/getAppVersionList",
method: "POST",
url: "/AppVersionRest/getAppVersionList",
params: [
{name: "page", type: "number"},
{name: "size", type: "number"},
{name: "appVersion", type: "string"},
{name: "clientType", type: "string"}
]
},
{
//添加
route: "/AppVersionRest/setAppVersion",
method: "POST",
url: "/AppVersionRest/setAppVersion",
params: [
{name: "appVersion", type: "string"},
{name: "clientType", type: "string"},
{name: "url", type: "string"},
{name: "content", type: "string"},
{name: "status", type: "string"}
]
},
{
//删除
route: "/AppVersionRest/delAppVersion",
method: "POST",
url: "/AppVersionRest/delAppVersion",
params: [
{name: "id", type: "number"}
]
},
{
//修改状态
route: "/AppVersionRest/editAppVersion",
method: "POST",
url: "/AppVersionRest/editAppVersion",
params: [
{name: "id", type: "number"},
{name: "status", type: "string"}
]
}
];
\ No newline at end of file
... ...
... ... @@ -42,7 +42,8 @@ exports.res = [
{name: 'logoUrl', type: 'string'},
{name: 'webUrl', type: 'string'},
{name: 'orderNum', type: 'number'},
{name: 'yhChannel', type: 'string'}
{name: 'yhChannel', type: 'string'},
{name: 'webCoverUrl', type: 'string'}
]
},
{
... ... @@ -64,7 +65,8 @@ exports.res = [
{name: 'logoUrl', type: 'string'},
{name: 'webUrl', type: 'string'},
{name: 'orderNum', type: 'number'},
{name: 'yhChannel', type: 'string'}
{name: 'yhChannel', type: 'string'},
{name: 'webCoverUrl', type: 'string'}
]
},
{
... ...
<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>商家端app包上传</li>
</ul>
<div>
<div style="width: 30%;float: left;">
<h4>商家端app包上传</h4>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-heading">
<a class="btn btn-success " id="addAppVersion"><i class="fa fa-plus"></i> 添加</a>
</div>
<div class="panel-body">
<div class="panel-col">
<input type="text" id="appVersion" class="form-control" placeholder="app版本">
</div>
<div class="panel-col">
<select name="platform" id="clientType" tabindex="-1" class="form-control select2-offscreen brandBtn-group">
<option value="" selected="">安装包类型</option>
<option value="iphone">IOS手机</option>
<option value="ipad">IOS Pad</option>
<option value="android">安卓手机</option>
</select>
</div>
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="" class="btn btn-info">全部</a>
</div>
<div id="list-content"></div>
</div>
<script type="text/template" id="template">
<div class="row" id="base-form">
<div class="form-group">
<label class="col-sm-2 control-label">app版本</label>
<div class="col-sm-8">
<input type="text" value="[[appVersion]]" class="form-control observe" data-field="appVersion" prompt="app版本" placeholder="请填写版本" required>
</div>
</div><!-- form-group -->
<div class="form-group">
<label class="col-sm-2 control-label">安装包类型</label>
<div class="col-sm-8">
<select name="platform" id="types" tabindex="-1" class="form-control select2-offscreen brandBtn-group observe" data-field="clientType" value="[[clientType]]" required>
<option value="" selected="">请选择类型</option>
<option value="iphone">IOS手机</option>
<option value="ipad">IOS Pad</option>
<option value="android">安卓手机</option>
</select>
</div>
</div><!-- form-group -->
<div class="form-group">
<label class="col-sm-2 control-label">url地址</label>
<div class="col-sm-6">
<input id="url" class="form-control" value="[[url]]" type="text" disabled="disabled" style="cursor:default" required prompt="app文件">
</div>
<div class="col-sm-4" style="position: relative">
<input id="appFile" name="appFile" class="btn btn-default excel-upload" type="file" style="position: absolute; top: 0;left: 0;">
<div class="file-name btn btn-default">请选择文件</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">提醒内容</label>
<div class="col-sm-8">
<textarea name="content" class="form-control observe" data-field="content" required prompt="提醒内容">[[content]]</textarea>
</div>
</div><!-- form-group -->
<div class="form-group">
<label class="col-sm-2 control-label">状态</label>
<div class="col-sm-8">
<label style="cursor: pointer;"><input style="width: 15px;height: 15px" type="radio" name="status" value="0" checked>关闭</label>
<label style="cursor: pointer;"><input style="width: 15px;height: 15px" type="radio" name="status" value="1">开启</label>
</div>
<input type="hidden" id="status" value="[[status||0]]" for="radio" />
</div><!-- form-group -->
</div>
</script>
\ No newline at end of file
... ...
... ... @@ -91,12 +91,12 @@
<div class="form-group">
<label class="col-sm-2 control-label">平台</label>
<div class="col-sm-8">
<label style="cursor: pointer;"><input type="radio" name="plateform" value="1">WEB</label>
<label style="cursor: pointer;"><input type="radio" name="plateform" value="2">APP</label>
<label style="cursor: pointer;"><input type="radio" name="plateform" value="3">WAP</label>
<label style="cursor: pointer;"><input type="radio" name="plateform" value="4">IPAD</label>
<label style="cursor: pointer;"><input type="checkbox" name="plateform" value="1">WEB</label>
<label style="cursor: pointer;"><input type="checkbox" name="plateform" value="2">APP</label>
<label style="cursor: pointer;"><input type="checkbox" name="plateform" value="3">WAP</label>
<label style="cursor: pointer;"><input type="checkbox" name="plateform" value="4">IPAD</label>
</div>
<input type="hidden" id="plateform" value="{plateform}" for="radio">
<input type="hidden" id="plateform" value="{plateform}" for="checkbox">
</div>
<div class="form-group">
<label class="col-sm-2 control-label">频道</label>
... ... @@ -153,12 +153,18 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">WEB封面</label>
<label class="col-sm-2 control-label">WEB logo</label>
<div class="col-sm-10">
<input type="file" id="logoUrl" name="logoUrl" value="{logoUrl}"/><!---->
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">web封面图</label>
<div class="col-sm-10">
<input type="file" id="webCoverUrl" name="webCoverUrl" value="{webCoverUrl}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">web列表页图</label>
<div class="col-sm-10">
<input type="file" id="webUrl" name="webUrl" value="{webUrl}"/>
... ... @@ -173,4 +179,32 @@
</div>
</div>
</div>
</script>
<script type="text/template" id="links-template">
<table class="table no-footer">
<tbody>
[[if linkWeb]]
<tr>
<td align="right">WEB链接</td>
<td width="80%"><textarea readonly style="border: 0;resize:none;outline:none;background-color: transparent;width: 100%;" id="linkWeb[[id]]">[[linkWeb]]</textarea></td>
<td><a class="btn btn-primary copy" data-link="linkWeb[[id]]">复制</a></td>
</tr>
[[/if]]
[[if linkWap]]
<tr>
<td align="right">WAP链接</td>
<td width="80%"><textarea readonly style="border: 0;resize:none;outline:none;background-color: transparent; width: 100%;" id="linkWap[[id]]">[[linkWap]]</textarea></td>
<td><a class="btn btn-primary copy" data-link="linkWap[[id]]">复制</a></td>
</tr>
[[/if]]
[[if linkApp]]
<tr>
<td align="right">APP链接</td>
<td width="80%"><textarea readonly style="border: 0;resize:none;outline:none;background-color: transparent;width: 100%;" id="linkApp[[id]]">[[linkApp]]</textarea></td>
<td><a class="btn btn-primary copy" data-link="linkApp[[id]]">复制</a></td>
</tr>
[[/if]]
</tbody>
</table>
</script>
\ No newline at end of file
... ...