切换导航条
此项目
正在载入...
登录
景龙
/
xingqiu
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
景龙
6 years ago
提交
6870cf2d9f25f6a394ca123ba55dc1656cefc04a
1 个父辈
ac1d9f7d
1 个管道 的构建
通过
耗费 1 秒
修改首页轮播和增加收藏文章功能
变更
9
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
9 个修改的文件
包含
355 行增加
和
8 行删除
app/portal/controller/LoginController.php
app/portal/controller/StarController.php
public/themes/simpleboot3/portal/index/index.html
public/themes/simpleboot3/portal/login/info.html
public/themes/simpleboot3/portal/login/my_collection.html
public/themes/simpleboot3/public/assets/css/collection.css
public/themes/simpleboot3/public/assets/css/header1.css
public/themes/simpleboot3/public/assets/js/TweenMax.min.js
public/themes/simpleboot3/public/assets/js/public.js
app/portal/controller/LoginController.php
查看文件 @
6870cf2
...
...
@@ -9,7 +9,9 @@ namespace app\portal\controller;
use
app\portal\model\UserModel
;
use
app\portal\validate\UsersValidate
;
use
cmf\controller\HomeBaseController
;
use
app\portal\model\CollectionModel
;
use
cmf\lib\Storage
;
use
think\Db
;
use
anerg\OAuth2\OAuth
;
use
think\Config
;
...
...
@@ -170,6 +172,40 @@ class LoginController extends HomeBaseController
}
}
//我的收藏列表
public
function
myCollection
(){
$limit
=
8
;
$uid
=
cmf_get_current_user_id
();
$collectionModel
=
new
CollectionModel
();
$res
=
$collectionModel
->
where
([
'uid'
=>
$uid
])
->
field
(
'id,post_id,category_name,city_name,post_url'
)
->
order
(
'id desc'
)
->
paginate
(
$limit
);
$data
=
$res
->
toArray
();
$page
=
$res
->
render
();
$post_ids
=
array_unique
(
array_column
(
$data
[
'data'
],
'post_id'
));
$data1
=
Db
::
name
(
'portal_post'
)
->
whereIn
(
'id'
,
$post_ids
)
->
where
(
'delete_time'
,
0
)
->
field
(
'id,post_title,post_excerpt,post_favorites'
)
->
order
(
'weigh desc'
)
->
select
()
->
toArray
();
foreach
(
$data
[
'data'
]
as
&
$value
){
foreach
(
$data1
as
$item
)
{
if
(
$value
[
'post_id'
]
==
$item
[
'id'
]){
$value
[
'post_title'
]
=
$item
[
'post_title'
];
$value
[
'post_excerpt'
]
=
$item
[
'post_excerpt'
];
$value
[
'post_favorites'
]
=
$item
[
'post_favorites'
];
}
}
}
$this
->
assign
(
'res'
,
$data
[
'data'
]);
$this
->
assign
(
'page'
,
$page
);
return
$this
->
fetch
();
}
//第三方微信登录
public
function
wx_login
(){
$config
=
Config
::
get
(
'wx_login'
);
...
...
app/portal/controller/StarController.php
查看文件 @
6870cf2
...
...
@@ -368,10 +368,34 @@ class StarController extends HomeBaseController
//判断是否登录
$login
=
cmf_is_user_login
();
$article_id
=
$this
->
request
->
param
(
'article_id'
);
//文章id
$post_url
=
$this
->
request
->
param
(
'post_url'
);
//文章链接
if
(
$login
){
$data
[
'uid'
]
=
cmf_get_current_user_id
();
$data
[
'post_id'
]
=
$article_id
;
$data
[
'create_time'
]
=
time
();
$data
[
'post_id'
]
=
$article_id
;
//文章id
$data
[
'post_url'
]
=
$post_url
;
//查找分类名称
$category
=
Db
::
name
(
'portal_category_post'
)
->
where
(
'post_id'
,
$article_id
)
->
field
(
'category_id'
)
->
find
();
$category_name
=
Db
::
name
(
'portal_category'
)
->
where
(
'id'
,
$category
[
'category_id'
])
->
field
(
'name'
)
->
find
();
//查找城市名称
$city
=
Db
::
name
(
'portal_post'
)
->
where
(
'id'
,
$article_id
)
->
where
(
'delete_time'
,
0
)
->
field
(
'city_id'
)
->
find
();
$city_name
=
Db
::
name
(
'city_category'
)
->
where
(
'id'
,
$city
[
'city_id'
])
->
field
(
'name'
)
->
find
();
$data
[
'category_name'
]
=
$category_name
[
'name'
];
//分类名称
$data
[
'city_name'
]
=
isset
(
$city_name
[
'name'
])
&&
!
empty
(
$city_name
[
'name'
])
?
$city_name
[
'name'
]
:
''
;
//城市名称
$data
[
'create_time'
]
=
time
();
//
$data
[
'update_time'
]
=
time
();
$collectionModel
=
new
CollectionModel
();
$res
=
$collectionModel
->
allowField
(
true
)
->
save
(
$data
);
...
...
public/themes/simpleboot3/portal/index/index.html
查看文件 @
6870cf2
...
...
@@ -19,6 +19,9 @@
.swiper-container6
{
overflow
:
hidden
;
}
.swiper-container6
.swiper-wrapper
{
transition-duration
:
1.5s
!important
;
}
</style>
</head>
...
...
@@ -788,16 +791,13 @@
var
swiper
=
new
Swiper
(
'.swiper-container6'
,
{
slidesPerView
:
1
,
spaceBetween
:
0
,
centeredSlides
:
true
,
autoplay
:
{
delay
:
4000
,
disableOnInteraction
:
false
,
},
// pagination: {
// el: '.swiper-pagination',
// clickable: true,
// },
navigation
:
{
nextEl
:
'.swiper-button-nextban'
,
prevEl
:
'.swiper-button-prevban'
...
...
public/themes/simpleboot3/portal/login/info.html
查看文件 @
6870cf2
...
...
@@ -43,7 +43,7 @@
<span>
修改资料
</span>
</div>
<!--我的收藏-->
<div
class=
"Collection clearfix"
>
<div
class=
"Collection clearfix"
id=
"myCollection"
>
<div
class=
"Collection_icon"
>
<img
src=
"__TMPL__/public/assets/starImg/aicon_86.png"
alt=
""
>
</div>
...
...
public/themes/simpleboot3/portal/login/my_collection.html
0 → 100644
查看文件 @
6870cf2
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
我的收藏
</title>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<link
rel=
"stylesheet"
href=
"__TMPL__/public/assets/css/bootstrap4.0.css"
>
<link
rel=
"stylesheet"
href=
"__TMPL__/public/assets/css/header1.css"
>
<link
rel=
"stylesheet"
href=
"__TMPL__/public/assets/css/collection.css"
>
<style>
.post_url
{
cursor
:
pointer
;
}
.post_url
:hover
{
text-decoration
:
none
;
}
.collection_item_title
:hover
{
color
:
#09FF8E
;
}
</style>
</head>
<body>
<include
file=
"public@header"
/>
<!--内容-->
<main>
<div
class=
"container"
>
<!--收藏-->
<div
class=
"collection"
>
<div
class=
"collection_list"
>
<volist
name=
"res"
id=
"vo"
>
<div
class=
"collection_item"
>
<a
href=
"{$vo.post_url}"
class=
"post_url"
>
<div
class=
"collection_item_title"
>
{$vo.post_title}
</div>
</a>
<div
class=
"collection_item_main"
>
{$vo.post_excerpt}
</div>
<div
class=
"collection_item_bottom clearfix"
>
<div
class=
"collection_item_bottom_left clearfix"
>
<div
class=
"collection_bottom_left_item"
>
{$vo.category_name}
</div>
<notempty
name=
"vo.city_name"
>
<div
class=
"collection_bottom_left_item"
>
{$vo.city_name}
</div>
</notempty>
</div>
<div
class=
"collection_item_bottom_right clearfix"
>
<div
class=
"collection_bottom_right_img"
>
<img
src=
"__TMPL__/public/assets/starImg/bicon_13.png"
alt=
""
>
</div>
<div
class=
"collection_bottom_right_num"
>
{$vo.post_favorites}
</div>
</div>
</div>
</div>
</volist>
</div>
<!--分页-->
<div
class=
"pagination"
>
{$page|default=''}
</div>
</div>
</div>
</main>
<!-- 底部 -->
<include
file=
"public@footer"
/>
<script
src=
"__TMPL__/public/assets/js/jquery-3.2.1.min.js"
></script>
<script
src=
"__TMPL__/public/assets/js/public.js"
></script>
</body>
</html>
...
...
public/themes/simpleboot3/public/assets/css/collection.css
0 → 100644
查看文件 @
6870cf2
.container
{
width
:
1200px
;
margin
:
0
auto
;
}
body
{
background
:
#3C3C94
;
}
main
{
padding-top
:
74px
;
box-sizing
:
border-box
;
padding-bottom
:
100px
;
}
main
.container
{
width
:
900px
;
margin
:
0
auto
;
background
:
#fff
;
margin-bottom
:
50px
;
}
.collection_list
{
background
:
#fff
;
padding
:
0
30px
;
}
.collection_item
{
width
:
100%
;
border-bottom
:
1px
solid
#EBEBEB
;
padding-bottom
:
30px
;
}
.collection_item_title
{
font-size
:
18px
;
color
:
#1A1A1A
;
font-weight
:
bold
;
padding-top
:
30px
;
}
.collection_item_main
{
padding
:
20px
0
;
font-size
:
14px
;
color
:
#999999
;
}
.collection_bottom_left_item
{
padding-right
:
10px
;
padding-left
:
10px
;
border-right
:
1px
solid
#EBEBEB
;
float
:
left
;
}
.collection_bottom_left_item
:first-child
{
padding-left
:
0
;
}
.collection_item_bottom_left
,
.collection_item_bottom_right
,
.collection_bottom_right_num
{
float
:
left
;
}
.collection_bottom_right_img
{
float
:
left
;
}
.collection_bottom_right_img
img
{
width
:
14px
;
height
:
12px
;
vertical-align
:
middle
;
margin-left
:
10px
;
margin-right
:
7px
;
cursor
:
pointer
;
}
\ No newline at end of file
...
...
public/themes/simpleboot3/public/assets/css/header1.css
0 → 100644
查看文件 @
6870cf2
body
,
ol
,
ul
,
h1
,
h2
,
h3
,
h4
,
h5
,
h6
,
p
,
th
,
td
,
dl
,
dd
,
form
,
fieldset
,
legend
,
input
,
textarea
,
select
{
margin
:
0
;
padding
:
0
}
body
{
font
:
12px
"微软雅黑"
,
"MicrosoftYaHei"
,
HELVETICA
;
background
:
#fff
;
-webkit-text-size-adjust
:
100%
;
color
:
rgba
(
51
,
51
,
51
,
1
);
}
a
{
color
:
#2d374b
;
text-decoration
:
none
}
em
,
i
{
font-style
:
normal
}
li
{
list-style
:
none
}
img
{
border
:
0
;
vertical-align
:
middle
}
table
{
border-collapse
:
collapse
;
border-spacing
:
0
}
p
{
word-wrap
:
break-word
}
/* 头部 */
#header
{
width
:
100%
;
background
:
#fff
;
margin
:
0
auto
;
height
:
80px
;
line-height
:
80px
}
#header
section
{
float
:
left
;
}
/* logo */
#header
.home_logo
{
width
:
110px
;
height
:
70px
;
margin
:
0
75px
0
0px
;
}
#header
.home_logo
img
{
width
:
100%
;
height
:
100%
}
/* 导航栏 */
#header
.home_nav
ul
li
{
float
:
left
;
font-size
:
17px
;
color
:
rgba
(
77
,
77
,
77
,
1
);
width
:
70px
;
height
:
76px
;
margin
:
0
15px
;
text-align
:
center
;
border-top
:
4px
solid
rgba
(
255
,
255
,
255
,
1
);
}
/* 搜索框 */
#header
.home_search
{
position
:
relative
;
/* width: 308px;*/
}
/* 图标 */
#header
.home_search
.search_icon
{
position
:
absolute
;
left
:
30px
;
top
:
30px
;
background-image
:
url("../starImg/aicon_23.png")
;
background-repeat
:
no-repeat
;
background-position
:
0px
0px
;
width
:
18px
;
height
:
18px
;
z-index
:
3
}
/* 输入框 */
#header
.home_search
input
{
margin
:
0
16px
0
16px
;
width
:
160px
;
height
:
33px
;
background
:
rgba
(
242
,
242
,
242
,
1
);
border-radius
:
17px
;
outline
:
none
;
border
:
none
;
padding-left
:
40px
;
}
/* 登录注册按钮 */
#header
.home_login
span
p
{
float
:
left
;
margin-left
:
16px
}
\ No newline at end of file
...
...
public/themes/simpleboot3/public/assets/js/TweenMax.min.js
0 → 100644
查看文件 @
6870cf2
此 diff 太大无法显示。
public/themes/simpleboot3/public/assets/js/public.js
查看文件 @
6870cf2
...
...
@@ -97,11 +97,16 @@ $(function(){
window
.
location
.
href
=
'/portal/login/editInfo'
;
});
//我的收藏页面
$
(
'#myCollection'
).
click
(
function
(){
window
.
location
.
href
=
'/portal/login/myCollection'
;
});
//评论
$
(
'#comment'
).
click
(
function
(){
var
content
=
$
(
'#comment_content'
).
val
();
var
article_id
=
getUrlParam
(
'id'
);
var
url
=
window
.
location
.
href
;
var
url
=
window
.
location
.
pathname
+
window
.
location
.
search
;
$
.
ajax
({
type
:
'POST'
,
url
:
"/portal/star/comment"
,
...
...
@@ -133,11 +138,13 @@ $(function(){
function
operation
(
url
){
var
article_id
=
getUrlParam
(
'id'
);
var
is_login
=
1
;
var
post_url
=
window
.
location
.
pathname
+
window
.
location
.
search
;
$
.
ajax
({
type
:
'POST'
,
url
:
url
,
data
:
{
'article_id'
:
article_id
,
'post_url'
:
post_url
},
dataType
:
'json'
,
async
:
false
,
...
...
请
注册
或
登录
后发表评论