正在显示
7 个修改的文件
包含
602 行增加
和
0 行删除
1 | +<?php | ||
2 | +// +---------------------------------------------------------------------- | ||
3 | +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ] | ||
4 | +// +---------------------------------------------------------------------- | ||
5 | +// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved. | ||
6 | +// +---------------------------------------------------------------------- | ||
7 | +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) | ||
8 | +// +---------------------------------------------------------------------- | ||
9 | +// | Author: 小夏 < 449134904@qq.com> | ||
10 | +// +---------------------------------------------------------------------- | ||
11 | +namespace app\portal\controller; | ||
12 | + | ||
13 | +use cmf\controller\AdminBaseController; | ||
14 | +use app\portal\model\ImageModel; | ||
15 | +use think\Db; | ||
16 | + | ||
17 | +//封面图片管理 | ||
18 | +class AdminImageController extends AdminBaseController | ||
19 | +{ | ||
20 | + //首页 | ||
21 | + public function index(){ | ||
22 | + $type = $this->request->param('type'); | ||
23 | + $imageModel = new ImageModel(); | ||
24 | + if(!empty($type) && isset($type)){ | ||
25 | + $image = $imageModel->where('type',$type)->order('weigh desc')->select(); | ||
26 | + }else{ | ||
27 | + $image = $imageModel->order('weigh desc')->select(); | ||
28 | + } | ||
29 | + | ||
30 | + $this->assign('image', $image); | ||
31 | + | ||
32 | + //封面图分类 | ||
33 | + $list = $this->getImgCategory(); | ||
34 | + $this->assign('list',$list); | ||
35 | + | ||
36 | + $this->assign('type',$type); | ||
37 | + return $this->fetch(); | ||
38 | + } | ||
39 | + | ||
40 | + //添加页面 | ||
41 | + public function add(){ | ||
42 | + //封面图分类 | ||
43 | + $list = $this->getImgCategory(); | ||
44 | + $this->assign('list',$list); | ||
45 | + return $this->fetch(); | ||
46 | + } | ||
47 | + | ||
48 | + //自定义封面图分类 | ||
49 | + private function getImgCategory(){ | ||
50 | + $imgCategory = [ | ||
51 | + ['id'=>1,'name'=>'首页'], | ||
52 | + ['id'=>2,'name'=>'星球画廊'], | ||
53 | + ['id'=>3,'name'=>'星享体验'], | ||
54 | + ['id'=>4,'name'=>'星探推荐'], | ||
55 | + ['id'=>5,'name'=>'星际活动'] | ||
56 | + ]; | ||
57 | + return $imgCategory; | ||
58 | + } | ||
59 | + | ||
60 | + //提交保存 | ||
61 | + public function addPost(){ | ||
62 | + $data = $this->request->param(); | ||
63 | + $imageModel = new ImageModel(); | ||
64 | + $result = $this->validate($data, 'AdminImage'); | ||
65 | + if ($result !== true) { | ||
66 | + $this->error($result); | ||
67 | + } | ||
68 | + $imageModel->allowField(true)->save($data); | ||
69 | + | ||
70 | + $this->success("添加成功!", url("AdminImage/index")); | ||
71 | + } | ||
72 | + | ||
73 | + //编辑页面 | ||
74 | + public function edit(){ | ||
75 | + $id = $this->request->param('id', 0, 'intval'); | ||
76 | + $imageModel = new ImageModel(); | ||
77 | + $image = $imageModel->get($id); | ||
78 | + | ||
79 | + //封面图分类 | ||
80 | + $list = $this->getImgCategory(); | ||
81 | + $this->assign('list',$list); | ||
82 | + | ||
83 | + $this->assign('image', $image); | ||
84 | + return $this->fetch(); | ||
85 | + } | ||
86 | + | ||
87 | + //编辑保存页面 | ||
88 | + public function editPost() | ||
89 | + { | ||
90 | + $data = $this->request->param(); | ||
91 | + $imageModel = new ImageModel(); | ||
92 | + $result = $this->validate($data, 'AdminImage'); | ||
93 | + if ($result !== true) { | ||
94 | + $this->error($result); | ||
95 | + } | ||
96 | + $imageModel->allowField(true)->isUpdate(true)->save($data); | ||
97 | + | ||
98 | + $this->success("保存成功!", url("AdminImage/index")); | ||
99 | + } | ||
100 | + | ||
101 | + //删除 | ||
102 | + public function delete(){ | ||
103 | + $id = $this->request->param('id', 0, 'intval'); | ||
104 | + $imageModel = new ImageModel(); | ||
105 | + $imageModel->where('id',$id)->delete(); | ||
106 | + $this->success("删除成功!", url("AdminImage/index")); | ||
107 | + } | ||
108 | +} |
app/portal/model/ImageModel.php
0 → 100644
1 | +<?php | ||
2 | +// +---------------------------------------------------------------------- | ||
3 | +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ] | ||
4 | +// +---------------------------------------------------------------------- | ||
5 | +// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved. | ||
6 | +// +---------------------------------------------------------------------- | ||
7 | +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) | ||
8 | +// +---------------------------------------------------------------------- | ||
9 | +// | Author: 老猫 <thinkcmf@126.com> | ||
10 | +// +---------------------------------------------------------------------- | ||
11 | +namespace app\portal\model; | ||
12 | + | ||
13 | +use think\Model; | ||
14 | + | ||
15 | +class ImageModel extends Model | ||
16 | +{ | ||
17 | + | ||
18 | + | ||
19 | +} |
app/portal/validate/AdminImageValidate.php
0 → 100644
1 | +<?php | ||
2 | +// +---------------------------------------------------------------------- | ||
3 | +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ] | ||
4 | +// +---------------------------------------------------------------------- | ||
5 | +// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved. | ||
6 | +// +---------------------------------------------------------------------- | ||
7 | +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) | ||
8 | +// +---------------------------------------------------------------------- | ||
9 | +// | Author: 小夏 < 449134904@qq.com> | ||
10 | +// +---------------------------------------------------------------------- | ||
11 | +namespace app\portal\validate; | ||
12 | + | ||
13 | +use think\Validate; | ||
14 | + | ||
15 | +class AdminImageValidate extends Validate | ||
16 | +{ | ||
17 | + protected $rule = [ | ||
18 | + 'type' => 'require', | ||
19 | + 'image' => 'require', | ||
20 | + ]; | ||
21 | + protected $message = [ | ||
22 | + 'type.require' => '请选择分类!', | ||
23 | + 'image.require' => '请上传封面图!', | ||
24 | + ]; | ||
25 | + | ||
26 | + protected $scene = [ | ||
27 | +// 'add' => ['user_login,user_pass,user_email'], | ||
28 | +// 'edit' => ['user_login,user_email'], | ||
29 | + ]; | ||
30 | +} |
@@ -187,6 +187,7 @@ return array ( | @@ -187,6 +187,7 @@ return array ( | ||
187 | 'PORTAL_ADMINENJOYSKY_EDITPOST' => '编辑提交', | 187 | 'PORTAL_ADMINENJOYSKY_EDITPOST' => '编辑提交', |
188 | 'PORTAL_ADMINENJOYSKY_INDEX' => '户外天堂', | 188 | 'PORTAL_ADMINENJOYSKY_INDEX' => '户外天堂', |
189 | 'PORTAL_ADMINEXE_DEFAULT' => '星际活动', | 189 | 'PORTAL_ADMINEXE_DEFAULT' => '星际活动', |
190 | + 'PORTAL_ADMINIMAGE_INDEX' => '封面图管理', | ||
190 | 'PORTAL_ADMININDEX_DEFAULT' => '门户管理', | 191 | 'PORTAL_ADMININDEX_DEFAULT' => '门户管理', |
191 | 'PORTAL_ADMINPAGE_ADD' => '添加页面', | 192 | 'PORTAL_ADMINPAGE_ADD' => '添加页面', |
192 | 'PORTAL_ADMINPAGE_ADDPOST' => '添加页面提交', | 193 | 'PORTAL_ADMINPAGE_ADDPOST' => '添加页面提交', |
@@ -301,6 +302,7 @@ return array ( | @@ -301,6 +302,7 @@ return array ( | ||
301 | 'PORTAL_COMMENT_INDEX' => '评论管理', | 302 | 'PORTAL_COMMENT_INDEX' => '评论管理', |
302 | 'PORTAL_COMMENT_TOGGLE' => '审核通过与驳回', | 303 | 'PORTAL_COMMENT_TOGGLE' => '审核通过与驳回', |
303 | 'PORTAL_COMMENTMANAGE_DEFAULT' => '评论管理', | 304 | 'PORTAL_COMMENTMANAGE_DEFAULT' => '评论管理', |
305 | + 'PORTAL_IMAGES_DEFAULT' => '封面图管理', | ||
304 | 'USER_ADMINASSET_DELETE' => '删除文件', | 306 | 'USER_ADMINASSET_DELETE' => '删除文件', |
305 | 'USER_ADMINASSET_INDEX' => '资源管理', | 307 | 'USER_ADMINASSET_INDEX' => '资源管理', |
306 | 'USER_ADMININDEX_BAN' => '本站用户拉黑', | 308 | 'USER_ADMININDEX_BAN' => '本站用户拉黑', |
1 | +<include file="public@header"/> | ||
2 | +<style type="text/css"> | ||
3 | + .pic-list li { | ||
4 | + margin-bottom: 5px; | ||
5 | + } | ||
6 | +</style> | ||
7 | +</head> | ||
8 | +<body> | ||
9 | +<div class="wrap js-check-wrap"> | ||
10 | + <ul class="nav nav-tabs"> | ||
11 | + <li><a href="{:url('AdminImage/index')}">封面图管理</a></li> | ||
12 | + <li class="active"><a href="{:url('AdminImage/add')}">添加封面图</a></li> | ||
13 | + </ul> | ||
14 | + <form action="{:url('AdminImage/addPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20"> | ||
15 | + <div class="row"> | ||
16 | + <div class="col-md-9"> | ||
17 | + <table class="table table-bordered"> | ||
18 | + <tr width="150"> | ||
19 | + <th width="100">分类<span class="form-required">*</span></th> | ||
20 | + <td> | ||
21 | + <select class="form-control check_city" name="type" id="input-parent" style="width:400px;"> | ||
22 | + <option value="">请选择分类</option> | ||
23 | + <foreach name="list" item="vo"> | ||
24 | + <option value="{$vo.id}">{$vo.name}</option> | ||
25 | + </foreach> | ||
26 | + </select> | ||
27 | + </td> | ||
28 | + </tr> | ||
29 | + <tr> | ||
30 | + <th>权重</th> | ||
31 | + <td> | ||
32 | + <input class="form-control" type="number" name="weigh" value="0"> | ||
33 | + </td> | ||
34 | + </tr> | ||
35 | + </table> | ||
36 | + <hook name="portal_admin_article_edit_view_main"/> | ||
37 | + <div class="form-group"> | ||
38 | + <div class="col-sm-offset-2 col-sm-10"> | ||
39 | + <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button> | ||
40 | + <a class="btn btn-default" href="{:url('AdminImage/index')}">{:lang('BACK')}</a> | ||
41 | + </div> | ||
42 | + </div> | ||
43 | + </div> | ||
44 | + <div class="col-md-3"> | ||
45 | + <table class="table table-bordered"> | ||
46 | + <tr> | ||
47 | + <th><b>封面图</b><span class="form-required">*</span></th> | ||
48 | + </tr> | ||
49 | + <tr> | ||
50 | + <td> | ||
51 | + <div style="text-align: center;"> | ||
52 | + <input type="hidden" name="image" id="thumbnail" value=""> | ||
53 | + <a href="javascript:uploadOneImage('图片上传','#thumbnail');"> | ||
54 | + <img src="__TMPL__/public/assets/images/default-thumbnail.png" | ||
55 | + id="thumbnail-preview" | ||
56 | + width="135" style="cursor: pointer"/> | ||
57 | + </a> | ||
58 | + <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片"> | ||
59 | + </div> | ||
60 | + </td> | ||
61 | + </tr> | ||
62 | + </table> | ||
63 | + | ||
64 | + <hook name="portal_admin_article_edit_view_right_sidebar"/> | ||
65 | + </div> | ||
66 | + </div> | ||
67 | + </form> | ||
68 | +</div> | ||
69 | +<script type="text/javascript" src="__STATIC__/js/admin.js"></script> | ||
70 | +<script type="text/javascript"> | ||
71 | + //编辑器路径定义 | ||
72 | + var editorURL = GV.WEB_ROOT; | ||
73 | +</script> | ||
74 | +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script> | ||
75 | +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script> | ||
76 | +<script type="text/javascript"> | ||
77 | + $(function () { | ||
78 | + | ||
79 | + editorcontent = new baidu.editor.ui.Editor(); | ||
80 | + editorcontent.render('content'); | ||
81 | + try { | ||
82 | + editorcontent.sync(); | ||
83 | + } catch (err) { | ||
84 | + } | ||
85 | + | ||
86 | + $('.btn-cancel-thumbnail').click(function () { | ||
87 | + $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png'); | ||
88 | + $('#thumbnail').val(''); | ||
89 | + }); | ||
90 | + | ||
91 | + }); | ||
92 | + | ||
93 | + function doSelectCategory() { | ||
94 | + var selectedCategoriesId = $('#js-categories-id-input').val(); | ||
95 | + openIframeLayer("{:url('AdminCategory/select')}?ids=" + selectedCategoriesId, '请选择分类', { | ||
96 | + area: ['700px', '400px'], | ||
97 | + btn: ['确定', '取消'], | ||
98 | + yes: function (index, layero) { | ||
99 | + //do something | ||
100 | + | ||
101 | + var iframeWin = window[layero.find('iframe')[0]['name']]; | ||
102 | + var selectedCategories = iframeWin.confirm(); | ||
103 | + if (selectedCategories.selectedCategoriesId.length == 0) { | ||
104 | + layer.msg('请选择分类'); | ||
105 | + return; | ||
106 | + } | ||
107 | + $('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(',')); | ||
108 | + $('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' ')); | ||
109 | + //console.log(layer.getFrameIndex(index)); | ||
110 | + layer.close(index); //如果设定了yes回调,需进行手工关闭 | ||
111 | + } | ||
112 | + }); | ||
113 | + } | ||
114 | +</script> | ||
115 | +</body> | ||
116 | +</html> |
1 | +<include file="public@header"/> | ||
2 | +<style type="text/css"> | ||
3 | + .pic-list li { | ||
4 | + margin-bottom: 5px; | ||
5 | + } | ||
6 | +</style> | ||
7 | +</head> | ||
8 | +<body> | ||
9 | +<div class="wrap js-check-wrap"> | ||
10 | + <ul class="nav nav-tabs"> | ||
11 | + <li><a href="{:url('AdminImage/index')}">封面图管理</a></li> | ||
12 | + <li> | ||
13 | + <a href="{:url('AdminImage/add')}">添加封面图</a> | ||
14 | + </li> | ||
15 | + <li class="active"><a href="#">编辑封面图</a></li> | ||
16 | + </ul> | ||
17 | + <form action="{:url('AdminImage/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20"> | ||
18 | + <div class="row"> | ||
19 | + <div class="col-md-9"> | ||
20 | + <table class="table table-bordered"> | ||
21 | + <input id="post-id" type="hidden" name="id" value="{$image.id}"> | ||
22 | + <tr> | ||
23 | + <th width="150">分类<span class="form-required">*</span></th> | ||
24 | + <td> | ||
25 | + <select class="form-control check_city" name="type" id="input-parent" style="width:400px;"> | ||
26 | + <option value="">请选择分类</option> | ||
27 | + <foreach name="list" item="vo"> | ||
28 | + <option value="{$vo.id}" <eq name="vo.id" value="$image.type">selected</eq>>{$vo.name}</option> | ||
29 | + </foreach> | ||
30 | + </select> | ||
31 | + </td> | ||
32 | + </tr> | ||
33 | + <tr> | ||
34 | + <th>权重</th> | ||
35 | + <td> | ||
36 | + <input class="form-control" type="number" name="weigh" value="{$image.weigh}"> | ||
37 | + </td> | ||
38 | + </tr> | ||
39 | + </table> | ||
40 | + | ||
41 | + <hook name="portal_admin_article_edit_view_main"/> | ||
42 | + </div> | ||
43 | + <div class="col-md-3"> | ||
44 | + <table class="table table-bordered"> | ||
45 | + <tr> | ||
46 | + <th>缩略图<span class="form-required">*</span></th> | ||
47 | + </tr> | ||
48 | + <tr> | ||
49 | + <td> | ||
50 | + <div style="text-align: center;"> | ||
51 | + <input type="hidden" name="image" id="thumbnail" | ||
52 | + value="{$image.image|default=''}"> | ||
53 | + <a href="javascript:uploadOneImage('图片上传','#thumbnail');"> | ||
54 | + <if condition="empty($image.image)"> | ||
55 | + <img src="__TMPL__/public/assets/images/default-thumbnail.png" | ||
56 | + id="thumbnail-preview" | ||
57 | + width="135" style="cursor: pointer"/> | ||
58 | + <else/> | ||
59 | + <img src="{:cmf_get_image_preview_url($image.image)}" | ||
60 | + id="thumbnail-preview" | ||
61 | + width="135" style="cursor: pointer"/> | ||
62 | + </if> | ||
63 | + </a> | ||
64 | + <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片"> | ||
65 | + </div> | ||
66 | + </td> | ||
67 | + </tr> | ||
68 | + </table> | ||
69 | + | ||
70 | + <hook name="portal_admin_article_edit_view_right_sidebar"/> | ||
71 | + </div> | ||
72 | + </div> | ||
73 | + <div class="form-group"> | ||
74 | + <div class="col-sm-offset-2 col-sm-10"> | ||
75 | + <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button> | ||
76 | + <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a> | ||
77 | + </div> | ||
78 | + </div> | ||
79 | + </form> | ||
80 | +</div> | ||
81 | +<script type="text/javascript" src="__STATIC__/js/admin.js"></script> | ||
82 | +<script type="text/javascript"> | ||
83 | + //编辑器路径定义 | ||
84 | + var editorURL = GV.WEB_ROOT; | ||
85 | +</script> | ||
86 | +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script> | ||
87 | +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script> | ||
88 | +<script type="text/javascript"> | ||
89 | + $(function () { | ||
90 | + | ||
91 | + editorcontent = new baidu.editor.ui.Editor(); | ||
92 | + editorcontent.render('content'); | ||
93 | + try { | ||
94 | + editorcontent.sync(); | ||
95 | + } catch (err) { | ||
96 | + } | ||
97 | + | ||
98 | + $('.btn-cancel-thumbnail').click(function () { | ||
99 | + $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png'); | ||
100 | + $('#thumbnail').val(''); | ||
101 | + }); | ||
102 | + | ||
103 | + $('#more-template-select').val("{$post.more.template|default=''}"); | ||
104 | + }); | ||
105 | + | ||
106 | + function doSelectCategory() { | ||
107 | + var selectedCategoriesId = $('#js-categories-id-input').val(); | ||
108 | + openIframeLayer("{:url('AdminCategory/select')}?ids=" + selectedCategoriesId, '请选择分类', { | ||
109 | + area: ['700px', '400px'], | ||
110 | + btn: ['确定', '取消'], | ||
111 | + yes: function (index, layero) { | ||
112 | + //do something | ||
113 | + | ||
114 | + var iframeWin = window[layero.find('iframe')[0]['name']]; | ||
115 | + var selectedCategories = iframeWin.confirm(); | ||
116 | + if (selectedCategories.selectedCategoriesId.length == 0) { | ||
117 | + layer.msg('请选择分类'); | ||
118 | + return; | ||
119 | + } | ||
120 | + $('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(',')); | ||
121 | + $('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' ')); | ||
122 | + //console.log(layer.getFrameIndex(index)); | ||
123 | + layer.close(index); //如果设定了yes回调,需进行手工关闭 | ||
124 | + } | ||
125 | + }); | ||
126 | + } | ||
127 | +</script> | ||
128 | + | ||
129 | +<script> | ||
130 | + | ||
131 | + var publishYesUrl = "{:url('AdminImage/publish',array('yes'=>1))}"; | ||
132 | + var publishNoUrl = "{:url('AdminImage/publish',array('no'=>1))}"; | ||
133 | + var topYesUrl = "{:url('AdminImage/top',array('yes'=>1))}"; | ||
134 | + var topNoUrl = "{:url('AdminImage/top',array('no'=>1))}"; | ||
135 | + var recommendYesUrl = "{:url('AdminImage/recommend',array('yes'=>1))}"; | ||
136 | + var recommendNoUrl = "{:url('AdminImage/recommend',array('no'=>1))}"; | ||
137 | + | ||
138 | + var postId = $('#post-id').val(); | ||
139 | + | ||
140 | + //发布操作 | ||
141 | + $("#post-status-checkbox").change(function () { | ||
142 | + if ($('#post-status-checkbox').is(':checked')) { | ||
143 | + //发布 | ||
144 | + $.ajax({ | ||
145 | + url: publishYesUrl, type: "post", dataType: "json", data: {ids: postId}, success: function (data) { | ||
146 | + if (data.code != 1) { | ||
147 | + $('#post-status-checkbox').removeAttr("checked"); | ||
148 | + $('#post-status-error').html(data.msg).show(); | ||
149 | + | ||
150 | + } else { | ||
151 | + $('#post-status-error').hide(); | ||
152 | + } | ||
153 | + } | ||
154 | + }); | ||
155 | + } else { | ||
156 | + //取消发布 | ||
157 | + $.ajax({ | ||
158 | + url: publishNoUrl, type: "post", dataType: "json", data: {ids: postId}, success: function (data) { | ||
159 | + if (data.code != 1) { | ||
160 | + $('#post-status-checkbox').prop("checked", 'true'); | ||
161 | + $('#post-status-error').html(data.msg).show(); | ||
162 | + } else { | ||
163 | + $('#post-status-error').hide(); | ||
164 | + } | ||
165 | + } | ||
166 | + }); | ||
167 | + } | ||
168 | + }); | ||
169 | + | ||
170 | + //置顶操作 | ||
171 | + $("#is-top-checkbox").change(function () { | ||
172 | + if ($('#is-top-checkbox').is(':checked')) { | ||
173 | + //置顶 | ||
174 | + $.ajax({ | ||
175 | + url: topYesUrl, type: "post", dataType: "json", data: {ids: postId}, success: function (data) { | ||
176 | + if (data.code != 1) { | ||
177 | + $('#is-top-checkbox').removeAttr("checked"); | ||
178 | + $('#is-top-error').html(data.msg).show(); | ||
179 | + | ||
180 | + } else { | ||
181 | + $('#is-top-error').hide(); | ||
182 | + } | ||
183 | + } | ||
184 | + }); | ||
185 | + } else { | ||
186 | + //取消置顶 | ||
187 | + $.ajax({ | ||
188 | + url: topNoUrl, type: "post", dataType: "json", data: {ids: postId}, success: function (data) { | ||
189 | + if (data.code != 1) { | ||
190 | + $('#is-top-checkbox').prop("checked", 'true'); | ||
191 | + $('#is-top-error').html(data.msg).show(); | ||
192 | + } else { | ||
193 | + $('#is-top-error').hide(); | ||
194 | + } | ||
195 | + } | ||
196 | + }); | ||
197 | + } | ||
198 | + }); | ||
199 | + //推荐操作 | ||
200 | + $("#recommended-checkbox").change(function () { | ||
201 | + if ($('#recommended-checkbox').is(':checked')) { | ||
202 | + //推荐 | ||
203 | + $.ajax({ | ||
204 | + url: recommendYesUrl, type: "post", dataType: "json", data: {ids: postId}, success: function (data) { | ||
205 | + if (data.code != 1) { | ||
206 | + $('#recommended-checkbox').removeAttr("checked"); | ||
207 | + $('#recommended-error').html(data.msg).show(); | ||
208 | + | ||
209 | + } else { | ||
210 | + $('#recommended-error').hide(); | ||
211 | + } | ||
212 | + } | ||
213 | + }); | ||
214 | + } else { | ||
215 | + //取消推荐 | ||
216 | + $.ajax({ | ||
217 | + url: recommendNoUrl, type: "post", dataType: "json", data: {ids: postId}, success: function (data) { | ||
218 | + if (data.code != 1) { | ||
219 | + $('#recommended-checkbox').prop("checked", 'true'); | ||
220 | + $('#recommended-error').html(data.msg).show(); | ||
221 | + } else { | ||
222 | + $('#recommended-error').hide(); | ||
223 | + } | ||
224 | + } | ||
225 | + }); | ||
226 | + } | ||
227 | + }); | ||
228 | + | ||
229 | + | ||
230 | +</script> | ||
231 | + | ||
232 | + | ||
233 | +</body> | ||
234 | +</html> |
1 | +<include file="public@header"/> | ||
2 | +</head> | ||
3 | +<body> | ||
4 | +<div class="wrap js-check-wrap"> | ||
5 | + <ul class="nav nav-tabs"> | ||
6 | + <li class="active"><a href="javascript:;">所有封面图</a></li> | ||
7 | + <li><a href="{:url('AdminImage/add')}">添加封面图</a></li> | ||
8 | + </ul> | ||
9 | + <form class="well form-inline margin-top-20" method="post" action="{:url('AdminImage/index')}"> | ||
10 | + 分类: | ||
11 | + <select class="form-control" name="type" style="width: 140px;"> | ||
12 | + <option value='0'>全部</option> | ||
13 | + <foreach name="list" item="vo"> | ||
14 | + <option value="{$vo.id}" <eq name="vo.id" value="$type">selected</eq>>{$vo.name}</option> | ||
15 | + </foreach> | ||
16 | + </select> | ||
17 | + <input type="submit" class="btn btn-primary" id="search" value="搜索"/> | ||
18 | + <a class="btn btn-danger" href="{:url('AdminImage/index')}">清空</a> | ||
19 | + </form> | ||
20 | + <form class="js-ajax-form" action="" method="post"> | ||
21 | + <div class="table-actions"> | ||
22 | + </div> | ||
23 | + <table class="table table-hover table-bordered table-list"> | ||
24 | + <thead> | ||
25 | + <tr> | ||
26 | + <th width="15"> | ||
27 | + <label> | ||
28 | + <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"> | ||
29 | + </label> | ||
30 | + </th> | ||
31 | + <!--<notempty name="category">--> | ||
32 | + <!--<th width="50">{:lang('SORT')}</th>--> | ||
33 | + <!--</notempty>--> | ||
34 | + <th width="50">ID</th> | ||
35 | + <th width="200">类型</th> | ||
36 | + <th width="100">封面图</th> | ||
37 | + <th width="70">权重</th> | ||
38 | + <th width="100">操作</th> | ||
39 | + </tr> | ||
40 | + </thead> | ||
41 | + <foreach name="image" item="vo"> | ||
42 | + <tr> | ||
43 | + <td> | ||
44 | + <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" | ||
45 | + value="{$vo.id}" title="ID:{$vo.id}"> | ||
46 | + </td> | ||
47 | + <!--<notempty name="category">--> | ||
48 | + <!--<td>--> | ||
49 | + <!--<input name="list_orders[{$vo.post_category_id}]" class="input-order" type="text"--> | ||
50 | + <!--value="{$vo.list_order}">--> | ||
51 | + <!--</td>--> | ||
52 | + <!--</notempty>--> | ||
53 | + <td><b>{$vo.id}</b></td> | ||
54 | + <td> | ||
55 | + <switch name="vo.type"> | ||
56 | + <case value="1">首页</case> | ||
57 | + <case value="2">星球画廊</case> | ||
58 | + <case value="3">星享体验</case> | ||
59 | + <case value="4">星探推荐</case> | ||
60 | + <case value="5">星际活动</case> | ||
61 | + </switch> | ||
62 | + </td> | ||
63 | + <td> | ||
64 | + <notempty name="vo.image"> | ||
65 | + <a href="javascript:parent.imagePreviewDialog('{:cmf_get_image_preview_url($vo.image)}');"> | ||
66 | + <i class="fa fa-photo fa-fw"></i> | ||
67 | + </a> | ||
68 | + <else/> | ||
69 | + <i class="fa fa-close fa-fw"></i> | ||
70 | + </notempty> | ||
71 | + </td> | ||
72 | + <td> | ||
73 | + <b>{$vo.weigh}</b> | ||
74 | + </td> | ||
75 | + <td> | ||
76 | + <a class="btn btn-xs btn-primary" href="{:url('AdminImage/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a> | ||
77 | + <a class="btn btn-xs btn-danger js-ajax-delete" | ||
78 | + href="{:url('AdminImage/delete',array('id'=>$vo['id']))}">{:lang('DELETE')}</a> | ||
79 | + </td> | ||
80 | + </tr> | ||
81 | + </foreach> | ||
82 | + </table> | ||
83 | + </form> | ||
84 | +</div> | ||
85 | +<script src="__STATIC__/js/admin.js"></script> | ||
86 | +<script> | ||
87 | + | ||
88 | + function reloadPage(win) { | ||
89 | + win.location.reload(); | ||
90 | + } | ||
91 | +</script> | ||
92 | +</body> | ||
93 | +</html> |
-
请 注册 或 登录 后发表评论