|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+<%@ Page Language="C#" MasterPageFile="~/Admin/Defult.Master" AutoEventWireup="true" CodeBehind="PictureEdit.aspx.cs" Inherits="ShopMobile.Admin.PictureEdit" %>
|
|
|
2
|
+
|
|
|
3
|
+<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
|
|
|
4
|
+</asp:Content>
|
|
|
5
|
+<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
|
|
|
6
|
+
|
|
|
7
|
+ <div class="page-content">
|
|
|
8
|
+ <div class="page-header">
|
|
|
9
|
+ <h1>图片上传
|
|
|
10
|
+ </h1>
|
|
|
11
|
+ </div>
|
|
|
12
|
+ <div class="row">
|
|
|
13
|
+ <div class="Content">
|
|
|
14
|
+ <!-- PAGE CONTENT BEGINS -->
|
|
|
15
|
+ <div class="form-group">
|
|
|
16
|
+ <label class="col-sm-3 control-label no-padding-right">
|
|
|
17
|
+ 图片排序:
|
|
|
18
|
+ </label>
|
|
|
19
|
+ <div class="col-sm-9">
|
|
|
20
|
+ <input type="text" id="txtPicSort" maxlength="30" placeholder="图片排序" class="col-xs-10 col-sm-5" runat="server" />
|
|
|
21
|
+ </div>
|
|
|
22
|
+ </div>
|
|
|
23
|
+ <div class="form-group">
|
|
|
24
|
+ <label class="col-sm-3 control-label no-padding-right" for="statuscheckbox">
|
|
|
25
|
+ 图片主图:
|
|
|
26
|
+ </label>
|
|
|
27
|
+ <div class="col-sm-9">
|
|
|
28
|
+ <div class="control-group">
|
|
|
29
|
+ <img src="" class="spztimg" style="display: none; width: 100px; height: 100px;" />
|
|
|
30
|
+ <input type="button" class="spzt" value="上传图片" />
|
|
|
31
|
+ <input type="hidden" runat="server" id="spzt" class="spztval" />
|
|
|
32
|
+ </div>
|
|
|
33
|
+ </div>
|
|
|
34
|
+ </div>
|
|
|
35
|
+ <div class="form-group">
|
|
|
36
|
+ <label class="col-sm-3 control-label no-padding-right">
|
|
|
37
|
+ 图片链接地址:</label>
|
|
|
38
|
+ <div class="col-sm-9">
|
|
|
39
|
+ <div class="clearfix">
|
|
|
40
|
+ <input class="col-xs-10 col-sm-5" type="text" id="ImgUrl" placeholder="图片链接地址" runat="server" />
|
|
|
41
|
+ </div>
|
|
|
42
|
+ </div>
|
|
|
43
|
+ </div>
|
|
|
44
|
+ <div style="clear: both">
|
|
|
45
|
+ </div>
|
|
|
46
|
+ <div class="clearfix form-actions">
|
|
|
47
|
+ <div class="col-md-offset-3 col-md-9">
|
|
|
48
|
+ <button class="btn btn-info" runat="server" id="submitButton" onclick="" onserverclick="submitButton_Click">
|
|
|
49
|
+ <i class="icon-ok bigger-110"></i>保存
|
|
|
50
|
+ </button>
|
|
|
51
|
+ </div>
|
|
|
52
|
+ </div>
|
|
|
53
|
+ </div>
|
|
|
54
|
+ </div>
|
|
|
55
|
+ </div>
|
|
|
56
|
+</asp:Content>
|
|
|
57
|
+<asp:Content ID="Content3" ContentPlaceHolderID="otherjquery" runat="server">
|
|
|
58
|
+ <link rel="stylesheet" href="assets/js/kindeditor-4.1.7/themes/default/default.css" />
|
|
|
59
|
+ <link rel="stylesheet" href="assets/js/kindeditor-4.1.7/plugins/code/prettify.css" />
|
|
|
60
|
+ <script charset="utf-8" src="assets/js/kindeditor-4.1.7/kindeditor.js"></script>
|
|
|
61
|
+ <script charset="utf-8" src="assets/js/kindeditor-4.1.7/lang/zh_CN.js"></script>
|
|
|
62
|
+ <script charset="utf-8" src="assets/js/kindeditor-4.1.7/plugins/code/prettify.js"></script>
|
|
|
63
|
+ <link href="/admin/assets/js/zTree_v3/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
|
|
|
64
|
+ <script src="/admin/assets/js/zTree_v3/js/jquery.ztree.core-3.5.min.js"></script>
|
|
|
65
|
+ <script type="text/javascript">
|
|
|
66
|
+ $(document).ready(function () {
|
|
|
67
|
+
|
|
|
68
|
+ var tp = $('.spztval').val();
|
|
|
69
|
+ var tps = $('.splbtval').val();
|
|
|
70
|
+ var bqs = $('.spbq').val();
|
|
|
71
|
+ var lx = $('.splx').val();
|
|
|
72
|
+ if (tp) {
|
|
|
73
|
+ $('.spztimg').attr('src', tp);
|
|
|
74
|
+ $('.spztimg').show();
|
|
|
75
|
+ }
|
|
|
76
|
+ if (tps) {
|
|
|
77
|
+ var html='';
|
|
|
78
|
+ $(tps.split(',')).each(function (i, n) {
|
|
|
79
|
+ html=html+'<li><div><img src="'+n+'" alt="" /><b class="close">X</b></div></li>';
|
|
|
80
|
+ })
|
|
|
81
|
+ $(html).appendTo($(".fl")).find(".close").click(function(){
|
|
|
82
|
+ $(this).parent().parent().remove();
|
|
|
83
|
+ geturls();
|
|
|
84
|
+ })
|
|
|
85
|
+ }
|
|
|
86
|
+ if (bqs) {
|
|
|
87
|
+ var html='';
|
|
|
88
|
+ $(bqs.split(',')).each(function (i, n) {
|
|
|
89
|
+ $("input[name='spbq'][value='"+n+"']").attr("checked","checked");
|
|
|
90
|
+ })
|
|
|
91
|
+ }
|
|
|
92
|
+ $(zNodes).each(function(i,n){
|
|
|
93
|
+ if(n.ID==lx)
|
|
|
94
|
+ {
|
|
|
95
|
+ $("#splxname").val(n.MenuTxt);
|
|
|
96
|
+ return false;
|
|
|
97
|
+ }
|
|
|
98
|
+ })
|
|
|
99
|
+ zTreeObj =$.fn.zTree.init($("#treeDemo"), setting, zNodes);
|
|
|
100
|
+ zTreeObj.expandAll(true);
|
|
|
101
|
+ $("#splxname").click(function(){
|
|
|
102
|
+ showMenu();
|
|
|
103
|
+ })
|
|
|
104
|
+ })
|
|
|
105
|
+ var setting = {
|
|
|
106
|
+ data: {
|
|
|
107
|
+ key:{
|
|
|
108
|
+ name:"MenuTxt"
|
|
|
109
|
+ },
|
|
|
110
|
+ simpleData: {
|
|
|
111
|
+ enable: true,
|
|
|
112
|
+ idKey: "ID",
|
|
|
113
|
+ pIdKey: "TopID",
|
|
|
114
|
+ rootPId: 0
|
|
|
115
|
+ }
|
|
|
116
|
+ },
|
|
|
117
|
+ callback: {
|
|
|
118
|
+ beforeClick: beforeClick,
|
|
|
119
|
+ onClick: onClick
|
|
|
120
|
+ }
|
|
|
121
|
+ };
|
|
|
122
|
+ <%--var zNodes =<%=jsontree %>;--%>
|
|
|
123
|
+ var zTreeObj ;
|
|
|
124
|
+
function beforeClick(treeId, treeNode) {
|
|
|
125
|
+ var check = (treeNode && treeNode.Lvl==3);
|
|
|
126
|
+ if (!check) alert("只能选择三级类别");
|
|
|
127
|
+ return check;
|
|
|
128
|
+ }
|
|
|
129
|
+ function onClick(e, treeId, treeNode) {
|
|
|
130
|
+ $("#splxname").val(treeNode.MenuTxt);
|
|
|
131
|
+ $(".splx").val(treeNode.ID);
|
|
|
132
|
+ hideMenu();
|
|
|
133
|
+ }
|
|
|
134
|
+ function showMenu() {
|
|
|
135
|
+ $("#menuContent").slideDown("fast");
|
|
|
136
|
+
|
|
|
137
|
+ $("body").bind("mousedown", onBodyDown);
|
|
|
138
|
+ }
|
|
|
139
|
+ function hideMenu() {
|
|
|
140
|
+ $("#menuContent").fadeOut("fast");
|
|
|
141
|
+ $("body").unbind("mousedown", onBodyDown);
|
|
|
142
|
+ }
|
|
|
143
|
+ function onBodyDown(event) {
|
|
|
144
|
+ if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
|
|
|
145
|
+ hideMenu();
|
|
|
146
|
+ }
|
|
|
147
|
+ }
|
|
|
148
|
+ KindEditor.ready(function (K) {
|
|
|
149
|
+ var editor = K.editor({
|
|
|
150
|
+ cssPath: 'assets/js/kindeditor-4.1.7/plugins/code/prettify.css',
|
|
|
151
|
+ uploadJson: 'assets/js/kindeditor-4.1.7/asp.net/upload_json.ashx',
|
|
|
152
|
+ allowFileManager: true
|
|
|
153
|
+ });
|
|
|
154
|
+ K('.spzt').click(function () {
|
|
|
155
|
+ editor.loadPlugin('image', function () {
|
|
|
156
|
+ editor.plugin.imageDialog({
|
|
|
157
|
+ showRemote: false,
|
|
|
158
|
+ imageUrl: K('.spztimg').attr("src"),
|
|
|
159
|
+ clickFn: function (url, title, width, height, border, align) {
|
|
|
160
|
+ K('.spztimg').attr('src', url);
|
|
|
161
|
+ K('.spztval').val(url);
|
|
|
162
|
+ K('.spztimg').show();
|
|
|
163
|
+ editor.hideDialog();
|
|
|
164
|
+ }
|
|
|
165
|
+ });
|
|
|
166
|
+ });
|
|
|
167
|
+ });
|
|
|
168
|
+
|
|
|
169
|
+ K('.splbt').click(function () {
|
|
|
170
|
+ editor.loadPlugin('multiimage', function () {
|
|
|
171
|
+ editor.plugin.multiImageDialog({
|
|
|
172
|
+ clickFn: function (urlList) {
|
|
|
173
|
+ var html='';
|
|
|
174
|
+ K.each(urlList, function (i, data) {
|
|
|
175
|
+ html=html+'<li><div><img src="'+data.url+'" alt="" /><b class="close">X</b></div></li>';
|
|
|
176
|
+ });
|
|
|
177
|
+ $(html).appendTo($(".fl")).find(".close").click(function(){
|
|
|
178
|
+ $(this).parent().parent().remove();
|
|
|
179
|
+ geturls();
|
|
|
180
|
+ })
|
|
|
181
|
+ geturls();
|
|
|
182
|
+ editor.hideDialog();
|
|
|
183
|
+ }
|
|
|
184
|
+ });
|
|
|
185
|
+ });
|
|
|
186
|
+ });
|
|
|
187
|
+
|
|
|
188
|
+ var editor1 = K.create('.xxxx', {
|
|
|
189
|
+ cssPath: 'assets/js/kindeditor-4.1.7/plugins/code/prettify.css',
|
|
|
190
|
+ uploadJson: 'assets/js/kindeditor-4.1.7/asp.net/upload_json.ashx',
|
|
|
191
|
+ fileManagerJson: 'assets/js/kindeditor-4.1.7/asp.net/file_manager_json.ashx',
|
|
|
192
|
+ allowFileManager: true,
|
|
|
193
|
+ //下面这行代码就是关键的所在,当失去焦点时执行 this.sync(),否则取不到值;
|
|
|
194
|
+ afterBlur: function () { this.sync(); }
|
|
|
195
|
+ });
|
|
|
196
|
+ });
|
|
|
197
|
+
|
|
|
198
|
+ function geturls() {
|
|
|
199
|
+ var url = '';
|
|
|
200
|
+ $(".fl li").each(function(){
|
|
|
201
|
+ url=url+$(this).find("img").attr("src")+",";
|
|
|
202
|
+ })
|
|
|
203
|
+ if(url){
|
|
|
204
|
+ url=url.substring(0,url.length-1);
|
|
|
205
|
+ }
|
|
|
206
|
+ $('.splbtval').val(url);
|
|
|
207
|
+ }
|
|
|
208
|
+
|
|
|
209
|
+ $("input[name='spbq']").change(function(){
|
|
|
210
|
+ getbqs();
|
|
|
211
|
+ })
|
|
|
212
|
+ function getbqs() {
|
|
|
213
|
+ var bq = '';
|
|
|
214
|
+ $("input[name='spbq']:checked").each(function(){
|
|
|
215
|
+ bq=bq+$(this).val()+",";
|
|
|
216
|
+ })
|
|
|
217
|
+
|
|
|
218
|
+ if(bq){
|
|
|
219
|
+ bq=bq.substring(0,bq.length-1);
|
|
|
220
|
+ }
|
|
|
221
|
+ $('.spbq').val(bq);
|
|
|
222
|
+ }
|
|
|
223
|
+ </script>
|
|
|
224
|
+ <style>
|
|
|
225
|
+ ul.ztree {
|
|
|
226
|
+ margin-top: 10px;
|
|
|
227
|
+ border: 1px solid #617775;
|
|
|
228
|
+ background: #f0f6e4;
|
|
|
229
|
+ width: 220px;
|
|
|
230
|
+ height: 360px;
|
|
|
231
|
+ overflow-y: scroll;
|
|
|
232
|
+ overflow-x: auto;
|
|
|
233
|
+ }
|
|
|
234
|
+
|
|
|
235
|
+ .ztree {
|
|
|
236
|
+ margin: 0;
|
|
|
237
|
+ padding: 5px;
|
|
|
238
|
+ color: #333;
|
|
|
239
|
+ }
|
|
|
240
|
+
|
|
|
241
|
+ .fl {
|
|
|
242
|
+ overflow: hidden;
|
|
|
243
|
+ }
|
|
|
244
|
+
|
|
|
245
|
+ .fl {
|
|
|
246
|
+ float: left;
|
|
|
247
|
+ }
|
|
|
248
|
+
|
|
|
249
|
+ .fl li {
|
|
|
250
|
+ list-style: none;
|
|
|
251
|
+ float: left;
|
|
|
252
|
+ margin-right: 10px;
|
|
|
253
|
+ margin-top: 10px;
|
|
|
254
|
+ margin-bottom: 10px;
|
|
|
255
|
+ overflow: auto;
|
|
|
256
|
+ top: -11px;
|
|
|
257
|
+ right: -7px;
|
|
|
258
|
+ }
|
|
|
259
|
+
|
|
|
260
|
+ .fl li div {
|
|
|
261
|
+ position: relative;
|
|
|
262
|
+ }
|
|
|
263
|
+
|
|
|
264
|
+ .fl li div b {
|
|
|
265
|
+ position: absolute;
|
|
|
266
|
+ }
|
|
|
267
|
+
|
|
|
268
|
+ .fl li div img {
|
|
|
269
|
+ width: 200px;
|
|
|
270
|
+ height: 200px;
|
|
|
271
|
+ }
|
|
|
272
|
+
|
|
|
273
|
+ .close {
|
|
|
274
|
+ width: 40px;
|
|
|
275
|
+ height: 40px;
|
|
|
276
|
+ background: red;
|
|
|
277
|
+ color: #FFFFFF;
|
|
|
278
|
+ text-align: center;
|
|
|
279
|
+ margin: 0 auto;
|
|
|
280
|
+ border-radius: 50%;
|
|
|
281
|
+ line-height: 40px;
|
|
|
282
|
+ top: -5px;
|
|
|
283
|
+ right: 0;
|
|
|
284
|
+ }
|
|
|
285
|
+ </style>
|
|
|
286
|
+</asp:Content>
|
|
|
287
|
+
|