From 0b55ac0050b2779383499c122182f82d0ce97f0f Mon Sep 17 00:00:00 2001 From: colly_wyx <wangyixiong_007@163.com> Date: Fri, 11 Aug 2017 13:50:21 +0800 Subject: [PATCH] 提交素材及新闻详情页 --- static/article/manager/js/edit.js | 79 +++++++++++++ application/modules/Admin/views/index/index.phtml | 8 + application/modules/Admin/views/index/look.phtml | 76 ----------- application/modules/Admin/views/layout/adminLayout.phtml | 4 static/article/manager/js/add.js | 79 +++++++++++++ application/modules/Admin/controllers/Index.php | 19 +-- static/user/user/js/my.js | 69 +++++++++++ themes/AdminLTE/dist/img/avatar.jpg | 0 8 files changed, 249 insertions(+), 85 deletions(-) diff --git a/application/modules/Admin/controllers/Index.php b/application/modules/Admin/controllers/Index.php index 0354726..ea12b92 100644 --- a/application/modules/Admin/controllers/Index.php +++ b/application/modules/Admin/controllers/Index.php @@ -34,20 +34,15 @@ * ������������ * @param [type] $id [description] */ - public function LookAction(){ - $id���= $this->get('id'); - if(!empty($id)){ - $article = $this->article_service->getArticleInfo(array('_id' => $id)); - if($article){ - $this->getView()->assign('article', $article); - } - else{ - $this->redirect('/error/show/type/no_data'); - } + public function LookAction($id){ + $article_service = new Service_Article(); + $article = $article_service->getArticleInfo(array('_id' => $id)); + if($article){ + $this->getView()->assign('article', $article); } else{ - $this->redirect('/error/show/type/not_found'); - } + $this->redirect('/error/show/type/no_data'); + } } } diff --git a/application/modules/Admin/views/index/index.phtml b/application/modules/Admin/views/index/index.phtml index c4946d8..8a269f5 100644 --- a/application/modules/Admin/views/index/index.phtml +++ b/application/modules/Admin/views/index/index.phtml @@ -40,8 +40,10 @@ <li class="item"> <i class="fa fa-file-text-o"> </i> + <a href="/admin/index/look/id/<?php echo $system_new['_id']?>"> <?php echo $system_new['name']?> <span class=" pull-right">[<?php echo $system_new['create_time']?>]</span> + </a> </li> <?php endforeach;?> @@ -70,8 +72,10 @@ <li class="item"> <i class="fa fa-file-text-o"> </i> + <a href="/admin/index/look/id/<?php echo $system_new['_id']?>"> <?php echo $industry_new['name']?> <span class=" pull-right">[<?php echo $industry_new['create_time']?>]</span> + </a> </li> <?php endforeach;?> @@ -102,8 +106,10 @@ <li class="item"> <i class="fa fa-file-text-o"> </i> + <a href="/admin/index/look/id/<?php echo $system_new['_id']?>"> <?php echo $ffs_new['name']?> <span class=" pull-right">[<?php echo $ffs_new['create_time']?>]</span> + </a> </li> <?php endforeach;?> @@ -132,8 +138,10 @@ <li class="item"> <i class="fa fa-file-text-o"> </i> + <a href="/admin/index/look/id/<?php echo $system_new['_id']?>"> <?php echo $my_new['name']?> <span class=" pull-right">[<?php echo $my_new['create_time']?>]</span> + </a> </li> <?php endforeach;?> diff --git a/application/modules/Admin/views/index/look.phtml b/application/modules/Admin/views/index/look.phtml index e42c888..8946ee4 100644 --- a/application/modules/Admin/views/index/look.phtml +++ b/application/modules/Admin/views/index/look.phtml @@ -7,91 +7,25 @@ <h3 class="box-title">������������</h3> <div class="box-tools pull-right"> - <a href="#" class="btn btn-box-tool" data-toggle="tooltip" title="Previous"><i class="fa fa-chevron-left">������</i></a> + <a href="javascript:history.go(-1);" class="btn btn-box-tool" data-toggle="tooltip" title="Previous"><i class="fa fa-chevron-left">������</i></a> </div> </div> <!-- /.box-header --> <div class="box-body no-padding"> <div class="mailbox-read-info"> - <h3>Message Subject Is Placed Here</h3> - <h5>From: help@example.com - <span class="mailbox-read-time pull-right">15 Feb. 2016 11:03 PM</span></h5> + <h3 style="text-align: center;"><?php echo $article['name']?></h3> + <h5 style="text-align: center; padding-top: 20px;">���������: [���������] ������������: [<?php echo $article['create_time']?>]</span></h5> </div> <!-- /.mailbox-controls --> <div class="mailbox-read-message"> - <p>Hello John,</p> - - <p>Keffiyeh blog actually fashion axe vegan, irony biodiesel. Cold-pressed hoodie chillwave put a bird - on it aesthetic, bitters brunch meggings vegan iPhone. Dreamcatcher vegan scenester mlkshk. Ethical - master cleanse Bushwick, occupy Thundercats banjo cliche ennui farm-to-table mlkshk fanny pack - gluten-free. Marfa butcher vegan quinoa, bicycle rights disrupt tofu scenester chillwave 3 wolf moon - asymmetrical taxidermy pour-over. Quinoa tote bag fashion axe, Godard disrupt migas church-key tofu - blog locavore. Thundercats cronut polaroid Neutra tousled, meh food truck selfies narwhal American - Apparel.</p> - - <p>Raw denim McSweeney's bicycle rights, iPhone trust fund quinoa Neutra VHS kale chips vegan PBR&B - literally Thundercats +1. Forage tilde four dollar toast, banjo health goth paleo butcher. Four dollar - toast Brooklyn pour-over American Apparel sustainable, lumbersexual listicle gluten-free health goth - umami hoodie. Synth Echo Park bicycle rights DIY farm-to-table, retro kogi sriracha dreamcatcher PBR&B - flannel hashtag irony Wes Anderson. Lumbersexual Williamsburg Helvetica next level. Cold-pressed - slow-carb pop-up normcore Thundercats Portland, cardigan literally meditation lumbersexual crucifix. - Wayfarers raw denim paleo Bushwick, keytar Helvetica scenester keffiyeh 8-bit irony mumblecore - whatever viral Truffaut.</p> - - <p>Post-ironic shabby chic VHS, Marfa keytar flannel lomo try-hard keffiyeh cray. Actually fap fanny - pack yr artisan trust fund. High Life dreamcatcher church-key gentrify. Tumblr stumptown four dollar - toast vinyl, cold-pressed try-hard blog authentic keffiyeh Helvetica lo-fi tilde Intelligentsia. Lomo - locavore salvia bespoke, twee fixie paleo cliche brunch Schlitz blog McSweeney's messenger bag swag - slow-carb. Odd Future photo booth pork belly, you probably haven't heard of them actually tofu ennui - keffiyeh lo-fi Truffaut health goth. Narwhal sustainable retro disrupt.</p> - - <p>Skateboard artisan letterpress before they sold out High Life messenger bag. Bitters chambray - leggings listicle, drinking vinegar chillwave synth. Fanny pack hoodie American Apparel twee. American - Apparel PBR listicle, salvia aesthetic occupy sustainable Neutra kogi. Organic synth Tumblr viral - plaid, shabby chic single-origin coffee Etsy 3 wolf moon slow-carb Schlitz roof party tousled squid - vinyl. Readymade next level literally trust fund. Distillery master cleanse migas, Vice sriracha - flannel chambray chia cronut.</p> - <p>Hello John,</p> - - <p>Keffiyeh blog actually fashion axe vegan, irony biodiesel. Cold-pressed hoodie chillwave put a bird - on it aesthetic, bitters brunch meggings vegan iPhone. Dreamcatcher vegan scenester mlkshk. Ethical - master cleanse Bushwick, occupy Thundercats banjo cliche ennui farm-to-table mlkshk fanny pack - gluten-free. Marfa butcher vegan quinoa, bicycle rights disrupt tofu scenester chillwave 3 wolf moon - asymmetrical taxidermy pour-over. Quinoa tote bag fashion axe, Godard disrupt migas church-key tofu - blog locavore. Thundercats cronut polaroid Neutra tousled, meh food truck selfies narwhal American - Apparel.</p> - - <p>Raw denim McSweeney's bicycle rights, iPhone trust fund quinoa Neutra VHS kale chips vegan PBR&B - literally Thundercats +1. Forage tilde four dollar toast, banjo health goth paleo butcher. Four dollar - toast Brooklyn pour-over American Apparel sustainable, lumbersexual listicle gluten-free health goth - umami hoodie. Synth Echo Park bicycle rights DIY farm-to-table, retro kogi sriracha dreamcatcher PBR&B - flannel hashtag irony Wes Anderson. Lumbersexual Williamsburg Helvetica next level. Cold-pressed - slow-carb pop-up normcore Thundercats Portland, cardigan literally meditation lumbersexual crucifix. - Wayfarers raw denim paleo Bushwick, keytar Helvetica scenester keffiyeh 8-bit irony mumblecore - whatever viral Truffaut.</p> - - <p>Post-ironic shabby chic VHS, Marfa keytar flannel lomo try-hard keffiyeh cray. Actually fap fanny - pack yr artisan trust fund. High Life dreamcatcher church-key gentrify. Tumblr stumptown four dollar - toast vinyl, cold-pressed try-hard blog authentic keffiyeh Helvetica lo-fi tilde Intelligentsia. Lomo - locavore salvia bespoke, twee fixie paleo cliche brunch Schlitz blog McSweeney's messenger bag swag - slow-carb. Odd Future photo booth pork belly, you probably haven't heard of them actually tofu ennui - keffiyeh lo-fi Truffaut health goth. Narwhal sustainable retro disrupt.</p> - - <p>Skateboard artisan letterpress before they sold out High Life messenger bag. Bitters chambray - leggings listicle, drinking vinegar chillwave synth. Fanny pack hoodie American Apparel twee. American - Apparel PBR listicle, salvia aesthetic occupy sustainable Neutra kogi. Organic synth Tumblr viral - plaid, shabby chic single-origin coffee Etsy 3 wolf moon slow-carb Schlitz roof party tousled squid - vinyl. Readymade next level literally trust fund. Distillery master cleanse migas, Vice sriracha - flannel chambray chia cronut.</p> - - <p>Thanks,<br>Jane</p> + <?php echo $article['content']?> </div> <!-- /.mailbox-read-message --> </div> <!-- /.box-footer --> <div class="box-footer"> <div class="pull-right"> - <button type="button" class="btn btn-default"><i class="fa fa-reply"></i> ������</button> + <a href="javascript:history.go(-1);"><button type="button" class="btn btn-default"><i class="fa fa-reply"></i> ������</button></a> </div> </div> <!-- /.box-footer --> diff --git a/application/modules/Admin/views/layout/adminLayout.phtml b/application/modules/Admin/views/layout/adminLayout.phtml index 3aca959..c0098cc 100644 --- a/application/modules/Admin/views/layout/adminLayout.phtml +++ b/application/modules/Admin/views/layout/adminLayout.phtml @@ -64,14 +64,14 @@ <!-- User Account: style can be found in dropdown.less --> <li class="dropdown user user-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> - <img src="/themes/AdminLTE/dist/img/user2-160x160.jpg" class="user-image" alt="User Image"> + <img src="/themes/AdminLTE/dist/img/avatar.jpg" class="user-image" alt="User Image"> <?php $session = Yaf_Session::getInstance();?> <span class="hidden-xs"><?php echo $session['user']['nickname']?></span> </a> <ul class="dropdown-menu"> <!-- User image --> <li class="user-header"> - <img src="/themes/AdminLTE/dist/img/user2-160x160.jpg" class="img-circle" alt="User Image"> + <img src="/themes/AdminLTE/dist/img/avatar.jpg" class="img-circle" alt="User Image"> <p> <?php echo $session['user']['nickname']?> - <?php echo $session['user']['role_name']?> diff --git a/static/article/manager/js/add.js b/static/article/manager/js/add.js new file mode 100644 index 0000000..13e6c1c --- /dev/null +++ b/static/article/manager/js/add.js @@ -0,0 +1,79 @@ +var validator_config = { + message: '���������������������������', + feedbackIcons: { + valid: 'glyphicon glyphicon-ok', + invalid: 'glyphicon glyphicon-remove', + validating: 'glyphicon glyphicon-refresh' + }, + fields:{ + name:{ + validators:{ + notEmpty: { + message: '������������������������', + }, + } + }, + category: { + validators: { + callback: { + message: '���������������������', + callback: function(value, validator){ + if(value == 0){ + return false; + } + else{ + return true; + } + } + } + } + }, + content: { + validators: { + notEmpty: { + message: '���������������������', + } + } + }, + is_publish: { + validators: { + notEmpty: { + message: '���������������������������' + } + } + } + } + + +} + +var ue = UE.getEditor('content'); + +$('#validateform').bootstrapValidator(validator_config).on('success.form.bv', function(e) { + e.preventDefault(); + + $("#dosubmit").attr("disabled","disabled"); + $.scojs_message('���������...', $.scojs_message.TYPE_WAIT); + $.ajax({ + type: "POST", + url: SITE_URL+"/article/manager/add", + data: $("#validateform").serialize(), + success:function(response){ + var dataObj=jQuery.parseJSON(response); + if(dataObj.code == 200) + { + $.scojs_message('������������,3������������������������...', $.scojs_message.TYPE_OK); + setTimeout(function(){window.location.href = SITE_URL+'/article/manager/list';}, 1800); + }else + { + $.scojs_message(dataObj.content, $.scojs_message.TYPE_ERROR); + $("#dosubmit").removeAttr("disabled"); + } + }, + error: function (request, status, error) { + $.scojs_message(request.responseText, $.scojs_message.TYPE_ERROR); + $("#dosubmit").removeAttr("disabled"); + } + }); + + }).on('error.form.bv',function(e){ $.scojs_message('���������������������������������������������', $.scojs_message.TYPE_ERROR);$("#dosubmit").removeAttr("disabled");}); diff --git a/static/article/manager/js/edit.js b/static/article/manager/js/edit.js new file mode 100644 index 0000000..3012685 --- /dev/null +++ b/static/article/manager/js/edit.js @@ -0,0 +1,79 @@ +var validator_config = { + message: '���������������������������', + feedbackIcons: { + valid: 'glyphicon glyphicon-ok', + invalid: 'glyphicon glyphicon-remove', + validating: 'glyphicon glyphicon-refresh' + }, + fields:{ + name:{ + validators:{ + notEmpty: { + message: '������������������������', + }, + } + }, + category: { + validators: { + callback: { + message: '���������������������', + callback: function(value, validator){ + if(value == 0){ + return false; + } + else{ + return true; + } + } + } + } + }, + content: { + validators: { + notEmpty: { + message: '���������������������', + } + } + }, + is_publish: { + validators: { + notEmpty: { + message: '���������������������������' + } + } + } + } + + +} + + + +$('#validateform').bootstrapValidator(validator_config).on('success.form.bv', function(e) { + e.preventDefault(); + + $("#dosubmit").attr("disabled","disabled"); + $.scojs_message('���������...', $.scojs_message.TYPE_WAIT); + $.ajax({ + type: "POST", + url: SITE_URL+"/article/manager/edit/id/"+ID, + data: $("#validateform").serialize(), + success:function(response){ + var dataObj=jQuery.parseJSON(response); + if(dataObj.code == 200) + { + $.scojs_message('������������,3������������������������...', $.scojs_message.TYPE_OK); + setTimeout(function(){window.location.href = SITE_URL+'/article/manager/list';}, 1800); + }else + { + $.scojs_message(dataObj.content, $.scojs_message.TYPE_ERROR); + $("#dosubmit").removeAttr("disabled"); + } + }, + error: function (request, status, error) { + $.scojs_message(request.responseText, $.scojs_message.TYPE_ERROR); + $("#dosubmit").removeAttr("disabled"); + } + }); + + }).on('error.form.bv',function(e){ $.scojs_message('���������������������������������������������', $.scojs_message.TYPE_ERROR);$("#dosubmit").removeAttr("disabled");}); diff --git a/static/user/user/js/my.js b/static/user/user/js/my.js new file mode 100644 index 0000000..c15642c --- /dev/null +++ b/static/user/user/js/my.js @@ -0,0 +1,69 @@ +var validator_config = { + message: '���������������������������', + feedbackIcons: { + valid: 'glyphicon glyphicon-ok', + invalid: 'glyphicon glyphicon-remove', + validating: 'glyphicon glyphicon-refresh' + }, + fields:{ + nickname: { + validators: { + notEmpty: { + message: '���������������������' + } + } + }, + refresh_frequency: { + validators: { + notEmpty: { + message: '���������������������' + } + } + }, + is_open_upload: { + validators: { + notEmpty: { + message: '���������������������������' + } + } + }, + video: { + validators: { + notEmpty: { + message: '���������������������' + } + } + }, + } + + +} + +$('#validateform').bootstrapValidator(validator_config).on('success.form.bv', function(e) { + e.preventDefault(); + + $("#dosubmit").attr("disabled","disabled"); + $.scojs_message('���������...', $.scojs_message.TYPE_WAIT); + $.ajax({ + type: "POST", + url: SITE_URL+"/user/user/my/", + data: $("#validateform").serialize(), + success:function(response){ + var dataObj=jQuery.parseJSON(response); + if(dataObj.code == 200) + { + $.scojs_message('������������,3���������������������', $.scojs_message.TYPE_OK); + setTimeout(function(){window.location.href = SITE_URL+'/public/user/logout';}, 1800); + }else + { + $.scojs_message(dataObj.content, $.scojs_message.TYPE_ERROR); + $("#dosubmit").removeAttr("disabled"); + } + }, + error: function (request, status, error) { + $.scojs_message(request.responseText, $.scojs_message.TYPE_ERROR); + $("#dosubmit").removeAttr("disabled"); + } + }); + + }).on('error.form.bv',function(e){ $.scojs_message('���������������������������������������������', $.scojs_message.TYPE_ERROR);$("#dosubmit").removeAttr("disabled");}); diff --git a/themes/AdminLTE/dist/img/avatar.jpg b/themes/AdminLTE/dist/img/avatar.jpg new file mode 100644 index 0000000..30fb48a --- /dev/null +++ b/themes/AdminLTE/dist/img/avatar.jpg Binary files differ -- Gitblit v1.8.0