This commit is contained in:
toogee 2020-04-22 18:37:53 +08:00
parent 72edb70ede
commit 943a11bdbf
12 changed files with 34 additions and 22 deletions

View File

@ -160,7 +160,7 @@ class Article extends BaseController
//站内信
$article = Db::name('article')->field('id,title,user_id')->where('id',$data['article_id'])->find();
$title = $article['title'];
$link = '/index/jie/'.$data['article_id'].'.html';
$link = '/jie/'.$data['article_id'].'.html';
//@user comment
$preg = "/@([^@\s]*)\s/";
preg_match($preg,$data['content'],$username);

View File

@ -24,7 +24,7 @@ class Auth
{
//登陆检验
if (!Session::has('admin_id')) {
return redirect('/admin/login/index');
return redirect((string) url('admin/login/index'));
}
$app = app('http')->getName();
$controller = $request->controller();

View File

@ -395,16 +395,16 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util'], function(
,newmsg: function(){
var elemUser = $('.fly-nav-user');
if(layui.cache.user.uid !== -1 && elemUser[0]){
fly.json('/index/message/nums', {
fly.json(messageNums, {
_: new Date().getTime()
}, function(res){
if(res.status === 0 && res.count > 0){
var msg = $('<a class="fly-nav-msg" href="javascript:;">'+ res.count +'</a>');
elemUser.append(msg);
msg.on('click', function(){
fly.json('/index/message/read', {}, function(res){
fly.json(messageRead, {}, function(res){
if(res.status === 0){
location.href = '/index/user/message';
location.href = userMessage;
}
});
});
@ -672,7 +672,7 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util'], function(
if(elemReply[0]){
fly.json('/index/index/reply', {
fly.json(replyurl, {
limit: 20
}, function(res){
var html = laytpl(tplReply).render(res);

View File

@ -143,7 +143,7 @@ layui.define('fly', function(exports){
var div = $('.fly-admin-box'), jieAdmin = $('#LAY_jieAdmin');
//查询帖子是否收藏
if(jieAdmin[0] && layui.cache.user.uid != -1){
fly.json('/index/collection/find/', {
fly.json(collectionFind, {
cid: div.data('id')
}, function(res){
jieAdmin.append('<span class="layui-btn layui-btn-xs jie-admin '+ (res.data.collection ? 'layui-btn-danger' : '') +'" type="collect" data-type="'+ (res.data.collection ? 'remove' : 'add') +'">'+ (res.data.collection ? '取消收藏' : '收藏') +'</span>');

View File

@ -325,7 +325,7 @@ layui.define(['laypage', 'fly', 'element', 'flow'], function(exports){
}
fly.json('/index/message/find/', {}, function(res){
fly.json(messageFind, {}, function(res){
var html = laytpl(tpl).render(res);
dom.minemsg.html(html);
if(res.rows.length > 0){
@ -339,7 +339,7 @@ layui.define(['laypage', 'fly', 'element', 'flow'], function(exports){
//阅读后删除
dom.minemsg.on('click', '.mine-msg li .fly-delete', function(){
var othis = $(this).parents('li'), id = othis.data('id');
fly.json('/index/message/remove/', {
fly.json(messageRemove, {
id: id
}, function(res){
if(res.status === 0){
@ -353,7 +353,7 @@ layui.define(['laypage', 'fly', 'element', 'flow'], function(exports){
$('#LAY_delallmsg').on('click', function(){
var othis = $(this);
layer.confirm('确定清空吗?', function(index){
fly.json('/index/message/remove/', {
fly.json(messageRemove, {
id: true
}, function(res){
if(res.status === 0){

View File

@ -9,6 +9,8 @@
// | 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');

View File

@ -38,7 +38,7 @@
</div>
<div class="layui-form-item">
<button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 入</button>
<button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit" id="LAY-user-login-submit">登 入</button>
</div>
<div class="layui-trans layui-form-item layadmin-user-login-other">
<label>社交账号登入</label>
@ -123,7 +123,7 @@
,icon: 1
,time: 1000
}, function(){
location.href = '/admin/index/index'; //后台主页
location.href = "{:url('admin/index/index')}"; //后台主页
});
} else {
layer.open({

View File

@ -258,14 +258,15 @@ $(function() {
});
</script>
<script>
var collectionFind = "{:url('index/collection/find')}";
layui.cache.page = 'jie';
layui.cache.user = {
username: '{$user.name??'游客'}'
,uid: {$user.id ? $user.id : -1}
,avatar: '{if condition="$user['user_img'] neq ''"}{$user['user_img']}{else /}/static/res/images/avatar/00.jpg{/if}'
,experience: 83
,sex: '{if condition="$user['sex'] eq 0"}男{else/}女{/if}'
};
username: '{$user.name??'游客'}'
,uid: {$user.id ? $user.id : -1}
,avatar: '{$user.name? $user['user_img']:'/static/res/images/avatar/00.jpg'}'
,experience: 83
,sex: '{if condition="$user['sex'] eq 0"}男{else/}女{/if}'
};
layui.config({
version: "3.0.0"
,base: '/static/res/mods/'

View File

@ -352,6 +352,7 @@
}).extend({
fly: 'index'
}).use('fly');
var replyurl = "{:url('index/index/reply')}";
</script>
<script>
(function(){

View File

@ -1,2 +1,7 @@
<script src="/static/layui/jquery.min.js" charset="utf-8"></script>
<script src="/static/layui/layui.js" charset="utf-8"></script>
<script>
var messageNums = "{:url('index/Message/nums')}",
messageRead = "{:url('index/Message/read')}",
userMessage = "{:url('index/User/message')}";
</script>

View File

@ -22,6 +22,9 @@
}).extend({
fly: 'index'
}).use('fly');
var messageFind = "{:url('index/Message/find')}",
messageRemove = "{:url('index/Message/remove')}";
//点开标题改变帖子已读状态
$('#LAY_minemsg').on('click','.art-title', function(){
var id = $(this).attr('id-data');

View File

@ -180,11 +180,11 @@ $(function(){
<script>
layui.cache.page = 'user';
layui.cache.user = {
username: '游客'
,uid: -1
,avatar: '/static/res/images/avatar/00.jpg'
username: '{$user.name??'游客'}'
,uid: {$user.id ? $user.id : -1}
,avatar: '{$user.name? $user['user_img']:'/static/res/images/avatar/00.jpg'}'
,experience: 83
,sex: '男'
,sex: '{if condition="$user['sex'] eq 0"}{else/}女{/if}'
};
layui.config({
version: "3.0.0"