Commit 54f5c8c1 by LiuJunYi

Initial commit

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

File added
.ftpconfig
.ftpconfig.cson
.ftpignore
id_rsa
.DS_Store
.git
.idea
composer.lock
*.log
sftp-config.json
.vscode
logs
runtime/*
*.yml
/vendor
/thinkphp
\ No newline at end of file
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Maveler管理系统
===============
## 部署
1. php版本 >= 7.0
2. 确保`runtime`、`logs`的权限。
```
chmod -R 777 runtime logs
```
## 数据库
```
根目录下的.sql文件: maveler.sql
```
数据库`CHARSET`编码设置为`utf8mb4`,`COLLATE`设置为`utf8mb4_unicode_ci`。
##### JSSDK分享配置
1. 先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”,添加群空间的域名。
2. 确保`public/qunstatic/jssdk/access_token.json`、`public/qunstatic/jssdk/jsapi_ticket.json`的读写权限。
```php
chmod 777 public/qunstatic/jssdk/access_token.json public/qunstatic/jssdk/jsapi_ticket.json
```
##### 登录验证码显示
安装`think-captcha`:
```
composer require topthink/think-captcha
```
1. 若出现redeclear check_captcha() 的错误,需要把 public/index.php 中的 require __DIR__ . '/../vendor/autoload.php'; 注释掉!
```
// require __DIR__ . '/../vendor/autoload.php';
```
2. 在 login.html 中添加如下代码
```
<div id="captcha_div">
<input type="captcha" class="form-control" name="captcha" placeholder="验证码">
{:captcha_img()}
</div>
```
3. 在 admin/Login/login 控制器中添加如下代码
```
$captcha = input("post.captcha");
if(!captcha_check($captcha)){
//验证失败
$this->error('登录失败,验证码不正确!');
};
```
deny from all
\ No newline at end of file
<?php
namespace app\admin\behavior;
use think\Controller;
/**
* 检测用户
*/
class UserCheck
{
//类里面引入jump;类
use \traits\controller\Jump;
// 绑定到CheckAuth标签,可以用于检测Session以用来判断用户是否登录
public function run(&$params){
// 网站session会话判断
if (!session('?uid')) {
return $this->error('请登录!', 'Login/login');
}
}
}
\ No newline at end of file
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
$config = [
];
return $config;
<?php
namespace app\admin\controller;
use app\common\model\Admin as AmdinModel;
use app\admin\controller\AuthBase;
class Admin extends AuthBase
{
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
$keyword = trim(input('get.word'));
$map = array();
if ($keyword) {
$map['name'] = ['like', "%".$keyword."%"];
}
$admins = AmdinModel::where($map)
->order('id', 'desc')->paginate(20, false, [
'query' => [
'k' => $keyword
]
]);
$this->assign('admins', $admins);
return $this->fetch();
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
$admin = AmdinModel::get(trim($id));
if ($admin) {
$data['user'] = $admin;
return json_encode(['error'=>0, 'msg'=>'获取成功', 'data'=>$data]);
} else {
return json_encode(['error'=>1, 'msg'=>'获取失败']);
}
}
/**
* 更新
*
* @param int $id
* @return \think\Response
*/
public function update($id)
{
if (request()->isPost()) {
$admin = AmdinModel::get(trim($id));
if ($admin) {
$name = input("post.name");
$password = input("post.password");
$update = false;
if ($name != $admin->name) {
$admin->name = $name;
$update = true;
}
if ($password && md5($password)!=$admin->password) {
$admin->password = md5($password);
$update = true;
}
if ($update && $admin->save()) {
// 更改当前管理员的session名称
if (session("uid")==$admin->id) {
session('username', $admin->name);
}
return json_encode(['error'=>0, 'msg'=>'更新成功']);
}else{
return json_encode(['error'=>1, 'msg'=>'没有任何修改']);
}
}else{
return json_encode(['error'=>1, 'msg'=>'未找到对象']);
}
}else{
return json_encode(['error'=>1, 'msg'=>'请求方法错误']);
}
}
}
<?php
namespace app\admin\controller;
use think\Controller;
use think\Request;
use think\Hook;
use app\admin\controller\Base;
/**
* 基础控制器
*/
class AuthBase extends Base
{
public function _initialize()
{
parent::_initialize();
Hook::listen('CheckAuth', $params);
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use app\admin\controller\AuthBase;
use app\common\model\Admin as AdminModel;
use app\admin\controller\Upload;
class Banner extends AuthBase{
public function _initialize(){
parent::_initialize();
}
public function index(){
$banner_model = model('banner');
$banner_list = $banner_model->order('created_at','desc')->select();
$this->assign('banner_list',$banner_list);
return $this -> fetch();
}
public function create(){
if(request()->isPost()){
$data = input('post.');
$banner_model = model('banner');
$upload = new Upload();
$result = $upload->sava(input('file.image'));
if(!$result['error']){
$image = $result['result']['url'];
$data['image'] = $image;
}
$res = $banner_model->data($data)->save();
if($res){
$this->success('添加成功',url('admin/banner/index'),'',1);
}else{
$this->error('添加失败','','',1);
}
}else{
return $this->fetch();
}
}
public function update($id){
$banner_model = model('banner');
$resource_model = model('resource');
if(request()->isPost()){
$data = input('post.');
if(input('file.image')){
$banner_info = ($banner_model->find('id'));
$old_image = $banner_info['image'];
$upload = new Upload();
$result = $upload->sava(input('file.image'));
if(!$result['error']){
$resource_model -> where('address',$old_image)->delete();
$image = $result['result']['url'];
$data['image'] = $image;
}
}
$res = $banner_model->save($data,['id'=>$id]);
if($res){
$this->success('修改成功',url('admin/banner/index'),'',1);
}else{
$this->error('修改失败','','',1);
}
}else{
$banner_info = $banner_model->find($id);
$this->assign('banner_info',$banner_info);
return $this->fetch();
}
}
public function delete(){
$id = input('post.id');
$res = model('banner')->destroy($id);
$banner_info = model('banner')->find($id);
$old_image = $banner_info['image'];
model('resource') -> where('address',$old_image)->delete();
if($res){
$this->success('删除成功','','',1);
}else{
$this->error('删除失败','','',1);
}
}
}
<?php
namespace app\admin\controller;
use think\Controller;
use think\Request;
/**
* 基础控制器
*/
class Base extends Controller
{
public function _initialize()
{
define('CONTROLLER_NAME',Request::instance()->controller());
define('MODULE_NAME',Request::instance()->module());
define('ACTION_NAME',Request::instance()->action());
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use think\Db;
use app\admin\controller\AuthBase;
use app\common\model\Post as PostModel;
use app\common\model\Admin as AdminModel;
use app\admin\controller\Upload;
class Guide extends AuthBase
{
public function index()
{
$title = input('title');
$map = array();
// 模糊查询title
if ($title) {
$map['title'] = ['like', "%".$title."%"];
}
$posts = PostModel::where($map)->order('id desc')->paginate(10);
$this->assign('articles', $posts);
return view("index");
}
public function create()
{
$tag_model = model("tags");
$tag_list = $tag_model -> order('sort','asc') -> select();
$this -> assign('tag_list', $tag_list);
if (request()->isPost()) {
$type = input("post.type");
$data = array(
'title' => input("post.title"),
'tags' => input("post.tags"),
'poster' => input('file.poster')
);
if($type == 1){
$data['content'] =input("post.content");
}else{
$data['content'] =input("post.href");
}
$validate = validate('Post');
if (!$validate->scene('create')->check($data)) {
$msg = $validate->getError();
$this->assign('msg', $msg);
return view();
}
// 上传封面到七牛云
$upload = new Upload();
$result = $upload -> sava(input('file.poster'));
if($result['error']){
$this->assign('msg', $result['error']);
return view();
}
$article = new PostModel([
'admin_id' => intval(session('uid')),
'poster' => $result['result']['url'],
'tags' => $data['tags'],
'title' => $data['title'],
'type' => $type,
'content' => htmlspecialchars($data['content'])
]);
if ($article->save()) {
$this->redirect(url('@admin/Guide/index'));
} else {
return view();
}
} else {
return view();
}
}
/**
* 修改文章
*
* @return \think\Response
*/
public function update($id)
{
$tag_model = model("tags");
$tag_list = $tag_model -> order('sort','asc') -> select();
$this -> assign('tag_list', $tag_list);
$article = PostModel::get($id);
$tags =$article['tags'];
$this->assign('tags',$tags);
if($tags!=''){
$tag_arr = explode(',',$tags);
}else{
$tag_arr = [];
}
$this->assign('tag_arr',$tag_arr);
if (request()->isPost()) {
$type = input("post.type");
$data = array(
'title' => input("post.title"),
'tags' => input("post.tags")
);
if($type == 1){
$data['content'] =input("post.content");
}else{
$data['content'] =input("post.href");
}
$validate = validate('Post');
if (!$validate->scene('update')->check($data)) {
$msg = $validate->getError();
$this->assign('msg', $msg);
return view();
}
$condition = [
'tags' => $data['tags'],
'title' => $data['title'],
'type' => $type,
'content' => htmlspecialchars($data['content'])
];
if(input('file.poster')){
// 上传封面到七牛云
$upload = new Upload();
$result = $upload -> sava(input('file.poster'));
if($result['error']){
$this->assign('msg', $result['error']);
return view();
}
// 将资源目录该图的引用设为0
$resource_model = model('Resource');
$res = $resource_model->where('address',input('post.old_poster'))->setDec("use_num");
$condition['poster'] = $result['result']['url'];
}
$article = new PostModel($condition);
if ($article->save()) {
$this->redirect(url('@admin/Guide/index'));
} else {
return view();
}
}else{
$this->assign('article', $article);
return view();
}
}
/**
* 删除文章
*
* @return \think\Response
*/
public function delete()
{
$result["error"] = 0;
$result["msg"] = '删除成功';
if( request()->isPost() ) {
$id = input("post.id");
$article = PostModel::get($id);
if( $article ) {
if( $article->delete() ){
}else{
$result["error"] = 1;
$result["msg"] = '删除失败!';
}
}else{
$result["error"] = 1;
$result["msg"] = '删除对象不存在';
}
}else{
$result["error"] = 1;
$result["msg"] = '不支持的请求方法';
}
echo json_encode($result);
}
}
<?php
namespace app\admin\controller;
use app\admin\controller\AuthBase;
use app\common\model\Visitor as VisitorModel;
use app\common\model\HomeView as HomeViewModel;
use app\common\model\MiniappView as MiniappViewModel;
use app\common\model\ExpbtnClick as ExpbtnClickModel;
class Index extends AuthBase
{
public function _initialize()
{
parent::_initialize();
}
public function index(){
$user_model = model('user');
$order_model = model('order');
$comment_model = model('comment');
$refund_model = model('refund');
// 统计用户总数
$user_num = $user_model->count();
$this->assign('user_num',$user_num);
// 统计今日新增用户数
$user_num_today = $user_model->where('created_at','>',date('Y-m-d',time()).' 00:00:00')->count();
$this->assign('user_num_today',$user_num_today);
// 统计订单总数
$order_num = $order_model->count();
$this->assign('order_num',$order_num);
// 统计今日订单总数
$order_num_today = $order_model->where('created_at','>',date('Y-m-d',time()).' 00:00:00')->count();
$this->assign('order_num_today',$order_num_today);
// 统计待审核退款
$wait_num_r = $refund_model->where('status',1)->count();
$this->assign('wait_num_r',$wait_num_r);
// 统计待审核评论
$wait_num_c = $comment_model->where('status',1)->count();
$this->assign('wait_num_c',$wait_num_c);
return view("index");
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use app\admin\controller\AuthBase;
use app\common\model\Log as LogModel;
use app\common\model\Admin as AdminModel;
class Log extends AuthBase
{
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
$level = input('level');
$category = input('category');
$admin = input('admin');
$map = [];
if ($admin) {
$uids = AdminModel::where('username','like','%'.$admin.'%')
->field('id')
->select();
if ($uids) {
$in_uids = [];
foreach ($uids as $key => $value) {
$in_uids = $value['id'];
}
$map['user_id'] = ['in', $in_uids];
}
}
if ($level != null) {
$map['level'] = $level;
}
if ($category != null) {
$map['category'] = ['like', "%$category%"];
}
$items = LogModel::where($map)
->with('admin')
->order('id', 'desc')
->paginate(15, false)
->each(function($item, $key){
// 拼接字符串
$item['visitor'] = 'IP:'.$item['ip'].'<br/>'.'OS:'.$item['os'].'<br/>'.'Browser:'.$item['browser'];
});
$this->assign('items', $items);
return view();
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use app\admin\controller\Base;
use app\common\model\Admin as AmdinModel;
class Login extends Base
{
/**
* 用户登录
*/
public function login()
{
// 已登录
$uid = session('uid');
if (session('uid')) {
$this->redirect(url('@admin/Index/index/tab/index'));
}
// 判断提交方式
if (request()->isPost()) {
$username = input("post.username");
$password = input("post.password");
$captcha = input("post.captcha");
if(!captcha_check($captcha)){
//验证失败
$this->error('登录失败,验证码不正确!');
};
$admin = AmdinModel::get(['username' => $username]);
if ($admin && $admin->password == md5($password)) {
session('uid', $admin['id']); // 当前用户id
session('username', $admin['username']); // 当前用户昵称
$admin->is_login = 1;
$admin->save();
$this->success('登录成功,正跳转至系统首页...', url('@admin/Index/index/tab/index'));
}else{
$this->error('登录失败,用户名或密码不正确!');
}
}else{
return view("admin/login");
}
}
/**
* 用户注销
*/
public function logout()
{
$uid = session('uid');
if ($uid && AmdinModel::get(intval($uid))) {
$admin = AmdinModel::get(intval($uid));
$admin->is_login = 0;
$admin->save();
}
// 清除所有session
session(null);
$this->redirect(url('@admin/Login/login'));
}
}
<?php
namespace app\admin\controller;
use app\admin\controller\AuthBase;
class Order extends AuthBase
{
protected $order_model;
public function _initialize()
{
parent::_initialize();
$this->order_model = model('Order');
}
// 订单列表
public function index(){
$status = input('get.status','-1');
$condition = [];
if($status!='-1'){
$condition['status']=$status;
}
$order_list = $this->order_model->where($condition)->order('created_at desc')->paginate(10,['query'=>['status'=>$status]]);
$this->assign("order_list",$order_list);
$this->assign("status",$status);
return $this->fetch();
}
// 退款审核
public function refund(){
$status = input('get.status','-1');
$condition = [];
if($status!='-1'){
$condition['status']=$status;
}
$refund_list = model('Refund')->where($condition)->order('created_at desc')->paginate(10,['query'=>['status'=>$status]]);
$this->assign('status',$status);
$this->assign('refund_list',$refund_list);
return $this->fetch();
}
// 评论审核
public function comment(){
$status = input('get.status','-1');
$condition = [];
if($status!='-1'){
$condition['status']=$status;
}
$comment_list = model('comment')->where($condition)->order('created_at desc')->paginate(10,['query'=>['status'=>$status]]);
$this->assign('status',$status);
$this->assign('comment_list',$comment_list);
return $this->fetch();
}
public function commentStatus($status,$id){
$res = model('comment')->save(['status'=>$status],['id' => $id]);
$status_str = array(
'1'=>'已退回重新审核该评论',
'2'=>'已审核通过该评论',
'3'=>'已设置该评论审核不通过'
);
if($res){
$this->success($status_str[$status],null,'',2);
}else{
$this->error('修改失败,本次审核无效',null,'',2);
}
}
}
<?php
namespace app\admin\controller;
use app\admin\controller\AuthBase;
class Project extends AuthBase
{
public function _initialize()
{
parent::_initialize();
}
public function index(){
$order_list = model('order')->order('id desc')->paginate(10);
$this->assign("order_list",$order_list);
$this->fetch();
}
}
<?php
namespace app\admin\controller;
use think\Db;
use app\admin\controller\AuthBase;
use app\common\model\Post as PostModel;
use app\common\model\Admin as AdminModel;
use app\admin\controller\Upload;
class Post extends AuthBase
{
public function index()
{
$title = input('title');
$map = array();
// 模糊查询title
if ($title) {
$map['title'] = ['like', "%".$title."%"];
}
$posts = PostModel::where($map)->order('id desc')->paginate(10);
$this->assign('articles', $posts);
return view("index");
}
public function create()
{
$tag_model = model("tags");
$tag_list = $tag_model -> order('sort','asc') -> select();
$this -> assign('tag_list', $tag_list);
if (request()->isPost()) {
$type = input("post.type");
$data = array(
'title' => input("post.title"),
'tags' => input("post.tags"),
'poster' => input('file.poster')
);
if($type == 1){
$data['content'] =input("post.content");
}else{
$data['content'] =input("post.href");
}
$validate = validate('Post');
if (!$validate->scene('create')->check($data)) {
$msg = $validate->getError();
$this->assign('msg', $msg);
return view();
}
// 上传封面到七牛云
$upload = new Upload();
$result = $upload -> sava(input('file.poster'));
if($result['error']){
$this->assign('msg', $result['error']);
return view();
}
$article = new PostModel([
'admin_id' => intval(session('uid')),
'poster' => $result['result']['url'],
'tags' => $data['tags'],
'title' => $data['title'],
'type' => $type,
'content' => htmlspecialchars($data['content'])
]);
if ($article->save()) {
$this->redirect(url('@admin/Post/index'));
} else {
return view();
}
} else {
return view();
}
}
/**
* 修改文章
*
* @return \think\Response
*/
public function update($id)
{
$article = PostModel::get($id);
if (request()->isPost()) {
if (!$article) {
$this->error('文章不存在!');
echo "404";
}
$data = input("post.");
if (!trim(input("post.title")) || !trim(input("post.content")) ) {
$msg = "标题和内容不为空!";
$this->assign('msg', $msg);
$this->assign('article', $article);
return view();
}
$article->title = $data['title'];
$article->content = htmlspecialchars($data['content']);
$article->admin_id = intval(session('uid'));
if ($article->save()) {
$this->redirect(url('@admin/Post/index'));
} else {
$this->assign('article', $article);
return view();
}
}else{
$this->assign('article', $article);
return view();
}
}
/**
* 删除文章
*
* @return \think\Response
*/
public function delete()
{
$result["error"] = 0;
$result["msg"] = '删除成功';
if( request()->isPost() ) {
$id = input("post.id");
$article = PostModel::get($id);
if( $article ) {
if( $article->delete() ){
}else{
$result["error"] = 1;
$result["msg"] = '删除失败!';
}
}else{
$result["error"] = 1;
$result["msg"] = '删除对象不存在';
}
}else{
$result["error"] = 1;
$result["msg"] = '不支持的请求方法';
}
echo json_encode($result);
}
}
<?php
namespace app\admin\controller;
use app\admin\controller\AuthBase;
use app\common\utils\HttpHelper;
use think\Controller;
use app\common\model\User as UserModel;
use think\Loader;
Loader::import('requests/library/Requests', EXTEND_PATH);
require_once EXTEND_PATH.'phpseclib/Crypt/RSA.php';
class Test extends AuthBase
{
public function _initialize()
{
parent::_initialize();
}
// 获取AccessToken:http://ysj.imgondar.com/admin/Test/access_token
public function access_token(){
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".config('wechat.appid')."&secret=".config('wechat.appsecret');
$params = [
"grant_type" => "client_credential",
"appid" => config('wechat.appid'),
"secret" => config('wechat.appsecret'),
];
$request = \Requests::get($url);
echo $request->body; exit;
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use think\Controller;
class Ueditor extends Controller{
private $uploadfolder='/upload/'; //上传地址
private $scrawlfolder='/upload/_scrawl/'; //涂鸦保存地址
private $catchfolder='/upload/_catch/'; //远程抓取地址
private $configpath='./static/ueditor/php/config.json';
public function index(){
$this->type=input('edit_type','');
//header('Access-Control-Allow-Origin: http://www.baidu.com'); //设置http://www.baidu.com允许跨域访问
//header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With'); //设置允许的跨域header
date_default_timezone_set("Asia/shanghai");
error_reporting(E_ERROR);
header("Content-Type: text/html; charset=utf-8");
$CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents($this->configpath)), true);
$this->config=$CONFIG;
$action = input('action');
switch ($action) {
case 'config':
$result = json_encode($CONFIG);
break;
/* 上传图片 */
case 'uploadimage':
$result = $this->_upload();
break;
/* 上传涂鸦 */
case 'uploadscrawl':
$result = $this->_upload_scrawl();
break;
/* 上传视频 */
case 'uploadvideo':
$result = $this->_upload(array('maxSize' => 1073741824,/*1G*/'exts'=>array('mp4', 'avi', 'wmv','rm','rmvb','mkv')));
break;
/* 上传文件 */
case 'uploadfile':
$result = $this->_upload(array('exts'=>array('jpg', 'gif', 'png', 'jpeg','txt','pdf','doc','docx','xls','xlsx','zip','rar','ppt','pptx',)));
break;
/* 列出图片 */
case 'listimage':
/* 列出文件 */
case 'listfile':
$result = $this->_list($action);
break;
/* 抓取远程文件 */
case 'catchimage':
$result = $this->_upload_catch();
break;
default:
$result = json_encode(array('state'=> '请求地址出错'));
break;
}
/* 输出结果 */
if (isset($_GET["callback"]) && false ) {
if (preg_match("/^[\w_]+$/", $_GET["callback"])) {
echo htmlspecialchars($_GET["callback"]) . '(' . $result . ')';
} else {
echo json_encode(array(
'state'=> 'callback参数不合法'
));
}
} else {
exit($result) ;
}
}
//上传
private function _upload($config=array())
{
$title = '';
$url='';
if(!empty($config)){
$this->config=array_merge($this->config,$config);;
}
$file = request()->file('upfile');
if($file){
$validate=array(
'size'=>10240000 ,// 设置附件上传大小
'ext'=>array('jpg', 'gif', 'png', 'jpeg'),
);
$info = $file->validate($validate)->move(ROOT_PATH . 'public/' . $this->uploadfolder);
if($info) {
$img_url=$this->uploadfolder.$info->getSaveName();
// 图片压缩
// $image = \think\Image::open('./'.$img_url);
// $image->thumb(700,1400)->save('./'.$img_url);
$title =$info->getFilename();
$state = 'SUCCESS';
$url= $img_url;
}else{
$state = $file->getError();
}
}else{
$state = '未接收到文件';
}
$response=array(
"state" => $state,
"url" => $url,
"title" => $title,
"original" =>$title,
);
return json_encode($response);
}
private function _upload_scrawl()
{
$data = input('post.' . $this->config ['scrawlFieldName']);
$url='';
$title = '';
$oriName = '';
if (empty ($data)) {
$state= 'Scrawl Data Empty!';
} else {
$savepath = $this->save_image('png', base64_decode($data), $this->scrawlfolder);
if ($savepath) {
$state = 'SUCCESS';
$url = $savepath;
} else {
$state = 'Save scrawl file error!';
}
}
$response=array(
"state" => $state,
"url" => $url,
"title" => $title,
"original" =>$oriName ,
);
return json_encode($response);
}
//抓取远程文件
private function _upload_catch()
{
set_time_limit(0);
$sret = array(
'state' => '',
'list' => null
);
$savelist = array();
$flist = input('post.' . $this->config ['catcherFieldName'].'/a');
if (empty ($flist)) {
$sret ['state'] = 'ERROR';
} else {
$sret ['state'] = 'SUCCESS';
foreach ($flist as $f) {
if (preg_match('/^(http|ftp|https):\\/\\//i', $f)) {
$ext = strtolower(pathinfo($f, PATHINFO_EXTENSION));
if (in_array('.' . $ext, $this->config ['catcherAllowFiles'])) {
if ($img = file_get_contents($f)) {
$savepath = $this->save_image($ext, $img, $this->catchfolder);
if ($savepath) {
$savelist [] = array(
'state' => 'SUCCESS',
'url' => '/'.$savepath,
'size' => strlen($img),
'title' => '',
'original' => '',
'source' => htmlspecialchars($f)
);
} else {
$savelist [] = array(
'state' => 'Save remote file error!',
'url' => '',
'size' => '',
'title' => '',
'original' => '',
'source' => htmlspecialchars($f),
);
}
} else {
$savelist [] = array(
'state' => 'Get remote file error',
'url' => '',
'size' => '',
'title' => '',
'original' => '',
'source' => htmlspecialchars($f),
);
}
} else {
$sret ['state'] = 'File ext not allowed';
}
} else {
$savelist [] = array(
'state' => 'not remote image',
'url' => '',
'size' => '',
'title' => '',
'original' => '',
'source' => htmlspecialchars($f),
);
}
}
$sret ['list'] = $savelist;
}
return json_encode($sret);
}
private function save_image($ext = null, $content = null, $path = null)
{
$newfile = '';
$path=substr($path,0,2)=='./' ? substr($path,2) :$path;
$path=substr($path,0,1)=='/' ? substr($path,1) :$path;
if ($ext && $content) {
do {
$newfile = $path.str_replace("-","",date('Y-m-d/')) . uniqid() . '.' . $ext;
} while (file_exists($newfile));
$dir = dirname($newfile);
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
file_put_contents($newfile, $content);
// 图片压缩
// $img_url='./'.$newfile;
// $image = \think\Image::open('./'.$img_url);
// $image->thumb(700,1400)->save('./'.$img_url);
}
return $newfile;
}
private function _list($action)
{
/* 判断类型 */
switch ($action) {
/* 列出文件 */
case 'listfile':
$allowFiles = $this->config['fileManagerAllowFiles'];
$listSize = $this->config['fileManagerListSize'];
$prefix='/';
break;
/* 列出图片 */
case 'listimage':
default:
$allowFiles = $this->config['imageManagerAllowFiles'];
$listSize = $this->config['imageManagerListSize'];
$prefix='/';
}
$allowFiles = substr(str_replace(".", "|", join("", $allowFiles)), 1);
/* 获取参数 */
$size = isset($_GET['size']) ? htmlspecialchars($_GET['size']) : $listSize;
$start = isset($_GET['start']) ? htmlspecialchars($_GET['start']) : 0;
$end = intval($start) + intval($size);
$path = $this->uploadfolder;
$files = $this->getfiles($path, $allowFiles);
if (!count($files)) {
return json_encode(array(
"state" => "no match file",
"list" => array(),
"start" => $start,
"total" => count($files)
));
}
/* 获取指定范围的列表 */
$len = count($files);
for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--){
$list[] = $files[$i];
}
/* 返回数据 */
$result = json_encode(array(
"state" => "SUCCESS",
"list" => $list,
"start" => $start,
"total" => count($files)
));
return $result;
}
/**
* 遍历获取目录下的指定类型的文件
* @param string $path
* @param string $allowFiles
* @param array $files
* @return array
*/
private function getfiles($path, $allowFiles, &$files = array())
{
dump($path);
if (!is_dir($path)) return null;
if(substr($path, strlen($path) - 1) != '/') $path .= '/';
$handle = opendir($path);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
$path2 = $path . $file;
if (is_dir($path2)) {
$this->getfiles($path2, $allowFiles, $files);
} else {
if (preg_match("/\.(".$allowFiles.")$/i", $file)) {
$files[] = array(
'url'=> substr($path2,1),
'mtime'=> filemtime($path2)
);
}
}
}
}
return $files;
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use think\Controller;
use Qiniu\Storage\UploadManager;
use Qiniu\Auth;
use app\common\model\Picture as PictureModel;
class Upload extends Controller
{
public $accessKey;
public $secretKey;
public $domain;
public $auth;
public $bucket;
public $token;
public $UploadMgr;
public function _initialize()
{
parent::_initialize();
$this->accessKey = config('qiniu.accessKey');
$this->secretKey = config('qiniu.secretKey');
$this->domain = config('qiniu.domain');
$this->bucket = config('qiniu.bucket');
$this->auth = new Auth($this->accessKey, $this->secretKey);
$this->token = $this->auth->uploadToken($this->bucket);
$this->uploadMgr = new UploadManager();
}
public function single()
{
$file = request()->file('file');
// 要上传文件的本地路径
$filePath = $file->getRealPath();
//后缀
$ext = pathinfo($file->getInfo('name'), PATHINFO_EXTENSION);
// 上传到七牛后保存的文件名
$key = substr(md5($file->getRealPath()), 0, 5).date('YmdHis').rand(0, 9999).'.'.$ext;
// 调用 UploadManager 的 putFile 方法进行文件的上传
list($ret, $err) = $this->uploadMgr->putFile($this->token, $key, $filePath);
if ($err !== null) {
return json_encode(['error'=>1, 'msg'=>'上传失败', 'result'=>$err]);
} else {
$result['url'] = $this->domain.'/'.$ret['key'];
return json_encode(['error'=>0, 'msg'=>'上传成功', 'result'=>$result]);
}
}
/**
* 保存文件到七牛云
* @param string $file [description]
* @return [type] [description]
*/
public function sava($file='')
{
$result['error'] = 1;
$result['msg'] = '上传文件到远程失败';
$result['result'] = null;
// 要上传文件的本地路径
$filePath = $file->getRealPath();
//后缀
$ext = pathinfo($file->getInfo('name'), PATHINFO_EXTENSION);
// 上传到七牛后保存的文件名
$key = substr(md5($file->getRealPath()), 0, 5).date('YmdHis').rand(0, 9999).'.'.$ext;
// 调用 UploadManager 的 putFile 方法进行文件的上传
list($ret, $err) = $this->uploadMgr->putFile($this->token, $key, $filePath);
if ($err !== null) {
$result['result'] = $err;
return $result;
} else {
$resource_model = model('resource');
$resource_model->isUpdate(false)->data([
'name' => $ret['key'],
'ext' => $ext,
'address' => $this->domain.'/'.$ret['key'],
'use_num' => 1
])->save();
$result['error'] = 0;
$result['msg'] = '成功上传文件到远程';
$result['result']['url'] = $this->domain.'/'.$ret['key'];
return $result;
}
}
public function savaAsync()
{
$name = input('post.name');
$file = input('file.')[$name];
$result['result'] = null;
// 要上传文件的本地路径
$filePath = $file->getRealPath();
$fileName = $file->getInfo('name');
//后缀
$ext = pathinfo($file->getInfo('name'), PATHINFO_EXTENSION);
// 上传到七牛后保存的文件名
$key = substr(md5($file->getRealPath()), 0, 5).date('YmdHis').rand(0, 9999).'.'.$ext;
// 调用 UploadManager 的 putFile 方法进行文件的上传
list($ret, $err) = $this->uploadMgr->putFile($this->token, $key, $filePath);
if ($err !== null) {
$result['error'] = $fileName.'上传到远程失败';
$result['result'] = $err;
return $result;
} else {
$resource_model = model('Resource');
$server_id = $resource_model -> insertGetId(array(
'name' => $ret['key'],
'ext' => $ext,
'address' => $this->domain.'/'.$ret['key'],
'use_num' => 1
));
$result['success'] = $fileName.'上传成功';
$result['result']['server_id'] = $server_id;
$result['result']['url'] = $this->domain.'/'.$ret['key'];
return $result;
}
}
public function deleteAsync()
{
$id = input('post.id');
$res = model('Resource')->where("id", $id)-> delete();
if ($res) {
return array('code'=>0);
}
return array('code'=>0);
}
/**
* 删除图片
* @return [type] [description]
*/
public function delete()
{
$picture = PictureModel::get(trim(input('post.key')));
if ($picture) {
if ($picture->delete()) {
$pictures = PictureModel::where(['type'=>trim(input('param.type')), 'oid'=>trim(input('param.id'))])->select();
$pics = array();
foreach ($pictures as $k => $pic) {
$pics[$k]['id'] = intval($pic->id);
$pics[$k]['url'] = $pic->url;
}
return json_encode(['error'=>0, 'msg'=>'删除成功', 'pics'=>$pics]);
}else{
return json_encode(['error'=>1, 'msg'=>'删除失败']);
}
}else{
return json_encode(['error'=>1, 'msg'=>'该图片不存在']);
}
}
/**
* 七牛云上传凭证
* @return [type] [description]
*/
public function uptoken()
{
$result['error'] = 0;
$result['msg'] = '获取成功';
// $policy = array(
// 'callbackUrl' => 'http://your.domain.com/callback.php',
// 'callbackBody' => 'filename=$(fname)&filesize=$(fsize)'
// );
// $uptoken = $auth->uploadToken($bucket, null, 3600, $policy);
$auth = new Auth($this->accessKey, $this->secretKey);
$upToken = $auth->uploadToken($this->bucket);
$result['uptoken'] = $upToken;
return json_encode($result);
}
}
<?php
/**
* Created by PhpStorm.
* User: wanggang
* Date: 2018/9/27
* Time: 上午3:21
*/
namespace app\admin\controller;
use app\admin\controller\AuthBase;
class User extends AuthBase
{
public function _initialize()
{
parent::_initialize();
}
public function index(){
$user_model = model('user');
$user_list = $user_model->order('created_at desc')->paginate(10);
$this->assign('user_list',$user_list);
return $this->fetch();
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: 30868
* Date: 2018/9/15
* Time: 1:05
*/
namespace app\admin\validate;
use think\Validate;
class Post extends Validate
{
protected $rule = [
['title','require','文章标题不能为空'],
['sort','number','序号必须为数字'],
['id','require|number','缺少必要参数ID'],
['status','number|in:-1,0,1','状态必须是数字|状态范围不合法'],
['content','require','文章内容不能为空'],
['poster','require','文章封面必须上传']
];
// 场景设置
protected $scene = [
'create' => ['title','content','poster'],
'update' => ['title','content']
];
}
<?php
namespace app\admin\validate;
use think\Validate;
class Project extends Validate
{
protected $rule = [
['name','require|max:30','名称必须传递|名称不能超过30个字符'],
['sort','number','序号必须为数字'],
['id','require|number','缺少必要参数ID'],
['status','number|in:-1,0,1','状态必须是数字|状态范围不合法'],
['poster','require','图片必须上传'],
];
// 场景设置
protected $scene = [
'addTag' => ['name','sort'],
'updateTag' => ['name','sort','id'],
'addCatalogs' => ['name','sort','poster']
];
}
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 管理员管理</h3>
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET">
<div class="form-group">
<label class="sr-only" for="keyword">关键词</label>
<input type="text" class="form-control" name="word" id="keyword" placeholder="关键词" value="<?php echo input('get.word');?>">
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>ID</th>
<th>用户名</th>
<th>是否登录</th>
<th>时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach($admins as $u => $user):?>
<tr id="tr_<?php echo $user->id;?>">
<td><?php echo $user->id;?></td>
<td>
<a href="javascript:void(0);" class="btn-detail" oid="<?php echo $user->id;?>">
<?php echo $user->username;?>
</a>
</td>
<td><?php echo $user->is_login;?></td>
<td><?php echo $user->created_at;?></td>
<td>
<button oid="<?php echo $user->id;?>" type="button" class="btn btn-primary btn-xs btn-update-admin" data-toggle="tooltip" data-placement="top" data-original-title="编辑">
<i class="fa fa-pencil"></i>
</button>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$admins->render()}
</div>
</div>
</section>
{literal}
<script id="user" type="text/html">
<div class="row margin-0">
<div class="col-md-12">
<h3 class="text-center">{{user.name}}</h3>
</div>
</div>
<hr/>
<div class="row margin-horizontal-0">
<div class="col-md-3 padding-right-0 text-right">
<span>昵称: </span>
</div>
<div class="col-md-9 padding-left-xs">
<p class="text-left">
<span class="text-primary">{{user.name}}</span>
</p>
</div>
</div>
<div class="row margin-horizontal-0">
<div class="col-md-3 padding-right-0 text-right">
<span>登录状态: </span>
</div>
<div class="col-md-9 padding-left-xs">
<p class="text-left">
<span class="text-primary">{{user.is_login}}</span>
</p>
</div>
</div>
<div class="row margin-horizontal-0">
<div class="col-md-3 padding-right-0 text-right">
<span>创建时间: </span>
</div>
<div class="col-md-9 padding-left-xs">
<p class="text-left">
<span class="text-primary">{{user.created_at}}</span>
</p>
</div>
</div>
</script>
{/literal}
<div class="modal fade" id="update-modal" tabindex="-1" role="dialog" aria-labelledby="updateModal" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="copyModal">编辑资料</h4>
</div>
<div class="modal-body">
<div class="form-group margin-right">
<label for="robot">帐号</label>
<input class="form-control" name="name" id="admin-name">
</input>
</div>
<div class="form-group margin-right" id="groups-sel2">
<label for="group">密码</label>
<input class="form-control" name="password" id="admin-password">
</input>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary btn-save">保存</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$('[data-toggle="tooltip"]').tooltip();
// 右侧详情
$('.btn-detail').unbind('click').bind('click', function (event) {
event.stopPropagation();
event.preventDefault();
document.getElementById('right-detail-content').innerHTML = "";
var url = "/admin/Admin/read";
var oid = $(this).attr('oid');
showRightDetail(function () {
$.get(url + "/id/" + oid, function (res) {
var res = JSON.parse(res);
console.log(res);
if (res.error) {
new PNotify({
title: '提示',
text: res.msg,
'type': 'error'
});
} else {
var html = template('user', res.data);
document.getElementById('right-detail-content').innerHTML = html;
}
});
});
});
$(".btn-update-admin").click(function(){
event.preventDefault();
var _this = $(this);
var oid = $(this).attr("oid");
var _modal = $('#update-modal').modal('show');
var name = $("#tr_"+oid).find("td:eq(1)").text().trim();
_modal.find("#admin-name").val(name);
_modal.find('.btn-save').unbind('click').bind('click', function () {
var _that = $(this);
var name = $.trim(_modal.find('#admin-name').val());
var password = _modal.find('#admin-password').val();
if (name == '') {
new PNotify({
title: '提示',
text: '请填写必要信息'
});
return;
};
var $btn = _that.button('loading');
var url = "/admin/Admin/update?id="+oid;
$.ajax({
url: url,
type: 'POST',
dataType: 'json',
data: {
name: name,
password: password
},
cache: false,
})
.done(function (res) {
var res = JSON.parse(res);
if (res.error) {
new PNotify({
title: '提示',
text: res.msg
});
} else {
window.location.reload();
}
})
.fail(function (res) {
new PNotify({
title: '提示',
text: '网络请求失败'
});
})
.always(function () {
_modal.modal('hide');
$btn.button('reset');
});
});
});
});
</script>
\ No newline at end of file
{layout name="public/layout_login"}
<style type="text/css">
#captcha_div input{
float: left;
width: 52%;
height: 50px;
}
#captcha_div img{
float: left;
margin-left: 10px;
width: 125px;
height: 50px;
border-radius: 4px;
margin-bottom: 20px;
}
</style>
<div id="login-page">
<div class="container">
<form class="form-login" action="/admin/Login/login" method="POST">
<h2 class="form-login-heading">登录</h2>
<div class="login-wrap">
<input type="text" class="form-control" name="username" placeholder="User ID" autofocus>
<br>
<input type="password" class="form-control" name="password" placeholder="Password">
<br/>
<div id="captcha_div">
<input type="captcha" class="form-control" name="captcha" placeholder="验证码">
<div>
<img id="verify_img" src="{:captcha_src()}" alt="验证码" onclick="refreshVerify()">
</div>
</div>
<br/>
<button class="btn btn-theme btn-block" type="submit">
登录
</button>
<hr>
<div class="login-social-link centered">
<p>没有账号?请联系管理员</p>
</div>
</form>
</div>
</div>
<script type="text/javascript">
// 刷新验证码 - http://www.thinkphp.cn/topic/49805.html
function refreshVerify() {
var ts = Date.parse(new Date())/1000;
var img = document.getElementById('verify_img');
img.src = "/captcha?id="+ts;
}
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/post/index')}">文章管理</a> <i class="fa fa-angle-right"></i> 发布文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" action="{:url('admin/banner/create')}")?>" id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right" >图片</label>
<div class="col-lg-10">
<input id="input-b1" name="image" type="file">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章类型</label>
<div class="col-lg-10">
<select class="form-control" name="type" id="post_type">
<option value="1">小程序页面路径</option>
<option value="2">跳转到网页链接地址</option>
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">请输入链接</label>
<div class="col-lg-10">
<input type="text" name="href" class="form-control">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">是否显示</label>
<div class="col-lg-10">
<select class="form-control" name="type" id="post_type">
<option value="1">显示</option>
<option value="2">隐藏</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-default" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
// 初始化文件上传
initFileInput($("#input-b1"));
// 单文件上传
function initFileInput(el,initArr,initConfig){
// var initialPreview = [];
// initialPreview.push(initArr);
el.fileinput({
language: 'zh',
uploadExtraData:{'name':name},
// initialPreview: initialPreview,
uploadExtraData:{'name':'banner-choose'},
// initialPreviewConfig: initConfig,
autoReplace : true,
showUpload:false, //是否显示上 传按钮
initialPreviewShowDelete:true,
initialPreviewAsData: true,
dropZoneEnabled: false,
showRemove :false,
showUpload:false, //是否显示上 传按钮
overwriteInitial:true,
showUploadedThumbs:false,
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
}
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/validation/css/validationEngine.jquery.css">
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/post/index')}">文章管理</a> <i class="fa fa-angle-right"></i> 发布文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" id="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" action="{:url('admin/banner/create')}" id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right" >图片</label>
<div class="col-lg-10">
<input id="input-b1" name="image" class="validate[required]" type="file">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章类型</label>
<div class="col-lg-10">
<select class="form-control" name="type" id="post_type">
<option value="1">小程序页面路径</option>
<option value="2">跳转到网页链接地址</option>
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">请输入链接</label>
<div class="col-lg-10">
<input type="text" name="url" class="form-control validate[required]" >
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">是否显示</label>
<div class="col-lg-10">
<select class="form-control" name="status" id="post_type">
<option value="1">显示</option>
<option value="2">不显示</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-default" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<script type="text/javascript" src="/static/validation/js/jquery.validationEngine-zh_CN.js"></script>
<script type="text/javascript" src="/static/validation/js/jquery.validationEngine.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
$("#myFrom").validationEngine();
// 初始化文件上传
initFileInput($("#input-b1"));
// 单文件上传
function initFileInput(el,initArr,initConfig){
// var initialPreview = [];
// initialPreview.push(initArr);
el.fileinput({
language: 'zh',
uploadExtraData:{'name':name},
// initialPreview: initialPreview,
uploadExtraData:{'name':'banner-choose'},
// initialPreviewConfig: initConfig,
autoReplace : true,
showUpload:false, //是否显示上 传按钮
initialPreviewShowDelete:true,
initialPreviewAsData: true,
dropZoneEnabled: false,
showRemove :false,
showUpload:false, //是否显示上 传按钮
overwriteInitial:true,
showUploadedThumbs:false,
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
}
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 轮播图管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="">
<a href="{:url('admin/banner/create')}" class="btn btn-success">添加轮播图</a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<!--<colgroup>-->
<!--<col style="width: 2%;">-->
<!--<col style="width: 80%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 10%;">-->
<!--</colgroup>-->
<thead>
<tr>
<th>#</th>
<th>图片</th>
<th>类型</th>
<th>地址</th>
<th>是否显示</th>
<th>发布时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{volist name="banner_list" id="vo" key="k" empty="暂时没有数据"}
<tr id="tr_{$vo.id}">
<td>{$k}</td>
<td><img src="{$vo.image}" style="width:170px" alt=""></td>
<td>
{if condition="$vo.type==1"}
小程序页面路径
{else/}
网页链接地址
{/if}
</td>
<td>{$vo.url}</td>
<td>
{if condition="$vo.status == 1"}
显示
{else/}
不显示
{/if}
</td>
<td>{$vo.created_at}</td>
<td>
<a href="{:url('admin/banner/update',['id'=>$vo.id])}" class="btn btn-xs btn-primary"><i class="fa fa-pencil"></i></a>
<a href="javascript:" oid="{$vo.id}" class="btn btn-xs btn-danger btn-delete"><i class="fa fa-trash"></i></a>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
</section>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "{:url('admin/banner/delete')}";
var oid = _this.attr('oid');
showDialog("提示", "确定删除该轮播图吗?", function(){
// ajax post 方法
$.post(url, {id:oid}, function (res) {
// var res = JSON.parse(res);
if (res.code == 1) {
// javascript 的默认弹出提示方法
_this.remove();
$("#tr_"+oid).fadeOut();
} else {
alert(res.msg);
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/validation/css/validationEngine.jquery.css">
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/post/index')}">文章管理</a> <i class="fa fa-angle-right"></i> 发布文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" id="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" action="{:url('admin/banner/update',['id'=>$banner_info.id])}" id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right" >图片</label>
<div class="col-lg-10">
<input id="input-b1" name="image" type="file">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章类型</label>
<div class="col-lg-10">
<select class="form-control" name="type" id="post_type">
<option value="1" {if condition="$banner_info.type == 1"}selected{/if}>小程序页面路径</option>
<option value="2" {if condition="$banner_info.type == 2"}selected{/if}>跳转到网页链接地址</option>
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">请输入链接</label>
<div class="col-lg-10">
<input type="text" name="url" class="form-control validate[required]" value="{$banner_info.url}">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">是否显示</label>
<div class="col-lg-10">
<select class="form-control" name="status" id="post_type">
<option value="1" {if condition="$banner_info.status == 1"}selected{/if}>显示</option>
<option value="2" {if condition="$banner_info.status == 2"}selected{/if}>不显示</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-default" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<script type="text/javascript" src="/static/validation/js/jquery.validationEngine-zh_CN.js"></script>
<script type="text/javascript" src="/static/validation/js/jquery.validationEngine.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
$("#myFrom").validationEngine();
// 初始化文件上传
initFileInput($("#input-b1"),"{$banner_info.image}");
// 单文件上传
function initFileInput(el,initArr,initConfig){
var initialPreview = [];
initialPreview.push(initArr);
el.fileinput({
language: 'zh',
uploadExtraData:{'name':name},
initialPreview: initialPreview,
uploadExtraData:{'name':'banner-choose'},
// initialPreviewConfig: initConfig,
autoReplace : true,
showUpload:false, //是否显示上 传按钮
initialPreviewShowDelete:true,
initialPreviewAsData: true,
dropZoneEnabled: false,
showRemove :false,
showUpload:false, //是否显示上 传按钮
overwriteInitial:true,
showUploadedThumbs:false,
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
}
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 分类管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline pull-left" method="GET" action="{:url('admin/project/Catalogs')}" >
<div class="form-group margin-right">
<label for="name">分类名</label>
<input class="form-control" type="text" name="name" id="name" value="<?php echo input('title');?>" />
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
<div class=" pull-right">
<a href="{:url('admin/project/addCatalogs')}" class="btn btn-success">添加分类</a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<!--<colgroup>-->
<!--<col style="width: 2%;">-->
<!--<col style="width: 80%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 10%;">-->
<!--</colgroup>-->
<thead>
<tr>
<th>#</th>
<th>分类名称</th>
<th>分类图标</th>
<th>引用次数</th>
<th>排序</th>
<th>发布时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{volist name="tag_list" id="vo" key="k" empty="暂时没有数据"}
<tr>
<td>{$k}</td>
<td>{$vo.name}</td>
<td><img style="width:170px" src="{$vo.poster}" alt=""></td>
<td>{$vo.used_num}</td>
<td>{$vo.sort}</td>
<td>{$vo.created_at}</td>
<td>
<a href="{:url('admin/project/editCatalogs',['id'=>$vo.id])}" class="btn btn-xs btn-primary"><i class="fa fa-pencil"></i></a>
<a href="###" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i></a>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$tag_list->render()}
</div>
</div>
</section>
<script type="text/javascript">
$("#myModal").modal();
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Guide/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/Guide/index')}">美行攻略</a> <i class="fa fa-angle-right"></i> 发布攻略
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" action="<?php echo url("@admin/Guide/create")?>" id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章标题</label>
<div class="col-lg-10">
<input type="text" class="form-control validate[required]" name="title" id="title" placeholder="文章标题 ">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right" >文章封面</label>
<div class="col-lg-10">
<input id="input-b1" name="poster" type="file">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章标签</label>
<div class="col-lg-10">
<input type="hidden" name="tags" id="tags" value="">
<select class="selectpicker form-control" id="tags_select" multiple data-live-search="true" onchange="setTags()">
{volist name="tag_list" name="tag_list" id="vo"}
<option value="{$vo.id}">{$vo.name}</option>
{/volist}
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章类型</label>
<div class="col-lg-10">
<select class="form-control" name="type" id="post_type">
<option value="1">手动编写文章</option>
<option value="2">链接到网络文章</option>
</select>
</div>
</div>
<div class="form-group" id="href" style="display: none">
<label for="title" class="col-sm-1 control-label text-right">请输入url</label>
<div class="col-lg-10">
<input type="text" name="href" class="form-control">
<code>http:// + 网址 或 https:// + 网址</code>
</div>
</div>
<div class="form-group" id="content">
<label for="content" class="col-sm-1 control-label text-right">文章内容</label>
<div class="col-lg-10">
<!-- 加载编辑器的容器 -->
<script id="post_container" name="content" type="text/plain" style="width: 100%">
</script>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-default" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
$(function(){
// 即时显示封面图
$('#poster').change(function(e){
var file = e.target.files[0];
preview(file, 0);
});
var type = $("#post_type").val();
if(type == 1){
$("#content").show();
$("#href").hide();
}else{
$("#href").show();
$("#content").hide();
}
});
$("#post_type").change(function(){
var type = $(this).val();
if(type == 1){
$("#content").show();
$("#href").hide();
}else{
$("#href").show();
$("#content").hide();
}
});
// 初始化文件上传
$("#input-b1").fileinput({
language: 'zh',
showUpload:false, //是否显示上传按钮
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
function setTags(){
var slected = $("#tags_select").val();
if(slected){
$("#tags").val(slected.toString());
}else{
$("#tags").val("");
}
}
UE.getEditor('post_container', {
//编辑区域大小
'initialFrameHeight' : '350',
'elementPathEnabled':false,
'autoHeight': true,
'autoHeightEnabled':true,
'autoFloatEnabled': true,
'iframeCssUrl': '/static/ueditor/themes/iframe.css',// 引入css
//定制菜单
'toolbars' : [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|', 'insertimage', '|',
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
],
]
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 文章管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET" action="<?php echo url('@admin/Guide/index')?>">
<div class="form-group margin-right">
<label for="title">文章标题</label>
<input class="form-control" type="text" name="title" id="title" value="<?php echo input('title');?>" />
</div>
<button type="submit" class="btn btn-primary">搜索</button>
<a href='<?php echo url("@admin/Guide/create")?>' type="button" class="btn btn-success" style="margin-left:30px;">
发布文章
</a>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>#</th>
<th>文章标题</th>
<th>封面</th>
<th>发布时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($articles as $k => $article):?>
<tr id="tr_<?php echo $article->id;?>">
<td><?php echo $article->id;?></td>
<td style="max-width:450px;">
{if condition="$article.type == 1"}
<a href="<?php echo url('@mob/Guide/read', 'id='.$article->id);?>/" target='_blank'>
<?php echo $article->title;?>
</a>
{else/}
<a href="{$article->content}" target='_blank'>
<?php echo $article->title;?>
</a>
{/if}
</td>
<td><img style="width: 170px" src="{$article->poster}" alt=""></td>
<td><?php echo $article->created_at;?></td>
<td style="min-width:100px;">
<a href="<?php echo url('@admin/Guide/update', 'id='.$article->id);?>" type="button" class="btn btn-primary btn-xs" data-toggle="tooltip" data-placement="top" data-original-title="编辑">
<i class="fa fa-pencil"></i>
</a>
<button oid="<?php echo $article->id;?>" type="button" class="btn btn-danger btn-xs btn-delete" data-toggle="tooltip" data-placement="top" data-original-title="删除">
<i class="fa fa-trash-o"></i>
</button>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$articles->render()}
</div>
</div>
</section>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Guide/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/Guide/index')}">文章管理</a> <i class="fa fa-angle-right"></i> 发布文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" action="<?php echo url("@admin/Guide/update/id/".$article['id'])?>" id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章标题</label>
<div class="col-lg-10">
<input type="text" class="form-control validate[required]" value="{$article.title}" name="title" id="title" placeholder="文章标题 ">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right" >文章封面</label>
<div class="col-lg-10">
<input type="hidden" name='old_poster' value="{$article.poster}">
<img src="{$article.poster}" style="width:170px;margin-bottom:10px" alt="" id="poster_view">
<input id="input-b1" name="poster" type="file">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章标签</label>
<div class="col-lg-10">
<input type="hidden" name="tags" id="tags" value="{$tags}">
<select class="selectpicker form-control" name="tags" multiple data-live-search="true">
{volist name="tag_list" name="tag_list" id="vo"}
<option {if condition="in_array($vo.id,$tag_arr)"}selected{/if} value="{$vo.id}">{$vo.name}</option>
{/volist}
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章类型</label>
<div class="col-lg-10">
<select class="form-control" name="type" id="post_type">
<option {if condition="$article.type == 1"}selected{/if} value="1">手动编写文章</option>
<option {if condition="$article.type == 2"}selected{/if} value="2">链接到网络文章</option>
</select>
</div>
</div>
<div class="form-group" id="href" style="display: none">
<label for="title" class="col-sm-1 control-label text-right">请输入url</label>
<div class="col-lg-10">
{if condition="$article.type == 1"}
<input type="text" name="href" class="form-control">
{else/}
<input type="text" value="{$article.content}" name="href" class="form-control">
{/if}
<code>http:// + 网址 或 https:// + 网址</code>
</div>
</div>
<div class="form-group" id="content">
<label for="content" class="col-sm-1 control-label text-right">文章内容</label>
<div class="col-lg-10">
<!-- 加载编辑器的容器 -->
{if condition="$article.type == 1"}
<script id="post_container" name="content" type="text/plain" style="width: 100%">
{$article.content}
</script>
{else/}
<script id="post_container" name="content" type="text/plain" style="width: 100%">
</script>
{/if}
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-default" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
$(function(){
// 即时显示封面图
$('#poster').change(function(e){
var file = e.target.files[0];
preview(file, 0);
});
var type = $("#post_type").val();
if(type == 1){
$("#content").show();
$("#href").hide();
}else{
$("#href").show();
$("#content").hide();
}
});
$("#post_type").change(function(){
var type = $(this).val();
if(type == 1){
$("#content").show();
$("#href").hide();
}else{
$("#href").show();
$("#content").hide();
}
});
// 初始化文件上传
var fileInput = $("#input-b1").fileinput({
language: 'zh',
showUpload:false, //是否显示上传按钮
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
$("#input-b1").change(function(data){
if(this.files.length>0){
$("#poster_view").hide();
}else{
$("#poster_view").show();
}
})
$("#input-b1").on("fileclear",function(event, data, msg){
$("#poster_view").show();
});
function setTags(){
var slected = $("#tags_select").val();
if(slected){
$("#tags").val(slected.toString());
}else{
$("#tags").val("");
}
}
UE.getEditor('post_container', {
//编辑区域大小
'initialFrameHeight' : '350',
'elementPathEnabled':false,
'autoHeight': true,
'autoHeightEnabled':true,
'autoFloatEnabled': true,
'iframeCssUrl': '/static/ueditor/themes/iframe.css',// 引入css
//定制菜单
'toolbars' : [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|', 'insertimage', '|',
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
],
]
});
</script>
{layout name="public/layout_main"}
<style type="text/css">
.progress-bar{
text-align: center;
}
</style>
<section class="wrapper">
<h3 class="top-back">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-left"></i> 编辑文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg !== ''):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-horizontal" enctype="multipart/form-data" method="POST" id="robot-create-form">
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">文章标题</label>
<div class="col-lg-8">
<input type="text" class="form-control validate[required]" name="title" id="title" value="<?php echo $article->title;?>">
</div>
</div>
<div class="form-group">
<label for="content" class="col-sm-2 control-label text-right">文章内容</label>
<div class="col-lg-8">
<!-- 加载编辑器的容器 -->
<script id="post_container" name="content" type="text/plain"><?php echo htmlspecialchars_decode($article->content); ?></script>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
var ue = UE.getEditor('post_container',{
// 图片上传配置路径
'serverUrl': "{:url('@admin/Ueditor/index')}",
'elementPathEnabled':false,
// autoHeight: true,
'autoHeightEnabled':false,
//编辑区域大小
'initialFrameHeight' : '300',
//定制菜单
'toolbars' : [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|', 'insertimage', '|',
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
],
]
});
/*
* 初始化分类
*/
$(function () {
});
</script>
\ No newline at end of file
{layout name="public/layout_main"}
<style type="text/css">
.whitelink{
color: white;
text-decoration: none;
}
.whitelink:hover{
color: #ddd;
}
.nav-tabs{
margin-bottom: 15px;
}
</style>
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 数据概览</h3>
<hr>
<!--<ul class="nav nav-tabs">-->
<!--<li class="<?php if(input('tab')=='index'){echo 'active';} ?>">-->
<!--<a href="<?php echo url("@admin/Index/index", ['tab'=>'index'])?>">数据概览</a>-->
<!--</li>-->
<!--<li class="<?php if(input('tab')=='visitor'){echo 'active';} ?>">-->
<!--<a href="<?php echo url("@admin/Index/index", ['tab'=>'visitor'])?>">访客数据</a>-->
<!--</li>-->
<!--<li class="<?php if(input('tab')=='miniapp'){echo 'active';} ?>">-->
<!--<a href="<?php echo url("@admin/Index/index", ['tab'=>'miniapp'])?>">小程序数据</a>-->
<!--</li>-->
<!--</ul>-->
<div class="row margin-bottom">
<div class="col-md-4">
<div class="bg-color-primary padding-lg text-center">
<div class="row">
<div class="col-md-6">
<div class="margin-bottom-xs">
<i class="fa fa-user-circle-o fa-3x text-align-bottom"></i>
<span class="padding-left-xs text-xxl text-align-bottom">
{$user_num}
</span>
</div>
<span class="text-lg">
<a class="whitelink" href="/admin/User/index">用户总数</a>
</span>
</div>
<div class="col-md-6">
<div class="margin-bottom-xs">
<i class="fa fa-mobile fa-3x text-align-bottom"></i>
<span class="padding-left-xs text-xxl text-align-bottom">
{$user_num_today}
</span>
</div>
<span class="text-lg">
<a class="whitelink" href="/admin/User/index">今日新增用户数</a>
</span>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="bg-color-success padding-lg text-center">
<div class="row">
<div class="col-md-6" id="div_wxqun" style="cursor: pointer;">
<div class="margin-bottom-xs">
<i class="fa fa-calendar-plus-o fa-3x text-align-bottom"></i>
<span class="padding-left-xs text-xxl text-align-bottom">
{$order_num}
</span>
</div>
<span class="text-lg">
<a class="whitelink" href="/admin/Activity/index">订单总数</a>
</span>
</div>
<div class="col-md-6">
<div class="margin-bottom-xs">
<i class="fa fa-book fa-3x text-align-bottom"></i>
<span class="padding-left-xs text-xxl text-align-bottom">
{$order_num_today}
</span>
</div>
<span class="text-lg">
<a class="whitelink" href="/admin/Project/index">今日新增订单数</a>
</span>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="bg-color-warning padding-lg text-center">
<div class="row">
<div class="col-md-6" id="div_wxqun" style="cursor: pointer;">
<div class="margin-bottom-xs">
<i class="fa fa-calendar-plus-o fa-3x text-align-bottom"></i>
<span class="padding-left-xs text-xxl text-align-bottom">
{$wait_num_r}
</span>
</div>
<span class="text-lg">
<a class="whitelink" href="/admin/Activity/index">退款待审核</a>
</span>
</div>
<div class="col-md-6">
<div class="margin-bottom-xs">
<i class="fa fa-book fa-3x text-align-bottom"></i>
<span class="padding-left-xs text-xxl text-align-bottom">
{$wait_num_c}
</span>
</div>
<span class="text-lg">
<a class="whitelink" href="/admin/Project/index">评论待审核</a>
</span>
</div>
</div>
</div>
</div>
</div>
</section>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 日志记录</h3>
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET" id="search_from">
<div class="form-group">
<input type="text" class="form-control" name="admin" id="admin" placeholder="管理员" value="<?php echo input('get.admin');?>">
<input type="text" class="form-control" name="category" id="category" placeholder="标签" value="<?php echo input('get.category');?>">
</div>
<button type="submit" class="btn btn-default margin-left">搜索</button>
</form>
</div>
</div>
<ul class="nav nav-tabs">
<li class="<?php if(input('level')=='info'){echo 'active';} ?>">
<a href="<?php echo url("@admin/Log/index", ['level'=>'info'])?>">信息日志</a>
</li>
<li class="<?php if(input('level')=='debug'){echo 'active';} ?>">
<a href="<?php echo url("@admin/Log/index", ['level'=>'debug'])?>">调试日志</a>
</li>
<li class="<?php if(input('level')=='error'){echo 'active';} ?>">
<a href="<?php echo url("@admin/Log/index", ['level'=>'error'])?>">错误日志</a>
</li>
</ul>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>#</th>
<th>级别</th>
<th>标签</th>
<th>内容</th>
<th>客户端</th>
<th>管理员</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<?php foreach($items as $item):?>
<tr id="tr_<?php echo $item->id;?>">
<td><?php echo $item->id;?></td>
<td>
<?php echo $item->level_text;?>
</td>
<td>
<?php echo $item->category;?>
</td>
<td style="max-width:240px;word-break:break-all">
<?php echo $item->message;?>
</td>
<td style="max-width:240px;word-break:break-all">
<?php echo $item['visitor'];?>
</td>
<td style="max-width:240px;word-break:break-all">
<?php
if($item->admin){
echo $item->admin->username;
}else{
echo '来自API';
}
?>
</td>
<td><?php echo $item['created_at'];?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$items->render()}
</div>
</div>
</section>
<script type="text/javascript">
$(function(){
// 右侧详情
});
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/datetimepicker/css/bootstrap-datetimepicker.min.css">
<link rel="stylesheet" href="/static/validation/css/validationEngine.jquery.css">
<section class="wrapper">
<h3 class="top-back">
<a href="<?php echo url('@admin/Miniapp/index')?>">
<i class="fa fa-angle-left"></i>
<?php echo isset($model)?'修改小程序':'添加小程序';?>
</a>
</h3>
<hr>
<!-- 错误信息:php需使用 $this->assign('errmsg', '错误信息'); 来设置显示内容! -->
<?php if(isset($errmsg)):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $errmsg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-horizontal" method="POST" action="<?php if(ACTION_NAME == 'update'){ }else{ echo url('@admin/Miniapp/create'); }?>" id="create-form" enctype="multipart/form-data">
<div class="form-group">
<label for="name" class="col-sm-2 control-label text-right">小程序名</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="text" class="form-control validate[required]" name="name" id="name" placeholder="小程序名" value="<?php echo isset($model)?$model->name:'';?>">
</div>
</div>
<div class="form-group">
<label for="subject" class="col-sm-2 control-label text-right">简介</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="text" class="form-control validate[required]" name="subject" id="subject" placeholder="简介" value="<?php echo isset($model)?$model->subject:'';?>">
</div>
</div>
<div class="form-group">
<label for="desc" class="col-sm-2 control-label text-right">封面图</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<!-- 1.上传ID和Input ID需在jq中添加事件 2.预览的类属性imgpreview不能缺失 -->
<div class="input-group">
<span class="input-group-addon pointer" id="upbtn_poster">上传</span>
<input type="text" class="form-control validate[required,custom[url]] imginpunt" name="poster" id="poster" placeholder="上传图片或输入图片链接" value="<?php echo isset($model)?$model->poster:'';?>">
<div class="input-group-addon imgpreview">
<a href="<?php echo isset($model)?$model->poster:'';?>" target="_blank" data-fancybox="images">预览</a>
</div>
</div>
</div>
</div>
<div class="form-group">
<a href="http://www.114la.com/other/rgb.htm" target="view_window">
<label class="col-sm-2 control-label text-right">按钮颜色</label>
</a>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="text" class="form-control validate[required]" name="btn_color" id="btn_color" placeholder="按钮颜色,点击label选择颜色" value="<?php echo isset($model)?$model->btn_color:'';?>"></input>
</div>
</div>
<div class="form-group">
<a href="http://www.114la.com/other/rgb.htm" target="view_window">
<label class="col-sm-2 control-label text-right">标题颜色</label>
</a>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="text" class="form-control validate[required]" name="title_color" id="title_color" placeholder="标题颜色,点击label选择颜色" value="<?php echo isset($model)?$model->title_color:'';?>"></input>
</div>
</div>
<div class="form-group">
<label for="desc" class="col-sm-2 control-label text-right">图标</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<!-- 1.上传ID和Input ID需在jq中添加事件 2.预览的类属性imgpreview不能缺失 -->
<div class="input-group">
<span class="input-group-addon pointer" id="upbtn_icon">上传</span>
<input type="text" class="form-control validate[required,custom[url]] imginpunt" name="icon" id="icon" placeholder="上传图片或输入图片链接" value="<?php echo isset($model)?$model->icon:'';?>">
<div class="input-group-addon imgpreview">
<a href="<?php echo isset($model)?$model->icon:'';?>" target="_blank" data-fancybox="images">预览</a>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="desc" class="col-sm-2 control-label text-right">小程序码</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<!-- 1.上传ID和Input ID需在jq中添加事件 2.预览的类属性imgpreview不能缺失 -->
<div class="input-group">
<span class="input-group-addon pointer" id="upbtn_qrcode">上传</span>
<input type="text" class="form-control validate[required,custom[url]] imginpunt" name="qrcode" id="qrcode" placeholder="上传图片或输入图片链接" value="<?php echo isset($model)?$model->qrcode:'';?>">
<div class="input-group-addon imgpreview">
<a href="<?php echo isset($model)?$model->qrcode:'';?>" target="_blank" data-fancybox="images">预览</a>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-success">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<script src="/static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script src="/static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="/static/validation/js/jquery.validationEngine-zh_CN.js"></script>
<script src="/static/validation/js/jquery.validationEngine.js"></script>
<script src="/static/plupload/moxie.min.js" type="text/javascript"></script>
<script src="/static/plupload/plupload.min.js" type="text/javascript"></script>
<script src="/static/qiniu/qiniu.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$('#create-form').validationEngine('attach', {
promptPosition: 'centerRight',
binded: true,
scroll: true
});
// 设置要上传图片的input输入框
setImageUp('upbtn_poster', 'poster');
setImageUp('upbtn_icon', 'icon');
setImageUp('upbtn_qrcode', 'qrcode');
// 图片输入框改变,则改变预览的图片地址
$('.imginpunt').on('input', function(){
$(this).siblings('.imgpreview').children('a').attr('href', $(this).val());
});
})
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3>
<i class="fa fa-angle-right"></i> 小程序列表
</h3>
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET" id="search_from">
<div class="form-group">
<input type="text" class="form-control" name="name" id="name" placeholder="名称" value="<?php echo input('get.name');?>">
</div>
<button type="submit" class="btn btn-primary margin-left">搜索</button>
<a href="<?=url('admin/Miniapp/create')?>" class="btn btn-success margin-left">创建小程序</a>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th>名称</th>
<th>简介</th>
<th>封面图</th>
<th>按钮颜色</th>
<th>标题颜色</th>
<th>图标</th>
<th>小程序码</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach($items as $item):?>
<tr id="tr_<?php echo $item->id;?>">
<td><?php echo $item->id;?></td>
<td>
<?php echo $item->name;?>
</td>
<td>
<?php echo $item->subject;?>
</td>
<td>
<a href="<?=$item->poster?>" target="_blank" data-fancybox="images">
<img src="<?=$item->poster?>" width='50' height='50' />
</a>
</td>
<td>
<?php echo $item->btn_color;?>
</td>
<td>
<?php echo $item->title_color;?>
</td>
<td>
<a href="<?=$item->icon?>" target="_blank" data-fancybox="images">
<img src="<?=$item->icon?>" width='50' height='50' />
</a>
</td>
<td>
<a href="<?=$item->qrcode?>" target="_blank" data-fancybox="images">
<img src="<?=$item->qrcode?>" width='50' height='50' />
</a>
</td>
<td>
<a href="<?=url('@admin/Miniapp/update', ['id'=>$item->id])?>" type="button" class="btn btn-primary btn-xs btn-delete" oid="<?=$item['id']?>"><i class="fa fa-pencil"></i></a>
/
<a href="javascript:;" type="button" class="btn btn-danger btn-xs btn-delete" oid="<?=$item['id']?>"><i class="fa fa-trash"></i></a>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$items->render()}
</div>
</div>
</section>
{include file="public/course_detail" /}
<script type="text/javascript">
$(function(){
$('#sel_type').change(function(){
$("#search_from").submit();
});
$('#sel_catalog').change(function(){
$("#search_from").submit();
});
// 课程分类
$.post('/admin/Course/ajax_course_catalogs', {}, function(res){
res = $.parseJSON(res);
if (res.code==0) {
var html = '';
var catalog = "<?=input('catalog')?>";
var selected;
for (var i = 0; i < res.data.length; i++) {
if (res.data[i].id==catalog) {
selected = "selected='selected'";
}else{
selected = "";
}
html += "<option "+selected+ "value="+res.data[i].id+">"+res.data[i].title+"</option>";
}
$('#sel_catalog').append(html);
}else{
alert(res.msg);
}
});
// 右侧详情
$('.btn-detail').unbind('click').bind('click', function (event) {
event.stopPropagation();
event.preventDefault();
document.getElementById('right-detail-content').innerHTML = "";
var url = "/admin/Course/read";
var oid = $(this).attr('oid');
showRightDetail(function () {
$.get(url + "/id/" + oid, function (res) {
var res = JSON.parse(res);
if (res.error) {
new PNotify({
title: '提示',
text: res.msg,
'type': 'error'
});
} else {
var html = template('course', res.data);
document.getElementById('right-detail-content').innerHTML = html;
}
});
});
});
$(".btn-delete").click(function(){
var _this = $(this);
var url = "ajax_delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除此小程序吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
console.log(res);
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 评论审核</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET" id="order-search" action="<?php echo url('@admin/order/comment')?>">
<div class="form-group">
<label for="title">评论审核状态</label>
<select name="status" class="form-control" id="status">
<option value="-1" {if condition="$status=='-1'"}selected{/if}>全部</option>
<option value="1" {if condition="$status=='1'"}selected{/if}>审核中</option>
<option value="2" {if condition="$status=='2'"}selected{/if}>审核通过</option>
<option value="3" {if condition="$status=='3'"}selected{/if}>审核失败</option>
</select>
</div>
<!--<button type="submit" class="btn btn-primary">搜索</button>-->
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>#</th>
<th>项目信息</th>
<th>用户信息</th>
<th>评分</th>
<th>评论内容</th>
<th>审核状态</th>
<th>审核</th>
</tr>
</thead>
<tbody>
{volist name="$comment_list" id="vo" key="k" empty="暂时没有数据"}
<tr>
<td>{$k}</td>
<td>
<img src="{$vo.project.poster}" style="width:70px;display:block;margin:0 auto;" alt="">
<p style="padding:0;margin:0;text-align:center">{$vo.project.title}</p>
</td>
<td>
<p style="padding:0;margin:0;text-align:center">{$vo.user.nickname}</p>
<p style="padding:0;margin:0;text-align:center">{$vo.user.phone}</p>
<p style="padding:0;margin:0;text-align:center;color:#f60">
{if condition="$vo.user.is_vip == 1"}
{/if}
</p>
</td>
<td>
{for start="0" end="$vo.grade"}
<span class="glyphicon glyphicon-star" style="color:goldenrod;font-size:16px;"></span>
{/for}
</td>
<td>
<div style="width:250px;">{$vo.content}</div>
</td>
<td>
<span style="color:{$vo.status_str.color}">
{$vo.status_str.name}
</span>
</td>
<td>
{if condition="$vo.status == 1"}
<a href="{:url('admin/order/commentStatus',['status'=>2,'id'=>$vo.id])}" class="btn btn-xs btn-primary">审核通过</a>
<a href="{:url('admin/order/commentStatus',['status'=>3,'id'=>$vo.id])}" class="btn btn-xs btn-warning">审核不通过</a>
{else/}
<a href="{:url('admin/order/commentStatus',['status'=>1,'id'=>$vo.id])}" class="btn btn-xs btn-primary">退回重审</a>
{/if}
<!--<a href="##" class="btn btn-xs btn-danger ">删除</a>-->
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$comment_list->render()}
</div>
</div>
</section>
<script type="text/javascript">
$("#status").change(function(){
$("#order-search").submit();
});
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 订单管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET" id="order-search" action="<?php echo url('@admin/order/index')?>">
<div class="form-group">
<label for="title">订单状态</label>
<select name="status" class="form-control" id="status">
<option value="-1" {if condition="$status=='-1'"}selected{/if}>全部</option>
<option value="0" {if condition="$status=='0'"}selected{/if}>待付款</option>
<option value="1" {if condition="$status=='1'"}selected{/if}>进行中</option>
<option value="2" {if condition="$status=='2'"}selected{/if}>待评价</option>
<option value="3" {if condition="$status=='3'"}selected{/if}>已完成</option>
</select>
</div>
<!--<button type="submit" class="btn btn-primary">搜索</button>-->
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>#</th>
<th>订单标题</th>
<th>订单来源</th>
<th>项目信息</th>
<th>用户信息</th>
<th>订单总价</th>
<th>订单状态</th>
<th>微信pay_id</th>
<th>微信交易订单号</th>
<th>微信支付状态</th>
<th>有无退款</th>
<th>有无评论</th>
</tr>
</thead>
<tbody>
{volist name="order_list" id="vo" key="k" empty="暂时没有数据"}
<tr>
<td>{$k}</td>
<td>{$vo.title}</td>
<td>
{if condition="$vo.type == 1"}
活动报名订单
{else/}
购买会员卡订单
{/if}
</td>
<td>
<img src="{$vo.project.poster}" style="width:70px;display:block;margin:0 auto;" alt="">
<p style="padding:0;margin:0;text-align:center">{$vo.project.title}</p>
</td>
<td>
<p style="padding:0;margin:0;text-align:center">{$vo.user_info.nickname}</p>
<p style="padding:0;margin:0;text-align:center">{$vo.user_info.phone}</p>
<p style="padding:0;margin:0;text-align:center;color:#f60">
{if condition="$vo.user_info.is_vip == 1"}
{/if}
</p>
</td>
<td>{$vo.total_fee}</td>
<!--订单状态-->
<td>
<span style="color:{$vo.status_name.color}">{$vo.status_name.name}</span>
</td>
<td>
{$vo.prepay_id}
</td>
<td>
{$vo.out_trade_no}
</td>
<td>
{$vo.trade_status}
</td>
<td>
{if condition="$vo.is_refund == 0"}
无退款申请
{else/}
有退款申请
{/if}
</td>
<td>
{if condition="$vo.is_comment == 0"}
无评论
{else/}
有评论
{/if}
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$order_list->render()}
</div>
</div>
</section>
<script type="text/javascript">
$("#status").change(function(){
$("#order-search").submit();
});
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 退款审核</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET" id="order-search" action="<?php echo url('@admin/order/refund')?>">
<div class="form-group">
<label for="title">退款状态</label>
<select name="status" class="form-control" id="status">
<option value="-1" {if condition="$status=='-1'"}selected{/if}>全部</option>
<option value="1" {if condition="$status=='1'"}selected{/if}>申请中</option>
<option value="2" {if condition="$status=='2'"}selected{/if}>退款成功</option>
<option value="3" {if condition="$status=='3'"}selected{/if}>退款失败</option>
</select>
</div>
<!--<button type="submit" class="btn btn-primary">搜索</button>-->
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>#</th>
<th>订单标题</th>
<th>订单来源</th>
<th>项目信息</th>
<th>用户信息</th>
<th>订单总价</th>
<th>微信pay_id</th>
<th>微信交易订单号</th>
<th>微信支付状态</th>
<th>退款状态</th>
<th>审核</th>
</tr>
</thead>
<tbody>
{volist name="$refund_list" id="vo" key="k" empty="暂时没有数据"}
<tr>
<td>{$k}</td>
<td>{$vo.order.title}</td>
<td>
{if condition="$vo.order.type == 1"}
活动报名订单
{else/}
购买会员卡订单
{/if}
</td>
<td>
<img src="{$vo.order.project.poster}" style="width:70px;display:block;margin:0 auto;" alt="">
<p style="padding:0;margin:0;text-align:center">{$vo.order.project.title}</p>
</td>
<td>
<p style="padding:0;margin:0;text-align:center">{$vo.order.user_info.nickname}</p>
<p style="padding:0;margin:0;text-align:center">{$vo.order.user_info.phone}</p>
<p style="padding:0;margin:0;text-align:center;color:#f60">
{if condition="$vo.order.user_info.is_vip == 1"}
{/if}
</p>
</td>
<td>{$vo.order.total_fee}</td>
<!--订单状态-->
<td>
{$vo.order.prepay_id}
</td>
<td>
{$vo.order.out_trade_no}
</td>
<td>
{$vo.order.trade_status}
</td>
<td>
<span style="color:{$vo.status_str.color}">
{$vo.status_str.name}
</span>
</td>
<td>
<a href="##" class="btn btn-xs btn-primary">退款</a>
<a href="##" class="btn btn-xs btn-warning">驳回</a>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$refund_list->render()}
</div>
</div>
</section>
<script type="text/javascript">
$("#status").change(function(){
$("#order-search").submit();
});
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/post/index')}">文章管理</a> <i class="fa fa-angle-right"></i> 发布文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" action="<?php echo url("@admin/Post/create")?>" id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章标题</label>
<div class="col-lg-10">
<input type="text" class="form-control validate[required]" name="title" id="title" placeholder="文章标题 ">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right" >文章封面</label>
<div class="col-lg-10">
<input id="input-b1" name="poster" type="file">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章标签</label>
<div class="col-lg-10">
<select class="selectpicker form-control" name="tags" multiple data-live-search="true">
{volist name="tag_list" name="tag_list" id="vo"}
<option value="{$vo.id}">{$vo.name}</option>
{/volist}
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章类型</label>
<div class="col-lg-10">
<select class="form-control" name="type" id="post_type">
<option value="1">手动编写文章</option>
<option value="2">链接到网络文章</option>
</select>
</div>
</div>
<div class="form-group" id="href" style="display: none">
<label for="title" class="col-sm-1 control-label text-right">请输入url</label>
<div class="col-lg-10">
<input type="text" name="href" class="form-control">
<code>http:// + 网址 或 https:// + 网址</code>
</div>
</div>
<div class="form-group" id="content">
<label for="content" class="col-sm-1 control-label text-right">文章内容</label>
<div class="col-lg-10">
<!-- 加载编辑器的容器 -->
<script id="post_container" name="content" type="text/plain" style="width: 100%">
</script>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-default" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
$(function(){
// 即时显示封面图
$('#poster').change(function(e){
var file = e.target.files[0];
preview(file, 0);
});
});
$("#post_type").change(function(){
var type = $(this).val();
if(type == 1){
$("#content").show();
$("#href").hide();
}else{
$("#href").show();
$("#content").hide();
}
});
// 初始化文件上传
$("#input-b1").fileinput({
language: 'zh',
showUpload:false, //是否显示上传按钮
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
UE.getEditor('post_container', {
//编辑区域大小
'initialFrameHeight' : '350',
'elementPathEnabled':false,
'autoHeight': true,
'autoHeightEnabled':true,
'autoFloatEnabled': true,
'iframeCssUrl': '/static/ueditor/themes/iframe.css',// 引入css
//定制菜单
'toolbars' : [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|', 'insertimage', '|',
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
],
]
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 文章管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET" action="<?php echo url('@admin/Post/index')?>">
<div class="form-group margin-right">
<label for="title">文章标题</label>
<input class="form-control" type="text" name="title" id="title" value="<?php echo input('title');?>" />
</div>
<button type="submit" class="btn btn-primary">搜索</button>
<a href='<?php echo url("@admin/Post/create")?>' type="button" class="btn btn-success" style="margin-left:30px;">
发布文章
</a>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>#</th>
<th>文章标题</th>
<th>封面</th>
<th>发布人</th>
<th>发布时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($articles as $k => $article):?>
<tr id="tr_<?php echo $article->id;?>">
<td><?php echo $article->id;?></td>
<td style="max-width:450px;">
{if condition="$article.type == 1"}
<a href="<?php echo url('@mob/Post/read', 'id='.$article->id);?>/" target='_blank'>
<?php echo $article->title;?>
</a>
{else/}
<a href="{$article->content}" target='_blank'>
<?php echo $article->title;?>
</a>
{/if}
</td>
<td><img style="width: 170px" src="{$article->poster}" alt=""></td>
<td><?php echo $article->admin->username;?></td>
<td><?php echo $article->created_at;?></td>
<td style="min-width:100px;">
<a href="<?php echo url('@admin/Post/update', 'id='.$article->id);?>" type="button" class="btn btn-primary btn-xs" data-toggle="tooltip" data-placement="top" data-original-title="编辑">
<i class="fa fa-pencil"></i>
</a>
<button oid="<?php echo $article->id;?>" type="button" class="btn btn-danger btn-xs btn-delete" data-toggle="tooltip" data-placement="top" data-original-title="删除">
<i class="fa fa-trash-o"></i>
</button>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$articles->render()}
</div>
</div>
</section>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<style type="text/css">
.progress-bar{
text-align: center;
}
</style>
<section class="wrapper">
<h3 class="top-back">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-left"></i> 编辑文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg !== ''):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-horizontal" enctype="multipart/form-data" method="POST" id="robot-create-form">
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">文章标题</label>
<div class="col-lg-8">
<input type="text" class="form-control validate[required]" name="title" id="title" value="<?php echo $article->title;?>">
</div>
</div>
<div class="form-group">
<label for="content" class="col-sm-2 control-label text-right">文章内容</label>
<div class="col-lg-8">
<!-- 加载编辑器的容器 -->
<script id="post_container" name="content" type="text/plain"><?php echo htmlspecialchars_decode($article->content); ?></script>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
var ue = UE.getEditor('post_container',{
// 图片上传配置路径
'serverUrl': "{:url('@admin/Ueditor/index')}",
'elementPathEnabled':false,
// autoHeight: true,
'autoHeightEnabled':false,
//编辑区域大小
'initialFrameHeight' : '300',
//定制菜单
'toolbars' : [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|', 'insertimage', '|',
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
],
]
});
/*
* 初始化分类
*/
$(function () {
});
</script>
\ No newline at end of file
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/post/index')}">文章管理</a> <i class="fa fa-angle-right"></i> 发布文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" action="<?php echo url("@admin/Post/create")?>" id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章标题</label>
<div class="col-lg-10">
<input type="text" class="form-control validate[required]" name="title" id="title" placeholder="文章标题 ">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right" >文章封面</label>
<div class="col-lg-10">
<input id="input-b1" name="poster" type="file">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章标签</label>
<div class="col-lg-10">
<select class="selectpicker form-control" name="tags" multiple data-live-search="true">
{volist name="tag_list" name="tag_list" id="vo"}
<option value="{$vo.id}">{$vo.name}</option>
{/volist}
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章类型</label>
<div class="col-lg-10">
<select class="form-control" name="type" id="post_type">
<option value="1">手动编写文章</option>
<option value="2">链接到网络文章</option>
</select>
</div>
</div>
<div class="form-group" id="href" style="display: none">
<label for="title" class="col-sm-1 control-label text-right">请输入url</label>
<div class="col-lg-10">
<input type="text" name="href" class="form-control">
<code>http:// + 网址 或 https:// + 网址</code>
</div>
</div>
<div class="form-group" id="content">
<label for="content" class="col-sm-1 control-label text-right">文章内容</label>
<div class="col-lg-10">
<!-- 加载编辑器的容器 -->
<script id="post_container" name="content" type="text/plain" style="width: 100%">
</script>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-default" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
$(function(){
// 即时显示封面图
$('#poster').change(function(e){
var file = e.target.files[0];
preview(file, 0);
});
});
$("#post_type").change(function(){
var type = $(this).val();
if(type == 1){
$("#content").show();
$("#href").hide();
}else{
$("#href").show();
$("#content").hide();
}
});
// 初始化文件上传
$("#input-b1").fileinput({
language: 'zh',
showUpload:false, //是否显示上传按钮
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
UE.getEditor('post_container', {
//编辑区域大小
'initialFrameHeight' : '350',
'elementPathEnabled':false,
'autoHeight': true,
'autoHeightEnabled':true,
'autoFloatEnabled': true,
'iframeCssUrl': '/static/ueditor/themes/iframe.css',// 引入css
//定制菜单
'toolbars' : [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|', 'insertimage', '|',
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
],
]
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 分类管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline pull-left" method="GET" action="{:url('admin/project/Catalogs')}" >
<div class="form-group margin-right">
<label for="name">分类名</label>
<input class="form-control" type="text" name="name" id="name" value="<?php echo input('title');?>" />
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
<div class=" pull-right">
<a href="{:url('admin/project/addCatalogs')}" class="btn btn-success">添加分类</a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<!--<colgroup>-->
<!--<col style="width: 2%;">-->
<!--<col style="width: 80%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 10%;">-->
<!--</colgroup>-->
<thead>
<tr>
<th>#</th>
<th>分类名称</th>
<th>分类图标</th>
<th>排序</th>
<th>发布时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{volist name="tag_list" id="vo" key="k" empty="暂时没有数据"}
<tr id="tr_{$vo.id}">
<td>{$k}</td>
<td>{$vo.name}</td>
<td><img style="width:90px" src="{$vo.poster}" alt=""></td>
<td>{$vo.sort}</td>
<td>{$vo.created_at}</td>
<td>
<a href="{:url('admin/project/editCatalogs',['id'=>$vo.id])}" class="btn btn-xs btn-primary"><i class="fa fa-pencil"></i></a>
<a href="javascript:" oid="{$vo.id}" class="btn btn-xs btn-danger btn-delete"><i class="fa fa-trash"></i></a>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$tag_list->render()}
</div>
</div>
</section>
<script type="text/javascript">
$("#myModal").modal();
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "{:url('admin/project/deleteCatalog')}";
var oid = _this.attr('oid');
showDialog("提示", "确定删除该分类吗?", function(){
// ajax post 方法
$.post(url, {id:oid}, function (res) {
// var res = JSON.parse(res);
if(res.code == 1){
// javascript 的默认弹出提示方法
_this.remove();
$("#tr_"+oid).fadeOut();
}else{
alert(res.msg);
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 城市管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline pull-left" method="GET" action="{:url('admin/project/citys')}" >
<div class="form-group margin-right">
<label for="name">城市名</label>
<input class="form-control" type="text" name="name" id="name" value="<?php echo input('title');?>" />
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
<form class="form-inline pull-right" method="post" action="{:url('admin/project/addCity')}">
<div class="form-group margin-right">
<label for="" style="font-weight: bold;color:#357ebd;font-size: 18px">添加城市:</label>
<label for="">城市名</label>
<input type="text" class="form-control" name="name">
</div>
<div class="form-group margin-right">
<label for="">排序</label>
<input type="number" class="form-control" style="width: 70px" name="sort">
</div>
<button type="submit" class="btn btn-success">添加</button>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<!--<colgroup>-->
<!--<col style="width: 2%;">-->
<!--<col style="width: 80%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 10%;">-->
<!--</colgroup>-->
<thead>
<tr>
<th>#</th>
<th>城市名称</th>
<!-- <th>引用次数</th> -->
<th>排序</th>
<th>发布时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{volist name="tag_list" id="vo" key="k" empty="暂时没有数据"}
<tr id="tr_{$vo.id}">
<td>{$k}</td>
<td>{$vo.name}</td>
<!-- <td>{$vo.used_num}</td> -->
<td>{$vo.sort}</td>
<td>{$vo.created_at}</td>
<td>
<a href="{:url('admin/project/editCity',['id'=>$vo.id])}" class="btn btn-xs btn-primary"><i class="fa fa-pencil"></i></a>
<a href="javascript:" oid="{$vo.id}" class="btn btn-xs btn-danger btn-delete"><i class="fa fa-trash"></i></a>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$tag_list->render()}
</div>
</div>
</section>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "{:url('admin/project/deleteCity')}";
var oid = _this.attr('oid');
showDialog("提示", "确定删除该城市吗?", function(){
// ajax post 方法
$.post(url, {id:oid}, function (res) {
// var res = JSON.parse(res);
if(res.code == 1){
// javascript 的默认弹出提示方法
_this.remove();
$("#tr_"+oid).fadeOut();
}else{
alert(res.msg);
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> <a href="{:url('admin/project/catalogs')}">分类管理</a> <i class="fa fa-angle-right"></i> 修改分类</h3>
<!-- 分割线 -->
<hr>
<div class="col-xs-12" >
<form method="post" class="form-horizontal" enctype="multipart/form-data" action="{:url('admin/project/updateCatalogs')}">
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">分类名</label>
<div class="col-lg-10">
<input type="hidden" name="id" value="{$id}">
<input type="text" class="form-control" name="name" value="{$tag_info.name}">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right" >文章封面</label>
<div class="col-lg-10">
<input type="hidden" name='old_poster' value="{$tag_info.poster}">
<img src="{$tag_info.poster}" style="width:170px;margin-bottom:10px" alt="" id="poster_view">
<input id="input-b1" name="poster" type="file">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">排序</label>
<div class="col-lg-10">
<input type="number" class="form-control" name="sort" value="{$tag_info.sort}">
</div>
</div>
<button type="submit" class="btn btn-success">修改</button>
</form>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
// 初始化文件上传
var fileInput = $("#input-b1").fileinput({
language: 'zh',
showUpload:false, //是否显示上传按钮
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
$("#input-b1").change(function(data){
if(this.files.length>0){
$("#poster_view").hide();
}else{
$("#poster_view").show();
}
})
$("#input-b1").on("fileclear",function(event, data, msg){
$("#poster_view").show();
});
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> <a href="{:url('admin/project/citys')}">城市管理</a> <i class="fa fa-angle-right"></i> 修改城市</h3>
<!-- 分割线 -->
<hr>
<div class="col-xs-12" style="width: 300px">
<form class="" method="post" action="{:url('admin/project/updateCity')}">
<input type="hidden" name="id" value="{$id}">
<div class="form-group margin-right">
<label for="">标签名</label>
<input type="text" class="form-control" name="name" value="{$tag_info.name}">
</div>
<div class="form-group margin-right">
<label for="">排序</label>
<input type="number" class="form-control" name="sort" value="{$tag_info.sort}">
</div>
<button type="submit" class="btn btn-success">修改</button>
</form>
</div>
</section>
<script type="text/javascript">
$("#myModal").modal();
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> <a href="{:url('admin/project/tags')}">标签管理</a> <i class="fa fa-angle-right"></i> 修改标签</h3>
<!-- 分割线 -->
<hr>
<div class="col-xs-12" style="width: 300px">
<form class="" method="post" action="{:url('admin/project/updateTag')}">
<input type="hidden" name="id" value="{$id}">
<div class="form-group margin-right">
<label for="">标签名</label>
<input type="text" class="form-control" name="name" value="{$tag_info.name}">
</div>
<div class="form-group margin-right">
<label for="">排序</label>
<input type="number" class="form-control" name="sort" value="{$tag_info.sort}">
</div>
<button type="submit" class="btn btn-success">修改</button>
</form>
</div>
</section>
<script type="text/javascript">
$("#myModal").modal();
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 活动商家列表</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline pull-left" method="GET" action="{:url('admin/project/index')}" >
<div class="form-group margin-right">
<label for="title">活动/商家名称</label>
<input class="form-control" type="text" name="title" id="title" value="<?php echo input('title');?>" />
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<!--<colgroup>-->
<!--<col style="width: 2%;">-->
<!--<col style="width: 80%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 10%;">-->
<!--</colgroup>-->
<thead>
<tr>
<th>#</th>
<th>活动/商家名称</th>
<th>封面图</th>
<th>国内/国外</th>
<th>城市</th>
<th>活动时间</th>
<th>报名截止时间</th>
<th>分类</th>
<th>标签</th>
<th>价格</th>
<th>会员价</th>
<th>状态</th>
<th>总量</th>
<th>已售</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{volist name="project_list" id="vo" key="k" empty="暂时没有数据"}
<tr id="tr_{$vo.id}">
<td>{$k}</td>
<td>{$vo.title}</td>
<td><img style="width:90px" src="{$vo.poster}" alt=""></td>
<td>
{if condition="$vo.region_type==1"}
国内
{else/}
国外
{/if}
</td>
<td>{$vo.city_str.name}</td>
<td>{$vo.time_period}</td>
<td>{$vo.sign_endtime}</td>
<td>{$vo.catalog_id_str.name}</td>
<td width="170px">
{$vo.tags}
</td>
<td>{$vo.price}</td>
<td>{$vo.vip_price}</td>
<td>{$vo.sign_endtime_str}</td>
<td>{$vo.sign_limits}</td>
<td>{$vo.sign_num}</td>
<td>
<a href="{:url('admin/project/updateProject',['id'=>$vo.id])}" class="btn btn-xs btn-primary"><i class="fa fa-pencil"></i></a>
<a href="javascript:" oid="{$vo.id}" class="btn btn-xs btn-danger btn-delete"><i class="fa fa-trash"></i></a>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$project_list->render()}
</div>
</div>
</section>
<script type="text/javascript">
$("#myModal").modal();
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "{:url('admin/project/delete')}";
var oid = _this.attr('oid');
showDialog("提示", "确定删除该项目/商家吗?", function(){
// ajax post 方法
$.post(url, {id:oid}, function (res) {
// var res = JSON.parse(res);
if(res.code == 1){
// javascript 的默认弹出提示方法
_this.remove();
$("#tr_"+oid).fadeOut();
}else{
alert(res.msg);
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 标签管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline pull-left" method="GET" action="{:url('admin/project/tags')}" >
<div class="form-group margin-right">
<label for="name">标签名</label>
<input class="form-control" type="text" name="name" id="name" value="<?php echo input('title');?>" />
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
<form class="form-inline pull-right" method="post" action="{:url('admin/project/addTag')}">
<div class="form-group margin-right">
<label for="" style="font-weight: bold;color:#357ebd;font-size: 18px">添加标签:</label>
<label for="">标签名</label>
<input type="text" class="form-control" name="name">
</div>
<div class="form-group margin-right">
<label for="">排序</label>
<input type="number" class="form-control" style="width: 70px" name="sort">
</div>
<button type="submit" class="btn btn-success">添加</button>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<!--<colgroup>-->
<!--<col style="width: 2%;">-->
<!--<col style="width: 80%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 10%;">-->
<!--</colgroup>-->
<thead>
<tr>
<th>#</th>
<th>标签名称</th>
<th>引用次数</th>
<th>排序</th>
<th>发布时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{volist name="tag_list" id="vo" key="k" empty="暂时没有数据"}
<tr id="tr_{$vo.id}">
<td>{$k}</td>
<td>{$vo.name}</td>
<td>{$vo.used}</td>
<td>{$vo.sort}</td>
<td>{$vo.created_at}</td>
<td>
<a href="{:url('admin/project/editTag',['id'=>$vo.id])}" class="btn btn-xs btn-primary"><i class="fa fa-pencil"></i></a>
<a href="javascript:" oid="{$vo.id}" class="btn btn-xs btn-danger btn-delete"><i class="fa fa-trash"></i></a>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$tag_list->render()}
</div>
</div>
</section>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "{:url('admin/project/deleteTag')}";
var oid = _this.attr('oid');
showDialog("提示", "确定删除该标签吗?", function(){
// ajax post 方法
$.post(url, {id:oid}, function (res) {
// var res = JSON.parse(res);
if(res.code == 1){
// javascript 的默认弹出提示方法
_this.remove();
$("#tr_"+oid).fadeOut();
}else{
alert(res.msg);
}
});
});
});
});
</script>
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment