作者 景龙
1 个管道 的构建 通过 耗费 10 秒

增加后台海外医疗模块

<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;
use cmf\controller\AdminBaseController;
use app\portal\model\PortalPostModel;
use app\portal\service\PostService;
use app\portal\model\PortalCategoryModel;
use app\portal\model\CityCategoryModel;
use think\Db;
use app\admin\model\ThemeModel;
//星探推荐->海外医疗
class AdminScoutOverseaController extends AdminBaseController
{
//文章列表
public function index()
{
$content = hook_one('portal_admin_article_index_view');
if (!empty($content)) {
return $content;
}
$param = $this->request->param();
$param['category'] = CityCategoryModel::hwyl;
// $categoryId = $this->request->param('category', 0, 'intval');
$categoryId = $param['category'];
$postService = new PostService();
$data = $postService->AdminArticleList($param);
$data->appends($param);
$articles = $data->items();
$portalCategoryModel = new PortalCategoryModel();
$categoryTree = $portalCategoryModel->adminCategoryTree($categoryId);
$this->assign('start_time', isset($param['start_time']) ? $param['start_time'] : '');
$this->assign('end_time', isset($param['end_time']) ? $param['end_time'] : '');
$this->assign('post_title', isset($param['post_title']) ? $param['post_title'] : '');
$this->assign('articles', $articles);
$this->assign('category_tree', $categoryTree);
$this->assign('category', $categoryId);
$this->assign('page', $data->render());
return $this->fetch();
}
//添加文章
public function add()
{
$content = hook_one('portal_admin_article_add_view');
if (!empty($content)) {
return $content;
}
$themeModel = new ThemeModel();
$articleThemeFiles = $themeModel->getActionThemeFiles('portal/Article/index');
$this->assign('article_theme_files', $articleThemeFiles);
//分类
$categories = CityCategoryModel::hwyl;
$this->assign('categories', $categories);
return $this->fetch();
}
//添加文章提交
public function addPost()
{
if ($this->request->isPost()) {
$data = $this->request->param();
//状态只能设置默认值。未发布、未置顶、未推荐
$data['post']['post_status'] = 0;
$data['post']['is_top'] = 0;
$data['post']['recommended'] = 0;
$post = $data['post'];
$result = $this->validate($post, 'AdminScoutOversea');
if ($result !== true) {
$this->error($result);
}
$portalPostModel = new PortalPostModel();
if (!empty($data['photo_names']) && !empty($data['photo_urls'])) {
$data['post']['more']['photos'] = [];
foreach ($data['photo_urls'] as $key => $url) {
$photoUrl = cmf_asset_relative_url($url);
array_push($data['post']['more']['photos'], ["url" => $photoUrl, "name" => $data['photo_names'][$key]]);
}
}
if (!empty($data['file_names']) && !empty($data['file_urls'])) {
$data['post']['more']['files'] = [];
foreach ($data['file_urls'] as $key => $url) {
$fileUrl = cmf_asset_relative_url($url);
array_push($data['post']['more']['files'], ["url" => $fileUrl, "name" => $data['file_names'][$key]]);
}
}
$portalPostModel->adminAddArticle($data['post'], $data['post']['categories']);
$data['post']['id'] = $portalPostModel->id;
$hookParam = [
'is_add' => true,
'article' => $data['post']
];
hook('portal_admin_after_save_article', $hookParam);
$this->success('添加成功!', url('AdminScoutOversea/edit', ['id' => $portalPostModel->id]));
}
}
//编辑文章
public function edit()
{
$content = hook_one('portal_admin_article_edit_view');
if (!empty($content)) {
return $content;
}
$id = $this->request->param('id', 0, 'intval');
$portalPostModel = new PortalPostModel();
$post = $portalPostModel->where('id', $id)->find();
$postCategories = $post->categories()->alias('a')->column('a.name', 'a.id');
$postCategoryIds = implode(',', array_keys($postCategories));
$themeModel = new ThemeModel();
$articleThemeFiles = $themeModel->getActionThemeFiles('portal/Article/index');
$this->assign('article_theme_files', $articleThemeFiles);
$this->assign('post', $post);
$this->assign('post_categories', $postCategories);
$this->assign('post_category_ids', $postCategoryIds);
//分类
$categories = CityCategoryModel::hwyl;
$this->assign('categories', $categories);
return $this->fetch();
}
//编辑文章提交
public function editPost()
{
if ($this->request->isPost()) {
$data = $this->request->param();
//需要抹除发布、置顶、推荐的修改。
unset($data['post']['post_status']);
unset($data['post']['is_top']);
unset($data['post']['recommended']);
$post = $data['post'];
$result = $this->validate($post, 'AdminScoutOversea');
if ($result !== true) {
$this->error($result);
}
$portalPostModel = new PortalPostModel();
if (!empty($data['photo_names']) && !empty($data['photo_urls'])) {
$data['post']['more']['photos'] = [];
foreach ($data['photo_urls'] as $key => $url) {
$photoUrl = cmf_asset_relative_url($url);
array_push($data['post']['more']['photos'], ["url" => $photoUrl, "name" => $data['photo_names'][$key]]);
}
}
if (!empty($data['file_names']) && !empty($data['file_urls'])) {
$data['post']['more']['files'] = [];
foreach ($data['file_urls'] as $key => $url) {
$fileUrl = cmf_asset_relative_url($url);
array_push($data['post']['more']['files'], ["url" => $fileUrl, "name" => $data['file_names'][$key]]);
}
}
$portalPostModel->adminEditArticle($data['post'], $data['post']['categories']);
$hookParam = [
'is_add' => false,
'article' => $data['post']
];
hook('portal_admin_after_save_article', $hookParam);
$this->success('保存成功!');
}
}
//文章删除
public function delete()
{
$param = $this->request->param();
$portalPostModel = new PortalPostModel();
if (isset($param['id'])) {
$id = $this->request->param('id', 0, 'intval');
$result = $portalPostModel->where('id', $id)->find();
$data = [
'object_id' => $result['id'],
'create_time' => time(),
'table_name' => 'portal_post',
'name' => $result['post_title'],
'user_id' => cmf_get_current_admin_id()
];
$resultPortal = $portalPostModel
->where('id', $id)
->update(['delete_time' => time()]);
if ($resultPortal) {
Db::name('portal_category_post')->where('post_id', $id)->update(['status' => 0]);
Db::name('portal_tag_post')->where('post_id', $id)->update(['status' => 0]);
Db::name('recycleBin')->insert($data);
}
$this->success("删除成功!", '');
}
if (isset($param['ids'])) {
$ids = $this->request->param('ids/a');
$recycle = $portalPostModel->where('id', 'in', $ids)->select();
$result = $portalPostModel->where('id', 'in', $ids)->update(['delete_time' => time()]);
if ($result) {
Db::name('portal_category_post')->where('post_id', 'in', $ids)->update(['status' => 0]);
Db::name('portal_tag_post')->where('post_id', 'in', $ids)->update(['status' => 0]);
foreach ($recycle as $value) {
$data = [
'object_id' => $value['id'],
'create_time' => time(),
'table_name' => 'portal_post',
'name' => $value['post_title'],
'user_id' => cmf_get_current_admin_id()
];
Db::name('recycleBin')->insert($data);
}
$this->success("删除成功!", '');
}
}
}
}
... ...
... ... @@ -29,6 +29,12 @@ class ScoutController extends HomeBaseController
$res_lylx = $this->getChildArticle($position,$field,$this->index_limit);
$this->assign('res_lylx',$res_lylx);
//海外医疗
$position['category_id'] = CityCategoryModel::hwyl;
$field = 'id,thumbnail,post_title';
$res_hwyl = $this->getChildArticle($position,$field,$this->index_limit);
$this->assign('res_hwyl',$res_hwyl);
//地道风物
$position['category_id'] = CityCategoryModel::ddfw;
$field = 'id,thumbnail,post_title,price';
... ...
... ... @@ -51,6 +51,7 @@ class CityCategoryModel extends Model
const cysj = 25;//创意设计
const yjyr = 26;//悦己悦人
const xjhd_c = 27;//星际活动
const hwyl = 40;//海外医疗
//城市
const xqgh_cc = 65;//星球故事
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace app\portal\validate;
use think\Validate;
class AdminScoutOverseaValidate extends Validate
{
protected $rule = [
'post_title' => 'require',
'post_excerpt' => 'require',
];
protected $message = [
'post_title.require' => '文章标题不能为空!',
'post_excerpt.require' => '文章简介不能为空!',
];
protected $scene = [
// 'add' => ['user_login,user_pass,user_email'],
// 'edit' => ['user_login,user_email'],
];
}
\ No newline at end of file
... ...
... ... @@ -250,6 +250,12 @@ return array (
'PORTAL_ADMINSCOUTLIKE_EDIT' => '编辑显示',
'PORTAL_ADMINSCOUTLIKE_EDITPOST' => '编辑提交',
'PORTAL_ADMINSCOUTLIKE_INDEX' => '海外教育',
'PORTAL_ADMINSCOUTOVERSEA_ADD' => '添加显示',
'PORTAL_ADMINSCOUTOVERSEA_ADDPOST' => '添加提交',
'PORTAL_ADMINSCOUTOVERSEA_DELETE' => '删除',
'PORTAL_ADMINSCOUTOVERSEA_EDIT' => '编辑显示',
'PORTAL_ADMINSCOUTOVERSEA_EDITPOST' => '编辑提交',
'PORTAL_ADMINSCOUTOVERSEA_INDEX' => '海外医疗',
'PORTAL_ADMINSCOUTSCENERY_ADD' => '添加显示',
'PORTAL_ADMINSCOUTSCENERY_ADDPOST' => '添加提交',
'PORTAL_ADMINSCOUTSCENERY_DELETE' => '删除',
... ...
<include file="public@header"/>
<style type="text/css">
.pic-list li {
margin-bottom: 5px;
}
</style>
<script type="text/html" id="photos-item-tpl">
<li id="saved-image{id}">
<input id="photo-{id}" type="hidden" name="photo_urls[]" value="{filepath}">
<input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
style="width: 200px;" title="图片名称">
<img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
onclick="imagePreviewDialog(this.src);">
<a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
<a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
</li>
</script>
<script type="text/html" id="files-item-tpl">
<li id="saved-file{id}">
<input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
<input class="form-control" id="file-{id}-name" type="text" name="file_names[]" value="{name}"
style="width: 200px;" title="文件名称">
<a id="file-{id}-preview" href="{preview_url}" target="_blank">下载</a>
<a href="javascript:uploadOne('文件上传','#file-{id}','file');">替换</a>
<a href="javascript:(function(){$('#saved-file{id}').remove();})();">移除</a>
</li>
</script>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li><a href="{:url('AdminScoutOversea/index')}">文章管理</a></li>
<li class="active"><a href="{:url('AdminScoutOversea/add')}">添加文章</a></li>
</ul>
<form action="{:url('AdminScoutOversea/addPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
<div class="row">
<div class="col-md-9">
<table class="table table-bordered">
<input class="form-control" type="hidden" value="{$categories}" name="post[categories]"
id="js-categories-id-input"/>
<tr>
<th width="100">标题<span class="form-required">*</span></th>
<td>
<input class="form-control" type="text" name="post[post_title]"
id="title" required value="" placeholder="请输入标题"/>
</td>
</tr>
<tr>
<th>预定须知<span class="form-required">*</span></th>
<td>
<input class="form-control" required type="text" name="post[notice]" placeholder="请输入预定须知"/>
</td>
</tr>
<tr>
<th>出发地点<span class="form-required">*</span></th>
<td>
<input class="form-control" required type="text" name="post[place]" placeholder="请输入出发地点"/>
</td>
</tr>
<tr>
<th>包含项目<span class="form-required">*</span></th>
<td>
<input class="form-control" required type="text" name="post[project]" placeholder="请输入包含项目"/>
</td>
</tr>
<tr>
<th>价格<span class="form-required">*</span></th>
<td>
<input class="form-control" required type="text" name="post[price]" placeholder="请输入价格"/>
</td>
</tr>
<tr>
<th>支付外链<span class="form-required">*</span></th>
<td>
<input class="form-control" required type="url" name="post[pay_url]" placeholder="请输入支付外链"/>
</td>
</tr>
<tr>
<th>简介<span class="form-required">*</span></th>
<td>
<textarea class="form-control" required name="post[post_excerpt]" style="height: 50px;"
placeholder="请填写简介"></textarea>
</td>
</tr>
<tr>
<th>相册</th>
<td>
<ul id="photos" class="pic-list list-unstyled form-inline"></ul>
<a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-tpl');"
class="btn btn-default btn-sm">选择图片</a>
</td>
</tr>
<tr>
<th>权重</th>
<td>
<input class="form-control" type="number" name="post[weigh]" value="0">
</td>
</tr>
</table>
<hook name="portal_admin_article_edit_view_main"/>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
<a class="btn btn-default" href="{:url('AdminScoutOversea/index')}">{:lang('BACK')}</a>
</div>
</div>
</div>
<div class="col-md-3">
<table class="table table-bordered">
<tr>
<th><b>首页缩略图</b><span class="form-required">*</span></th>
</tr>
<tr>
<td>
<div style="text-align: center;">
<input type="hidden" name="post[index_thumbnail]" id="index_thumbnail" value="">
<a href="javascript:uploadOneImage('图片上传','#index_thumbnail');">
<img src="__TMPL__/public/assets/images/default-thumbnail.png"
id="index_thumbnail-preview"
width="135" style="cursor: pointer"/>
</a>
<input type="button" class="btn btn-sm btn-cancel-index_thumbnail" value="取消图片">
</div>
<div style="margin-top:30px;">
<span class="form-required">图片参考尺寸:290*230</span>
</div>
</td>
</tr>
<tr>
<th><b>列表页缩略图</b><span class="form-required">*</span></th>
</tr>
<tr>
<td>
<div style="text-align: center;">
<input type="hidden" name="post[more][thumbnail]" id="thumbnail" value="">
<a href="javascript:uploadOneImage('图片上传','#thumbnail');">
<img src="__TMPL__/public/assets/images/default-thumbnail.png"
id="thumbnail-preview"
width="135" style="cursor: pointer"/>
</a>
<input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
</div>
<div style="margin-top:30px;">
<span class="form-required">图片参考尺寸:386*303</span>
</div>
</td>
</tr>
<tr>
<th><b>发布时间</b></th>
</tr>
<tr>
<td>
<input class="form-control js-bootstrap-datetime" type="text" name="post[published_time]"
value="{:date('Y-m-d H:i:s',time())}">
</td>
</tr>
</table>
<hook name="portal_admin_article_edit_view_right_sidebar"/>
</div>
</div>
</form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
//编辑器路径定义
var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
$(function () {
editorcontent = new baidu.editor.ui.Editor();
editorcontent.render('content');
try {
editorcontent.sync();
} catch (err) {
}
//首页缩略图
$('.btn-cancel-index_thumbnail').click(function () {
$('#index_thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
$('#index_thumbnail').val('');
});
//列表页缩略图
$('.btn-cancel-thumbnail').click(function () {
$('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
$('#thumbnail').val('');
});
});
function doSelectCategory() {
var selectedCategoriesId = $('#js-categories-id-input').val();
openIframeLayer("{:url('AdminCategory/select')}?ids=" + selectedCategoriesId, '请选择分类', {
area: ['700px', '400px'],
btn: ['确定', '取消'],
yes: function (index, layero) {
//do something
var iframeWin = window[layero.find('iframe')[0]['name']];
var selectedCategories = iframeWin.confirm();
if (selectedCategories.selectedCategoriesId.length == 0) {
layer.msg('请选择分类');
return;
}
$('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(','));
$('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' '));
//console.log(layer.getFrameIndex(index));
layer.close(index); //如果设定了yes回调,需进行手工关闭
}
});
}
</script>
</body>
</html>
... ...
<include file="public@header"/>
<style type="text/css">
.pic-list li {
margin-bottom: 5px;
}
</style>
<script type="text/html" id="photos-item-tpl">
<li id="saved-image{id}">
<input id="photo-{id}" type="hidden" name="photo_urls[]" value="{filepath}">
<input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
style="width: 200px;" title="图片名称">
<img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
onclick="imagePreviewDialog(this.src);">
<a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
<a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
</li>
</script>
<script type="text/html" id="files-item-tpl">
<li id="saved-file{id}">
<input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
<input class="form-control" id="file-{id}-name" type="text" name="file_names[]" value="{name}"
style="width: 200px;" title="文件名称">
<a id="file-{id}-preview" href="{preview_url}" target="_blank">下载</a>
<a href="javascript:uploadOne('文件上传','#file-{id}','file');">替换</a>
<a href="javascript:(function(){$('#saved-file{id}').remove();})();">移除</a>
</li>
</script>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li><a href="{:url('AdminScoutOversea/index')}">文章管理</a></li>
<li>
<a href="{:url('AdminScoutOversea/add')}">添加文章</a>
</li>
<li class="active"><a href="#">编辑文章</a></li>
</ul>
<form action="{:url('AdminScoutOversea/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
<div class="row">
<div class="col-md-9">
<table class="table table-bordered">
<input id="post-id" type="hidden" name="post[id]" value="{$post.id}">
<input class="form-control" type="hidden" value="{$categories}" name="post[categories]"
id="js-categories-id-input"/>
<tr>
<th width="100">标题<span class="form-required">*</span></th>
<td>
<input class="form-control" type="text" name="post[post_title]"
required value="{$post.post_title}" placeholder="请输入标题"/>
</td>
</tr>
<tr>
<th>预定须知<span class="form-required">*</span></th>
<td>
<input class="form-control" required type="text" name="post[notice]" placeholder="请输入预定须知" value="{$post.notice}"/>
</td>
</tr>
<tr>
<th>出发地点<span class="form-required">*</span></th>
<td>
<input class="form-control" required type="text" name="post[place]" placeholder="请输入出发地点" value="{$post.place}"/>
</td>
</tr>
<tr>
<th>包含项目<span class="form-required">*</span></th>
<td>
<input class="form-control" required type="text" name="post[project]" placeholder="请输入包含项目" value="{$post.project}"/>
</td>
</tr>
<tr>
<th>价格<span class="form-required">*</span></th>
<td>
<input class="form-control" required type="text" name="post[price]" placeholder="请输入价格" value="{$post.price}"/>
</td>
</tr>
<tr>
<th>支付外链<span class="form-required">*</span></th>
<td>
<input class="form-control" required type="url" name="post[pay_url]" placeholder="请输入支付外链" value="{$post.pay_url}"/>
</td>
</tr>
<tr>
<th>简介<span class="form-required">*</span></th>
<td>
<textarea class="form-control" required name="post[post_excerpt]" style="height: 50px;"
placeholder="请填写简介">{$post.post_excerpt}</textarea>
</td>
</tr>
<tr>
<th>相册</th>
<td>
<ul id="photos" class="pic-list list-unstyled form-inline">
<notempty name="post.more.photos">
<foreach name="post.more.photos" item="vo">
<php>$img_url=cmf_get_image_preview_url($vo['url']);</php>
<li id="saved-image{$key}">
<input id="photo-{$key}" type="hidden" name="photo_urls[]"
value="{$vo.url}">
<input class="form-control" id="photo-{$key}-name" type="text"
name="photo_names[]"
value="{$vo.name|default=''}" style="width: 200px;" title="图片名称">
<img id="photo-{$key}-preview"
src="{:cmf_get_image_preview_url($vo['url'])}"
style="height:36px;width: 36px;"
onclick="parent.imagePreviewDialog(this.src);">
<a href="javascript:uploadOneImage('图片上传','#photo-{$key}');">替换</a>
<a href="javascript:(function(){$('#saved-image{$key}').remove();})();">移除</a>
</li>
</foreach>
</notempty>
</ul>
<a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-tpl');"
class="btn btn-sm btn-default">选择图片</a>
</td>
</tr>
<tr>
<th>权重</th>
<td>
<input class="form-control" type="number" name="post[weigh]" value="{$post.weigh}">
</td>
</tr>
</table>
<hook name="portal_admin_article_edit_view_main"/>
</div>
<div class="col-md-3">
<table class="table table-bordered">
<tr>
<th>首页缩略图<span class="form-required">*</span></th>
</tr>
<tr>
<td>
<div style="text-align: center;">
<input type="hidden" name="post[index_thumbnail]" id="index_thumbnail"
value="{$post.index_thumbnail|default=''}">
<a href="javascript:uploadOneImage('图片上传','#index_thumbnail');">
<if condition="empty($post.index_thumbnail)">
<img src="__TMPL__/public/assets/images/default-thumbnail.png"
id="index_thumbnail-preview"
width="135" style="cursor: pointer"/>
<else/>
<img src="{:cmf_get_image_preview_url($post.index_thumbnail)}"
id="index_thumbnail-preview"
width="135" style="cursor: pointer"/>
</if>
</a>
<input type="button" class="btn btn-sm btn-cancel-index_thumbnail" value="取消图片">
</div>
<div style="margin-top:30px;">
<span class="form-required">图片参考尺寸:290*230</span>
</div>
</td>
</tr>
<tr>
<th>列表页缩略图<span class="form-required">*</span></th>
</tr>
<tr>
<td>
<div style="text-align: center;">
<input type="hidden" name="post[more][thumbnail]" id="thumbnail"
value="{$post.more.thumbnail|default=''}">
<a href="javascript:uploadOneImage('图片上传','#thumbnail');">
<if condition="empty($post.more.thumbnail)">
<img src="__TMPL__/public/assets/images/default-thumbnail.png"
id="thumbnail-preview"
width="135" style="cursor: pointer"/>
<else/>
<img src="{:cmf_get_image_preview_url($post.more.thumbnail)}"
id="thumbnail-preview"
width="135" style="cursor: pointer"/>
</if>
</a>
<input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
</div>
<div style="margin-top:30px;">
<span class="form-required">图片参考尺寸:386*303</span>
</div>
</td>
</tr>
<tr>
<th>发布时间</th>
</tr>
<tr>
<td>
<input class="form-control js-bootstrap-datetime" type="text" name="post[published_time]"
value="{:date('Y-m-d H:i',$post['published_time'])}">
</td>
</tr>
</table>
<hook name="portal_admin_article_edit_view_right_sidebar"/>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
</div>
</div>
</form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
//编辑器路径定义
var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
$(function () {
editorcontent = new baidu.editor.ui.Editor();
editorcontent.render('content');
try {
editorcontent.sync();
} catch (err) {
}
//首页缩略图
$('.btn-cancel-index_thumbnail').click(function () {
$('#index_thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
$('#index_thumbnail').val('');
});
//列表页缩略图
$('.btn-cancel-thumbnail').click(function () {
$('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
$('#thumbnail').val('');
});
$('#more-template-select').val("{$post.more.template|default=''}");
});
function doSelectCategory() {
var selectedCategoriesId = $('#js-categories-id-input').val();
openIframeLayer("{:url('AdminCategory/select')}?ids=" + selectedCategoriesId, '请选择分类', {
area: ['700px', '400px'],
btn: ['确定', '取消'],
yes: function (index, layero) {
//do something
var iframeWin = window[layero.find('iframe')[0]['name']];
var selectedCategories = iframeWin.confirm();
if (selectedCategories.selectedCategoriesId.length == 0) {
layer.msg('请选择分类');
return;
}
$('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(','));
$('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' '));
//console.log(layer.getFrameIndex(index));
layer.close(index); //如果设定了yes回调,需进行手工关闭
}
});
}
</script>
<script>
var publishYesUrl = "{:url('AdminScoutOversea/publish',array('yes'=>1))}";
var publishNoUrl = "{:url('AdminScoutOversea/publish',array('no'=>1))}";
var topYesUrl = "{:url('AdminScoutOversea/top',array('yes'=>1))}";
var topNoUrl = "{:url('AdminScoutOversea/top',array('no'=>1))}";
var recommendYesUrl = "{:url('AdminScoutOversea/recommend',array('yes'=>1))}";
var recommendNoUrl = "{:url('AdminScoutOversea/recommend',array('no'=>1))}";
var postId = $('#post-id').val();
//发布操作
$("#post-status-checkbox").change(function () {
if ($('#post-status-checkbox').is(':checked')) {
//发布
$.ajax({
url: publishYesUrl, type: "post", dataType: "json", data: {ids: postId}, success: function (data) {
if (data.code != 1) {
$('#post-status-checkbox').removeAttr("checked");
$('#post-status-error').html(data.msg).show();
} else {
$('#post-status-error').hide();
}
}
});
} else {
//取消发布
$.ajax({
url: publishNoUrl, type: "post", dataType: "json", data: {ids: postId}, success: function (data) {
if (data.code != 1) {
$('#post-status-checkbox').prop("checked", 'true');
$('#post-status-error').html(data.msg).show();
} else {
$('#post-status-error').hide();
}
}
});
}
});
//置顶操作
$("#is-top-checkbox").change(function () {
if ($('#is-top-checkbox').is(':checked')) {
//置顶
$.ajax({
url: topYesUrl, type: "post", dataType: "json", data: {ids: postId}, success: function (data) {
if (data.code != 1) {
$('#is-top-checkbox').removeAttr("checked");
$('#is-top-error').html(data.msg).show();
} else {
$('#is-top-error').hide();
}
}
});
} else {
//取消置顶
$.ajax({
url: topNoUrl, type: "post", dataType: "json", data: {ids: postId}, success: function (data) {
if (data.code != 1) {
$('#is-top-checkbox').prop("checked", 'true');
$('#is-top-error').html(data.msg).show();
} else {
$('#is-top-error').hide();
}
}
});
}
});
//推荐操作
$("#recommended-checkbox").change(function () {
if ($('#recommended-checkbox').is(':checked')) {
//推荐
$.ajax({
url: recommendYesUrl, type: "post", dataType: "json", data: {ids: postId}, success: function (data) {
if (data.code != 1) {
$('#recommended-checkbox').removeAttr("checked");
$('#recommended-error').html(data.msg).show();
} else {
$('#recommended-error').hide();
}
}
});
} else {
//取消推荐
$.ajax({
url: recommendNoUrl, type: "post", dataType: "json", data: {ids: postId}, success: function (data) {
if (data.code != 1) {
$('#recommended-checkbox').prop("checked", 'true');
$('#recommended-error').html(data.msg).show();
} else {
$('#recommended-error').hide();
}
}
});
}
});
</script>
</body>
</html>
... ...
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">所有文章</a></li>
<li><a href="{:url('AdminScoutOversea/add')}">添加文章</a></li>
</ul>
<form class="well form-inline margin-top-20" method="post" action="{:url('AdminScoutOversea/index')}">
<!--分类:-->
<!--<select class="form-control" name="category" style="width: 140px;">-->
<!--<option value='0'>全部</option>-->
<!--{$category_tree|default=''}-->
<!--</select> &nbsp;&nbsp;-->
标题:
<input type="text" class="form-control" name="post_title"
value="{$post_title|default=''}"
style="width: 140px;">&nbsp;&nbsp;
时间:
<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off">
<input type="submit" class="btn btn-primary" id="search" value="搜索"/>
<a class="btn btn-danger" href="{:url('AdminScoutOversea/index')}">清空</a>
</form>
<form class="js-ajax-form" action="" method="post">
<div class="table-actions">
</div>
<table class="table table-hover table-bordered table-list">
<thead>
<tr>
<th width="15">
<label>
<input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
</label>
</th>
<!--<notempty name="category">-->
<!--<th width="50">{:lang('SORT')}</th>-->
<!--</notempty>-->
<th width="50">ID</th>
<th width="300">标题</th>
<th width="100">缩略图</th>
<th width="100">出发地点</th>
<th width="100">包含项目</th>
<th width="100">价格</th>
<th width="65">点击量</th>
<th width="130">创建时间</th>
<th width="130">更新时间</th>
<th width="70">权重</th>
<th width="100">操作</th>
</tr>
</thead>
<foreach name="articles" item="vo">
<tr>
<td>
<input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
value="{$vo.id}" title="ID:{$vo.id}">
</td>
<!--<notempty name="category">-->
<!--<td>-->
<!--<input name="list_orders[{$vo.post_category_id}]" class="input-order" type="text"-->
<!--value="{$vo.list_order}">-->
<!--</td>-->
<!--</notempty>-->
<td><b>{$vo.id}</b></td>
<td>
<notempty name="category">
{$vo.post_title}
<else/>
{$vo.post_title}
</notempty>
</td>
<td>
<notempty name="vo.more.thumbnail">
<a href="javascript:parent.imagePreviewDialog('{:cmf_get_image_preview_url($vo.more.thumbnail)}');">
<i class="fa fa-photo fa-fw"></i>
</a>
<else/>
<i class="fa fa-close fa-fw"></i>
</notempty>
</td>
<td>{$vo.place}</td>
<td>{$vo.project}</td>
<td>¥{$vo.price}</td>
<td>{$vo.post_hits|default=0}</td>
<td>
<notempty name="vo.create_time">
{:date('Y-m-d H:i',$vo['create_time'])}
</notempty>
</td>
<td>
<notempty name="vo.update_time">
{:date('Y-m-d H:i',$vo['update_time'])}
</notempty>
</td>
<td>
<b>{$vo.weigh}</b>
</td>
<td>
<a class="btn btn-xs btn-primary" href="{:url('AdminScoutOversea/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a>
<a class="btn btn-xs btn-danger js-ajax-delete"
href="{:url('AdminScoutOversea/delete',array('id'=>$vo['id']))}">{:lang('DELETE')}</a>
</td>
</tr>
</foreach>
</table>
<ul class="pagination">{$page|default=''}</ul>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
function reloadPage(win) {
win.location.reload();
}
$(function () {
setCookie("refersh_time", 0);
Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
//批量复制
$('.js-articles-copy').click(function (e) {
var ids = [];
$("input[name='ids[]']").each(function () {
if ($(this).is(':checked')) {
ids.push($(this).val());
}
});
if (ids.length == 0) {
art.dialog.through({
id: 'error',
icon: 'error',
content: '您没有勾选信息,无法进行操作!',
cancelVal: '关闭',
cancel: true
});
return false;
}
ids = ids.join(',');
art.dialog.open("__ROOT__/index.php?g=portal&m=AdminScoutOversea&a=copy&ids=" + ids, {
title: "批量复制",
width: "300px"
});
});
//批量移动
$('.js-articles-move').click(function (e) {
var ids = [];
$("input[name='ids[]']").each(function () {
if ($(this).is(':checked')) {
ids.push($(this).val());
}
});
if (ids.length == 0) {
art.dialog.through({
id: 'error',
icon: 'error',
content: '您没有勾选信息,无法进行操作!',
cancelVal: '关闭',
cancel: true
});
return false;
}
ids = ids.join(',');
art.dialog.open("__ROOT__/index.php?g=portal&m=AdminScoutOversea&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {
title: "批量移动",
width: "300px"
});
});
});
$('#search').click(function(){
var array = ['1','2','3','4','5','6'];
var city_id = $('.check_city option:selected').val();
var index = $.inArray(city_id,array); //结果:index=1
if (index >= 0) {
alert('请选择二级分类!');
return false;
}
});
});
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -187,6 +187,49 @@
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
</div>
<!--海外医疗-->
<div class="Product" id="overseas" style="margin-top:106px;">
<div class="Spot_title clearfix">
<div class="Spot_icon fl">
<img src="__TMPL__/public/assets/starImg/aicon_74.png" alt="">
</div>
<div class="Spot_name fl">
<div class="Spot_name_left fl">
海外
</div>
<div class="Spot_name_right fl">
医疗
</div>
</div>
<div class="Spot_English_name fl">
<p>Overseas Medical Care</p>
</div>
</div>
<div class="Product_main">
<div class="swiper-container">
<div class="swiper-wrapper">
<volist name="res_hwyl" id="vo">
<div class="swiper-slide">
<div class="Product_item">
<a href="/portal/scout/getTravelDetail?id={$vo.id}">
<div class="Product_item_img">
<img src="{:cmf_get_image_url($vo.thumbnail)}" alt="">
</div>
<div class="Product_item_Route">
{$vo.post_title}
</div>
</a>
</div>
</div>
</volist>
</div>
</div>
</div>
<div class="swiper-button-next swiper-button-white"></div>
<div class="swiper-button-prev swiper-button-white"></div>
</div>
</div>
</main>
<include file="public@footer"/>
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="__TMPL__/public/assets/css/bootstrap4.0.css">
<link rel="stylesheet" href="__TMPL__/public/assets/css/happy.css" />
<title>搜索列表</title>
</head>
<body>
<include file="public@header"/>
<div class="index_searchBox">
<!--顶部标题-->
<div class="in_seaTit">
<div class="in_seaTitImg">
<img src="__TMPL__/public/assets/images/bicon_45.png" alt="" />
</div>
<h1 class="in_seaTitTxt1">{$keyword}</h1>
<p class="in_seaTitTxt2">共搜到 {$count} 个结果</p>
</div>
<!--内容-->
<div class="in_seaCon">
<ul>
<volist name="res" id="vo">
<li>
<h1 class="in_seaConTxt1 one-txt-cut">{$vo.post_title}</h1>
<p class="in_seaConTxt2 txt-cut">
{$vo.post_excerpt}
</p>
<div class="in_seaConList">
<span>{$vo.category_name}</span>
<notempty name="vo.city_name">
<span>{$vo.city_name}</span>
</notempty>
<span>{$vo.post_favorites}</span>
</div>
</li>
</volist>
</ul>
</div>
<!--分页-->
<div class="page">
<!--分页-->
<div class="pagination">
{$page|default=''}
</div>
</div>
</div>
<include file="public@footer"/>
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="__TMPL__/public/assets/js/jquery-2.1.0.js"></script>
<script src="__TMPL__/public/assets/js/public.js"></script>
</body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="__TMPL__/public/assets/css/swiper-3.4.2.min.css" />
<link rel="stylesheet" href="__TMPL__/public/assets/css/base.css" />
<link rel="stylesheet" href="__TMPL__/public/assets/css/index.css" />
<title>星探推荐详情</title>
</head>
<body>
<include file="public@header"/>
<div class="index_fifteenth">
<div class="index_fifteenth_bg">
<div class="index_fifteenth_contant">
<div class="index_fifteenth_top">
<img src="__TMPL__/public/assets/images/cicon_58@2x.png" alt="" />
</div>
<div class="index_fifteenth_one">
{$res.post_title}
</div>
<div class="index_fifteenth_three">
<div class="index_fifteenth_three_left">
商品售价:
</div>
<div class="index_fifteenth_three_right">
¥{$res.price}
</div>
</div>
<div class="index_fifteenth_four">
{$res.post_excerpt}
</div>
<div class="index_fifteenth_five">
<a href="{$res.pay_url}">
立即前往购买
</a>
</div>
</div>
</div>
</div>
<include file="public@footer"/>
</body>
<script src="__TMPL__/public/assets/js/base.js"></script>
<script src="__TMPL__/public/assets/js/jquery-2.1.0.js"></script>
<script src="__TMPL__/public/assets/js/swiper.min.js"></script>
<script src="__TMPL__/public/assets/js/public.js"></script>
<script></script>
</html>
\ No newline at end of file
... ...
... ... @@ -183,6 +183,42 @@
</ul>
</div>
</div>
<!--海外医疗-->
<div class="first_scene">
<div class="first_scene_contant" id="oversea">
<div class="first_scene_img">
<div class="first_scene_top_img">
<img src="__TMPL__/public/assets/images/cicon_59@2x.png" alt="" />
</div>
<div class="first_scene_top_ch">海外<span>医疗</span></div>
<div class="first_scene_top_en">
Overseas Medical Care
</div>
</div>
</div>
</div>
<div class="gallery">
<!-- 图片 -->
<div class="star_gall_img swiper-container1">
<!-- 轮播图 -->
<ul class="swiper-wrapper">
<volist name="res_hwyl" id="vo">
<li class="swiper-slide">
<div class="thirteenth_log">
<a href="/portal/scout/getTravelDetail?id={$vo.id}">
<div class="thirteenth_log_top">
<img src="{:cmf_get_image_url($vo.thumbnail)}" alt="" />
</div>
<div class="thirteenth_log_bottom">
{$vo.post_title}
</div>
</a>
</div>
</li>
</volist>
</ul>
</div>
</div>
<include file="public@footer"/>
</body>
<script src="__TMPL__/public/assets/js/jquery-2.1.0.js"></script>
... ...
... ... @@ -109,6 +109,11 @@ $(function() {
window.location.href = '/portal/login/myCollection';
});
//跳转链接
$('.nav_downLi a').click(function(){
$('.nav_down').css('display','none');
});
//评论
$('#comment').click(function(){
var content = $('#comment_content').val();
... ...
... ... @@ -9,9 +9,9 @@
</div>
<!-- input框 -->
<div class="nav_search">
<form action="">
<form action="/portal/login/searchList" method="GET">
<i></i>
<input type="text" placeholder="请输入搜索内容">
<input type="text" placeholder="请输入搜索内容" name="keyword" value="{$keyword}" id="keywords">
</form>
</div>
<div class="navImg3">
... ...