indexEdit.js
4.2 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
var myLocateInfo = {};
var locations = {};
var direction = "";
var map = null,
geocoder = null,
geolocation = null;
var isLoading = false;
var urls = {
"get": "/wanmei/seriesinfo/get",
"save": "/wanmei/seriesinfo/save",
"update": "/wanmei/seriesinfo/update",
"fileupdate": "/wanmei/file/upload"
};
// 站点的信息
var stationList = null;
// 会议信息,用来做比对。
var meetingObject = null;
openMenu("meeting.html");
var indexEdit = {};
indexEdit.get = function() {
var id = _getQueryString("id");
var data = { id: id };
$.ajax({
"url": _REQUESTURL + urls.get,
"data": data,
"success": function(res) {
if (res.success && res.code == 2000) {
if (res.content) {
$("#series_name").attr("data-id", res.content.id);
$("#series_name").val(res.content.series_name);
$("#commercial").val(res.content.commercial);
$("#product_height_1").val(res.content.product_height_1);
$("#product_height_2").val(res.content.product_height_2);
$("#product_width_1").val(res.content.product_width_1);
$("#product_width_2").val(res.content.product_width_2);
$("#p_product_url_1").attr("src", res.content.product_url_1);
$("#p_product_url_2").attr("src", res.content.product_url_2);
$("#product_id").val(res.content.product_id);
} else {}
} else {
alert("系统错误");
}
}
});
}
indexEdit.get();
//上传图片
function uploadPic(obj, type, index, id) {
};
function initSelector() {
if (stationList != null && meetingObject != null) {
changeSelector();
}
}
(function() {
$("#save").on("click", function() {
var id = $("#series_name").attr("data-id");
var series_name = $("#series_name").val();
var commercial = $("#commercial").val();
var product_height_1 = $("#product_height_1").val();
var product_height_2 = $("#product_height_2").val();
var product_width_1 = $("#product_width_1").val();
var product_width_2 = $("#product_width_2").val();
var product_url_1 = $("#p_product_url_1").attr("src");
var product_url_2 = $("#p_product_url_2").attr("src");
var product_id = $("#product_id").val();
var url = urls.save;
if (id) {
url = urls.update;
} else {
url = urls.save;
}
var data = {
id: id,
series_name: series_name,
product_height_1: product_height_1,
product_height_2: product_height_2,
product_width_1: product_width_1,
product_width_2: product_width_2,
product_url_1: product_url_1,
product_url_2: product_url_2,
commercial: commercial,
product_id:product_id
};
$.ajax({
"url": _REQUESTURL + url,
"data": data,
"success": function(res) {
if (res.success && res.code == 2000) {
alert("保存成功");
window.location.href = "index.html";
} else {
alert("系统错误");
}
}
});
});
$('#f_product_url_1').fileupload({
url: "http://mat.marubi.cn" + urls.fileupdate,
dataType: 'json',
done: function(e, data) {
var res = data.result;
if (res.success && res.code == 2000) {
$('#p_product_url_1').attr("src", "http://mat.marubi.com.cn/uploads" + res.content.url);
} else {
alert("系统错误");
}
}
});
$('#f_product_url_2').fileupload({
url: "http://mat.marubi.cn" + urls.fileupdate,
dataType: 'json',
done: function(e, data) {
var res = data.result;
if (res.success && res.code == 2000) {
$('#p_product_url_2').attr("src", "http://mat.marubi.com.cn/uploads" + res.content.url);
} else {
alert("系统错误");
}
}
});
})();