作者 jinglong

增加首页内容管理

  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 app\portal\model\AboutModel;
  14 +use app\portal\model\PortalPostModel;
  15 +use cmf\controller\AdminBaseController;
  16 +
  17 +class AdminAboutController extends AdminBaseController
  18 +{
  19 + //关于我们
  20 +
  21 + //编辑页面
  22 + public function edit(){
  23 + $aboutModel = new AboutModel();
  24 + $post = $aboutModel->where('id',1)->find();
  25 + $contentModel = new PortalPostModel();
  26 + $post['detail'] = $contentModel->getPostContentAttr($post['detail']);
  27 + $post['detail_en'] = $contentModel->getPostContentAttr($post['detail_en']);
  28 + $this->assign('post',$post);
  29 + return $this->fetch();
  30 + }
  31 +
  32 + //编辑提交
  33 + public function editPost(){
  34 + $data = $this->request->param();
  35 + $result = $this->validate($data, 'AdminAbout.edit');
  36 + if ($result !== true) {
  37 + $this->error($result);
  38 + }
  39 +
  40 + $aboutModel = new AboutModel();
  41 + // 显式指定更新数据操作
  42 + $contentModel = new PortalPostModel();
  43 + $data['detail'] = $contentModel->setPostContentAttr($data['detail']);
  44 + $data['detail_en'] = $contentModel->setPostContentAttr($data['detail_en']);
  45 + $res = $aboutModel->isUpdate(true)->save($data);
  46 + if($res){
  47 + $this->success('保存成功!');
  48 + }else{
  49 + $this->error('失败');
  50 + }
  51 + }
  52 +}
  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 app\portal\model\AdvantageModel;
  14 +use cmf\controller\AdminBaseController;
  15 +use think\Db;
  16 +
  17 +class AdminAdvantageController extends AdminBaseController
  18 +{
  19 + //我们优势
  20 +
  21 +
  22 + //列表
  23 + public function index(){
  24 + $res = Db::name('advantage')
  25 + ->order('id desc')
  26 + ->paginate(10);
  27 + $data = $res->toArray();
  28 + $data = $data['data'];
  29 + $page = $res->render();
  30 +
  31 + $this->assign('list',$data);
  32 + $this->assign('page',$page);
  33 + return $this->fetch();
  34 + }
  35 +
  36 + //添加页面
  37 + public function add(){
  38 + return $this->fetch();
  39 + }
  40 +
  41 + //添加提交
  42 + public function addPost(){
  43 + $data = $this->request->param();
  44 + $result = $this->validate($data, 'AdminAdvantage.add');
  45 + if ($result !== true) {
  46 + $this->error($result);
  47 + }
  48 +
  49 + $advantageModel = new AdvantageModel();
  50 + $res = $advantageModel->create($data);
  51 + if($res){
  52 + $this->success('添加成功!', url('AdminAdvantage/index'));
  53 + }else{
  54 + $this->error('失败');
  55 + }
  56 + }
  57 +
  58 + //编辑页面
  59 + public function edit(){
  60 + $id = $this->request->param('id');
  61 + $post = Db::name('advantage')
  62 + ->where(['id'=>$id])
  63 + ->find();
  64 + $this->assign('post',$post);
  65 + return $this->fetch();
  66 + }
  67 +
  68 + //编辑提交
  69 + public function editPost(){
  70 + $data = $this->request->param();
  71 + $result = $this->validate($data, 'AdminAdvantage.edit');
  72 + if ($result !== true) {
  73 + $this->error($result);
  74 + }
  75 +
  76 + $advantageModel = new AdvantageModel();
  77 + // 显式指定更新数据操作
  78 + $res = $advantageModel->isUpdate(true)->save($data);
  79 + if($res){
  80 + $this->success('保存成功!', url('AdminAdvantage/index'));
  81 + }else{
  82 + $this->error('失败');
  83 + }
  84 + }
  85 +
  86 + //删除
  87 + public function delete(){
  88 + $id = $this->request->param('id');
  89 + $advantageModel = new AdvantageModel();
  90 + $res = $advantageModel->where(['id'=>$id])->delete();
  91 + if($res){
  92 + $this->success('删除成功!');
  93 + }else{
  94 + $this->error('失败');
  95 + }
  96 + }
  97 +}
  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 app\portal\model\RotationModel;
  14 +use cmf\controller\AdminBaseController;
  15 +use think\Db;
  16 +
  17 +class AdminRotationController extends AdminBaseController
  18 +{
  19 + //轮播图
  20 +
  21 +
  22 + //列表
  23 + public function index(){
  24 + $res = Db::name('rotation')
  25 + ->order('id desc')
  26 + ->paginate(10);
  27 + $data = $res->toArray();
  28 + $data = $data['data'];
  29 + $page = $res->render();
  30 +
  31 + $this->assign('list',$data);
  32 + $this->assign('page',$page);
  33 + return $this->fetch();
  34 + }
  35 +
  36 + //添加页面
  37 + public function add(){
  38 + return $this->fetch();
  39 + }
  40 +
  41 + //添加提交
  42 + public function addPost(){
  43 + $data = $this->request->param();
  44 + $result = $this->validate($data, 'AdminRotation.add');
  45 + if ($result !== true) {
  46 + $this->error($result);
  47 + }
  48 +
  49 + $rotationModel = new RotationModel();
  50 + $res = $rotationModel->create($data);
  51 + if($res){
  52 + $this->success('添加成功!', url('AdminRotation/index'));
  53 + }else{
  54 + $this->error('失败');
  55 + }
  56 + }
  57 +
  58 + //编辑页面
  59 + public function edit(){
  60 + $id = $this->request->param('id');
  61 + $post = Db::name('rotation')
  62 + ->where(['id'=>$id])
  63 + ->find();
  64 + $this->assign('post',$post);
  65 + return $this->fetch();
  66 + }
  67 +
  68 + //编辑提交
  69 + public function editPost(){
  70 + $data = $this->request->param();
  71 + $result = $this->validate($data, 'AdminRotation.edit');
  72 + if ($result !== true) {
  73 + $this->error($result);
  74 + }
  75 +
  76 + $rotationModel = new RotationModel();
  77 + // 显式指定更新数据操作
  78 + $res = $rotationModel->isUpdate(true)->save($data);
  79 + if($res){
  80 + $this->success('保存成功!', url('AdminRotation/index'));
  81 + }else{
  82 + $this->error('失败');
  83 + }
  84 + }
  85 +
  86 + //删除
  87 + public function delete(){
  88 + $id = $this->request->param('id');
  89 + $rotationModel = new RotationModel();
  90 + $res = $rotationModel->where(['id'=>$id])->delete();
  91 + if($res){
  92 + $this->success('删除成功!');
  93 + }else{
  94 + $this->error('失败');
  95 + }
  96 + }
  97 +}
  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 AboutModel extends Model
  16 +{
  17 + protected $autoWriteTimestamp = true;
  18 +}
  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 AdvantageModel extends Model
  16 +{
  17 + protected $autoWriteTimestamp = true;
  18 +}
  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 RotationModel extends Model
  16 +{
  17 + protected $autoWriteTimestamp = true;
  18 +}
  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\validate;
  12 +
  13 +use think\Validate;
  14 +
  15 +class AdminAboutValidate extends Validate
  16 +{
  17 + protected $rule = [
  18 + 'thumbnail' => 'require',
  19 + 'introduce' => 'require',
  20 + 'introduce_en' => 'require',
  21 + 'detail' => 'require',
  22 + 'detail_en' => 'require',
  23 + 'video' => 'require',
  24 + ];
  25 +
  26 + protected $message = [
  27 + 'thumbnail.require' => '请上传缩略图',
  28 + 'introduce.require' => '简介不能为空',
  29 + 'introduce_en.require' => '简介(英文)不能为空',
  30 + 'detail.require' => '详情不能为空',
  31 + 'detail_en.require' => '详情(英文)不能为空',
  32 + 'video.require' => '请上传视频',
  33 + ];
  34 +
  35 + protected $scene = [
  36 + 'edit' => ['thumbnail','introduce','introduce_en','detail','detail_en','video'],
  37 + ];
  38 +}
  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\validate;
  12 +
  13 +use think\Validate;
  14 +
  15 +class AdminAdvantageValidate extends Validate
  16 +{
  17 + protected $rule = [
  18 + 'title' => 'require|max:40',
  19 + 'title_en' => 'require|max:40',
  20 + 'introduce' => 'require|max:500',
  21 + 'introduce_en' => 'require|max:500',
  22 + ];
  23 +
  24 + protected $message = [
  25 + 'title.require' => '标题不能为空',
  26 + 'title.max' => '标题不能超多40个字符',
  27 + 'title_en.require' => '标题(英文)不能为空',
  28 + 'title_en.max' => '标题(英文)不能超多40个字符',
  29 + 'introduce.require' => '简介不能为空',
  30 + 'introduce.max' => '简介不能超多500个字符',
  31 + 'introduce_en.require' => '简介(英文)不能为空',
  32 + 'introduce_en.max' => '简介(英文)不能超多500个字符',
  33 + ];
  34 +
  35 + protected $scene = [
  36 + 'add' => ['title','title_en','introduce','introduce_en'],
  37 + 'edit' => ['title','title_en','introduce','introduce_en'],
  38 + ];
  39 +}
  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\validate;
  12 +
  13 +use think\Validate;
  14 +
  15 +class AdminRotationValidate extends Validate
  16 +{
  17 + protected $rule = [
  18 + 'link' => 'require',
  19 + 'thumbnail' => 'require',
  20 + ];
  21 +
  22 + protected $message = [
  23 + 'link.require' => '链接不能为空',
  24 + 'thumbnail.require' => '请上传轮播图',
  25 +
  26 + ];
  27 +
  28 + protected $scene = [
  29 + 'add' => ['link','thumbnail'],
  30 + 'edit' => ['link','thumbnail'],
  31 + ];
  32 +}
  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 class="active"><a href="#">编辑关于我们</a></li>
  33 + </ul>
  34 + <form action="{:url('AdminAbout/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
  35 + <div class="row">
  36 + <div class="col-md-9">
  37 + <table class="table table-bordered">
  38 + <tr>
  39 + <th width="150">简介<span class="form-required">*</span></th>
  40 + <td>
  41 + <input id="post-id" type="hidden" name="id" value="{$post.id}">
  42 + <textarea rows="5" class="form-control" name="introduce" required placeholder="请输入简介">{$post.introduce}</textarea>
  43 + </td>
  44 + </tr>
  45 + <tr>
  46 + <th>简介(英文)<span class="form-required">*</span></th>
  47 + <td>
  48 + <textarea rows="5" class="form-control" name="introduce_en" required placeholder="请输入简介">{$post.introduce_en}</textarea>
  49 + </td>
  50 + </tr>
  51 + <tr>
  52 + <th>详情<span class="form-required">*</span></th>
  53 + <td>
  54 + <script type="text/plain" id="content" name="detail">{$post.detail}</script>
  55 + </td>
  56 + </tr>
  57 + <tr>
  58 + <th>详情(英文)<span class="form-required">*</span></th>
  59 + <td>
  60 + <script type="text/plain" id="content_en" name="detail_en">{$post.detail_en}</script>
  61 + </td>
  62 + </tr>
  63 + <tr>
  64 + <th>视频<span class="form-required">*</span></th>
  65 + <td class="form-inline">
  66 + <input id="file-video" class="form-control" type="text" name="video" value="{$post.video|default=''}" placeholder="请上传视频文件" style="width: 400px;">
  67 + <notempty name="post.video">
  68 + <a id="file-video-preview" href="{:cmf_get_file_download_url($post.video)}"
  69 + target="_blank">下载</a>
  70 + </notempty>
  71 + <a href="javascript:uploadOne('文件上传','#file-video','video');">上传</a>
  72 + </td>
  73 + </tr>
  74 + </table>
  75 + </div>
  76 + <div class="col-md-3">
  77 + <table class="table table-bordered">
  78 + <tr>
  79 + <th>缩略图<span class="form-required">*</span></th>
  80 + </tr>
  81 + <tr>
  82 + <td>
  83 + <div style="text-align: center;">
  84 + <input type="hidden" name="thumbnail" id="thumbnail" value="{$post.thumbnail|default=''}">
  85 + <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
  86 + <if condition="empty($post.thumbnail)">
  87 + <img src="__TMPL__/public/assets/images/default-thumbnail.png" id="thumbnail-preview" width="135" style="cursor: pointer"/>
  88 + <else/>
  89 + <img src="{:cmf_get_image_preview_url($post.thumbnail)}" id="thumbnail-preview" width="135" style="cursor: pointer"/>
  90 + </if>
  91 + </a>
  92 + <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
  93 + </div>
  94 + </td>
  95 + </tr>
  96 + </table>
  97 + </div>
  98 + </div>
  99 + <div class="form-group">
  100 + <div class="col-sm-offset-2 col-sm-10">
  101 + <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
  102 + <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
  103 + </div>
  104 + </div>
  105 + </form>
  106 +</div>
  107 +<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
  108 +<script type="text/javascript">
  109 + //编辑器路径定义
  110 + var editorURL = GV.WEB_ROOT;
  111 +</script>
  112 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
  113 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
  114 +<script type="text/javascript">
  115 + $(function () {
  116 +
  117 + editorcontent = new baidu.editor.ui.Editor();
  118 + editorcontent.render('content');
  119 + try {
  120 + editorcontent.sync();
  121 + } catch (err) {
  122 + }
  123 +
  124 + editorcontent = new baidu.editor.ui.Editor();
  125 + editorcontent.render('content_en');
  126 + try {
  127 + editorcontent.sync();
  128 + } catch (err) {
  129 + }
  130 +
  131 + $('.btn-cancel-thumbnail').click(function () {
  132 + $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
  133 + $('#thumbnail').val('');
  134 + });
  135 + });
  136 +</script>
  137 +</body>
  138 +</html>
  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('AdminAdvantage/index')}">优势列表</a></li>
  33 + <li class="active"><a href="#">添加优势</a></li>
  34 + </ul>
  35 + <form action="{:url('AdminAdvantage/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="150">标题<span class="form-required">*</span></th>
  41 + <td>
  42 + <input class="form-control" type="text" name="title" required placeholder="请输入标题"/>
  43 + </td>
  44 + </tr>
  45 + <tr>
  46 + <th>标题(英文)<span class="form-required">*</span></th>
  47 + <td>
  48 + <input class="form-control" type="text" name="title_en" required placeholder="请输入标题(英文)"/>
  49 + </td>
  50 + </tr>
  51 + <tr>
  52 + <th>简介<span class="form-required">*</span></th>
  53 + <td>
  54 + <textarea class="form-control" rows="3" name="introduce" required placeholder="请输入简介"></textarea>
  55 + </td>
  56 + </tr>
  57 + <tr>
  58 + <th>简介(英文)<span class="form-required">*</span></th>
  59 + <td>
  60 + <textarea class="form-control" rows="3" name="introduce_en" required placeholder="请输入简介(英文)"></textarea>
  61 + </td>
  62 + </tr>
  63 + </table>
  64 + <div class="form-group">
  65 + <div class="col-sm-offset-2 col-sm-10">
  66 + <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
  67 + <a class="btn btn-default" href="{:url('AdminAdvantage/index')}">{:lang('BACK')}</a>
  68 + </div>
  69 + </div>
  70 + </div>
  71 + </div>
  72 + </form>
  73 +</div>
  74 +<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
  75 +<script type="text/javascript">
  76 + //编辑器路径定义
  77 + var editorURL = GV.WEB_ROOT;
  78 +</script>
  79 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
  80 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
  81 +<script type="text/javascript">
  82 + $(function () {
  83 +
  84 + editorcontent = new baidu.editor.ui.Editor();
  85 + editorcontent.render('content');
  86 + try {
  87 + editorcontent.sync();
  88 + } catch (err) {
  89 + }
  90 +
  91 + $('.btn-cancel-thumbnail').click(function () {
  92 + $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
  93 + $('#thumbnail').val('');
  94 + });
  95 +
  96 + });
  97 +</script>
  98 +</body>
  99 +</html>
  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('AdminAdvantage/index')}">优势列表</a></li>
  33 + <li class="active"><a href="#">编辑优势</a></li>
  34 + </ul>
  35 + <form action="{:url('AdminAdvantage/editPost')}" 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="150">标题<span class="form-required">*</span></th>
  41 + <td>
  42 + <input type="hidden" name="id" required value="{$post.id}"/>
  43 + <input class="form-control" type="text" name="title" required placeholder="请输入标题" value="{$post.title}"/>
  44 + </td>
  45 + </tr>
  46 + <tr>
  47 + <th>标题(英文)<span class="form-required">*</span></th>
  48 + <td>
  49 + <input class="form-control" type="text" name="title_en" required placeholder="请输入标题(英文)" value="{$post.title_en}"/>
  50 + </td>
  51 + </tr>
  52 + <tr>
  53 + <th>简介<span class="form-required">*</span></th>
  54 + <td>
  55 + <textarea class="form-control" rows="3" name="introduce" required placeholder="请输入简介">{$post.introduce}</textarea>
  56 + </td>
  57 + </tr>
  58 + <tr>
  59 + <th>简介(英文)<span class="form-required">*</span></th>
  60 + <td>
  61 + <textarea class="form-control" rows="3" name="introduce_en" required placeholder="请输入简介(英文)">{$post.introduce_en}</textarea>
  62 + </td>
  63 + </tr>
  64 + </table>
  65 + </div>
  66 + </div>
  67 + <div class="form-group">
  68 + <div class="col-sm-offset-2 col-sm-10">
  69 + <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
  70 + <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
  71 + </div>
  72 + </div>
  73 + </form>
  74 +</div>
  75 +<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
  76 +<script type="text/javascript">
  77 + //编辑器路径定义
  78 + var editorURL = GV.WEB_ROOT;
  79 +</script>
  80 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
  81 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
  82 +<script type="text/javascript">
  83 + $(function () {
  84 +
  85 + editorcontent = new baidu.editor.ui.Editor();
  86 + editorcontent.render('content');
  87 + try {
  88 + editorcontent.sync();
  89 + } catch (err) {
  90 + }
  91 +
  92 + $('.btn-cancel-thumbnail').click(function () {
  93 + $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
  94 + $('#thumbnail').val('');
  95 + });
  96 + });
  97 +</script>
  98 +</body>
  99 +</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('AdminAdvantage/add')}">添加优势</a></li>
  8 + </ul>
  9 + <form class="well form-inline margin-top-20" method="get" action="{:url('AdminAdvantage/index')}">
  10 + <!--时间:-->
  11 + <!--<input type="text" class="form-control js-bootstrap-datetime" name="start_time"-->
  12 + <!--value="{$start_time|default=''}"-->
  13 + <!--style="width: 140px;" autocomplete="off">- -->
  14 + <!--<input type="text" class="form-control js-bootstrap-datetime" name="end_time"-->
  15 + <!--value="{$end_time|default=''}"-->
  16 + <!--style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;-->
  17 + <!--关键字:-->
  18 + <!--<input type="text" class="form-control" name="keyword" style="width: 200px;"-->
  19 + <!--value="{$keyword|default=''}" placeholder="请输入关键字...">-->
  20 + <!--<input type="submit" class="btn btn-primary" value="搜索"/>-->
  21 + <!--<a class="btn btn-danger" href="{:url('AdminAdvantage/index')}">清空</a>-->
  22 + </form>
  23 + <form class="js-ajax-form" action="" method="post">
  24 + <table class="table table-hover table-bordered table-list">
  25 + <thead>
  26 + <tr>
  27 + <th width="50">
  28 + <label>
  29 + <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
  30 + </label>
  31 + </th>
  32 + <th>ID</th>
  33 + <th>标题</th>
  34 + <th>创建时间</th>
  35 + <th>操作</th>
  36 + </tr>
  37 + </thead>
  38 + <foreach name="list" item="vo">
  39 + <tr>
  40 + <td>
  41 + <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
  42 + value="{$vo.id}" title="ID:{$vo.id}">
  43 + </td>
  44 + <td>{$vo.id}</td>
  45 + <td>
  46 + {$vo.title}
  47 + </td>
  48 + <td>
  49 + {:date('Y-m-d H:i:s',$vo['create_time'])}
  50 + </td>
  51 + <td>
  52 + <a class="btn btn-xs btn-primary" href="{:url('AdminAdvantage/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a>
  53 + <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('AdminAdvantage/delete',array('id'=>$vo['id']))}">{:lang('DELETE')}</a>
  54 + </td>
  55 + </tr>
  56 + </foreach>
  57 + </table>
  58 + <ul class="pagination">{$page|default=''}</ul>
  59 + </form>
  60 +</div>
  61 +<script src="__STATIC__/js/admin.js"></script>
  62 +<script>
  63 +
  64 + function reloadPage(win) {
  65 + win.location.reload();
  66 + }
  67 +</script>
  68 +</body>
  69 +</html>
  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('AdminRotation/index')}">轮播图管理</a></li>
  33 + <li class="active"><a href="{:url('AdminRotation/add')}">添加轮播图</a></li>
  34 + </ul>
  35 + <form action="{:url('AdminRotation/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="url" name="link" required placeholder="请输入链接"/>
  43 + </td>
  44 + </tr>
  45 + </table>
  46 + <div class="form-group">
  47 + <div class="col-sm-offset-2 col-sm-10">
  48 + <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
  49 + <a class="btn btn-default" href="{:url('AdminRotation/index')}">{:lang('BACK')}</a>
  50 + </div>
  51 + </div>
  52 + </div>
  53 + <div class="col-md-3">
  54 + <table class="table table-bordered">
  55 + <tr>
  56 + <th>轮播图<span class="form-required">*</span></th>
  57 + </tr>
  58 + <tr>
  59 + <td>
  60 + <div style="text-align: center;">
  61 + <input type="hidden" name="thumbnail" id="thumbnail">
  62 + <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
  63 + <img src="__TMPL__/public/assets/images/default-thumbnail.png"
  64 + id="thumbnail-preview"
  65 + width="135" style="cursor: pointer"/>
  66 + </a>
  67 + <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
  68 + </div>
  69 + </td>
  70 + </tr>
  71 + </table>
  72 + </div>
  73 + </div>
  74 + </form>
  75 +</div>
  76 +<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
  77 +<script type="text/javascript">
  78 + //编辑器路径定义
  79 + var editorURL = GV.WEB_ROOT;
  80 +</script>
  81 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
  82 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
  83 +<script type="text/javascript">
  84 + $(function () {
  85 +
  86 + editorcontent = new baidu.editor.ui.Editor();
  87 + editorcontent.render('content');
  88 + try {
  89 + editorcontent.sync();
  90 + } catch (err) {
  91 + }
  92 +
  93 + $('.btn-cancel-thumbnail').click(function () {
  94 + $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
  95 + $('#thumbnail').val('');
  96 + });
  97 +
  98 + });
  99 +</script>
  100 +</body>
  101 +</html>
  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('AdminRotation/index')}">轮播图管理</a></li>
  33 + <li class="active"><a href="#">编辑轮播图</a></li>
  34 + </ul>
  35 + <form action="{:url('AdminRotation/editPost')}" 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 id="post-id" type="hidden" name="id" value="{$post.id}">
  43 + <input class="form-control" type="url" name="link" required value="{$post.link}" placeholder="请输入链接"/>
  44 + </td>
  45 + </tr>
  46 + </table>
  47 + </div>
  48 + <div class="col-md-3">
  49 + <table class="table table-bordered">
  50 + <tr>
  51 + <th>轮播图<span class="form-required">*</span></th>
  52 + </tr>
  53 + <tr>
  54 + <td>
  55 + <div style="text-align: center;">
  56 + <input type="hidden" name="thumbnail" id="thumbnail" value="{$post.thumbnail|default=''}">
  57 + <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
  58 + <if condition="empty($post.thumbnail)">
  59 + <img src="__TMPL__/public/assets/images/default-thumbnail.png" id="thumbnail-preview" width="135" style="cursor: pointer"/>
  60 + <else/>
  61 + <img src="{:cmf_get_image_preview_url($post.thumbnail)}" id="thumbnail-preview" 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 + </div>
  70 + </div>
  71 + <div class="form-group">
  72 + <div class="col-sm-offset-2 col-sm-10">
  73 + <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
  74 + <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
  75 + </div>
  76 + </div>
  77 + </form>
  78 +</div>
  79 +<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
  80 +<script type="text/javascript">
  81 + //编辑器路径定义
  82 + var editorURL = GV.WEB_ROOT;
  83 +</script>
  84 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
  85 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
  86 +<script type="text/javascript">
  87 + $(function () {
  88 +
  89 + editorcontent = new baidu.editor.ui.Editor();
  90 + editorcontent.render('content');
  91 + try {
  92 + editorcontent.sync();
  93 + } catch (err) {
  94 + }
  95 +
  96 + $('.btn-cancel-thumbnail').click(function () {
  97 + $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
  98 + $('#thumbnail').val('');
  99 + });
  100 + });
  101 +</script>
  102 +</body>
  103 +</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('AdminRotation/add')}">添加轮播</a></li>
  8 + </ul>
  9 + <form class="well form-inline margin-top-20" method="get" action="{:url('AdminRotation/index')}">
  10 + <!--时间:-->
  11 + <!--<input type="text" class="form-control js-bootstrap-datetime" name="start_time"-->
  12 + <!--value="{$start_time|default=''}"-->
  13 + <!--style="width: 140px;" autocomplete="off">- -->
  14 + <!--<input type="text" class="form-control js-bootstrap-datetime" name="end_time"-->
  15 + <!--value="{$end_time|default=''}"-->
  16 + <!--style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;-->
  17 + <!--关键字:-->
  18 + <!--<input type="text" class="form-control" name="keyword" style="width: 200px;"-->
  19 + <!--value="{$keyword|default=''}" placeholder="请输入关键字...">-->
  20 + <!--<input type="submit" class="btn btn-primary" value="搜索"/>-->
  21 + <!--<a class="btn btn-danger" href="{:url('AdminRotation/index')}">清空</a>-->
  22 + </form>
  23 + <form class="js-ajax-form" action="" method="post">
  24 + <table class="table table-hover table-bordered table-list">
  25 + <thead>
  26 + <tr>
  27 + <th width="50">
  28 + <label>
  29 + <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
  30 + </label>
  31 + </th>
  32 + <th>ID</th>
  33 + <th>轮播图</th>
  34 + <th>链接</th>
  35 + <th>创建时间</th>
  36 + <th>操作</th>
  37 + </tr>
  38 + </thead>
  39 + <foreach name="list" item="vo">
  40 + <tr>
  41 + <td>
  42 + <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
  43 + value="{$vo.id}" title="ID:{$vo.id}">
  44 + </td>
  45 + <td>{$vo.id}</td>
  46 + <td>
  47 + <notempty name="vo.thumbnail">
  48 + <a href="javascript:parent.imagePreviewDialog('{:cmf_get_image_preview_url($vo.thumbnail)}');">
  49 + <i class="fa fa-photo fa-fw"></i>
  50 + </a>
  51 + <else/>
  52 + <i class="fa fa-close fa-fw"></i>
  53 + </notempty>
  54 + </td>
  55 + <td>
  56 + {$vo.link}
  57 + </td>
  58 + <td>
  59 + {:date('Y-m-d H:i:s',$vo['create_time'])}
  60 + </td>
  61 + <td>
  62 + <a class="btn btn-xs btn-primary" href="{:url('AdminRotation/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a>
  63 + <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('AdminRotation/delete',array('id'=>$vo['id']))}">{:lang('DELETE')}</a>
  64 + </td>
  65 + </tr>
  66 + </foreach>
  67 + </table>
  68 + <ul class="pagination">{$page|default=''}</ul>
  69 + </form>
  70 +</div>
  71 +<script src="__STATIC__/js/admin.js"></script>
  72 +<script>
  73 +
  74 + function reloadPage(win) {
  75 + win.location.reload();
  76 + }
  77 +</script>
  78 +</body>
  79 +</html>
@@ -326,6 +326,8 @@ class Upload @@ -326,6 +326,8 @@ class Upload
326 session_write_close(); 326 session_write_close();
327 $result = $storage->upload($arrInfo["file_path"], './upload/' . $arrInfo["file_path"], $fileType); 327 $result = $storage->upload($arrInfo["file_path"], './upload/' . $arrInfo["file_path"], $fileType);
328 if (!empty($result)) { 328 if (!empty($result)) {
  329 + //我加的
  330 + unlink('./upload/' . $arrInfo["file_path"]);
329 return array_merge([ 331 return array_merge([
330 'filepath' => $arrInfo["file_path"], 332 'filepath' => $arrInfo["file_path"],
331 "name" => $arrInfo["filename"], 333 "name" => $arrInfo["filename"],