Authored by 陶雨

1.专题管理复制链接

2.商家端app包上传
3.专题管理添加web封面图
  1 +/**
  2 + * Created by ty on 2016/6/3.
  3 + */
  4 +var $ = require('jquery'),
  5 + common = require('../common/common');
  6 +
  7 +var VersionData = {};
  8 +
  9 +new common.dropDown({el: "#clientType"});
  10 +
  11 +var g = new common.grid({
  12 + el: "#list-content",
  13 + parms: function () {
  14 + return {
  15 + appVersion: common.util.__input('appVersion'),
  16 + clientType: common.util.__input('clientType')
  17 + };
  18 + },
  19 + columns: [
  20 + {display: "ID", name: "id"},
  21 + {display: "APP版本", name: "version"},
  22 + {display: "提醒内容", name: "content"},
  23 + {display: "跳转链接", name: "url"},
  24 + {display: "客户端类型", name: "clientType", render: function(item) {
  25 + if(item.clientType != null && item.clientType.trim() != "") {
  26 + var platform = item.clientType;
  27 + var temp = platform.replace("iphone", "IOS手机").replace("ipad", "IOS Pad")
  28 + .replace("android", "安卓手机").replace("androidpad", "安卓Pad")
  29 + .replace(/,/g, " ");
  30 + return temp;
  31 + }
  32 + }},
  33 + {display: "状态", name: "status", render: function(item) {
  34 + if(item.status == 1) {
  35 + return "已开启";
  36 + } else if(item.status == 0) {
  37 + return "已关闭";
  38 + }
  39 + }},
  40 + {
  41 + display: "操作",name: "", render: function (item) {
  42 + var arr = [];
  43 + if(item.status == 0) {
  44 + arr.push('<a class="btn btn-danger btn-xs change-status" data-index="' + item.__index + '">开启</a>');
  45 + } else {
  46 + arr.push('<a class="btn btn-info btn-xs change-status" data-index="' + item.__index + '">关闭</a>');
  47 + }
  48 + arr.push('<a class="btn btn-primary btn-xs del" data-index="' + item.__index + '">删除</a>');
  49 + return arr.join("");
  50 + }
  51 + }
  52 + ]
  53 +});
  54 +
  55 +g.init('/AppVersionRest/getAppVersionList');
  56 +
  57 +var Bll = {
  58 + toast:function(url, item, hint) {
  59 + var e = new common.edit2("#base-form");
  60 +
  61 + var dialog = common.dialog.confirm(hint,
  62 + common.util.__template2($("#template").html(), item),
  63 + function() {
  64 + if(e.validate()) {
  65 + VersionData.status = $("#status").val();
  66 + VersionData.url = $("#url").val();
  67 + console.log(VersionData);
  68 + common.util.__ajax({
  69 + url: url,
  70 + data: VersionData
  71 + }, function (res) {
  72 + dialog.close();
  73 + g.reload();
  74 + });
  75 + }
  76 + return false;
  77 + });
  78 + $("#appFile").ajaxfileupload({
  79 + 'action': '/ajax/upload',
  80 + 'params': {
  81 + bucket: "yohobuyzip",
  82 + __type: "fileupload-upload"
  83 + },
  84 + onComplete: function (response) {
  85 + if (response.status && response.code == 200) {
  86 + if(response.data){
  87 + $("#url").attr("value", response.data);
  88 + }
  89 + } else {
  90 + common.util.__tip(response.message);
  91 + }
  92 + },
  93 + valid_extensions: ["ipa", "apk"]
  94 + })
  95 +
  96 + new common.dropDown({el: "#types"});
  97 + e.bind();
  98 + }
  99 +};
  100 +
  101 +$(document).on('click', '#addAppVersion', function() {
  102 + VersionData = {};
  103 + Bll.toast("/AppVersionRest/setAppVersion", VersionData, "上传APP包");
  104 +});
  105 +
  106 +$(document).on("change", ".observe", function () {
  107 + var name = $(this).data("field");
  108 + VersionData[name] = $(this).val();
  109 +});
  110 +
  111 +$(document).on("click", ".change-status", function () {
  112 + VersionData = g.rows[$(this).data("index")];
  113 + VersionData.status = 1 - VersionData.status;
  114 + common.util.__ajax({
  115 + url: "/AppVersionRest/editAppVersion",
  116 + data: {id: VersionData.id, status: VersionData.status}
  117 + }, function (res) {
  118 + g.reload();
  119 + });
  120 +});
  121 +
  122 +$(document).on("click", ".del", function () {
  123 + VersionData = g.rows[$(this).data("index")];
  124 + common.dialog.confirm("警告",
  125 + "确认删除?",
  126 + function() {
  127 + common.util.__ajax({
  128 + url: "/AppVersionRest/delAppVersion",
  129 + data: {id: VersionData.id}
  130 + }, function () {
  131 + g.reload();
  132 + });
  133 + });
  134 +});
  135 +
  136 +$(document).on("click", "#filter-btn", function () {
  137 + g.reload(1);
  138 +});
@@ -63,19 +63,13 @@ var g = new common.grid({ @@ -63,19 +63,13 @@ var g = new common.grid({
63 if(!item.startTime || !item.endTime) return ""; 63 if(!item.startTime || !item.endTime) return "";
64 return Bll.getLocalTime(item.startTime) + "~" + Bll.getLocalTime(item.endTime); 64 return Bll.getLocalTime(item.startTime) + "~" + Bll.getLocalTime(item.endTime);
65 }}, 65 }},
66 - {display: "专题链接", render: function(item) {  
67 - var arr = [];  
68 - if(!!item.url) {  
69 - 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>');  
70 - arr.push('<a class="btn btn-primary copy" data-index="' + item.__index + '" data-id="' + item.id + '">复制链接</a>');  
71 - }  
72 - return arr.join(" ");  
73 - }},  
74 { 66 {
75 display: "操作", name: "", render: function (item) { 67 display: "操作", name: "", render: function (item) {
76 var arr = []; 68 var arr = [];
77 arr.push('<a class="btn btn-info add2" data-index="' + item.__index + '">编辑</a>'); 69 arr.push('<a class="btn btn-info add2" data-index="' + item.__index + '">编辑</a>');
78 arr.push('<a class="btn btn-info delbtn" data-index="' + item.__index + '">删除</a>'); 70 arr.push('<a class="btn btn-info delbtn" data-index="' + item.__index + '">删除</a>');
  71 + arr.push("<br>");
  72 + arr.push('<a class="btn btn-info showLink" data-index="' + item.__index + '">查看链接</a>');
79 return arr.join(""); 73 return arr.join("");
80 } 74 }
81 } 75 }
@@ -139,6 +133,7 @@ var Bll = { @@ -139,6 +133,7 @@ var Bll = {
139 option.data.promotionName = $("#promotionName5").val() + "%Off"; 133 option.data.promotionName = $("#promotionName5").val() + "%Off";
140 } 134 }
141 option.data.yhChannel = option.data.yhChannel.replace(/\|/g, ","); 135 option.data.yhChannel = option.data.yhChannel.replace(/\|/g, ",");
  136 + option.data.plateform = option.data.plateform.replace(/\|/g, ",");
