作者 jinglong
1 个管道 的构建 通过 耗费 7 秒

增加后台专业团队

@@ -54,6 +54,27 @@ class AdminTeamController extends AdminBaseController @@ -54,6 +54,27 @@ class AdminTeamController extends AdminBaseController
54 return $this->fetch(); 54 return $this->fetch();
55 } 55 }
56 56
  57 + //添加
  58 + public function add()
  59 + {
  60 + return $this->fetch();
  61 + }
  62 +
  63 + //添加提交
  64 + public function addPost()
  65 + {
  66 + $teamModel = new TeamModel();
  67 + $param = $this->request->param();
  68 + $param['create_time'] = time();
  69 + $param['update_time'] = time();
  70 + $param['user_id'] = 1;
  71 + $res = $teamModel->create($param);
  72 + if($res){
  73 + $this->success('保存成功','AdminTeam/index');
  74 + }
  75 + $this->error('请稍后重试');
  76 + }
  77 +
57 /** 78 /**
58 * 编辑专业团队 79 * 编辑专业团队
59 * @adminMenu( 80 * @adminMenu(
@@ -96,7 +117,7 @@ class AdminTeamController extends AdminBaseController @@ -96,7 +117,7 @@ class AdminTeamController extends AdminBaseController
96 $param = $this->request->param(); 117 $param = $this->request->param();
97 $res = $teamModel->isUpdate(true)->save($param); 118 $res = $teamModel->isUpdate(true)->save($param);
98 if($res){ 119 if($res){
99 - $this->success('保存成功'); 120 + $this->success('保存成功','AdminTeam/index');
100 } 121 }
101 $this->error('请稍后重试'); 122 $this->error('请稍后重试');
102 } 123 }
@@ -19,6 +19,7 @@ class TeamModel extends Model @@ -19,6 +19,7 @@ class TeamModel extends Model
19 { 19 {
20 $list = $this 20 $list = $this
21 ->field('name,post,phone,mobile,email,thumb') 21 ->field('name,post,phone,mobile,email,thumb')
  22 + ->order('sort desc,id desc')
22 ->select(); 23 ->select();
23 return $list; 24 return $list;
24 } 25 }
  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('AdminTeam/index')}">全部</a></li>
  33 + <li class="active"><a href="{:url('AdminTeam/add')}">添加</a></li>
  34 + </ul>
  35 + <form action="{:url('AdminTeam/addPost')}" 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 + <tr>
  40 + <th width="100">姓名<span class="form-required">*</span></th>
  41 + <td>
  42 + <input class="form-control" type="text" name="name" required value=""/>
  43 + </td>
  44 + </tr>
  45 + <tr>
  46 + <th width="100">职务<span class="form-required">*</span></th>
  47 + <td>
  48 + <input class="form-control" type="text" name="post" required value=""/>
  49 + </td>
  50 + </tr>
  51 + <tr>
  52 + <th width="100">座机<span class="form-required">*</span></th>
  53 + <td>
  54 + <input class="form-control" type="text" name="phone" required value=""/>
  55 + </td>
  56 + </tr>
  57 + <tr>
  58 + <th width="100">手机号<span class="form-required">*</span></th>
  59 + <td>
  60 + <input class="form-control" type="text" name="mobile" required value=""/>
  61 + </td>
  62 + </tr>
  63 + <tr>
  64 + <th width="100">邮箱<span class="form-required">*</span></th>
  65 + <td>
  66 + <input class="form-control" type="text" name="email" required value=""/>
  67 + </td>
  68 + </tr>
  69 + <tr>
  70 + <th width="100">排序<span class="form-required">*</span></th>
  71 + <td>
  72 + <input class="form-control" type="number" name="sort" required value="1"/>
  73 + </td>
  74 + </tr>
  75 + </table>
  76 + <div class="form-group">
  77 + <div class="col-sm-offset-2 col-sm-10">
  78 + <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
  79 + <a class="btn btn-default" href="{:url('AdminTeam/index')}">{:lang('BACK')}</a>
  80 + </div>
  81 + </div>
  82 + </div>
  83 + <div class="col-md-3">
  84 + <table class="table table-bordered">
  85 + <tr>
  86 + <th><b>头像</b></th>
  87 + </tr>
  88 + <tr>
  89 + <td>
  90 + <div style="text-align: center;">
  91 + <input type="hidden" name="thumb" id="thumbnail" value="">
  92 + <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
  93 + <img src="__TMPL__/public/assets/images/default-thumbnail.png"
  94 + id="thumbnail-preview"
  95 + width="135" style="cursor: pointer"/>
  96 + </a>
  97 + <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
  98 + </div>
  99 + </td>
  100 + </tr>
  101 + </table>
  102 + </div>
  103 + </div>
  104 + </form>
  105 +</div>
  106 +<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
  107 +<script type="text/javascript">
  108 + //编辑器路径定义
  109 + var editorURL = GV.WEB_ROOT;
  110 +</script>
  111 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
  112 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
  113 +<script type="text/javascript">
  114 + $(function () {
  115 +
  116 + editorcontent = new baidu.editor.ui.Editor();
  117 + editorcontent.render('content');
  118 + try {
  119 + editorcontent.sync();
  120 + } catch (err) {
  121 + }
  122 +
  123 + $('.btn-cancel-thumbnail').click(function () {
  124 + $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
  125 + $('#thumbnail').val('');
  126 + });
  127 +
  128 + });
  129 +</script>
  130 +</body>
  131 +</html>
@@ -65,6 +65,12 @@ @@ -65,6 +65,12 @@
65 <input class="form-control" type="text" name="email" required value="{$info.email}"/> 65 <input class="form-control" type="text" name="email" required value="{$info.email}"/>
66 </td> 66 </td>
67 </tr> 67 </tr>
  68 + <tr>
  69 + <th width="100">排序<span class="form-required">*</span></th>
  70 + <td>
  71 + <input class="form-control" type="number" name="sort" required value="{$info.sort}"/>
  72 + </td>
  73 + </tr>
68 </table> 74 </table>
69 <div class="form-group"> 75 <div class="form-group">
70 <div class="col-sm-offset-2 col-sm-10"> 76 <div class="col-sm-offset-2 col-sm-10">
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <div class="wrap js-check-wrap"> 5 <div class="wrap js-check-wrap">
6 <ul class="nav nav-tabs"> 6 <ul class="nav nav-tabs">
7 <li class="active"><a href="javascript:;">全部</a></li> 7 <li class="active"><a href="javascript:;">全部</a></li>
8 - <!--<li><a href="{:url('AdminTeam/aspirations_add')}">添加</a></li>--> 8 + <li><a href="{:url('AdminTeam/add')}">添加</a></li>
9 </ul> 9 </ul>
10 <form class="well form-inline margin-top-20" method="post" action="{:url('AdminTeam/index')}"> 10 <form class="well form-inline margin-top-20" method="post" action="{:url('AdminTeam/index')}">
11 时间: 11 时间:
@@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
31 <th>座机号</th> 31 <th>座机号</th>
32 <th>手机号</th> 32 <th>手机号</th>
33 <th>邮箱</th> 33 <th>邮箱</th>
  34 + <th>排序</th>
34 <th>更新时间</th> 35 <th>更新时间</th>
35 <th width="120">操作</th> 36 <th width="120">操作</th>
36 </tr> 37 </tr>
@@ -43,6 +44,7 @@ @@ -43,6 +44,7 @@
43 <td>{$vo.phone}</td> 44 <td>{$vo.phone}</td>
44 <td>{$vo.mobile}</td> 45 <td>{$vo.mobile}</td>
45 <td>{$vo.email}</td> 46 <td>{$vo.email}</td>
  47 + <td>{$vo.sort}</td>
46 <td>{:date('Y-m-d H:i',$vo['update_time'])}</td> 48 <td>{:date('Y-m-d H:i',$vo['update_time'])}</td>
47 <td> 49 <td>
48 <a href="{:url('AdminTeam/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a> 50 <a href="{:url('AdminTeam/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a>