Index.js
2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
* Created by ty on 2016/6/17.
* 批量生成链接
*/
var $ = require('jquery');
common = require('../../../common/common');
var module = {
channelId: 2,
linkType: "app",
urlType:1
},
singleModule = {
action: "go.brand",
linkType: "app",
urlType:1
};
var edit = new common.edit2("#generate-content");
var role = $("#wrap-content").attr("role"),
url = $("#wrap-content").attr("url");
var Bll = {
__render: function () {
$("#generate-content").html(common.util.__template2($("#content-template").html(), role == "complex" ? module : singleModule));
edit.init();
}
};
Bll.__render();
if(role == "single") {
$("#exportsearch").hide();
}
//生成
$(document).on("click", "#submitsearch", function () {
if(edit.validate()) {
module.linkType = $("#linkType").val();
singleModule.linkType = $("#linkType").val();
module.urlType = $("#urlType").val();
singleModule.urlType = $("#urlType").val();
common.util.__ajax({
url: url,
data: role == "complex" ? module : singleModule
}, function (res) {
module.data = res.data;
singleModule.data = res.data;
Bll.__render();
});
}
});
//导出
$(document).on("click", "#exportsearch", function () {
if(edit.validate()) {
module.linkType = $("#linkType").val();
module.urlType = $("#urlType").val();
var temp = $.extend(true, {}, module);
delete temp.data;
window.open("/ajax/down?queryConf=" + JSON.stringify(temp) + "&type=linkExport");
}
});
$(document).on("change", ".observe", function () {
var name = $(this).data("field");
module[name] = $(this).val();
singleModule[name] = $(this).val();
});
//复制
$(document).on("click", ".copy", function() {
var Url2=document.getElementById($(this).data("link"));
Url2.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
common.util.__tip("链接复制成功", "success");
});