142 137
143 option.success=function(res){ 138 option.success=function(res){
144 dialog.close(); 139 dialog.close();
@@ -221,8 +216,17 @@ $(document).on("click","#filter-btn",function () { @@ -221,8 +216,17 @@ $(document).on("click","#filter-btn",function () {
221 }); 216 });
222 217
223 $(document).on("click", ".copy", function() { 218 $(document).on("click", ".copy", function() {
224 - var Url2=document.getElementById($(this).data("id")); 219 + var Url2=document.getElementById($(this).data("link"));
225 Url2.select(); // 选择对象 220 Url2.select(); // 选择对象
226 document.execCommand("Copy"); // 执行浏览器复制命令 221 document.execCommand("Copy"); // 执行浏览器复制命令
227 common.util.__tip("链接复制成功", "success"); 222 common.util.__tip("链接复制成功", "success");
  223 +});
  224 +
  225 +$(document).on("click", ".showLink", function () {
  226 + var item = g.rows[$(this).data("index")];
  227 + var a=new common.dialog({
  228 + title:"\"\""+item.title + "\"\"链接",
  229 + width:"80%",
  230 + content:common.util.__template2($("#links-template").html(), item)
  231 + });
228 }); 232 });
@@ -26,7 +26,8 @@ var config = { @@ -26,7 +26,8 @@ var config = {
26 domain:'http://192.168.102.210:8088/platform',//联调 26 domain:'http://192.168.102.210:8088/platform',//联调
27 //domain: 'http://172.16.6.146:8088/platform', 27 //domain: 'http://172.16.6.146:8088/platform',
28 //domain:'http://172.16.6.120:8080/platform',//曹艳 28 //domain:'http://172.16.6.120:8080/platform',//曹艳
29 - //domain:'http://172.16.6.231:8080/platform',//王伟 29 + //domain:'http://172.16.6.225:8080/platform',//王伟
  30 + //domain:'http://172.16.6.190:8088/platform',
30 31
31 //domain: 'http://172.16.6.239:8080', //孙杰翔 32 //domain: 'http://172.16.6.239:8080', //孙杰翔
32 //domain:'http://172.16.6.189:8088/platform', //李健1 33 //domain:'http://172.16.6.189:8088/platform', //李健1
  1 +/**
  2 + * Created by ty on 2016/6/3.
  3 + */
  4 +
  5 +exports.domain = require('../config/common.js').domain;
  6 +
  7 +exports.res = [
  8 + {
  9 + route: "/operations/shopsVersionUpdate/index",
  10 + method: "GET",
  11 + view: "pages/operations/shopsVersionUpdate",
  12 + src: "/operations/shopsVersionUpdate",
  13 + },
  14 + {
  15 + route: "/AppVersionRest/getAppVersionList",
  16 + method: "POST",
  17 + url: "/AppVersionRest/getAppVersionList",
  18 + params: [
  19 + {name: "page", type: "number"},
  20 + {name: "size", type: "number"},
  21 + {name: "appVersion", type: "string"},
  22 + {name: "clientType", type: "string"}
  23 + ]
  24 + },
  25 + {
  26 + //添加
  27 + route: "/AppVersionRest/setAppVersion",
  28 + method: "POST",
  29 + url: "/AppVersionRest/setAppVersion",
  30 + params: [
  31 + {name: "appVersion", type: "string"},
  32 + {name: "clientType", type: "string"},
  33 + {name: "url", type: "string"},
  34 + {name: "content", type: "string"},
  35 + {name: "status", type: "string"}
  36 + ]
  37 + },
  38 + {
  39 + //删除
  40 + route: "/AppVersionRest/delAppVersion",
  41 + method: "POST",
  42 + url: "/AppVersionRest/delAppVersion",
  43 + params: [
  44 + {name: "id", type: "number"}
  45 + ]
  46 + },
  47 + {
  48 + //修改状态
  49 + route: "/AppVersionRest/editAppVersion",
  50 + method: "POST",
  51 + url: "/AppVersionRest/editAppVersion",
  52 + params: [
  53 + {name: "id", type: "number"},
  54 + {name: "status", type: "string"}
  55 + ]
  56 + }
  57 +];
@@ -42,7 +42,8 @@ exports.res = [ @@ -42,7 +42,8 @@ exports.res = [
42 {name: 'logoUrl', type: 'string'}, 42 {name: 'logoUrl', type: 'string'},
43 {name: 'webUrl', type: 'string'}, 43 {name: 'webUrl', type: 'string'},
44 {name: 'orderNum', type: 'number'}, 44 {name: 'orderNum', type: 'number'},
45 - {name: 'yhChannel', type: 'string'} 45 + {name: 'yhChannel', type: 'string'},
  46 + {name: 'webCoverUrl', type: 'string'}
46 ] 47 ]
47 }, 48 },
48 { 49 {
@@ -64,7 +65,8 @@ exports.res = [ @@ -64,7 +65,8 @@ exports.res = [
64 {name: 'logoUrl', type: 'string'}, 65 {name: 'logoUrl', type: 'string'},
65 {name: 'webUrl', type: 'string'}, 66 {name: 'webUrl', type: 'string'},
66 {name: 'orderNum', type: 'number'}, 67 {name: 'orderNum', type: 'number'},
67 - {name: 'yhChannel', type: 'string'} 68 + {name: 'yhChannel', type: 'string'},
  69 + {name: 'webCoverUrl', type: 'string'}
68 ] 70 ]
69 }, 71 },
70 { 72 {
  1 +<div class="pageheader">
  2 + <div class="media">
  3 + <div class="pageicon pull-left">
  4 + <i class="fa fa-th-list"></i>
  5 + </div>
  6 + <div class="media-body">
  7 + <ul class="breadcrumb">
  8 + <li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
  9 + <li><a href="">运营管理</a></li>
  10 + <li>商家端app包上传</li>
  11 + </ul>
  12 +
  13 + <div>
  14 + <div style="width: 30%;float: left;">
  15 + <h4>商家端app包上传</h4>
  16 + </div>
  17 + </div>
  18 + </div>
  19 + </div>
  20 +</div>
  21 +
  22 +<div class="panel panel-default" style="margin-bottom:10px;">
  23 + <div class="panel-heading">
  24 + <a class="btn btn-success " id="addAppVersion"><i class="fa fa-plus"></i> 添加</a>
  25 + </div>
  26 + <div class="panel-body">
  27 + <div class="panel-col">
  28 + <input type="text" id="appVersion" class="form-control" placeholder="app版本">
  29 + </div>
  30 + <div class="panel-col">
  31 + <select name="platform" id="clientType" tabindex="-1" class="form-control select2-offscreen brandBtn-group">
  32 + <option value="" selected="">安装包类型</option>
  33 + <option value="iphone">IOS手机</option>
  34 + <option value="ipad">IOS Pad</option>
  35 + <option value="android">安卓手机</option>
  36 + </select>
  37 + </div>
  38 + <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
  39 + <a id="all-btn" href="" class="btn btn-info">全部</a>
  40 + </div>
  41 + <div id="list-content"></div>
  42 +</div>
  43 +
  44 +<script type="text/template" id="template">
  45 + <div class="row" id="base-form">
  46 + <div class="form-group">
  47 + <label class="col-sm-2 control-label">app版本</label>
  48 + <div class="col-sm-8">
  49 + <input type="text" value="[[appVersion]]" class="form-control observe" data-field="appVersion" prompt="app版本" placeholder="请填写版本" required>
  50 + </div>
  51 + </div><!-- form-group -->
  52 +
  53 + <div class="form-group">
  54 + <label class="col-sm-2 control-label">安装包类型</label>
  55 + <div class="col-sm-8">
  56 + <select name="platform" id="types" tabindex="-1" class="form-control select2-offscreen brandBtn-group observe" data-field="clientType" value="[[clientType]]" required>
  57 + <option value="" selected="">请选择类型</option>
  58 + <option value="iphone">IOS手机</option>
  59 + <option value="ipad">IOS Pad</option>
  60 + <option value="android">安卓手机</option>
  61 + </select>
  62 + </div>
  63 + </div><!-- form-group -->
  64 +
  65 + <div class="form-group">
  66 + <label class="col-sm-2 control-label">url地址</label>
  67 + <div class="col-sm-6">
  68 + <input id="url" class="form-control" value="[[url]]" type="text" disabled="disabled" style="cursor:default" required prompt="app文件">
  69 + </div>
  70 + <div class="col-sm-4" style="position: relative">
  71 + <input id="appFile" name="appFile" class="btn btn-default excel-upload" type="file" style="position: absolute; top: 0;left: 0;">
  72 + <div class="file-name btn btn-default">请选择文件</div>
  73 + </div>
  74 + </div>
  75 + <div class="form-group">
  76 + <label class="col-sm-2 control-label">提醒内容</label>
  77 + <div class="col-sm-8">
  78 + <textarea name="content" class="form-control observe" data-field="content" required prompt="提醒内容">[[content]]</textarea>
  79 + </div>
  80 + </div><!-- form-group -->
  81 + <div class="form-group">
  82 + <label class="col-sm-2 control-label">状态</label>
  83 + <div class="col-sm-8">
  84 + <label style="cursor: pointer;"><input style="width: 15px;height: 15px" type="radio" name="status" value="0" checked>关闭</label>
  85 + <label style="cursor: pointer;"><input style="width: 15px;height: 15px" type="radio" name="status" value="1">开启</label>
  86 + </div>
  87 + <input type="hidden" id="status" value="[[status||0]]" for="radio" />
  88 + </div><!-- form-group -->
  89 + </div>
  90 +</script>
@@ -91,12 +91,12 @@ @@ -91,12 +91,12 @@
91 <div class="form-group"> 91 <div class="form-group">
92 <label class="col-sm-2 control-label">平台</label> 92 <label class="col-sm-2 control-label">平台</label>
93 <div class="col-sm-8"> 93 <div class="col-sm-8">
94 - <label style="cursor: pointer;"><input type="radio" name="plateform" value="1">WEB</label>  
95 - <label style="cursor: pointer;"><input type="radio" name="plateform" value="2">APP</label>  
96 - <label style="cursor: pointer;"><input type="radio" name="plateform" value="3">WAP</label>  
97 - <label style="cursor: pointer;"><input type="radio" name="plateform" value="4">IPAD</label> 94 + <label style="cursor: pointer;"><input type="checkbox" name="plateform" value="1">WEB</label>
  95 + <label style="cursor: pointer;"><input type="checkbox" name="plateform" value="2">APP</label>
  96 + <label style="cursor: pointer;"><input type="checkbox" name="plateform" value="3">WAP</label>
  97 + <label style="cursor: pointer;"><input type="checkbox" name="plateform" value="4">IPAD</label>
98 </div> 98 </div>
99 - <input type="hidden" id="plateform" value="{plateform}" for="radio"> 99 + <input type="hidden" id="plateform" value="{plateform}" for="checkbox">
100 </div> 100 </div>
101 <div class="form-group"> 101 <div class="form-group">
102 <label class="col-sm-2 control-label">频道</label> 102 <label class="col-sm-2 control-label">频道</label>
@@ -153,12 +153,18 @@ @@ -153,12 +153,18 @@
153 </div> 153 </div>
154 </div> 154 </div>
155 <div class="form-group"> 155 <div class="form-group">
156 - <label class="col-sm-2 control-label">WEB封面</label> 156 + <label class="col-sm-2 control-label">WEB logo</label>
157 <div class="col-sm-10"> 157 <div class="col-sm-10">
158 <input type="file" id="logoUrl" name="logoUrl" value="{logoUrl}"/><!----> 158 <input type="file" id="logoUrl" name="logoUrl" value="{logoUrl}"/><!---->
159 </div> 159 </div>
160 </div> 160 </div>
161 <div class="form-group"> 161 <div class="form-group">
  162 + <label class="col-sm-2 control-label">web封面图</label>
  163 + <div class="col-sm-10">
  164 + <input type="file" id="webCoverUrl" name="webCoverUrl" value="{webCoverUrl}"/>
  165 + </div>
  166 + </div>
  167 + <div class="form-group">
162 <label class="col-sm-2 control-label">web列表页图</label> 168 <label class="col-sm-2 control-label">web列表页图</label>
163 <div class="col-sm-10"> 169 <div class="col-sm-10">
164 <input type="file" id="webUrl" name="webUrl" value="{webUrl}"/> 170 <input type="file" id="webUrl" name="webUrl" value="{webUrl}"/>
@@ -173,4 +179,32 @@ @@ -173,4 +179,32 @@
173 </div> 179 </div>
174 </div> 180 </div>
175 </div> 181 </div>
  182 +</script>
  183 +
  184 +<script type="text/template" id="links-template">
  185 + <table class="table no-footer">
  186 + <tbody>
  187 + [[if linkWeb]]
  188 + <tr>
  189 + <td align="right">WEB链接</td>
  190 + <td width="80%"><textarea readonly style="border: 0;resize:none;outline:none;background-color: transparent;width: 100%;" id="linkWeb[[id]]">[[linkWeb]]</textarea></td>
  191 + <td><a class="btn btn-primary copy" data-link="linkWeb[[id]]">复制</a></td>
  192 + </tr>
  193 + [[/if]]
  194 + [[if linkWap]]
  195 + <tr>
  196 + <td align="right">WAP链接</td>
  197 + <td width="80%"><textarea readonly style="border: 0;resize:none;outline:none;background-color: transparent; width: 100%;" id="linkWap[[id]]">[[linkWap]]</textarea></td>
  198 + <td><a class="btn btn-primary copy" data-link="linkWap[[id]]">复制</a></td>
  199 + </tr>
  200 + [[/if]]
  201 + [[if linkApp]]
  202 + <tr>
  203 + <td align="right">APP链接</td>
  204 + <td width="80%"><textarea readonly style="border: 0;resize:none;outline:none;background-color: transparent;width: 100%;" id="linkApp[[id]]">[[linkApp]]</textarea></td>
  205 + <td><a class="btn btn-primary copy" data-link="linkApp[[id]]">复制</a></td>
  206 + </tr>
  207 + [[/if]]
  208 + </tbody>
  209 + </table>
176 </script> 210 </script>