优化详情页权限,移除发帖token及页脚版本
This commit is contained in:
parent
10a3660d33
commit
f12a531500
@ -3,11 +3,11 @@
|
||||
* 升级包规定的目录结构
|
||||
* xxx_版本号.zip(如:xxx_1.0.0.zip)
|
||||
* |
|
||||
* |————mysql
|
||||
* |————runtime
|
||||
* | |
|
||||
* | |___mysql_update.sql(更新脚本) //create table test(id init(11)); create table test2(id init(11));
|
||||
* | |___update.sql(更新脚本) //create table test(id init(11)); create table test2(id init(11));
|
||||
*
|
||||
* | |___mysql_rockback.sql(回滚脚本) //drop table test; //drop table test2;
|
||||
* | |___rockback.sql(回滚脚本) //drop table test; //drop table test2;
|
||||
* |
|
||||
* |____php
|
||||
*
|
||||
@ -273,7 +273,7 @@ class Upgrade extends AdminController
|
||||
}
|
||||
|
||||
//升级sql操作
|
||||
$upSql = $zipPath.'runtime/mysql_update.sql';
|
||||
$upSql = $zipPath.'runtime/update.sql';
|
||||
if(file_exists($upSql))
|
||||
{
|
||||
$sqlRes = $this->db_update($upSql);
|
||||
|
@ -2,11 +2,13 @@
|
||||
namespace app\index\controller;
|
||||
|
||||
use think\facade\View;
|
||||
use app\common\controller\BaseController;
|
||||
|
||||
class Error
|
||||
class Error extends BaseController
|
||||
{
|
||||
public function __call($method, $args)
|
||||
{
|
||||
return View::fetch('../view/404');
|
||||
View::assign('jspage','');
|
||||
return View::fetch('../../404');
|
||||
}
|
||||
}
|
@ -19,8 +19,8 @@ Route::group(function () {
|
||||
'ename' => '\w+',
|
||||
'page' => '\d+',
|
||||
]);
|
||||
Route::rule('add','article/add');
|
||||
Route::rule('edit/[:id]','article/edit');
|
||||
Route::rule('add','Article/add');
|
||||
Route::rule('edit/[:id]','Article/edit');
|
||||
//Route::rule('del/:id','article/delete');
|
||||
});
|
||||
Route::group(function () {
|
||||
|
@ -22,7 +22,8 @@ return [
|
||||
// 域名绑定(自动多应用模式有效)
|
||||
'domain_bind' => [
|
||||
//'www' => 'index',
|
||||
//'admin' => 'admin'
|
||||
//'adm' => 'admin',
|
||||
//'api' => 'api'
|
||||
],
|
||||
// 禁止URL访问的应用列表(自动多应用模式有效)
|
||||
'deny_app_list' => [],
|
||||
@ -33,10 +34,10 @@ return [
|
||||
// 错误显示信息,非调试模式有效
|
||||
'error_message' => '页面错误!请稍后再试~',
|
||||
// 显示错误信息
|
||||
'show_error_msg' => false,
|
||||
'show_error_msg' => true,
|
||||
//异常页面模板
|
||||
'http_exception_template' => [
|
||||
404 => '../view/404.html',
|
||||
500 => '../view/404.html'
|
||||
404 => '404.html',
|
||||
500 => '404.html'
|
||||
]
|
||||
];
|
||||
|
@ -7,7 +7,7 @@ return [
|
||||
//应用名,此项不可更改
|
||||
'appname' => 'TaoLer',
|
||||
//版本配置
|
||||
'version' => '1.8.2',
|
||||
'version' => '1.8.3',
|
||||
//加盐
|
||||
'salt' => 'taoler',
|
||||
//数据库备份目录
|
||||
@ -17,9 +17,9 @@ return [
|
||||
'email_notice' => 0,
|
||||
'cate_show' => 0,
|
||||
'area_show' => 0,
|
||||
'regist_check' => 0,
|
||||
'posts_check' => 0,
|
||||
'commnets_check' => 0,
|
||||
'regist_check' => 1,
|
||||
'posts_check' => 1,
|
||||
'commnets_check' => 1,
|
||||
|
||||
]
|
||||
|
||||
|
@ -16,7 +16,7 @@ return [
|
||||
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
|
||||
'auto_rule' => 1,
|
||||
// 模板目录名
|
||||
'view_dir_name' => 'view/'.$template,
|
||||
'view_dir_name' => 'view\\'.$template,
|
||||
// 模板后缀
|
||||
'view_suffix' => 'html',
|
||||
// 模板文件名分隔符
|
||||
|
@ -9,7 +9,7 @@
|
||||
<div class="fly-panel">
|
||||
<div class="fly-none">
|
||||
<h2><i class="iconfont icon-404"></i></h2>
|
||||
<p>页面或者数据被<a href="http://www.aieok.com"> 纸飞机</a>运到火星了,啥都看不到了…</p>
|
||||
<p>页面或者数据被<a href="/"> 纸飞机啊!</a>运到火星了,啥都看不到了…</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
layui.cache.page = 'user';
|
||||
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: {$user.id ? $user.id : -1}
|
||||
|
@ -1,86 +0,0 @@
|
||||
# TaoLer
|
||||
|
||||
> TaoLer是一个简单迅捷的轻论坛系统,适用于个人或组织区域型信息交流发布平台。
|
||||
|
||||
* 官网:https://www.aieok.com:8443
|
||||
* 前台:http://bbs.aieok.com:888
|
||||
* 后台:http://adm.aieok.com:888
|
||||
* 账号:test
|
||||
* 密码:test123
|
||||
* 版本:TaoLer 1.7.26
|
||||
* 日期:2021.7.24
|
||||
|
||||
#### 项目地址
|
||||
|
||||
1. gitee https://www.gitee.com/toogee/Taoler
|
||||
2. github https://www.github.com/taoser/TaoLer
|
||||
3. composer create-project taoser/taoler
|
||||
|
||||
#### 介绍
|
||||
|
||||
1. 采用动态密码加密,相同密码在入库时具有唯一性,即使管理员也无法破解,用户信息安全牢固。
|
||||
2. 系统采用最新版TinkPHP6框架开发,底层安全可靠,数据查询更快,运行效率更高,网站速度更快。
|
||||
3. 自适应前端,桌面和移动端访问界面友好简洁,模块清晰。
|
||||
4. 完善的后台系统,管理便捷,动态菜单和权限角色分配系统。支持3级菜单和无限极分类。
|
||||
5. 双升级系统,可支持自动和手动升级。可在线检测并升级系统,保持网站的更新和安全。
|
||||
6. 代码开源,不设暗门操作,更安全。
|
||||
7. 项目会长期维护,优化更新。
|
||||
|
||||
|
||||
#### 构架组成
|
||||
- 1.x版本构架:
|
||||
- 构架:Tinkphp6 + layui2.6
|
||||
- 环境:php7 + mysql
|
||||
- 前端:Fly template V3.0
|
||||
|
||||
#### 构架介绍
|
||||
快速、简单的面向对象的轻量级PHP开发框架,出色的性能和至简代码的,更注重易用性。代码维护方便。
|
||||
layui前端
|
||||
极简、丰盈,简单高效,模块化UI框架,体积轻盈,组件丰盈。
|
||||
Fly模板:
|
||||
一款至简的社区模板,适合政府机构、教育机构、事业单位、商业企业、个人站长等众多行业领域。
|
||||
|
||||
#### 安装教程
|
||||
1. 首选确保满目使用环境要求,php > 7.2, mysql > 5.7.3
|
||||
2. git下载:https://gitee.com/toogee/TaoLer
|
||||
官网下载:https://www.aieok.com
|
||||
3. 解压后,项目绑定域名为public目录对外访问,如果使用nginx服务器,首先设置伪静态Nginx.conf。
|
||||
```html
|
||||
location / { // …..省略部分代码
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^(.*)$ /index.php?s=/$1 last;
|
||||
}
|
||||
}
|
||||
```
|
||||
4. 首次安装,访问域名http://www.youdomain.com可自动跳转到/install/index进行引导安装,重新安装需删除public目录下install.lock。
|
||||
5. 安装前需要先创建mysql数据库(准备:数据库连接地址,数据库用户名,数据库密码,数据库端口,建好在数据库名)
|
||||
6. 请牢记安装设置的管理员用户名和密码,默认admin/123456。前后台的管理员密码一致。前后端管理员账户是独立的,前端主要对文章内容的审查管理等操作。
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. 安装后本系统已配置默认演示数据,可以删除原数据或者进行数据的修改
|
||||
2. 后台可设置分类cate,一定要设置英文别名
|
||||
3. 首页有置顶模块,列表文章模块,右侧包含广告模块,回复展示模块
|
||||
|
||||
#### 文档
|
||||
|
||||
参考官网分享文章
|
||||
|
||||
aieok.com (http://wiki.aieok.com)
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
|
||||
#### 版权信息
|
||||
|
||||
非商业可免费使用,没有功能限制,但不能更改版本信息,如需更改可购买授权。
|
||||
|
||||
本项目包含的第三方源码和二进制文件之版权信息另行标注。
|
||||
|
||||
版权所有Copyright © 2020-2021 by aieok.com (https://www.aieok.com)
|
||||
|
||||
All rights reserved。
|
@ -1,192 +0,0 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app;
|
||||
|
||||
use think\App;
|
||||
use think\exception\ValidateException;
|
||||
use think\Validate;
|
||||
use think\Response;
|
||||
use think\exception\HttpResponseException;
|
||||
|
||||
/**
|
||||
* 控制器基础类
|
||||
*/
|
||||
abstract class BaseController
|
||||
{
|
||||
/**
|
||||
* Request实例
|
||||
* @var \think\Request
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* 应用实例
|
||||
* @var \think\App
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* 是否批量验证
|
||||
* @var bool
|
||||
*/
|
||||
protected $batchValidate = false;
|
||||
|
||||
/**
|
||||
* 控制器中间件
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [];
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
* @access public
|
||||
* @param App $app 应用对象
|
||||
*/
|
||||
public function __construct(App $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->request = $this->app->request;
|
||||
|
||||
// 控制器初始化
|
||||
$this->initialize();
|
||||
}
|
||||
|
||||
// 初始化
|
||||
protected function initialize()
|
||||
{}
|
||||
|
||||
/**
|
||||
* 验证数据
|
||||
* @access protected
|
||||
* @param array $data 数据
|
||||
* @param string|array $validate 验证器名或者验证规则数组
|
||||
* @param array $message 提示信息
|
||||
* @param bool $batch 是否批量验证
|
||||
* @return array|string|true
|
||||
* @throws ValidateException
|
||||
*/
|
||||
protected function validate(array $data, $validate, array $message = [], bool $batch = false)
|
||||
{
|
||||
if (is_array($validate)) {
|
||||
$v = new Validate();
|
||||
$v->rule($validate);
|
||||
} else {
|
||||
if (strpos($validate, '.')) {
|
||||
// 支持场景
|
||||
[$validate, $scene] = explode('.', $validate);
|
||||
}
|
||||
$class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
|
||||
$v = new $class();
|
||||
if (!empty($scene)) {
|
||||
$v->scene($scene);
|
||||
}
|
||||
}
|
||||
|
||||
$v->message($message);
|
||||
|
||||
// 是否批量验证
|
||||
if ($batch || $this->batchValidate) {
|
||||
$v->batch(true);
|
||||
}
|
||||
|
||||
return $v->failException(true)->check($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作错误跳转
|
||||
* @param mixed $msg 提示信息
|
||||
* @param string $url 跳转的URL地址
|
||||
* @param mixed $data 返回的数据
|
||||
* @param integer $wait 跳转等待时间
|
||||
* @param array $header 发送的Header信息
|
||||
* @return void
|
||||
*/
|
||||
protected function error($msg = '', string $url = null, $data = '', int $wait = 3, array $header = []): Response
|
||||
{
|
||||
if (is_null($url)) {
|
||||
$url = request()->isAjax() ? '' : 'javascript:history.back(-1);';
|
||||
} elseif ($url) {
|
||||
$url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : app('route')->buildUrl($url);
|
||||
}
|
||||
|
||||
$result = [
|
||||
'code' => 0,
|
||||
'msg' => $msg,
|
||||
'data' => $data,
|
||||
'url' => $url,
|
||||
'wait' => $wait,
|
||||
];
|
||||
|
||||
$type = (request()->isJson() || request()->isAjax()) ? 'json' : 'html';
|
||||
if ('html' == strtolower($type)) {
|
||||
$type = 'jump';
|
||||
}
|
||||
|
||||
$response = Response::create($result, $type)->header($header)->options(['jump_template' => app('config')->get('app.dispatch_error_tmpl')]);
|
||||
|
||||
throw new HttpResponseException($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回封装后的API数据到客户端
|
||||
* @param mixed $data 要返回的数据
|
||||
* @param integer $code 返回的code
|
||||
* @param mixed $msg 提示信息
|
||||
* @param string $type 返回数据格式
|
||||
* @param array $header 发送的Header信息
|
||||
* @return Response
|
||||
*/
|
||||
protected function result($data, int $code = 0, $msg = '', string $type = '', array $header = []): Response
|
||||
{
|
||||
$result = [
|
||||
'code' => $code,
|
||||
'msg' => $msg,
|
||||
'time' => time(),
|
||||
'data' => $data,
|
||||
];
|
||||
|
||||
$type = $type ?: 'json';
|
||||
$response = Response::create($result, $type)->header($header);
|
||||
|
||||
throw new HttpResponseException($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作成功跳转
|
||||
* @param mixed $msg 提示信息
|
||||
* @param string $url 跳转的URL地址
|
||||
* @param mixed $data 返回的数据
|
||||
* @param integer $wait 跳转等待时间
|
||||
* @param array $header 发送的Header信息
|
||||
* @return void
|
||||
*/
|
||||
protected function success($msg = '', string $url = null, $data = '', int $wait = 3, array $header = []): Response
|
||||
{
|
||||
if (is_null($url) && isset($_SERVER["HTTP_REFERER"])) {
|
||||
$url = $_SERVER["HTTP_REFERER"];
|
||||
} elseif ($url) {
|
||||
$url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : app('route')->buildUrl($url);
|
||||
}
|
||||
|
||||
$result = [
|
||||
'code' => 1,
|
||||
'msg' => $msg,
|
||||
'data' => $data,
|
||||
'url' => $url,
|
||||
'wait' => $wait,
|
||||
];
|
||||
|
||||
$type = (request()->isJson() || request()->isAjax()) ? 'json' : 'html';
|
||||
// 把跳转模板的渲染下沉,这样在 response_send 行为里通过getData()获得的数据是一致性的格式
|
||||
if ('html' == strtolower($type)) {
|
||||
$type = 'jump';
|
||||
}
|
||||
|
||||
$response = Response::create($result, $type)->header($header)->options(['jump_template' => app('config')->get('app.dispatch_success_tmpl')]);
|
||||
|
||||
throw new HttpResponseException($response);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
<?php
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class User extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'name|用户名' => 'require|min:2|max:18|chsDash|unique:user',
|
||||
'email|邮箱' => 'require|email|unique:user',
|
||||
'password|密码' => 'require|min:6|max:20',
|
||||
'repassword|确认密码'=>'require|confirm:password',
|
||||
'nickname|昵称' => 'require|min:2|max:20',
|
||||
'captcha|验证码' => 'require|captcha',
|
||||
'city|城市' => 'min:2|max:25',
|
||||
'sign|签名' => 'min:10|max:100',
|
||||
'sex|性别' => 'require',
|
||||
'nowpass|新密码' => 'require|min:6|max:20',
|
||||
'code|校验码' => 'require|length:4',
|
||||
];
|
||||
|
||||
//邮件邮件码验证
|
||||
public function sceneCode()
|
||||
{
|
||||
return $this->only(['code']);
|
||||
}
|
||||
|
||||
//name登陆验证场景
|
||||
public function sceneLoginName()
|
||||
{
|
||||
return $this->only(['name','password','captcha'])
|
||||
->remove('name', 'unique');
|
||||
}
|
||||
|
||||
//emai登陆验证场景
|
||||
public function sceneLoginEmail()
|
||||
{
|
||||
return $this->only(['email','password','captcha'])
|
||||
->remove('email', 'unique');
|
||||
}
|
||||
|
||||
//注册验证场景
|
||||
public function sceneReg()
|
||||
{
|
||||
return $this->only(['name','email','password','repassword','captcha']);
|
||||
|
||||
}
|
||||
|
||||
//密码找回
|
||||
public function sceneForget()
|
||||
{
|
||||
return $this->only(['email','captcha'])
|
||||
->remove('email', 'unique');
|
||||
}
|
||||
|
||||
//密码重设
|
||||
public function sceneRepass()
|
||||
{
|
||||
return $this->only(['password','repassword','captcha']);
|
||||
}
|
||||
|
||||
//密码重置
|
||||
public function sceneRespass()
|
||||
{
|
||||
return $this->only(['password','repassword','captcha']);
|
||||
}
|
||||
|
||||
//用户资料
|
||||
public function sceneSet()
|
||||
{
|
||||
return $this->only(['email','nickname','ctity','sex','sign'])
|
||||
->remove('email','unique');
|
||||
}
|
||||
|
||||
//设置新密码
|
||||
public function sceneSetpass()
|
||||
{
|
||||
return $this->only(['nowpass','password','repassword']);
|
||||
}
|
||||
}
|
@ -1,380 +0,0 @@
|
||||
<?php
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use think\facade\View;
|
||||
use think\facade\Request;
|
||||
use think\facade\Db;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Config;
|
||||
use app\common\model\Comment;
|
||||
use app\common\model\Article as ArticleModel;
|
||||
use app\common\model\Slider;
|
||||
use think\exception\ValidateException;
|
||||
use taoler\com\Message;
|
||||
use app\common\lib\Msgres;
|
||||
use app\common\lib\Uploads;
|
||||
|
||||
class Article extends BaseController
|
||||
{
|
||||
protected $middleware = [
|
||||
'logincheck' => ['except' => ['cate','detail','download'] ],
|
||||
];
|
||||
|
||||
//文章分类
|
||||
public function cate()
|
||||
{
|
||||
//非法请求参数,抛出异常
|
||||
if(count(Request::param()) >3){
|
||||
// 抛出 HTTP 异常
|
||||
throw new \think\exception\HttpException(404, '请求异常');
|
||||
}
|
||||
|
||||
//获取分类ID
|
||||
$ename = Request::param('ename');
|
||||
$type = Request::param('type') ?? 'all';
|
||||
|
||||
//分页伪静态
|
||||
$str = Request::baseUrl(); //不带参数在url
|
||||
$patterns = "/\d+/"; //数字正则
|
||||
preg_match($patterns,$str,$arr); //正则查询页码出现在位置
|
||||
//检测route配置中是否设置了伪静态后缀
|
||||
$suffix = Config::get('route.url_html_suffix') ? '.'.Config::get('route.url_html_suffix') : '/';
|
||||
if(Config::get('route.url_html_suffix')){
|
||||
//伪静态有后缀
|
||||
if(isset($arr[0])){
|
||||
$page = $arr[0];
|
||||
$url = strstr($str,$arr[0],true);
|
||||
} else {
|
||||
$page = 1;
|
||||
$url = strstr($str,'.html',true).'/';
|
||||
}
|
||||
} else {
|
||||
//伪静态后缀false
|
||||
if(isset($arr[0])){
|
||||
$page = $arr[0];
|
||||
$url = strstr($str,$arr[0],true);
|
||||
} else {
|
||||
$page = 1;
|
||||
$url = $str.'/';
|
||||
}
|
||||
}
|
||||
//分类列表
|
||||
$article = new ArticleModel();
|
||||
$artList = $article->getCateList($ename,$type,$page,$url,$suffix);
|
||||
|
||||
// 热议文章
|
||||
$artHot = $article->getArtHot(10);
|
||||
|
||||
//广告
|
||||
$ad = new Slider();
|
||||
//分类图片
|
||||
$ad_cateImg = $ad->getSliderList(3);
|
||||
//分类钻展赞助
|
||||
$ad_comm = $ad->getSliderList(6);
|
||||
|
||||
View::assign(['type'=>$type,'artList'=>$artList,'artHot'=>$artHot,'ad_cateImg'=>$ad_cateImg,'ad_comm'=>$ad_comm,'jspage'=>'jie']);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//文章详情页
|
||||
public function detail($id)
|
||||
{
|
||||
$article = new ArticleModel();
|
||||
$artDetail = $article->getArtDetail($id);
|
||||
if(!$artDetail){
|
||||
// 抛出 HTTP 异常
|
||||
throw new \think\exception\HttpException(404, '异常消息');
|
||||
}
|
||||
$comments = $artDetail->comments()->where('status',1)->order(['cai'=>'asc','create_time'=>'asc'])->paginate(10);
|
||||
//$comment = new \app\common\model\Comment();
|
||||
//$comments = $comment->getComment($id);
|
||||
//dump($comments);
|
||||
$artDetail->inc('pv')->update();
|
||||
$pv = Db::name('article')->field('pv')->where('id',$id)->value('pv');
|
||||
$download = $artDetail->upzip ? download($artDetail->upzip,'file') : '';
|
||||
|
||||
/*
|
||||
$nt = time();
|
||||
$ft = $article->comments;
|
||||
$ct[] = [];
|
||||
foreach($ft as $c){
|
||||
$t = $c->create_time;
|
||||
$ct[] = intval(($nt - strtotime($t))/86400);
|
||||
}
|
||||
dump($nt);
|
||||
dump($ct);
|
||||
$this->assign('ct',$ct);
|
||||
$article->append(['comment.ct'])->toArray();
|
||||
//halt($article);
|
||||
*/
|
||||
|
||||
// 热议文章
|
||||
$artHot = $article->getArtHot(10);
|
||||
//广告
|
||||
$ad = new Slider();
|
||||
//分类图片
|
||||
$ad_artImg = $ad->getSliderList(4);
|
||||
//分类钻展赞助
|
||||
$ad_comm = $ad->getSliderList(7);
|
||||
|
||||
View::assign(['article'=>$artDetail,'pv'=>$pv,'comments'=>$comments,'artHot'=>$artHot,'ad_art'=>$ad_artImg,'ad_comm'=>$ad_comm,$download,'jspage'=>'jie']);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//文章评论
|
||||
public function comment()
|
||||
{
|
||||
if (Request::isAjax()){
|
||||
//获取评论
|
||||
$data = Request::only(['content','article_id','user_id']);
|
||||
$sendId = $data['user_id'];
|
||||
if(empty($data['content'])){
|
||||
return json(['code'=>0, 'msg'=>'评论不能为空!']);
|
||||
}
|
||||
|
||||
//用户留言存入数据库
|
||||
if (Comment::create($data)) {
|
||||
//站内信
|
||||
$article = Db::name('article')->field('id,title,user_id')->where('id',$data['article_id'])->find();
|
||||
$title = $article['title'];
|
||||
$link = (string) url('article/detail',['id'=>$data['article_id']]);
|
||||
|
||||
//评论中回复@user comment
|
||||
$preg = "/@([^@\s]*)\s/";
|
||||
preg_match($preg,$data['content'],$username);
|
||||
if(isset($username[1])){
|
||||
$receveId = Db::name('user')->whereOr('nickname', $username[1])->whereOr('name', $username[1])->value('id');
|
||||
} else {
|
||||
$receveId = $article['user_id'];
|
||||
}
|
||||
$data = ['title'=>$title,'content'=>'评论通知','link'=>$link,'user_id'=>$sendId,'type'=>2]; //type=2为评论留言
|
||||
Message::sendMsg($sendId,$receveId,$data);
|
||||
if(Config::get('taoler.config.email_notice')) mailto($this->showUser(1)['email'],'评论审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚对 <b>'.$title.'</b> 发表了评论,请尽快处理。');
|
||||
$res = ['code'=>0, 'msg'=>'留言成功'];
|
||||
} else {
|
||||
$res = ['code'=>-1, 'msg'=>'留言失败'];
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加帖子文章
|
||||
* @return string|\think\Response|\think\response\Json|void
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (Request::isAjax()) {
|
||||
$data = Request::only(['cate_id', 'title', 'title_color', 'user_id', 'content', 'upzip', 'tags', 'captcha']);
|
||||
$validate = new \app\common\validate\Article; //调用验证器
|
||||
$result = $validate->scene('Artadd')->check($data); //进行数据验证
|
||||
if (true !== $result) {
|
||||
return Msgres::error($validate->getError());
|
||||
}
|
||||
|
||||
//获取内容图片音视频标识
|
||||
$iva= $this->hasIva($data['content']);
|
||||
$data = array_merge($data,$iva);
|
||||
|
||||
$article = new ArticleModel();
|
||||
$result = $article->add($data);
|
||||
if ($result == 1) {
|
||||
$aid = Db::name('article')->max('id');
|
||||
$link = (string)url('article/detail', ['id' => $aid]);
|
||||
//清除文章tag缓存
|
||||
Cache::tag('tagArtDetail')->clear();
|
||||
if(Config::get('taoler.config.email_notice')) mailto($this->showUser(1)['email'],'发帖审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚发表了 <b>'.$data['title'].'</b> 新的帖子,请尽快处理。');
|
||||
$res = Msgres::success('add_success', $link);
|
||||
} else {
|
||||
$res = Msgres::error('add_error');
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
View::assign(['jspage'=>'jie']);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑文章
|
||||
* @param $id
|
||||
* @return string|\think\Response|\think\response\Json|void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$article = ArticleModel::find($id);
|
||||
//编辑
|
||||
if(Request::isAjax()){
|
||||
$data = Request::only(['id','cate_id','title','title_color','user_id','content','upzip','tags','captcha']);
|
||||
$validate = new \app\common\validate\Article(); //调用验证器
|
||||
$res = $validate->scene('Artadd')->check($data); //进行数据验证
|
||||
|
||||
if(true !== $res){
|
||||
return Msgres::error($validate->getError());
|
||||
} else {
|
||||
//获取内容图片音视频标识
|
||||
$iva= $this->hasIva($data['content']);
|
||||
$data = array_merge($data,$iva);
|
||||
|
||||
$result = $article->edit($data);
|
||||
if($result == 1) {
|
||||
//删除原有缓存显示编辑后内容
|
||||
Cache::delete('article_'.$id);
|
||||
$link = (string) url('article/detail',['id'=> $id]);
|
||||
$editRes = Msgres::success('edit_success',$link);
|
||||
} else {
|
||||
$editRes = Msgres::error($result);
|
||||
}
|
||||
return $editRes;
|
||||
}
|
||||
}
|
||||
//查询标签
|
||||
$tag = $article->tags;
|
||||
$attr = explode(',',$tag);
|
||||
$tags = [];
|
||||
foreach($attr as $key=>$v){
|
||||
if ($v !='') {
|
||||
$tags[] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
View::assign(['article'=>$article,'tags'=>$tags,'jspage'=>'jie']);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//删除帖子
|
||||
public function delete()
|
||||
{
|
||||
$article = ArticleModel::find(input('id'));
|
||||
$result = $article->together(['comments'])->delete();
|
||||
if($result) {
|
||||
$res = Msgres::success('delete_success');
|
||||
} else {
|
||||
$res = Msgres::error('delete_error');
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function uploads()
|
||||
{
|
||||
$type = Request::param('type');
|
||||
$uploads = new Uploads();
|
||||
switch ($type){
|
||||
case 'image':
|
||||
$upRes = $uploads->put('file','article_pic',1024,'image');
|
||||
break;
|
||||
case 'zip':
|
||||
$upRes = $uploads->put('file','article_zip',1024,'application|image');
|
||||
break;
|
||||
case 'video':
|
||||
$upRes = $uploads->put('file','article_video',102400,'video|audio');
|
||||
break;
|
||||
case 'audio':
|
||||
$upRes = $uploads->put('file','article_audio',102400,'audio');
|
||||
break;
|
||||
default:
|
||||
$upRes = $uploads->put('file','article_file',1024,'image');
|
||||
break;
|
||||
}
|
||||
return $upRes;
|
||||
}
|
||||
|
||||
//附件下载
|
||||
public function download($id)
|
||||
{
|
||||
$zipdir = Db::name('article')->where('id',$id)->value('upzip');
|
||||
$zip = substr($zipdir,1);
|
||||
Db::name('article')->cache(true)->where('id',$id)->inc('downloads')->update();
|
||||
//删除缓存显示下载后数据
|
||||
Cache::delete('article_'.$id);
|
||||
return download($zip,'my');
|
||||
}
|
||||
|
||||
//添加tag
|
||||
public function tags()
|
||||
{
|
||||
$data = Request::only(['tags']);
|
||||
$att = explode(',',$data['tags']);
|
||||
$tags = [];
|
||||
foreach($att as $v){
|
||||
if ($v !='') {
|
||||
$tags[] = $v;
|
||||
}
|
||||
}
|
||||
return json(['code'=>0,'data'=>$tags]);
|
||||
}
|
||||
|
||||
//文章置顶,状态
|
||||
public function jieset(){
|
||||
$data = Request::param();
|
||||
$article = ArticleModel::field('id,is_top,is_hot,is_reply')->find($data['id']);
|
||||
switch ($data['field']){
|
||||
case 'top':
|
||||
if($data['rank']==1){
|
||||
$article->save(['is_top' => 1]);
|
||||
$res = ['status'=>0,'msg'=>'置顶成功'];
|
||||
} else {
|
||||
$article->save(['is_top' => 0]);
|
||||
$res = ['status'=>0,'msg'=>'已取消置顶'];
|
||||
}
|
||||
break;
|
||||
case 'hot':
|
||||
if($data['rank']==1){
|
||||
$article->save(['is_hot' => 1]);
|
||||
$res = ['status'=>0,'msg'=>'已设精贴'];
|
||||
} else {
|
||||
$article->save(['is_hot' => 0]);
|
||||
$res = ['status'=>0,'msg'=>'精贴已取消'];
|
||||
}
|
||||
break;
|
||||
case 'reply':
|
||||
if($data['rank']==1){
|
||||
$article->save(['is_reply' => 1]);
|
||||
$res = ['status'=>0,'msg'=>'本帖禁评'];
|
||||
} else {
|
||||
$article->save(['is_reply' => 0]);
|
||||
$res = ['status'=>0,'msg'=>'禁评已取消'];
|
||||
}
|
||||
}
|
||||
//删除本贴设置缓存显示编辑后内容
|
||||
Cache::delete('article_'.$data['id']);
|
||||
//清除文章tag缓存
|
||||
Cache::tag('tagArtDetail')->clear();
|
||||
return json($res);
|
||||
}
|
||||
|
||||
//改变标题颜色
|
||||
public function titleColor()
|
||||
{
|
||||
$data = Request::param();
|
||||
$result = ArticleModel::update($data);
|
||||
if($result){
|
||||
//清除文章缓存
|
||||
Cache::tag(['tagArt','tagArtDetail'])->clear();
|
||||
$res = ['code'=> 0, 'msg'=>'标题颜色设置成功'];
|
||||
}else{
|
||||
$res = ['code'=> -1, 'msg'=>'标题颜色设置失败'];
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
|
||||
//内容中是否有图片视频音频插入
|
||||
public function hasIva($content)
|
||||
{
|
||||
//判断是否插入图片
|
||||
$isHasImg = strpos($content,'img[');
|
||||
$data['has_img'] = is_int($isHasImg) ? 1 : 0;
|
||||
//判断是否插入视频
|
||||
$isHasVideo = strpos($content,'video(');
|
||||
$data['has_video'] = is_int($isHasVideo) ? 1 : 0;
|
||||
//判断是否插入音频
|
||||
$isHasAudio = strpos($content,'audio[');
|
||||
$data['has_audio'] = is_int($isHasAudio) ? 1 : 0;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
@ -1,209 +0,0 @@
|
||||
<?php
|
||||
namespace app\index\Controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\lib\Msgres;
|
||||
use app\common\validate\User as userValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\Request;
|
||||
use think\facade\Session;
|
||||
use think\facade\Cookie;
|
||||
use think\facade\Cache;
|
||||
use think\facade\View;
|
||||
use think\facade\Config;
|
||||
use app\common\model\User;
|
||||
|
||||
class Login extends BaseController
|
||||
{
|
||||
//已登陆中间件检测
|
||||
protected $middleware = [
|
||||
'logedcheck' => ['except' => ['index'] ]
|
||||
];
|
||||
|
||||
//给模板中JScace文件赋值
|
||||
protected function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
View::assign(['jspage'=>'']);
|
||||
}
|
||||
|
||||
//用户登陆
|
||||
public function index()
|
||||
{
|
||||
//已登陆跳出
|
||||
if(Session::has('user_id')){
|
||||
return redirect((string) url('user/index'));
|
||||
}
|
||||
//获取登录前访问页面refer
|
||||
$refer = Request::server('HTTP_REFERER');
|
||||
//$domain = Request::domain();
|
||||
//截取域名后面的字符
|
||||
//$url = substr($refer,strlen($domain));
|
||||
Cookie::set('url',$refer);
|
||||
if(Request::isAjax()) {
|
||||
//登陆前数据校验
|
||||
$data = Request::param();
|
||||
|
||||
//邮箱正则表达式
|
||||
$pattern = "/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i";
|
||||
//判断输入的是邮箱还是用户名
|
||||
if (preg_match($pattern, $data['name'])){
|
||||
//输入邮箱email登陆验证
|
||||
$data['email'] = $data['name'];
|
||||
unset($data['name']);
|
||||
try{
|
||||
validate(userValidate::class)
|
||||
->scene('loginEmail')
|
||||
->check($data);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return json(['code'=>-1,'msg'=>$e->getError()]);
|
||||
}
|
||||
$data['name'] = $data['email'];
|
||||
unset($data['email']);
|
||||
} else {
|
||||
//用户名name登陆验证
|
||||
try{
|
||||
validate(userValidate::class)
|
||||
->scene('loginName')
|
||||
->check($data);
|
||||
} catch (ValidateException $e) {
|
||||
// 验证失败 输出错误信息
|
||||
return json(['code'=>-1,'msg'=>$e->getError()]);
|
||||
}
|
||||
}
|
||||
//登陆请求
|
||||
$user = new User();
|
||||
$res = $user->login($data);
|
||||
if ($res == 1) { //登陆成功
|
||||
return Msgres::success('login_success',Cookie::get('url'));
|
||||
} else {
|
||||
return Msgres::error($res);
|
||||
}
|
||||
}
|
||||
|
||||
return View::fetch('login');
|
||||
}
|
||||
|
||||
//注册
|
||||
public function reg()
|
||||
{
|
||||
if(Request::isAjax()){
|
||||
$data = Request::only(['name','email','password','repassword','captcha']);
|
||||
|
||||
//校验场景中reg的方法数据
|
||||
try{
|
||||
validate(userValidate::class)
|
||||
->scene('Reg')
|
||||
->check($data);
|
||||
} catch (ValidateException $e) {
|
||||
return json(['code'=>-1,'msg'=>$e->getError()]);
|
||||
}
|
||||
|
||||
$user = new User();
|
||||
$result = $user->reg($data);
|
||||
|
||||
if ($result == 1) {
|
||||
$res = ['code'=>0,'msg'=>'注册成功','url'=>(string) url('login/index')];
|
||||
if(Config::get('taoler.config.email_notice')) mailto($this->showUser(1)['email'],'注册新用户通知','Hi亲爱的管理员:</br>新用户 <b>'.$data['name'].'</b> 刚刚注册了新的账号,请尽快处理。');
|
||||
}else {
|
||||
$res = ['code'=>-1,'msg'=>$result];
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//找回密码
|
||||
public function forget()
|
||||
{
|
||||
if(Request::isAjax()){
|
||||
$data = Request::param();
|
||||
|
||||
try{
|
||||
validate(userValidate::class)
|
||||
->scene('Forget')
|
||||
->check($data);
|
||||
} catch (ValidateException $e) {
|
||||
return json(['code'=>-1,'msg'=>$e->getError()]);
|
||||
}
|
||||
//查询用户
|
||||
$user = Db::name('user')->where('email',$data['email'])->find();
|
||||
if($user) {
|
||||
$code = mt_rand('1111','9999');
|
||||
Cache::set('code',$code,600);
|
||||
Cache::set('userid',$user['id'],600);
|
||||
|
||||
$result = mailto($data['email'],'重置密码','Hi亲爱的'.$user['name'].':</br>您正在维护您的信息,请在10分钟内验证,您的验证码为:'.$code);
|
||||
if($result){
|
||||
Cache::set('repass','postcode',60); //设置repass标志为1存入Cache
|
||||
$res = ['code'=>0,'msg'=>'验证码已发送成功,请去邮箱查看!','url'=>(string) url('login/postcode')];
|
||||
} else {
|
||||
$res = ['code'=>-1,'msg'=>'验证码发送失败!'];
|
||||
}
|
||||
}else{
|
||||
$res = ['code' =>-1,'msg'=>'邮箱错误或不存在'];
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//接收验证码
|
||||
public function postcode()
|
||||
{
|
||||
if(Cache::get('repass') !== 'postcode'){
|
||||
return redirect((string) url('login/forget'));
|
||||
}
|
||||
if(Request::isAjax()){
|
||||
$code = Request::only(['code']);
|
||||
try{
|
||||
validate(userValidate::class)
|
||||
->scene('Code')
|
||||
->check($code);
|
||||
} catch (ValidateException $e) {
|
||||
return json(['code'=>-1,'msg'=>$e->getError()]);
|
||||
}
|
||||
|
||||
if(Cache::get('code')==$code['code']) { //无任何输入情况下需排除code为0和Cache为0的情况
|
||||
//Cache::delete('repass');
|
||||
Cache::set('repass','resetpass',60);
|
||||
$res = ['code'=>0,'msg'=>'验证成功','url'=>(string) url('login/respass')];
|
||||
} else {
|
||||
$res = ['code'=>-1,'msg'=>'验证码错误或已过期!'];
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
return View::fetch('forget');
|
||||
}
|
||||
|
||||
//忘记密码找回重置
|
||||
public function respass()
|
||||
{
|
||||
if(Cache::get('repass') !== 'resetpass'){
|
||||
return redirect((string) url('login/forget'));
|
||||
}
|
||||
if(Request::isAjax()){
|
||||
$data = Request::param();
|
||||
try{
|
||||
validate(userValidate::class)
|
||||
->scene('Repass')
|
||||
->check($data);
|
||||
} catch (ValidateException $e) {
|
||||
return json(['code'=>-1,'msg'=>$e->getError()]);
|
||||
}
|
||||
|
||||
$data['uid'] = Cache::get('userid');
|
||||
$user = new User();
|
||||
$res = $user->respass($data);
|
||||
if ($res == 1) {
|
||||
return json(['code'=>0,'msg'=>'修改成功','url'=>(string) url('login/index')]);
|
||||
} else {
|
||||
return json(['code'=>-1,'msg'=>'$res']);
|
||||
}
|
||||
}
|
||||
return View::fetch('forget');
|
||||
}
|
||||
|
||||
}
|
@ -1,251 +0,0 @@
|
||||
<?php
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\common\controller\BaseController;
|
||||
use app\common\validate\User as userValidate;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\Request;
|
||||
use think\facade\Session;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Cookie;
|
||||
use think\facade\View;
|
||||
use app\common\model\Article;
|
||||
use app\common\model\Collection;
|
||||
use app\common\model\User as userModel;
|
||||
use think\facade\Config;
|
||||
use taoler\com\Message;
|
||||
|
||||
class User extends BaseController
|
||||
{
|
||||
protected $middleware = [
|
||||
'logincheck' => ['except' => ['home'] ],
|
||||
];
|
||||
|
||||
//用户中心
|
||||
public function index()
|
||||
{
|
||||
return view();
|
||||
}
|
||||
|
||||
|
||||
//发帖list
|
||||
public function artList()
|
||||
{
|
||||
$article = Article::withCount('comments')->where('user_id',$this->uid)->order('update_time','desc')->paginate(10);
|
||||
//var_dump($article);
|
||||
$count = $article->total();
|
||||
$res = [];
|
||||
if($count){
|
||||
$res['code'] = 0;
|
||||
$res['count'] = $count;
|
||||
foreach($article as $v){
|
||||
$res['data'][] = ['id'=>$v['id'],
|
||||
'title' => $v['title'],
|
||||
'url' => (string) url('article/detail',['id'=>$v['id']]),
|
||||
'status' => $v['status'] ? '正常':'待审核',
|
||||
'ctime' => $v['create_time'],
|
||||
'datas' => $v['pv'].'阅/'.$v['comments_count'].'答'
|
||||
];
|
||||
}
|
||||
|
||||
} else {
|
||||
return json(['code'=>-1,'msg'=>'无数据']);
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
|
||||
//收藏list
|
||||
public function collList(){
|
||||
//收藏的帖子
|
||||
$collect = Collection::with(['article'=>function($query){
|
||||
$query->withCount('comments')->where('status',1);
|
||||
}])->where('user_id',$this->uid)->order('create_time','desc')->paginate(10);
|
||||
$count =$collect->total();
|
||||
$res = [];
|
||||
if($count){
|
||||
$res['code'] = 0;
|
||||
$res['count'] = $count ;
|
||||
foreach($collect as $v){
|
||||
|
||||
$res['data'][] = [
|
||||
'id' =>$v['id'],
|
||||
'title' => $v['collect_title'],
|
||||
'url' => (string) url('article/detail',['id'=>$v['article_id']]),
|
||||
'auther' => $v['auther'],
|
||||
'status' => is_null(Db::name('article')->field('id')->where('delete_time',0)->find($v['article_id'])) ? '已失效' : '正常',
|
||||
'ctime' => $v['create_time']
|
||||
];
|
||||
}
|
||||
|
||||
} else {
|
||||
return json(['code'=>-1,'msg'=>'无数据']);
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//文章管理
|
||||
public function post()
|
||||
{
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//取消文章收藏
|
||||
public function colltDel()
|
||||
{
|
||||
if(Request::isAjax()){
|
||||
$collt = Collection::where('user_id',$this->uid)->find(input('id'));
|
||||
$result = $collt->delete();
|
||||
if($result){
|
||||
$res = ['code'=>0,'msg'=>'取消成功'];
|
||||
} else {
|
||||
$res = ['code'=>0,'msg'=>'取消失败'];
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
}
|
||||
|
||||
//用户设置-我的资料
|
||||
public function set()
|
||||
{
|
||||
if(Request::isAjax()){
|
||||
$data = Request::only(['user_id','email','nickname','sex','city','area_id','sign']);
|
||||
$validate = new userValidate;
|
||||
$result = $validate->scene('Set')->check($data);
|
||||
if(!$result){
|
||||
$this->error($validate->getError());
|
||||
} else {
|
||||
$user = new userModel;
|
||||
$result = $user->setNew($data);
|
||||
if($result == 1){
|
||||
Cache::tag('user')->clear();
|
||||
return ['code'=>0,'msg'=>'资料更新成功'];
|
||||
} else {
|
||||
$this->error($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
$area = Db::name('user_area')->select();
|
||||
View::assign(['area'=>$area]);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//更换头像
|
||||
public function uploadHeadImg()
|
||||
{
|
||||
$uploads = new \app\common\lib\Uploads();
|
||||
$upRes = $uploads->put('file','head_img',1024,'image','uniqid');
|
||||
$upHeadRes = $upRes->getData();
|
||||
if($upHeadRes['status'] == 0){
|
||||
$name_path = $upHeadRes['url'];
|
||||
//$name = $file->hashName();
|
||||
//$image = \think\Image::open("uploads/$name_path");
|
||||
//$image->thumb(168, 168)->save("uploads/$name_path");
|
||||
|
||||
//查出当前用户头像删除原头像并更新
|
||||
$imgPath = Db::name('user')->where('id',$this->uid)->value('user_img');
|
||||
if(file_exists('.'.$imgPath)){
|
||||
$dirPath = dirname('.'.$imgPath);
|
||||
if($dirPath !== './static/res/images/avatar'){ //防止删除默认头像
|
||||
unlink('.'.$imgPath);
|
||||
}
|
||||
}
|
||||
$result = Db::name('user')
|
||||
->where('id',$this->uid)
|
||||
->update(['user_img'=>$name_path]);
|
||||
Cache::tag(['user','tagArtDetail','tagArt'])->clear();
|
||||
if($result) {
|
||||
$res = ['status'=>0,'msg'=>'头像更新成功'];
|
||||
} else {
|
||||
$res = ['status'=>1,'msg'=>'头像更新失败'];
|
||||
}
|
||||
} else {
|
||||
$res = ['status'=>1,'msg'=>'上传错误'];
|
||||
}
|
||||
return json($res);
|
||||
}
|
||||
|
||||
|
||||
public function message()
|
||||
{
|
||||
$uid = Session::get('user_id');
|
||||
$msg = Message::receveMsg($uid);
|
||||
|
||||
View::assign('msg',$msg);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
//个人页
|
||||
public function home($id)
|
||||
{
|
||||
//用户
|
||||
$u = Cache::get('user'.$id);
|
||||
if(!$u){
|
||||
$u = Db::name('user')->field('name,nickname,city,sex,sign,user_img,point,vip,create_time')->cache(3600)->find($id);
|
||||
}
|
||||
|
||||
|
||||
//用户发贴
|
||||
$arts = Db::name('user')->alias('u')->join('article a','u.id = a.user_id')->field('u.id,a.id,a.title,a.pv,a.is_hot,a.create_time,a.delete_time')->where('a.delete_time',0)->where('a.user_id',$id)->order(['a.create_time'=>'desc'])->cache(3600)->select();
|
||||
//用户回答
|
||||
$reys = Db::name('comment')->alias('c')->join('article a','c.article_id = a.id')->field('a.id,a.title,c.content,c.create_time,c.delete_time')->where(['a.delete_time'=>0,'c.delete_time'=>0])->where('c.user_id',$id)->order(['c.create_time'=>'desc'])->cache(3600)->select();
|
||||
|
||||
View::assign(['u'=>$u,'arts'=>$arts,'reys'=>$reys,'jspage'=>'']);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
|
||||
public function layout()
|
||||
{
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
|
||||
//邮箱激活
|
||||
public function activate()
|
||||
{
|
||||
$this->isLogin();
|
||||
$user = UserModel::find($this->uid);
|
||||
$this->assign('user',$user);
|
||||
return view();
|
||||
}
|
||||
|
||||
//修改密码
|
||||
public function setPass()
|
||||
{
|
||||
if(Request::isAjax()){
|
||||
$data = Request::param();
|
||||
$validate = new userValidate;
|
||||
$res = $validate->scene('setPass')->check($data);
|
||||
if(!$res){
|
||||
return $this->error($validate->getError());
|
||||
}
|
||||
$user = new userModel;
|
||||
$result = $user->setpass($data);
|
||||
if($result == 1) {
|
||||
Session::clear();
|
||||
Cookie::delete('auth');
|
||||
return $this->success('密码修改成功 请登录', (string) url('login/index'));
|
||||
} else {
|
||||
return $this->error($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//退出账户
|
||||
public function logout()
|
||||
{
|
||||
Session::clear();
|
||||
Cookie::delete('auth');
|
||||
//Cookie::delete('user_name');
|
||||
//Cookie::delete('user_id');
|
||||
if(Session::has('user_id')){
|
||||
return json(['code' => -1, 'msg' => '退出失败']);
|
||||
} else {
|
||||
return json(['code' => 200, 'msg' => '退出成功', 'url' => '/']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
use think\facade\Route;
|
||||
|
||||
Route::get('captcha/[:config]','\\think\\captcha\\CaptchaController@index');
|
||||
Route::rule('/', 'index'); // 首页访问路由
|
||||
Route::group(function () {
|
||||
Route::get('jie/:id', 'article/detail');
|
||||
Route::get('column/<ename?>/<type?>/<page?>','article/cate')
|
||||
->pattern([
|
||||
'ename' => '\w+',
|
||||
'page' => '\d+',
|
||||
]);
|
||||
Route::rule('add','article/add')->token();
|
||||
Route::rule('edit/[:id]','article/edit');
|
||||
//Route::rule('del/:id','article/delete');
|
||||
});
|
||||
Route::group(function () {
|
||||
Route::rule('u/:id', 'user/home');
|
||||
});
|
||||
Route::rule('login','login/index');
|
||||
Route::rule('forget','login/forget');
|
||||
Route::rule('postcode','login/postcode');
|
||||
Route::rule('respass','login/respass');
|
||||
Route::rule('reg','Login/reg')
|
||||
->middleware(\app\middleware\CheckRegister::class);
|
||||
|
||||
Route::rule('search/[:keywords]', 'index/search'); // 搜索
|
||||
|
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 网站公共配置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
//应用名,此项不可更改
|
||||
'appname' => 'TaoLer',
|
||||
//版本配置
|
||||
'version' => '1.7.26',
|
||||
//加盐
|
||||
'salt' => 'taoler',
|
||||
//数据库备份目录
|
||||
'databasebackdir' => app()->getRootPath() .'data/',
|
||||
//配置
|
||||
'config' =>[
|
||||
'email_notice' => 1,
|
||||
'cate_show' => 0,
|
||||
'area_show' => 0,
|
||||
|
||||
]
|
||||
|
||||
|
||||
];
|
2
view/public/static/layui/jquery.min.js
vendored
2
view/public/static/layui/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,378 +0,0 @@
|
||||
/**
|
||||
|
||||
@Name: 用户模块
|
||||
|
||||
*/
|
||||
|
||||
layui.define(['laypage', 'fly', 'element', 'flow', 'imgcom'], function(exports){
|
||||
|
||||
var $ = layui.jquery;
|
||||
var layer = layui.layer;
|
||||
var util = layui.util;
|
||||
var laytpl = layui.laytpl;
|
||||
var form = layui.form;
|
||||
var laypage = layui.laypage;
|
||||
var fly = layui.fly;
|
||||
var flow = layui.flow;
|
||||
var element = layui.element;
|
||||
var upload = layui.upload;
|
||||
var imgcom = layui.imgcom;
|
||||
var table = layui.table;
|
||||
|
||||
var gather = {}, dom = {
|
||||
mine: $('#LAY_mine')
|
||||
,mineview: $('.mine-view')
|
||||
,minemsg: $('#LAY_minemsg')
|
||||
,infobtn: $('#LAY_btninfo')
|
||||
};
|
||||
|
||||
|
||||
//我的相关数据
|
||||
|
||||
//发贴list
|
||||
var post = table.render({
|
||||
elem: '#art-post'
|
||||
,url: artListUrl
|
||||
,title: ''
|
||||
,cols: [[
|
||||
{type: 'numbers', fixed: 'left'}
|
||||
,{field: 'title', title: '标题',minWidth: 250 ,templet: '<div><a href="{{d.url}}" target="_blank">{{d.title}}</a></div>'}
|
||||
,{field: 'status', title: '状态', width: 80}
|
||||
,{field: 'ctime', title: '时间', width: 120}
|
||||
,{field: 'datas', title: '数据', width: 120}
|
||||
,{title: '操作', width: 150, align: 'center', toolbar: '#artTool'}
|
||||
]]
|
||||
,text: '对不起,加载出现异常!'
|
||||
,page: true
|
||||
});
|
||||
|
||||
//收藏list
|
||||
table.render({
|
||||
elem: '#coll-post'
|
||||
,url: collListUrl
|
||||
,title: ''
|
||||
,cols: [[
|
||||
{type: 'numbers', fixed: 'left'}
|
||||
,{field: 'title', title: '标题',minWidth: 250,templet: '<div><a href="{{d.url}}" target="_blank">{{d.title}}</a></div>'}
|
||||
,{field: 'auther', title: '作者', width: 120}
|
||||
,{field: 'status', title: '状态', width: 80}
|
||||
,{field: 'ctime', title: '时间', width: 120}
|
||||
,{title: '取消', width: 80, align: 'center', toolbar: '#collTool'}
|
||||
]]
|
||||
,text: '对不起,加载出现异常!'
|
||||
,page: true
|
||||
});
|
||||
|
||||
//监听行工具事件
|
||||
table.on('tool(art-post)', function(obj){
|
||||
var data = obj.data;
|
||||
var id = data.id;
|
||||
if(obj.event === 'del'){
|
||||
layer.confirm('确定删除吗?',{
|
||||
title:'删除文章',
|
||||
icon:3
|
||||
},function(index){
|
||||
layer.close(index);
|
||||
$.post(atrDelUrl,{"id":id},function(data){
|
||||
if(data.code == 0){
|
||||
layer.msg(data.msg,{
|
||||
icon:6,
|
||||
time:2000
|
||||
});
|
||||
} else {
|
||||
layer.open({
|
||||
title:'删除失败',
|
||||
content:data.msg,
|
||||
icon:5,
|
||||
adim:6
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
table.reload('art-post');
|
||||
});
|
||||
|
||||
} else if(obj.event === 'edit'){//编辑
|
||||
$.post(artEditUrl,{"id":id},function(){
|
||||
location.href = artEditUrl + '?id=' + id;
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//监听行工具事件
|
||||
table.on('tool(coll-post)', function(obj){
|
||||
var id = obj.data.id;
|
||||
if(obj.event === 'del'){
|
||||
layer.confirm('确定取消收藏?',{
|
||||
title:'取消收藏',
|
||||
icon:3
|
||||
},function(index){
|
||||
layer.close(index);
|
||||
$.post(collDelUrl,{"id":id},function(data){
|
||||
if(data.code == 0){
|
||||
layer.msg(data.msg,{
|
||||
icon:6,
|
||||
time:2000
|
||||
});
|
||||
} else {
|
||||
layer.open({
|
||||
title:'取消失败',
|
||||
content:data.msg,
|
||||
icon:5,
|
||||
adim:6
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
table.reload('coll-post');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//显示当前tab
|
||||
if(location.hash){
|
||||
element.tabChange('user', location.hash.replace(/^#/, ''));
|
||||
}
|
||||
|
||||
element.on('tab(user)', function(){
|
||||
var othis = $(this), layid = othis.attr('lay-id');
|
||||
if(layid){
|
||||
location.hash = layid;
|
||||
}
|
||||
});
|
||||
/*
|
||||
//根据ip获取城市
|
||||
if($('#L_city').val() === ''){
|
||||
$.getScript('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js', function(){
|
||||
$('#L_city').val(remote_ip_info.city||'');
|
||||
});
|
||||
}
|
||||
*/
|
||||
//上传图片
|
||||
if($('.upload-img')[0]){
|
||||
layui.use('upload', function(upload){
|
||||
var avatarAdd = $('.avatar-add');
|
||||
|
||||
upload.render({
|
||||
elem: '.upload-img'
|
||||
,accept: 'images'
|
||||
,acceptMime: 'image/*'
|
||||
,exts: 'jpg|png|gif|bmp|jpeg'
|
||||
,url: uploadHeadImg
|
||||
,size: 10240
|
||||
,auto: false
|
||||
,choose: function (obj) { //选择文件后的回调
|
||||
imgcom.uploads(obj);
|
||||
}
|
||||
,before: function(){
|
||||
avatarAdd.find('.loading').show();
|
||||
}
|
||||
,done: function(res){
|
||||
if(res.status == 0){
|
||||
location.reload();
|
||||
} else {
|
||||
layer.msg(res.msg, {icon: 5});
|
||||
}
|
||||
avatarAdd.find('.loading').hide();
|
||||
}
|
||||
,error: function(){
|
||||
avatarAdd.find('.loading').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//合作平台
|
||||
if($('#LAY_coop')[0]){
|
||||
|
||||
//资源上传
|
||||
$('#LAY_coop .uploadRes').each(function(index, item){
|
||||
var othis = $(this);
|
||||
upload.render({
|
||||
elem: item
|
||||
,url: '/api/upload/cooperation/?filename='+ othis.data('filename')
|
||||
,accept: 'file'
|
||||
,exts: 'zip'
|
||||
,size: 30*1024
|
||||
,before: function(){
|
||||
layer.msg('正在上传', {
|
||||
icon: 16
|
||||
,time: -1
|
||||
,shade: 0.7
|
||||
});
|
||||
}
|
||||
,done: function(res){
|
||||
if(res.code == 0){
|
||||
layer.msg(res.msg, {icon: 6})
|
||||
} else {
|
||||
layer.msg(res.msg)
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//成效展示
|
||||
var effectTpl = ['{{# layui.each(d.data, function(index, item){ }}'
|
||||
,'<tr>'
|
||||
,'<td><a href="/u/{{ item.uid }}" target="_blank" style="color: #01AAED;">{{ item.uid }}</a></td>'
|
||||
,'<td>{{ item.authProduct }}</td>'
|
||||
,'<td>¥{{ item.rmb }}</td>'
|
||||
,'<td>{{ item.create_time }}</td>'
|
||||
,'</tr>'
|
||||
,'{{# }); }}'].join('');
|
||||
|
||||
var effectView = function(res){
|
||||
var html = laytpl(effectTpl).render(res);
|
||||
$('#LAY_coop_effect').html(html);
|
||||
$('#LAY_effect_count').html('你共有 <strong style="color: #FF5722;">'+ (res.count||0) +'</strong> 笔合作授权订单');
|
||||
};
|
||||
|
||||
var effectShow = function(page){
|
||||
fly.json('/cooperation/effect', {
|
||||
page: page||1
|
||||
}, function(res){
|
||||
effectView(res);
|
||||
laypage.render({
|
||||
elem: 'LAY_effect_page'
|
||||
,count: res.count
|
||||
,curr: page
|
||||
,jump: function(e, first){
|
||||
if(!first){
|
||||
effectShow(e.curr);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
effectShow();
|
||||
|
||||
}
|
||||
|
||||
//提交成功后刷新
|
||||
fly.form['set-mine'] = function(data, required){
|
||||
layer.msg('修改成功', {
|
||||
icon: 1
|
||||
,time: 1000
|
||||
,shade: 0.1
|
||||
}, function(){
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
//帐号绑定
|
||||
$('.acc-unbind').on('click', function(){
|
||||
var othis = $(this), type = othis.attr('type');
|
||||
layer.confirm('整的要解绑'+ ({
|
||||
qq_id: 'QQ'
|
||||
,weibo_id: '微博'
|
||||
})[type] + '吗?', {icon: 5}, function(){
|
||||
fly.json('/api/unbind', {
|
||||
type: type
|
||||
}, function(res){
|
||||
if(res.status === 0){
|
||||
layer.alert('已成功解绑。', {
|
||||
icon: 1
|
||||
,end: function(){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//手机设备的简单适配
|
||||
var treeMobileUser = $('.site-tree-mobile-user')
|
||||
,shadeMobileUser = $('.site-mobile-shade-user')
|
||||
|
||||
treeMobileUser.on('click', function(){
|
||||
$('body').addClass('site-mobile');
|
||||
});
|
||||
|
||||
shadeMobileUser.on('click', function(){
|
||||
$('body').removeClass('site-mobile');
|
||||
});
|
||||
|
||||
//我的消息
|
||||
gather.minemsg = function(){
|
||||
var delAll = $('#LAY_delallmsg')
|
||||
,tpl = '{{# var len = d.rows.length;\
|
||||
if(len === 0){ }}\
|
||||
<div class="fly-none">您暂时没有最新消息</div>\
|
||||
{{# } else { }}\
|
||||
<ul class="mine-msg">\
|
||||
{{# for(var i = 0; i < len; i++){ }}\
|
||||
<li data-id="{{d.rows[i].id}}">\
|
||||
{{# if(d.rows[i].type == 1){ }}\
|
||||
<blockquote class="layui-elem-quote"><a href= "'+ userNameJump +'?username={{ d.rows[i].name}}" target="_blank"><cite>{{ d.rows[i].name}}</cite></a>给您发了站内信<a class="sys-title" id-data="{{ d.rows[i].id}}" href="javascript:;"><cite>{{ d.rows[i].title}}</cite></a> <span class="float:right">{{ d.rows[i].read}}</span></blockquote>\
|
||||
{{# } }}\
|
||||
{{# if(d.rows[i].type == 2){ }}\
|
||||
<blockquote class="layui-elem-quote"><a href= "'+ userNameJump +'?username={{ d.rows[i].name}}" target="_blank"><cite>{{ d.rows[i].name}}</cite></a>回答了您的帖子<a target="_blank" class="art-title" id-data="{{ d.rows[i].id}}" href="{{ d.rows[i].link}}"><cite>{{ d.rows[i].title}}</cite></a> <span class="float:right">{{ d.rows[i].read}}</span></blockquote>\
|
||||
{{# } }}\
|
||||
{{# if(d.rows[i].type == 0){ }}\
|
||||
<blockquote class="layui-elem-quote">系统消息:<a class="sys-title" id-data="{{ d.rows[i].id}}" href="javascript:;"><cite>{{ d.rows[i].title}}</cite></a> <span class="float:right">{{ d.rows[i].read}}</span></blockquote>\
|
||||
{{# } }}\
|
||||
<p><span>{{d.rows[i].time}}</span><a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-danger fly-delete">删除</a></p>\
|
||||
</li>\
|
||||
{{# } }}\
|
||||
</ul>\
|
||||
{{# } }}'
|
||||
,delEnd = function(clear){
|
||||
if(clear || dom.minemsg.find('.mine-msg li').length === 0){
|
||||
dom.minemsg.html('<div class="fly-none">您暂时没有最新消息</div>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fly.json(messageFind, {}, function(res){
|
||||
var html = laytpl(tpl).render(res);
|
||||
dom.minemsg.html(html);
|
||||
if(res.rows.length > 0){
|
||||
delAll.removeClass('layui-hide');
|
||||
} else {
|
||||
delAll.addClass('layui-hide');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//阅读后删除
|
||||
dom.minemsg.on('click', '.mine-msg li .fly-delete', function(){
|
||||
var othis = $(this).parents('li'), id = othis.data('id');
|
||||
fly.json(messageRemove, {
|
||||
id: id
|
||||
}, function(res){
|
||||
if(res.status === 0){
|
||||
othis.remove();
|
||||
delEnd();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//删除全部
|
||||
$('#LAY_delallmsg').on('click', function(){
|
||||
var othis = $(this);
|
||||
layer.confirm('确定清空吗?', function(index){
|
||||
fly.json(messageRemove, {
|
||||
id: true
|
||||
}, function(res){
|
||||
if(res.status === 0){
|
||||
layer.close(index);
|
||||
othis.addClass('layui-hide');
|
||||
delEnd(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
dom.minemsg[0] && gather.minemsg();
|
||||
|
||||
exports('user', null);
|
||||
|
||||
});
|
@ -122,7 +122,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<input type="hidden" class="layui-hide" name="__token__" value="{:token()}" />
|
||||
<button type="submit" class="layui-btn" lay-filter="article-add" lay-submit id="add">{:lang('post now')}</button>
|
||||
</div>
|
||||
|
||||
@ -199,7 +198,7 @@
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/add')}",
|
||||
data:{"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"captcha":field.captcha,"__token__":field.__token__},
|
||||
data:{"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"captcha":field.captcha},
|
||||
dataType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
|
@ -37,7 +37,7 @@
|
||||
<div class="detail-body-wenda photos">问题描述:{$article.content|raw}</div>
|
||||
|
||||
{//管理}
|
||||
{if (($article.upzip !== '') || session('?user_name'))}
|
||||
{if (($article.upzip !== '') || (session('user_id')==$article.user_id) OR ($user.auth ?? ''))}
|
||||
<div class="detail-assist">
|
||||
{notempty name="$article.upzip"}
|
||||
<button type="button" class="layui-btn layui-btn-xs" id="zip-download"><i class="layui-icon layui-icon-download-circle"></i>{:lang('download files')}: {$article.downloads}次</button>
|
||||
|
@ -44,7 +44,7 @@
|
||||
</div>
|
||||
<div class="detail-body photos">{$article.content|raw}</div>
|
||||
{//管理}
|
||||
{if (($article.upzip !== '') || session('?user_name'))}
|
||||
{if (($article.upzip !== '') || (session('user_id')==$article.user_id) OR ($user.auth ?? ''))}
|
||||
<div class="detail-assist">
|
||||
{notempty name="$article.upzip"}
|
||||
<button type="button" class="layui-btn layui-btn-xs" id="zip-download"><i class="layui-icon layui-icon-download-circle"></i>{:lang('download files')}: {$article.downloads}次</button>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="fly-footer html5plus-hide">
|
||||
<p> Copyright © {:date('Y')}{$sysInfo.copyright|raw}v{:config('taoler.version')}</p>
|
||||
<div class="fly-footer html5plus-hide layui-hide-xs">
|
||||
<p> Copyright © {:date('Y')}{$sysInfo.copyright|raw}</p>
|
||||
<p>
|
||||
{$sysInfo.showlist|raw}
|
||||
{volist name="footlinks" id="vo"}
|
||||
|
@ -1,260 +0,0 @@
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="title"}发表帖子{/block}
|
||||
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
||||
{block name="column"}{/block}
|
||||
{block name="content"}
|
||||
<div class="">{include file="public/menu" /}</div>
|
||||
<div class="layui-container fly-marginTop">
|
||||
<div class="fly-panel" pad20 style="padding-top: 5px;">
|
||||
<!--<div class="fly-none">没有权限</div>-->
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="user">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">{:lang('add post')}<!-- 编辑帖子 --></li>
|
||||
</ul>
|
||||
<div class="layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
|
||||
<div class="layui-tab-item layui-show">
|
||||
|
||||
<div class="layui-row layui-col-space15 layui-form-item">
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label">{:lang('special column')}</label>
|
||||
<div class="layui-input-block">
|
||||
<select lay-verify="required" name="cate_id" lay-filter="column">
|
||||
<option></option>
|
||||
{volist name="cateList" id="cate"}
|
||||
<option value="{$cate.id}">{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md8">
|
||||
<label for="L_title" class="layui-form-label">{:lang('title')}</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input">
|
||||
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input">
|
||||
<input type="hidden" name="user_id" value="{:session('user_id')}">
|
||||
</div>
|
||||
</div>
|
||||
{if ($user.auth == 1)}
|
||||
<div class="layui-col-md1">
|
||||
<div id="color"></div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="layui-row layui-col-space15 layui-form-item layui-hide" id="LAY_quiz">
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label">所属产品</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="project">
|
||||
<option></option>
|
||||
<option value="layui">layui</option>
|
||||
<option value="独立版layer">独立版layer</option>
|
||||
<option value="独立版layDate">独立版layDate</option>
|
||||
<option value="LayIM">LayIM</option>
|
||||
<option value="Fly社区模板">Fly社区模板</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label" for="L_version">版本号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_version" value="" name="version" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6">
|
||||
<label class="layui-form-label" for="L_browser">浏览器</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_browser" value="" name="browser" placeholder="浏览器名称及版本,如:IE 11" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<div class="layui-input-block">
|
||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor" style="height: 260px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">{:lang('enclosure')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="upzip" value="" placeholder="zip,image文件" title="上传附件"/>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>{:lang('uploads')}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">{:lang('add tags')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="tags" placeholder="多个标签用,号隔开" title="添加标签"/>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="article-tags-button">{:lang('add')}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-btn-container">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">悬赏飞吻</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<select name="experience">
|
||||
<option value="20">20</option>
|
||||
<option value="30">30</option>
|
||||
<option value="50">50</option>
|
||||
<option value="60">60</option>
|
||||
<option value="80">80</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">发表后无法更改飞吻</div>
|
||||
</div>
|
||||
</div-->
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div >
|
||||
<span style="color: #c00;"><img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" /></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<input type="hidden" class="layui-hide" name="__token__" value="{:token()}" />
|
||||
<button type="submit" class="layui-btn" lay-filter="article-add" lay-submit id="add">{:lang('post now')}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
//删除tag
|
||||
$(document).ready(function(){
|
||||
$('.layui-btn-container').on('click','button',function(){
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
layui.use(['fly','form','colorpicker','upload','plyr'], function(){
|
||||
var $ = layui.jquery
|
||||
,fly = layui.fly
|
||||
,form = layui.form
|
||||
,colorpicker = layui.colorpicker
|
||||
,upload = layui.upload
|
||||
,plyr = layui.plyr;
|
||||
|
||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||
$('.layui-textarea').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
othis.html(fly.content(html));
|
||||
})
|
||||
|
||||
//预定义颜色项
|
||||
colorpicker.render({
|
||||
elem: '#color'
|
||||
,color: '#393d49'
|
||||
,predefine: true // 开启预定义颜色
|
||||
,done: function(color){
|
||||
//譬如你可以在回调中把得到的 color 赋值给表单
|
||||
$('#L_title_color').val(color);
|
||||
//改变标题颜色
|
||||
$('#L_title').css("color", color);
|
||||
}
|
||||
});
|
||||
|
||||
//上传附件
|
||||
upload.render({
|
||||
elem: '#zip-button'
|
||||
,url: "{:url('article/Uploads')}" //改成您自己的上传接口
|
||||
,data: {type:'zip'}
|
||||
,accept: 'file' //普通文件
|
||||
,done: function(res){
|
||||
if(res.status == 0){
|
||||
$('input[name="upzip"]').val(res.url);
|
||||
layer.msg('上传成功');
|
||||
} else {
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//发布文章
|
||||
form.on('submit(article-add)', function(data){
|
||||
var field = data.field;
|
||||
var numArr = new Array();
|
||||
$('.layui-btn-container').children('button').each(function(){
|
||||
numArr.push($(this).val());//添加至数组
|
||||
});
|
||||
tags = numArr.lenth ? '' : numArr.join(',');
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/add')}",
|
||||
data:{"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"captcha":field.captcha,"__token__":field.__token__},
|
||||
dataType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg,{icon:6,time:2000}, function(){
|
||||
location.href = data.url;
|
||||
});
|
||||
} else {
|
||||
layer.open({title:'发布失败',content:data.msg,icon:5,anim:6});
|
||||
layui.jquery('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
//添加tags
|
||||
$('#article-tags-button').on('click',function(){
|
||||
var tags = $("input[name='tags']").val();
|
||||
if(tags == ''){
|
||||
layer.msg('不能为空');
|
||||
return false;
|
||||
}
|
||||
//把得到的tags放进数组
|
||||
var numArr = new Array();
|
||||
$('.layui-btn-container').children('button').each(function(){
|
||||
numArr.push($(this).val());//添加至数组
|
||||
});
|
||||
|
||||
for(var i=0; i<numArr.length; i++){
|
||||
if(tags.indexOf(numArr[i])>=0){
|
||||
layer.msg('不能重复添加'+numArr[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//console.log(tags);
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/tags')}",
|
||||
data:{"tags":tags},
|
||||
daType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
for(var i=0; i<data.data.length; i++){
|
||||
$('.layui-btn-container').append('<button type="button" class="layui-btn" value='+data.data[i]+'>'+data.data[i]+'</button>');
|
||||
}
|
||||
$("input[name='tags']").val("");
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
//加载播放器
|
||||
plyr.setup();
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
@ -1,335 +0,0 @@
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="title"}{$article.title}-{$sysInfo.webname}{/block}
|
||||
{block name="keywords"}{$article.title},{$article.tags}{/block}
|
||||
{block name="description"}{$article.title},{:getArtContent($article.content)}{/block}
|
||||
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
||||
{block name="column"}<div class="layui-hide-xs">{include file="/public/column" /}</div>{/block}
|
||||
{block name="content"}
|
||||
<div class="layui-container">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md8 content detail">
|
||||
<div class="fly-panel detail-box">
|
||||
<h1 style="color:{$article.title_color};">{$article.title}
|
||||
<span class="layui-hide-xs"><div onclick="PhoneDown();" style="" class="detail_qrcode" id="mobile"></div></span>
|
||||
</h1>
|
||||
<span class="fly-list-nums">
|
||||
<a href="#comment"><i class="iconfont" title="{:lang('reply')}"></i> {$comments->count()} </a>
|
||||
<i class="iconfont" title="浏览"></i> {$pv}
|
||||
</span>
|
||||
|
||||
<div class="detail-about">
|
||||
<a class="fly-avatar" href="{:url('user/home',['id'=>$article.user.id])}">
|
||||
<img src="{$article.user.user_img}" alt="{$article.user.name}">
|
||||
<i class="iconfont icon-renzheng" title="认证信息"></i>
|
||||
</a>
|
||||
<div class="fly-detail-user">
|
||||
<a href="{:url('user/home',['id'=>$article.user.id])}" class="fly-link">
|
||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="">{:getAsing($article.user.area_id) ?: '无'}</i>{/if}
|
||||
<cite>{$article.user.nickname ?: $article.user.name}</cite>
|
||||
</a>
|
||||
</div>
|
||||
<div class="fly-detail-info">
|
||||
<div class="fly-admin-box" data-id="{$article.id}">
|
||||
{if ($user.auth ?? '')}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="del"><i class="layui-icon layui-icon-delete"></i></span>
|
||||
{if($article.is_top == 0)}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="1"><i class="layui-icon layui-icon-top"></i></span>
|
||||
{else /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="0" style="background-color:#ccc;">{:lang('cancel topping')}</span>
|
||||
{/if}
|
||||
{if($article.is_hot == 0)}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="1"><i class="layui-icon layui-icon-fire"></i></span>
|
||||
{else /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="0" style="background-color:#ccc;">{:lang('cancel hoting')}</span>
|
||||
{/if}
|
||||
{if($article.is_reply == 1)}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="0"><i class="layui-icon layui-icon-face-cry"></i></span>
|
||||
{else /}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="1" style="background-color:#ccc;">{:lang('enable reply')}</span>
|
||||
{/if}
|
||||
<span id="color">{:lang('title color')}</span>
|
||||
{/if}
|
||||
{if(session('user_name')==$article.user.name || ($user.auth ?? ''))}
|
||||
<span class="layui-btn layui-btn-xs jie-admin" type="edit"><a href="{:url('article/edit',['id'=>$article.id])}">{:lang('edit')}</a></span>
|
||||
{/if}
|
||||
<div id="LAY_jieAdmin" data-id="{$article['id']}"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="detail-hits">
|
||||
<!--span style="padding-right: 10px; color: #FF7200">悬赏:60飞吻</span-->
|
||||
<span class="post-time" data="{$article.create_time}" style="padding-top: 5px;"></span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="detail-body photos">{$article.content|raw}</div>
|
||||
{notempty name="$article.upzip"}
|
||||
<div class="layui-inline">
|
||||
<label ">{:lang('enclosure')}:</label>
|
||||
<button type="button" class="layui-btn" id="zip-download"><i class="layui-icon layui-icon-download-circle"></i>{:lang('download files')}: {$article.downloads}次</button>
|
||||
</div>
|
||||
{/notempty}
|
||||
</div>
|
||||
<!--评论-->
|
||||
<div class="fly-panel detail-box" id="flyReply">
|
||||
<span style="font-size:18px;">评论 {$comments->count()}</span>
|
||||
<ul class="jieda" id="jieda">
|
||||
{volist name="comments" id="vo" empty= ""}
|
||||
<li data-id="{$vo.id}" class="jieda-daan">
|
||||
<a name="item-1111111111"></a>
|
||||
<div class="detail-about detail-about-reply">
|
||||
<a class="fly-avatar" href="{:url('user/home',['id'=>$vo.user.id])}">
|
||||
<img src="{$vo.user.user_img}" alt=" ">
|
||||
</a>
|
||||
<div class="fly-detail-user">
|
||||
<a href="{:url('user/home',['id'=>$vo.user.id])}" class="fly-link">
|
||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="">{:getAsing($vo.user.area_id) ?: '无'}</i>{/if}
|
||||
<cite>{$vo.user.nickname ?: $vo.user.name}</cite>
|
||||
<!--i class="iconfont icon-renzheng" title="认证信息:XXX"></i>
|
||||
<i class="layui-badge fly-badge-vip">VIP3</i-->
|
||||
</a>
|
||||
{if condition="$article.user.id eq $vo.user.id"}
|
||||
<span>({:lang('poster')})</span>
|
||||
{/if}
|
||||
<!--
|
||||
<span style="color:#5FB878">(管理员)</span>
|
||||
<span style="color:#FF9E3F">(社区之光)</span>
|
||||
<span style="color:#999">(该号已被封)</span>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<div class="detail-hits">
|
||||
<span class="post-time" data="{$vo.create_time}"></span>
|
||||
</div>
|
||||
{if $vo.cai == 1}<i class="iconfont icon-caina" title="最佳答案"></i>{/if}
|
||||
</div>
|
||||
|
||||
<div class="detail-body jieda-body photos">{$vo.content|raw}</div>
|
||||
|
||||
<div class="jieda-reply">
|
||||
<span class="jieda-zan {if($vo.zan != 0)}zanok{/if}" type="zan">
|
||||
<i class="iconfont icon-zan"></i><em>{$vo.zan}</em>
|
||||
</span>
|
||||
<span type="reply"><i class="iconfont icon-svgmoban53"></i>{:lang('reply')}</span>
|
||||
|
||||
<div class="jieda-admin">
|
||||
{if (session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2) OR ($user.auth ?? '')}
|
||||
<span type="edit">{:lang('edit')}</span>
|
||||
<span type="del">{:lang('delete')}</span>
|
||||
{if $vo.cai == 0 && (session('user_id') == $article.user_id) OR ($user.auth ?? '') /}
|
||||
<span class="jieda-accept" type="accept">{:lang('accept')}</span>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{/volist}
|
||||
</ul>
|
||||
<div style="text-align: center">{$comments|raw}</div>
|
||||
{if condition="$article.is_reply == 1"}
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<a name="comment"></a>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor" style="height: 150px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<input type="hidden" name="article_id" value="{$article.id}">
|
||||
<input type="hidden" name="user_id" value="{:session('user_id')}">
|
||||
<button class="layui-btn" lay-filter="user-comment" lay-submit>{:lang('submit comments')}</button>
|
||||
</div>
|
||||
</div>
|
||||
{else /}
|
||||
<blockquote class="layui-elem-quote layui-quote-nm layui-disabled" style="margin: 100px 0 20px; padding: 50px 20px; text-align: center; color: #999!important;">本帖已设置禁止回复</blockquote>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<div class="fly-panel">
|
||||
<div class="fly-panel-title">{:lang('sponsor')}<span style="padding: 0 3px;">-</span>
|
||||
<a href="" class="fly-link fly-joinad">{:lang('i want to join')}</a>
|
||||
</div>
|
||||
<div class="fly-panel-main">
|
||||
{volist name="ad_comm" id="vo"}
|
||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: {$vo.slid_color};">{$vo.slid_name}</a>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
<dl class="fly-panel fly-list-one">
|
||||
<dt class="fly-panel-title">{:lang('hot post list')}</dt>
|
||||
{volist name="artHot" id="vo"}
|
||||
<dd>
|
||||
<a href="{:url('article/detail',['id' => $vo.id])}">{$vo.title}</a>
|
||||
<span><i class="iconfont icon-pinglun1"></i> {$vo.comments_count}</span>
|
||||
</dd>
|
||||
{/volist}
|
||||
</dl>
|
||||
<div class="fly-panel" style="padding: 5px 0; text-align: center;">
|
||||
{volist name="ad_art" id="vo"}
|
||||
<a href="{$vo.slid_href}" target="_blank"><img src="{$vo.slid_img}" style="max-width: 100%;"></a>
|
||||
{/volist}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{include file="public/menu" /}
|
||||
<!--底部栏-->
|
||||
<div class="site-tree-mobile-detail-bottom layui-hide-md">
|
||||
<div id="LAY_jieAdmin" data-id="{$article['id']}"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/block}
|
||||
{block name="script"}
|
||||
<script>
|
||||
var collectionFind = "{:url('Collection/find')}",
|
||||
articleJieset = "{:url('Article/jieset')}",
|
||||
articleDelete = "{:url('Article/delete')}",
|
||||
commentJiedaZan = "{:url('Comment/jiedaZan')}",
|
||||
commentJiedaCai = "{:url('Comment/jiedaCai')}",
|
||||
commentGetDa = "{:url('Comment/getDa')}",
|
||||
commentUpdateDa = "{:url('Comment/updateDa')}",
|
||||
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
||||
langCollection = "{:lang('collection')}",
|
||||
langCancelCollection = "{:lang('cancel collection')}";
|
||||
var collection = "{:url('collection/')}";
|
||||
|
||||
layui.use(['fly', 'face','colorpicker','plyr'], function(){
|
||||
var $ = layui.jquery
|
||||
,form = layui.form
|
||||
,fly = layui.fly
|
||||
,colorpicker = layui.colorpicker
|
||||
,plyr = layui.plyr;
|
||||
var laytpl = layui.laytpl;
|
||||
var uid = layui.cache.user.uid;
|
||||
|
||||
//tpl模板给发布时间赋值
|
||||
$('div.detail-hits').children('span.post-time').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
var string = laytpl('{{ d.time }}').render({
|
||||
//time: html
|
||||
time: othis.attr('data')
|
||||
});
|
||||
var posttime = layui.util.timeAgo(string, 1);
|
||||
|
||||
othis.text(posttime);
|
||||
//console.log(othis.attr('data'));
|
||||
});
|
||||
|
||||
|
||||
//预定义颜色项
|
||||
colorpicker.render({
|
||||
elem: '#color'
|
||||
,color: '#393d49'
|
||||
,predefine: true // 开启预定义颜色
|
||||
,size: 'xs'
|
||||
,done: function(color){
|
||||
//改变标题颜色
|
||||
$('h1').css("color", color);
|
||||
var id = {$article.id};
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:"{:url('Article/titleColor')}",
|
||||
data:{id: id,title_color: color},
|
||||
dataType:'json',
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
layer.msg(data.msg,{icon:6,time:2000
|
||||
});
|
||||
} else {
|
||||
layer.open({content:data.msg,icon:5,adim:6});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//评论需要登陆
|
||||
form.on('submit(user-comment)',function (data){
|
||||
var filed = data.field;
|
||||
if (uid == -1) {
|
||||
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
||||
location.href = "{:url('login/index')}";
|
||||
});
|
||||
} else {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "{:url('article/comment')}",
|
||||
data: filed,
|
||||
dataType: "json",
|
||||
success:function (data) {
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg,{icon:6,time:2000},function () {
|
||||
location.reload(true);
|
||||
});
|
||||
}else {
|
||||
layer.open({title:'评论失败',content:data.msg,icon:5,anim:6});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
//下载
|
||||
$('#zip-download').click(function (){
|
||||
var id = "{$article.id}";
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/download')}",
|
||||
data:{id:id},
|
||||
success:function (data) {
|
||||
location.href = "{:url('article/download',['id'=>$article.id])}";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||
$('.detail-body').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
othis.html(fly.content(html));
|
||||
});
|
||||
//加载播放器
|
||||
plyr.setup();
|
||||
|
||||
});
|
||||
|
||||
//扫码阅读
|
||||
$("#rdown").hover(function(){
|
||||
$("#phonedl").show().stop();
|
||||
},function(){
|
||||
$("#phonedl").hide().stop();
|
||||
});
|
||||
|
||||
$("#phonedl").hover(function(){
|
||||
$("#phonedl").show().stop();
|
||||
},function(){
|
||||
$("#phonedl").hide().stop();
|
||||
});
|
||||
|
||||
function PhoneDown(){
|
||||
layer.open({
|
||||
title: "扫码查阅",
|
||||
skin: 'layui-layer',
|
||||
content: "<img src='/qrcode/?text={$Request.domain}{:url('article/detail',['id' => $article.id])}&size=230'>"
|
||||
});
|
||||
}
|
||||
//推送百度收录服务
|
||||
(function(){
|
||||
var bp = document.createElement('script');
|
||||
var curProtocol = window.location.protocol.split(':')[0];
|
||||
if (curProtocol === 'https') {
|
||||
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
|
||||
}
|
||||
else {
|
||||
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
|
||||
}
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(bp, s);
|
||||
})();
|
||||
</script>
|
||||
{/block}
|
@ -1,270 +0,0 @@
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="title"}编辑帖子{/block}
|
||||
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
||||
{block name="column"}{/block}
|
||||
{block name="content"}
|
||||
<div class="">{include file="public/menu" /}</div>
|
||||
<div class="layui-container fly-marginTop">
|
||||
<div class="fly-panel" pad20 style="padding-top: 5px;">
|
||||
<!--<div class="fly-none">没有权限</div>-->
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="user">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">{:lang('edit post')}</li>
|
||||
</ul>
|
||||
<div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
|
||||
<div class="layui-tab-item layui-show">
|
||||
|
||||
<input type="hidden" name="id" value="{$article.id}">
|
||||
<div class="layui-row layui-col-space15 layui-form-item">
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label">{:lang('special column')}</label>
|
||||
<div class="layui-input-block">
|
||||
<select lay-verify="required" name="cate_id" lay-filter="column">
|
||||
<option></option>
|
||||
|
||||
{volist name="cateList" id="cate"}
|
||||
<option value="{$cate.id}" {if $article.cate_id == $cate.id}selected{/if}>{:cookie('think_lang') == 'en-us' ? $cate.ename : $cate.catename}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md8">
|
||||
<label for="L_title" class="layui-form-label">{:lang('title')}</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$article.title}">
|
||||
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" value="{$article.title_color}">
|
||||
<input type="hidden" name="user_id" value="{$article.user_id}">
|
||||
</div>
|
||||
</div>
|
||||
{if ($user.auth == 1)}
|
||||
<div class="layui-col-md1">
|
||||
<div id="color"></div>
|
||||
<div id="test9" style="margin-left: 30px;"></div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="layui-row layui-col-space15 layui-form-item layui-hide" id="LAY_quiz">
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label">所属产品</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="project">
|
||||
<option></option>
|
||||
<option value="layui">layui</option>
|
||||
<option value="独立版layer">独立版layer</option>
|
||||
<option value="独立版layDate">独立版layDate</option>
|
||||
<option value="LayIM">LayIM</option>
|
||||
<option value="Fly社区模板">Fly社区模板</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md3">
|
||||
<label class="layui-form-label" for="L_version">版本号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_version" value="" name="version" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6">
|
||||
<label class="layui-form-label" for="L_browser">浏览器</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="L_browser" value="" name="browser" placeholder="浏览器名称及版本,如:IE 11" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<div class="layui-input-block">
|
||||
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细描述" class="layui-textarea fly-editor" style="height: 260px;">{$article.content}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">悬赏飞吻</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<select name="experience">
|
||||
<option value="20">20</option>
|
||||
<option value="30">30</option>
|
||||
<option value="50">50</option>
|
||||
<option value="60">60</option>
|
||||
<option value="80">80</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">发表后无法更改飞吻</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">{:lang('enclosure')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="upzip" value="{$article.upzip}" placeholder="zip,jpg格式" title="上传附件"/>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="zip-button"><i class="layui-icon"></i>上传文件</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">{:lang('add tags')}</label>
|
||||
<div class="layui-input-inline" style="width: 190px;">
|
||||
<input type="text" class="layui-input" name="tags" placeholder="多个标签用,号隔开" title="添加标签"/>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="article-tags-button">{:lang('add')}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-btn-container">
|
||||
{volist name="tags" id="vo" }
|
||||
<button type="button" class="layui-btn" value="{$vo}">{$vo}</button>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
<span style="color: #c00;"><img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" /></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" class="layui-btn" lay-filter="article-edit" lay-submit id="edit">{:lang('post now')}</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
layui.use(['fly','colorpicker','form','upload','plyr'], function(){
|
||||
var $ = layui.jquery
|
||||
,fly = layui.fly
|
||||
,colorpicker = layui.colorpicker
|
||||
,form = layui.form
|
||||
,upload = layui.upload
|
||||
,plyr = layui.plyr;
|
||||
|
||||
//预定义颜色项
|
||||
colorpicker.render({
|
||||
elem: '#color'
|
||||
,color: '{$article.title_color}'
|
||||
,predefine: true // 开启预定义颜色
|
||||
,done: function(color){
|
||||
//console.log(color);
|
||||
//譬如你可以在回调中把得到的 color 赋值给表单
|
||||
$('#L_title_color').val(color);
|
||||
//改变标题颜色
|
||||
$('#L_title').css("color", color);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//指定允许上传的文件类型
|
||||
upload.render({
|
||||
elem: '#zip-button'
|
||||
,url: '{:url('article/upzip')}' //改成您自己的上传接口
|
||||
,accept: 'file' //普通文件
|
||||
,done: function(res){
|
||||
if(res.status == 0){
|
||||
$('input[name="upzip"]').val(res.url);
|
||||
layer.msg('上传成功');
|
||||
} else {
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//编辑文章
|
||||
form.on('submit(article-edit)', function(data){
|
||||
var field = data.field;
|
||||
var numArr = new Array();
|
||||
$('.layui-btn-container').children('button').each(function(){
|
||||
numArr.push($(this).val());//添加至数组
|
||||
});
|
||||
tags = numArr.lenth ? '' : numArr.join(',');
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/edit')}",
|
||||
data:{"id":field.id,"cate_id":field.cate_id,"title":field.title,"title_color":field.title_color,"user_id":field.user_id,"content":field.content,"upzip":field.upzip,"tags":tags,"captcha":field.captcha},
|
||||
daType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg,{icon:6,time:2000}, function(){
|
||||
location.href = data.url;
|
||||
});
|
||||
} else {
|
||||
layer.open({title:'编辑失败',content:data.msg,icon:5,anim:6});
|
||||
layui.jquery('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
|
||||
};
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
//添加tags
|
||||
$('#article-tags-button').on('click',function(){
|
||||
var tags = $("input[name='tags']").val();
|
||||
|
||||
if(tags == ''){
|
||||
layer.msg('不能为空');
|
||||
return false;
|
||||
}
|
||||
|
||||
var numArr = new Array();
|
||||
$('.layui-btn-container').children('button').each(function(){
|
||||
numArr.push($(this).val());//添加至数组
|
||||
});
|
||||
for(var i=0; i<numArr.length; i++){
|
||||
if(tags.indexOf(numArr[i])>=0){
|
||||
layer.msg('不能重复添加'+numArr[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//保存tags
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url:"{:url('article/tags')}",
|
||||
data:{"tags":tags},
|
||||
daType:"json",
|
||||
success:function (data){
|
||||
if (data.code == 0) {
|
||||
for(var i=0; i<data.data.length; i++){
|
||||
$('.layui-btn-container').append('<button type="button" class="layui-btn" value='+data.data[i]+'>'+data.data[i]+'</button>');
|
||||
}
|
||||
$("input[name='tags']").val("");
|
||||
} else {
|
||||
layer.open({
|
||||
title:'添加失败',
|
||||
content:data.msg,
|
||||
icon:5,
|
||||
anim:6
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
//删除tag
|
||||
$(document).ready(function(){
|
||||
$('.layui-btn-container').on('click','button',function(){
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
|
||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||
$('.layui-textarea').each(function(){
|
||||
var othis = $(this), html = othis.html();
|
||||
othis.attr(fly.content(html));
|
||||
})
|
||||
//加载播放器
|
||||
plyr.setup();
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
@ -1,186 +0,0 @@
|
||||
{extend name="public/base" /}
|
||||
|
||||
{block name="title"}{:lang('retrieve password')}{/block}
|
||||
{block name="column"}{/block}
|
||||
{block name="content"}
|
||||
<div class="">{include file="public/menu" /}</div>
|
||||
<div class="layui-container fly-marginTop">
|
||||
<div class="fly-panel fly-panel-user" pad20>
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="user">
|
||||
<ul class="layui-tab-title">
|
||||
<li><a href="{:url('index/login/index')}">{:lang('login')}</a></li>
|
||||
<li class="layui-this">{if cache('repass')==2}{:lang('reset password')}{else /}{:lang('retrieve password')}{/if}</li>
|
||||
</ul>
|
||||
<div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
|
||||
<div class="layui-tab-item layui-show">
|
||||
{//验证码}
|
||||
{if cache('repass') == 'postcode'}
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="code" required lay-verify="required" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn" lay-submit lay-filter="user-get-code">{:lang('submit')}</button>
|
||||
<span class="layui-btn" ><a href="{:url('login/forget')}">{:lang('go back')}</a></span>
|
||||
</div>
|
||||
</div>
|
||||
{elseif cache('repass') == 'resetpass' /}
|
||||
<!-- 重置密码 -->
|
||||
<div class="fly-msg">{:lang('reset password')}</div>
|
||||
<div class="layui-form layui-form-pane" style="margin-top: 30px;">
|
||||
<div class="layui-form-item">
|
||||
<label for="L_pass" class="layui-form-label">{:lang('new password')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="L_pass" name="password" required lay-verify="required" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">{:lang('6-16 characters')}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_repass" class="layui-form-label">{:lang('confirm password')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="L_repass" name="repassword" required lay-verify="required" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
<span style="color: #c00;">
|
||||
<div >
|
||||
<img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" />
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<!--
|
||||
<input type="hidden" name="name" value="{{d.username}}">
|
||||
<input type="hidden" name="email" value="{{d.email}}">
|
||||
-->
|
||||
<button class="layui-btn" alert="1" lay-filter="user-reset-pass" lay-submit>{:lang('submit')}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fly-error">该重置密码链接已失效,请重新校验您的信息</div>
|
||||
<div class="fly-error">非法链接,请重新校验您的信息</div>
|
||||
{else /}
|
||||
{//发邮件}
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-form-item">
|
||||
<label for="L_email" class="layui-form-label">{:lang('email')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_email" name="email" required lay-verify="required" placeholder="{:lang('email')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
<span style="color: #c00;">
|
||||
<div ><img id="captcha" src="{:captcha_src()}?id=1" onclick="this.src='{:captcha_src()}?id=1'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" /></div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" name="submit" class="layui-btn" alert="1" lay-filter="user-forget-sendmail" lay-submit>{:lang('submit')}</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
layui.use(function(){
|
||||
var $ = layui.jquery;
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
//设置资料
|
||||
form.on('submit(user-forget-sendmail)', function(data){
|
||||
var field = data.field;
|
||||
var loading = layer.load(2, {
|
||||
shade: [0.2, '#000']
|
||||
});
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:"{:url('login/forget')}",
|
||||
data:field,
|
||||
dataType:"json",
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
layer.close(loading);
|
||||
layer.msg(data.msg,{icon:6,tiye:2000},function(){
|
||||
location.href = data.url;
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.open({title:"发送失败",content:data.msg,icon:5,anim:6});
|
||||
$('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
|
||||
}}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//验证码
|
||||
form.on('submit(user-get-code)', function(data){
|
||||
var field = data.field;
|
||||
var loading = layer.load(2, {
|
||||
shade: [0.2, '#000']
|
||||
});
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:"{:url('login/postcode')}",
|
||||
data:field,
|
||||
dataType:"json",
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
layer.close(loading);
|
||||
layer.msg(data.msg,{icon:6,tiye:2000},function(){
|
||||
location.href = data.url;
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.open({title:"验证失败",content:data.msg,icon:5,anim:6});
|
||||
$('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
|
||||
}}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//修改密码
|
||||
form.on('submit(user-reset-pass)', function(data){
|
||||
var field = data.field;
|
||||
var loading = layer.load(2, {
|
||||
shade: [0.2, '#000']
|
||||
});
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:"{:url('login/respass')}",
|
||||
data:field,
|
||||
dataType:"json",
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
layer.close(loading);
|
||||
layer.msg(data.msg,{icon:6,tiye:2000},function(){
|
||||
location.href = data.url;
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.open({title:"修改失败",content:data.msg,icon:5,anim:6});
|
||||
$('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
|
||||
}}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
@ -1,105 +0,0 @@
|
||||
{extend name="public:base" /}
|
||||
|
||||
{block name="title"}注册账号{/block}
|
||||
{block name="column"}{/block}
|
||||
{block name="content"}
|
||||
<div class="">{include file="public/menu" /}</div>
|
||||
<div class="layui-container fly-marginTop">
|
||||
<div class="fly-panel fly-panel-user" pad20>
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="user">
|
||||
<ul class="layui-tab-title">
|
||||
<li><a href="{:url('login/index')}">{:lang('login')}</a></li>
|
||||
<li class="layui-this">{:lang('sign up')}</li>
|
||||
</ul>
|
||||
<div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-form-item">
|
||||
<label for="L_username" class="layui-form-label">{:lang('username')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_username" name="name" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('it cannot be changed')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_email" class="layui-form-label">{:lang('email')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_email" name="email" required lay-verify="email" autocomplete="off" class="layui-input" placeholder="{:lang('email')}">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">{:lang('the only way to get back your password')}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_pass" class="layui-form-label">{:lang('password')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="L_pass" name="password" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('6-16 characters')}">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">{:lang('strong type encryption')}</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_repass" class="layui-form-label">{:lang('confirm password')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="L_repass" name="repassword" required lay-verify="required" autocomplete="off" class="layui-input" placeholder="{:lang('please confirm the password')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_vercode" class="layui-form-label">{:lang('captcha')}</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_vercode" name="captcha" required lay-verify="required" placeholder="{:lang('please input the captcha')}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div >
|
||||
<span style="color: #c00;">
|
||||
<div>
|
||||
<img id="captcha" src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" />
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" class="layui-btn" lay-filter="user-register" lay-submit>{:lang('register now')}</button>
|
||||
</div>
|
||||
<!--div class="layui-form-item fly-form-app">
|
||||
<span>或者直接使用社交账号快捷注册</span>
|
||||
<a href="" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-qq" title="QQ登入"></a>
|
||||
<a href="" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-weibo" title="微博登入"></a>
|
||||
</div-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
layui.use(['form','layer'],function(){
|
||||
var $ = layui.jquery;
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
//注册
|
||||
form.on('submit(user-register)', function(data){
|
||||
var field = data.field;
|
||||
var loading = layer.load(2, {
|
||||
shade: [0.2, '#000']
|
||||
});
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:"{:url('Login/reg')}",
|
||||
data:field,
|
||||
dataType:"json",
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
layer.close(loading);
|
||||
layer.msg(data.msg,{icon:6,tiye:2000},function(){
|
||||
location.href = data.url;
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.open({title:"更新失败",content:data.msg,icon:5,anim:6});
|
||||
layui.jquery('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
|
||||
}}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
@ -1,53 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>用户中心</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="keywords" content="TaoLer社区">
|
||||
<meta name="description" content="TaoLer社区是模块化前端UI框架社区,致力于为web开发提供强劲动力">
|
||||
<link rel="stylesheet" href="/static/res/css/font_24081_qs69ykjbea.css" />
|
||||
<link rel="stylesheet" href="/static/layui/css/layui.css">
|
||||
<link rel="stylesheet" href="/static/res/css/global.css">
|
||||
{block name="css"}{/block}
|
||||
</head>
|
||||
<body>
|
||||
{include file="public/header" /}
|
||||
<div class="layui-container fly-marginTop fly-user-main">
|
||||
{include file="public/user-nav" /}
|
||||
<div class="fly-panel fly-panel-user" pad20 style="padding-top:20px;">
|
||||
{block name="content"}
|
||||
{/block}
|
||||
</div>
|
||||
</div>
|
||||
{include file="public/footer" /}
|
||||
<script>
|
||||
var articleUrl = "{:url('user/article')}";
|
||||
var artListUrl = "{:url('User/artList')}";
|
||||
var collListUrl = "{:url('User/collList')}";
|
||||
var atrDelUrl = "{:url('article/delete')}";
|
||||
var artEditUrl = "{:url('article/edit')}";
|
||||
var collDelUrl = "{:url('user/colltDel')}";
|
||||
var uploadHeadImg = "{:url('User/uploadHeadImg')}";
|
||||
|
||||
layui.cache.page = 'user';
|
||||
layui.cache.user = {
|
||||
username: '{$user.name??'游客'}'
|
||||
,uid: '{$user.id ?? -1}'
|
||||
,avatar: '{$user['user_img'] ?? '/static/res/images/avatar/00.jpg'}'
|
||||
,experience: '{$user.point ?? ''}'
|
||||
,sex: '{$user.sex ? '女':'男'}'
|
||||
};
|
||||
layui.config({
|
||||
version: "3.0.0"
|
||||
,base: '/static/res/mods/'
|
||||
}).extend({
|
||||
fly: 'index'
|
||||
}).use('fly');
|
||||
</script>
|
||||
{block name="script"}
|
||||
<script>
|
||||
</script>
|
||||
{/block}
|
||||
</body>
|
||||
</html>
|
@ -1,171 +0,0 @@
|
||||
{extend name="public/user" /}
|
||||
|
||||
{block name="content"}
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="user">
|
||||
<ul class="layui-tab-title" id="LAY_mine">
|
||||
<li class="layui-this" lay-id="info">我的资料</li>
|
||||
<li lay-id="avatar">头像</li>
|
||||
<li lay-id="pass">密码</li>
|
||||
<li lay-id="bind">帐号绑定</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content" style="padding: 20px 0;">
|
||||
<div class="layui-form layui-form-pane layui-tab-item layui-show">
|
||||
<div class="layui-form-item">
|
||||
<label for="L_email" class="layui-form-label">邮箱</label>
|
||||
<input type="hidden" name="user_id" value="{:session('user_id')}">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_email" name="email" lay-verify="email" autocomplete="off" value="{$user.email}" class="layui-input" placeholder="{$user.email}">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">如果您在邮箱已激活的情况下,变更了邮箱,需<a href="activate.html" style="font-size: 12px; color: #4f99cf;">重新验证邮箱</a>。</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_username" class="layui-form-label">昵称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_username" name="nickname" required lay-verify="required" autocomplete="off" value="{$user.nickname}" class="layui-input" placeholder="{$user.nickname}">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input type="radio" name="sex" value="0" {if condition="$user['sex'] eq 0"} checked {/if} title="男">
|
||||
<input type="radio" name="sex" value="1" {if condition="$user['sex'] eq 1"} checked {/if} title="女">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_city" class="layui-form-label">城市</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="L_city" name="city" autocomplete="off" value="{$user.city}" class="layui-input" placeholder="{$user.city}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_area" class="layui-form-label">区域</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="area_id" lay-filter="LAY-user-adminrole-type">
|
||||
<option value="">无</option>
|
||||
{volist name="area" id="vo"}
|
||||
<option {if condition="$vo.id eq $user.area_id"} selected {/if} value="{$vo.id}">{$vo.area}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="L_sign" class="layui-form-label">签名</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea placeholder="随便写些什么刷下存在感" id="L_sign" name="sign" autocomplete="off" class="layui-textarea" style="height: 80px;" value="{$user.sign}">{$user.sign}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" name="submit" class="layui-btn" lay-filter="user-set-info" lay-submit>确认修改</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form layui-form-pane layui-tab-item">
|
||||
<div class="layui-form-item">
|
||||
<div class="avatar-add">
|
||||
<p>建议尺寸168*168,支持jpg、png、gif,最大不能超过50KB</p>
|
||||
<button type="button" class="layui-btn upload-img">
|
||||
<i class="layui-icon"></i>上传头像
|
||||
</button>
|
||||
<img src="{$user.user_img}">
|
||||
<span class="loading"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form layui-form-pane layui-tab-item">
|
||||
<input type="hidden" name="user_id" value="{:session('user_id')}">
|
||||
<div class="layui-form-item">
|
||||
<label for="L_nowpass" class="layui-form-label">当前密码</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="L_nowpass" name="nowpass" required lay-verify="required" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_pass" class="layui-form-label">新密码</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="L_pass" name="password" required lay-verify="required" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">6到16个字符</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="L_repass" class="layui-form-label">确认密码</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="L_repass" name="repassword" required lay-verify="required" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn" lay-filter="user-set-pass" lay-submit >确认修改</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form layui-form-pane layui-tab-item">
|
||||
<ul class="app-bind">
|
||||
<li class="fly-msg app-havebind">
|
||||
<i class="iconfont icon-qq"></i>
|
||||
<span>已成功绑定,您可以使用QQ帐号直接登录Fly社区,当然,您也可以</span>
|
||||
<a href="javascript:;" class="acc-unbind" type="qq_id">解除绑定</a>
|
||||
|
||||
<!-- <a href="" onclick="layer.msg('正在绑定微博QQ', {icon:16, shade: 0.1, time:0})" class="acc-bind" type="qq_id">立即绑定</a>
|
||||
<span>,即可使用QQ帐号登录Fly社区</span> -->
|
||||
</li>
|
||||
<li class="fly-msg">
|
||||
<i class="iconfont icon-weibo"></i>
|
||||
<!-- <span>已成功绑定,您可以使用微博直接登录Fly社区,当然,您也可以</span>
|
||||
<a href="javascript:;" class="acc-unbind" type="weibo_id">解除绑定</a> -->
|
||||
|
||||
<a href="" class="acc-weibo" type="weibo_id" onclick="layer.msg('正在绑定微博', {icon:16, shade: 0.1, time:0})" >立即绑定</a>
|
||||
<span>,即可使用微博帐号登录Fly社区</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
layui.use(function(){
|
||||
var $ = layui.jquery;
|
||||
var form = layui.form;
|
||||
//设置资料
|
||||
form.on('submit(user-set-info)', function(data){
|
||||
var field = data.field;
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:"{:url('User/set')}",
|
||||
data:field,
|
||||
dataType:"json",
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
layer.msg(data.msg,{icon:6,tiye:2000},function(){
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
layer.open({title:"更新失败",content:data.msg,icon:5,anim:6});
|
||||
}}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//设置密码
|
||||
form.on('submit(user-set-pass)', function(data){
|
||||
var field = data.field;
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:"{:url('User/setPass')}",
|
||||
data:field,
|
||||
dataType:"json",
|
||||
success:function(data){
|
||||
if(data.code == 1){
|
||||
layer.msg(data.msg,{icon:6,tiye:2000},function(){
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
layer.open({title:"密码设置失败",content:data.msg,icon:5,anim:6});
|
||||
}}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
{/block}
|
Loading…
x
Reference in New Issue
Block a user