|
|
1
|
+<include file="public@header"/>
|
|
|
2
|
+<style type="text/css">
|
|
|
3
|
+ .pic-list li {
|
|
|
4
|
+ margin-bottom: 5px;
|
|
|
5
|
+ }
|
|
|
6
|
+</style>
|
|
|
7
|
+<script type="text/html" id="photos-item-tpl">
|
|
|
8
|
+ <li id="saved-image{id}">
|
|
|
9
|
+ <input id="photo-{id}" type="hidden" name="photo_urls[]" value="{filepath}">
|
|
|
10
|
+ <input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
|
|
|
11
|
+ style="width: 200px;" title="图片名称">
|
|
|
12
|
+ <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
|
|
|
13
|
+ onclick="imagePreviewDialog(this.src);">
|
|
|
14
|
+ <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
|
|
|
15
|
+ <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
|
|
|
16
|
+ </li>
|
|
|
17
|
+</script>
|
|
|
18
|
+<script type="text/html" id="files-item-tpl">
|
|
|
19
|
+ <li id="saved-file{id}">
|
|
|
20
|
+ <input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
|
|
|
21
|
+ <input class="form-control" id="file-{id}-name" type="text" name="file_names[]" value="{name}"
|
|
|
22
|
+ style="width: 200px;" title="文件名称">
|
|
|
23
|
+ <a id="file-{id}-preview" href="{preview_url}" target="_blank">下载</a>
|
|
|
24
|
+ <a href="javascript:uploadOne('图片上传','#file-{id}','file');">替换</a>
|
|
|
25
|
+ <a href="javascript:(function(){$('#saved-file{id}').remove();})();">移除</a>
|
|
|
26
|
+ </li>
|
|
|
27
|
+</script>
|
|
|
28
|
+</head>
|
|
|
29
|
+<body>
|
|
|
30
|
+<div class="wrap js-check-wrap">
|
|
|
31
|
+ <ul class="nav nav-tabs">
|
|
|
32
|
+ <li><a href="{:url('index')}">商品管理</a></li>
|
|
|
33
|
+ <li class="active"><a href="">编辑商品</a></li>
|
|
|
34
|
+ </ul>
|
|
|
35
|
+ <form action="{:url('goodEdit')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
|
|
|
36
|
+ <div class="row">
|
|
|
37
|
+ <div class="col-md-9">
|
|
|
38
|
+ <table class="table table-bordered">
|
|
|
39
|
+ <input name="id" type="hidden" value="{$good.id}">
|
|
|
40
|
+ <tr>
|
|
|
41
|
+ <th>商品名称<span class="form-required">*</span></th>
|
|
|
42
|
+ <td>
|
|
|
43
|
+ <input class="form-control" type="text" name="post[name]"
|
|
|
44
|
+ id="title" required value="{$good.name}" placeholder="请输入标题"/>
|
|
|
45
|
+ </td>
|
|
|
46
|
+ </tr>
|
|
|
47
|
+
|
|
|
48
|
+ <tr>
|
|
|
49
|
+ <th>简介</th>
|
|
|
50
|
+ <td>
|
|
|
51
|
+ <textarea class="form-control" name="post[describe]" style="height: 50px;"
|
|
|
52
|
+ placeholder="请填写摘要">{$good.describe}</textarea>
|
|
|
53
|
+ </td>
|
|
|
54
|
+ </tr>
|
|
|
55
|
+ <tr>
|
|
|
56
|
+ <th>消耗积分数</th>
|
|
|
57
|
+ <td>
|
|
|
58
|
+ <input type="number" class="form-control" name="post[fee]" style="height: 50px;"
|
|
|
59
|
+ value="{$good.fee}">
|
|
|
60
|
+ </td>
|
|
|
61
|
+ </tr>
|
|
|
62
|
+ <tr>
|
|
|
63
|
+ <th>内容</th>
|
|
|
64
|
+ <td>
|
|
|
65
|
+ <script type="text/plain" id="content" name="post[content]">{:getContent($good.content)}</script>
|
|
|
66
|
+ </td>
|
|
|
67
|
+ </tr>
|
|
|
68
|
+ <tr>
|
|
|
69
|
+ <th>相册</th>
|
|
|
70
|
+ <td>
|
|
|
71
|
+ <ul id="photos" class="pic-list list-unstyled form-inline">
|
|
|
72
|
+ <notempty name="good.pic">
|
|
|
73
|
+
|
|
|
74
|
+ <foreach name="good.pic" item="vo">
|
|
|
75
|
+ <php>$img_url=cmf_get_image_preview_url($vo);</php>
|
|
|
76
|
+ <li id="saved-image{$key}">
|
|
|
77
|
+ <input id="photo-{$key}" type="hidden" name="photo_urls[]"
|
|
|
78
|
+ value="{$vo}">
|
|
|
79
|
+ <img id="photo-{$key}-preview"
|
|
|
80
|
+ src="{:cmf_get_image_preview_url($vo)}"
|
|
|
81
|
+ style="height:36px;width: 36px;"
|
|
|
82
|
+ onclick="parent.imagePreviewDialog(this.src);">
|
|
|
83
|
+ <a href="javascript:uploadOneImage('图片上传','#photo-{$key}');">替换</a>
|
|
|
84
|
+ <a href="javascript:(function(){$('#saved-image{$key}').remove();})();">移除</a>
|
|
|
85
|
+ </li>
|
|
|
86
|
+ </foreach>
|
|
|
87
|
+ </notempty>
|
|
|
88
|
+ </ul>
|
|
|
89
|
+ <a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-tpl');"
|
|
|
90
|
+ class="btn btn-sm btn-default">选择图片</a>
|
|
|
91
|
+ </td>
|
|
|
92
|
+ </tr>
|
|
|
93
|
+ </table>
|
|
|
94
|
+ <div class="form-group">
|
|
|
95
|
+ <div class="col-sm-offset-2 col-sm-10">
|
|
|
96
|
+ <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
|
|
|
97
|
+ <a class="btn btn-default" href="{:url('AdminArticle/index')}">{:lang('BACK')}</a>
|
|
|
98
|
+ </div>
|
|
|
99
|
+ </div>
|
|
|
100
|
+ </div>
|
|
|
101
|
+ <div class="col-md-3">
|
|
|
102
|
+ <table class="table table-bordered">
|
|
|
103
|
+ <tr>
|
|
|
104
|
+ <th>缩略图</th>
|
|
|
105
|
+ </tr>
|
|
|
106
|
+ <tr>
|
|
|
107
|
+ <td>
|
|
|
108
|
+ <div style="text-align: center;">
|
|
|
109
|
+ <input type="hidden" name="post[thumbnail]" id="thumbnail"
|
|
|
110
|
+ value="{$good.thumbnail|default=''}">
|
|
|
111
|
+ <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
|
|
|
112
|
+ <if condition="empty($good.thumbnail)">
|
|
|
113
|
+ <img src="__TMPL__/public/assets/images/default-thumbnail.png"
|
|
|
114
|
+ id="thumbnail-preview"
|
|
|
115
|
+ width="135" style="cursor: pointer"/>
|
|
|
116
|
+ <else/>
|
|
|
117
|
+ <img src="{:cmf_get_image_preview_url($good.thumbnail)}"
|
|
|
118
|
+ id="thumbnail-preview"
|
|
|
119
|
+ width="135" style="cursor: pointer"/>
|
|
|
120
|
+ </if>
|
|
|
121
|
+ </a>
|
|
|
122
|
+ <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
|
|
|
123
|
+ </div>
|
|
|
124
|
+ </td>
|
|
|
125
|
+ </tr>
|
|
|
126
|
+ </table>
|
|
|
127
|
+ </div>
|
|
|
128
|
+ </div>
|
|
|
129
|
+ </form>
|
|
|
130
|
+</div>
|
|
|
131
|
+<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
|
|
|
132
|
+<script type="text/javascript">
|
|
|
133
|
+ //编辑器路径定义
|
|
|
134
|
+ var editorURL = GV.WEB_ROOT;
|
|
|
135
|
+</script>
|
|
|
136
|
+<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
|
|
|
137
|
+<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
|
|
|
138
|
+<script type="text/javascript">
|
|
|
139
|
+ $(function () {
|
|
|
140
|
+
|
|
|
141
|
+ editorcontent = new baidu.editor.ui.Editor();
|
|
|
142
|
+ editorcontent.render('content');
|
|
|
143
|
+ try {
|
|
|
144
|
+ editorcontent.sync();
|
|
|
145
|
+ } catch (err) {
|
|
|
146
|
+ }
|
|
|
147
|
+
|
|
|
148
|
+ $('.btn-cancel-thumbnail').click(function () {
|
|
|
149
|
+ $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
|
|
|
150
|
+ $('#thumbnail').val('');
|
|
|
151
|
+ });
|
|
|
152
|
+
|
|
|
153
|
+ });
|
|
|
154
|
+ function doSelectUsers() {
|
|
|
155
|
+ var selectedUsersId = $('#js-users-id-input').val();
|
|
|
156
|
+ openIframeLayer("{:url('Common/selectUsers')}?ids=" + selectedUsersId, '请选择分类', {
|
|
|
157
|
+ area: ['1200px', '800px'],
|
|
|
158
|
+ btn: ['确定', '取消'],
|
|
|
159
|
+ yes: function (index, layero) {
|
|
|
160
|
+ //do something
|
|
|
161
|
+
|
|
|
162
|
+ var iframeWin = window[layero.find('iframe')[0]['name']];
|
|
|
163
|
+ var selectedUsers = iframeWin.confirm();
|
|
|
164
|
+ if (selectedUsers.selectedUsersId.length == 0) {
|
|
|
165
|
+ layer.msg('请选择分类');
|
|
|
166
|
+ return;
|
|
|
167
|
+ }
|
|
|
168
|
+ $('#js-users-id-input').val(selectedUsers.selectedUsersId.join(','));
|
|
|
169
|
+ $('#js-users-name-input').val(selectedUsers.selectedUsersName.join(' '));
|
|
|
170
|
+ //console.log(layer.getFrameIndex(index));
|
|
|
171
|
+ layer.close(index); //如果设定了yes回调,需进行手工关闭
|
|
|
172
|
+ }
|
|
|
173
|
+ });
|
|
|
174
|
+ }
|
|
|
175
|
+
|
|
|
176
|
+
|
|
|
177
|
+
|
|
|
178
|
+
|
|
|
179
|
+ function doSelectCategory() {
|
|
|
180
|
+ console.log('打开页面');
|
|
|
181
|
+ var selectedCategoriesId = $('#js-categories-id-input').val();
|
|
|
182
|
+ openIframeLayer("{:url('AdminCategory/select')}?ids=" + selectedCategoriesId, '请选择分类', {
|
|
|
183
|
+ area: ['700px', '400px'],
|
|
|
184
|
+ btn: ['确定', '取消'],
|
|
|
185
|
+ yes: function (index, layero) {
|
|
|
186
|
+ //do something
|
|
|
187
|
+
|
|
|
188
|
+ var iframeWin = window[layero.find('iframe')[0]['name']];
|
|
|
189
|
+ var selectedCategories = iframeWin.confirm();
|
|
|
190
|
+ if (selectedCategories.selectedCategoriesId.length == 0) {
|
|
|
191
|
+ layer.msg('请选择分类');
|
|
|
192
|
+ return;
|
|
|
193
|
+ }
|
|
|
194
|
+ $('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(','));
|
|
|
195
|
+ $('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' '));
|
|
|
196
|
+ //console.log(layer.getFrameIndex(index));
|
|
|
197
|
+ layer.close(index); //如果设定了yes回调,需进行手工关闭
|
|
|
198
|
+ }
|
|
|
199
|
+ });
|
|
|
200
|
+ }
|
|
|
201
|
+</script>
|
|
|
202
|
+</body>
|
|
|
203
|
+</html> |