Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
party-build-cloud
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangqinghua
party-build-cloud
Commits
888497b4
Commit
888497b4
authored
May 09, 2019
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
轮播图
1.点击失效问题 2.图片尺寸处理 3.轮播的时候出现的报错
parent
5cf85d9a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
78 additions
and
40 deletions
+78
-40
config.xml
config.xml
+1
-1
slide.html
src/components/slide/slide.html
+2
-3
slide.scss
src/components/slide/slide.scss
+10
-3
slide.ts
src/components/slide/slide.ts
+4
-5
discover.html
src/pages/tabs/discover/discover.html
+6
-5
discover.scss
src/pages/tabs/discover/discover.scss
+3
-0
home.html
src/pages/tabs/home/home.html
+5
-5
home.ts
src/pages/tabs/home/home.ts
+47
-18
No files found.
config.xml
View file @
888497b4
<?xml version='1.0' encoding='utf-8'?>
<?xml version='1.0' encoding='utf-8'?>
<widget
id=
"io.ionic.partyCloud.starter.test"
version=
"0.2.
4
"
xmlns=
"http://www.w3.org/ns/widgets"
xmlns:cdv=
"http://cordova.apache.org/ns/1.0"
>
<widget
id=
"io.ionic.partyCloud.starter.test"
version=
"0.2.
8
"
xmlns=
"http://www.w3.org/ns/widgets"
xmlns:cdv=
"http://cordova.apache.org/ns/1.0"
>
<name>
部机关党建云(测试)
</name>
<name>
部机关党建云(测试)
</name>
<description>
An awesome Ionic/Cordova app.
</description>
<description>
An awesome Ionic/Cordova app.
</description>
<author
email=
"hi@ionicframework"
href=
"http://ionicframework.com/"
>
Ionic Framework Team
</author>
<author
email=
"hi@ionicframework"
href=
"http://ionicframework.com/"
>
Ionic Framework Team
</author>
...
...
src/components/slide/slide.html
View file @
888497b4
<div
class=
"slides-content"
>
<div
class=
"slides-content"
>
<ion-slides
(
ionSlideDidChange
)="
slideChange
($
event
)"
*
ngIf=
"slidersItems.length>0"
<ion-slides
(
ionSlideDidChange
)="
slideChange
($
event
)"
*
ngIf=
"slidersItems.length>0"
(
ionSlideTap
)="
goToDetail
()"
loop=
"true"
autoplay=
"2000"
speed=
"1500"
>
loop=
"true"
autoplay=
"2000"
speed=
"1500"
>
<ion-slide
*
ngFor=
"let item of slidersItems;"
>
<ion-slide
*
ngFor=
"let item of slidersItems;"
>
<img
src=
"{{picture+item.imgUrl}}"
class=
"slide-image"
(
click
)="
goToDetail
(
item
)"
>
<img
src=
"{{picture+item.imgUrl}}"
class=
"slide-image"
>
</ion-slide>
</ion-slide>
</ion-slides>
</ion-slides>
</div>
</div>
...
...
src/components/slide/slide.scss
View file @
888497b4
...
@@ -8,6 +8,7 @@ slide {
...
@@ -8,6 +8,7 @@ slide {
ion-slide
{
ion-slide
{
width
:
100%
;
width
:
100%
;
height
:
$slide-height
;
height
:
$slide-height
;
background-color
:
#e42417
;
}
}
ion-slides
{
ion-slides
{
width
:
100%
;
width
:
100%
;
...
@@ -15,10 +16,16 @@ slide {
...
@@ -15,10 +16,16 @@ slide {
}
}
.slide-image
{
.slide-image
{
width
:
100%
;
//width: 100%;
height
:
$slide-height
;
//height: $slide-height;
vertical-align
:
middle
;
max-height
:
220px
;
}
.slide-zoom
{
text-align
:
center
;
line-height
:
$slide-height
;
max-height
:
100%
;
}
}
.swiper-container
{
.swiper-container
{
height
:
$slide-height
;
height
:
$slide-height
;
width
:
100%
;
width
:
100%
;
...
...
src/components/slide/slide.ts
View file @
888497b4
...
@@ -55,15 +55,14 @@ export class SlideComponent implements AfterViewInit{
...
@@ -55,15 +55,14 @@ export class SlideComponent implements AfterViewInit{
//轮播图变动
//轮播图变动
slideChange
(
e
)
{
slideChange
(
e
)
{
this
.
slideIndex
=
this
.
slides
.
realIndex
+
1
;
this
.
slideIndex
=
this
.
slides
.
realIndex
+
1
;
let
index
=
this
.
slides
.
getActiveIndex
();
this
.
slideTitle
=
this
.
slidersItems
[
this
.
slideIndex
-
1
].
title
;
if
(
index
==
this
.
slidersItems
.
length
+
1
)
index
=
1
this
.
slideTitle
=
this
.
slidersItems
[
index
-
1
].
title
;
}
}
//查看文章详情
//查看文章详情
goToDetail
(
item
)
{
goToDetail
()
{
const
index
=
this
.
slides
.
realIndex
;
this
.
nav
.
push
(
StuffDetailPage
,
{
this
.
nav
.
push
(
StuffDetailPage
,
{
id
:
item
.
id
id
:
this
.
slidersItems
[
index
]
.
id
})
})
}
}
}
}
src/pages/tabs/discover/discover.html
View file @
888497b4
...
@@ -107,9 +107,10 @@
...
@@ -107,9 +107,10 @@
</ion-slide>
</ion-slide>
</ion-slides>
</ion-slides>
<ion-infinite-scroll
#
infiniteScrollContent
(
ionInfinite
)="
doInfinite
($
event
)"
>
<!-- <ion-infinite-scroll #infiniteScrollContent (ionInfinite)="doInfinite($event)">-->
<ion-infinite-scroll-content
<!-- <ion-infinite-scroll-content-->
loadingSpinner=
"bubbles"
threshold=
"10%"
<!-- loadingSpinner="bubbles" threshold="10%"-->
loadingText=
"加载更多..."
></ion-infinite-scroll-content>
<!-- loadingText="加载更多..."></ion-infinite-scroll-content>-->
</ion-infinite-scroll>
<!-- </ion-infinite-scroll>-->
</ion-content>
</ion-content>
src/pages/tabs/discover/discover.scss
View file @
888497b4
...
@@ -14,6 +14,9 @@ page-discover {
...
@@ -14,6 +14,9 @@ page-discover {
border-radius
:
0px
;
border-radius
:
0px
;
}
}
#tips
{
bottom
:
5px
;
}
.search-button
{
.search-button
{
position
:
relative
;
position
:
relative
;
...
...
src/pages/tabs/home/home.html
View file @
888497b4
...
@@ -105,11 +105,11 @@
...
@@ -105,11 +105,11 @@
</ion-slide>
</ion-slide>
</ion-slides>
</ion-slides>
<ion-infinite-scroll
#
infiniteScrollContent
(
ionInfinite
)="
doInfinite
($
event
)"
>
<!-- <ion-infinite-scroll #infiniteScrollContent (ionInfinite)="doInfinite($event)">--
>
<ion-infinite-scroll-content
<!-- <ion-infinite-scroll-content-->
loadingSpinner=
"bubbles"
<!-- loadingSpinner="bubbles"-->
loadingText=
"加载更多..."
></ion-infinite-scroll-content
>
<!-- loadingText="加载更多..."></ion-infinite-scroll-content>--
>
</ion-infinite-scroll
>
<!-- </ion-infinite-scroll>--
>
</ion-content>
</ion-content>
<!--政治生日-->
<!--政治生日-->
<div
*
ngIf=
"isBir"
class=
"signMask"
(
click
)="
close
($
event
)"
>
<div
*
ngIf=
"isBir"
class=
"signMask"
(
click
)="
close
($
event
)"
>
...
...
src/pages/tabs/home/home.ts
View file @
888497b4
...
@@ -13,6 +13,7 @@ import {StuffDetailPage} from "../../home-pages/stuff-detail/stuff-detail";
...
@@ -13,6 +13,7 @@ import {StuffDetailPage} from "../../home-pages/stuff-detail/stuff-detail";
import
{
EmitService
}
from
"../../../provide/emit.service"
;
import
{
EmitService
}
from
"../../../provide/emit.service"
;
import
{
DatePipe
}
from
"@angular/common"
;
import
{
DatePipe
}
from
"@angular/common"
;
import
{
SlideListComponent
}
from
"../../../components/slide-list/slide-list"
;
import
{
SlideListComponent
}
from
"../../../components/slide-list/slide-list"
;
import
{
SlideComponent
}
from
"../../../components/slide/slide"
;
@
IonicPage
()
@
IonicPage
()
@
Component
({
@
Component
({
...
@@ -72,18 +73,15 @@ export class HomePage {
...
@@ -72,18 +73,15 @@ export class HomePage {
spanWidth
;
//文字宽度
spanWidth
;
//文字宽度
pageSize
=
1
;
pageCount
=
100
;
//分页
//分页
total
=
{
//总页数
totalNum
;
one
:
Number
,
two
:
Number
,
three
:
Number
,
four
:
Number
,
};
constructor
(
public
navCtrl
:
NavController
,
public
tts
:
TextToSpeech
,
public
datePipe
:
DatePipe
,
constructor
(
public
navCtrl
:
NavController
,
public
tts
:
TextToSpeech
,
public
datePipe
:
DatePipe
,
public
commonSer
:
CommonService
,
public
emitSer
:
EmitService
,
public
commonSer
:
CommonService
,
public
emitSer
:
EmitService
,
public
zone
:
NgZone
,
public
slideListCom
:
SlideListComponent
,
public
zone
:
NgZone
,
public
slideListCom
:
SlideListComponent
,
public
renderer
:
Renderer2
,
public
renderer
:
Renderer2
,
public
slideCom
:
SlideComponent
,
public
appService
:
AppService
,
public
http
:
Http
,
public
storage
:
Storage
,
public
appService
:
AppService
,
public
http
:
Http
,
public
storage
:
Storage
,
public
badge
:
Badge
,
public
tabsSer
:
TabsService
)
{
public
badge
:
Badge
,
public
tabsSer
:
TabsService
)
{
// 接收发射过来的数据
// 接收发射过来的数据
...
@@ -96,6 +94,7 @@ export class HomePage {
...
@@ -96,6 +94,7 @@ export class HomePage {
}
}
ionViewDidEnter
()
{
ionViewDidEnter
()
{
this
.
slideCom
.
getBanner
();
this
.
tabsSer
.
signNow
().
subscribe
(
this
.
tabsSer
.
signNow
().
subscribe
(
(
res
)
=>
{
(
res
)
=>
{
this
.
signObj
=
res
.
data
;
this
.
signObj
=
res
.
data
;
...
@@ -115,7 +114,7 @@ export class HomePage {
...
@@ -115,7 +114,7 @@ export class HomePage {
scrollHeight
()
{
scrollHeight
()
{
const
height
=
this
.
topHeight
.
nativeElement
.
offsetHeight
+
54
;
const
height
=
this
.
topHeight
.
nativeElement
.
offsetHeight
+
48
;
this
.
content
.
ionScroll
.
subscribe
((
$event
)
=>
{
this
.
content
.
ionScroll
.
subscribe
((
$event
)
=>
{
this
.
zone
.
run
(()
=>
{
this
.
zone
.
run
(()
=>
{
if
(
this
.
content
.
scrollTop
>
height
)
{
if
(
this
.
content
.
scrollTop
>
height
)
{
...
@@ -128,6 +127,7 @@ export class HomePage {
...
@@ -128,6 +127,7 @@ export class HomePage {
}
}
change
(
item
)
{
change
(
item
)
{
this
.
pageSize
=
1
;
const
index
=
item
.
index
;
const
index
=
item
.
index
;
// 自身div的一半 - 滑块的一半
// 自身div的一半 - 滑块的一半
this
.
tips
.
nativeElement
.
style
.
left
=
this
.
itemWidth
*
(
index
)
+
(
this
.
itemWidth
-
this
.
spanWidth
)
/
2
+
'px'
;
this
.
tips
.
nativeElement
.
style
.
left
=
this
.
itemWidth
*
(
index
)
+
(
this
.
itemWidth
-
this
.
spanWidth
)
/
2
+
'px'
;
...
@@ -135,8 +135,8 @@ export class HomePage {
...
@@ -135,8 +135,8 @@ export class HomePage {
this
.
index
=
index
;
this
.
index
=
index
;
this
.
plateType
=
item
.
type
;
this
.
plateType
=
item
.
type
;
const
data
=
{
const
data
=
{
pageSize
:
1
,
pageSize
:
this
.
pageSize
,
pageCount
:
100
,
pageCount
:
this
.
pageCount
,
obj
:
{
obj
:
{
'plateType'
:
this
.
plateType
,
'plateType'
:
this
.
plateType
,
'resourceType'
:
1
'resourceType'
:
1
...
@@ -145,6 +145,7 @@ export class HomePage {
...
@@ -145,6 +145,7 @@ export class HomePage {
this
.
tabsSer
.
stuffPage
(
data
).
subscribe
(
this
.
tabsSer
.
stuffPage
(
data
).
subscribe
(
(
res
)
=>
{
(
res
)
=>
{
let
arr
=
res
.
data
.
list
;
let
arr
=
res
.
data
.
list
;
this
.
totalNum
=
res
.
data
.
total
;
if
(
arr
.
length
>
0
){
if
(
arr
.
length
>
0
){
arr
.
forEach
(
e
=>
{
arr
.
forEach
(
e
=>
{
if
(
e
.
attachments
.
length
>
0
)
{
if
(
e
.
attachments
.
length
>
0
)
{
...
@@ -167,7 +168,6 @@ export class HomePage {
...
@@ -167,7 +168,6 @@ export class HomePage {
if
(
index
==
this
.
tabsList
.
length
)
index
=
0
;
if
(
index
==
this
.
tabsList
.
length
)
index
=
0
;
if
(
index
==
this
.
tabsList
.
length
+
1
)
index
=
1
;
if
(
index
==
this
.
tabsList
.
length
+
1
)
index
=
1
;
this
.
change
(
this
.
tabsList
[
index
])
this
.
change
(
this
.
tabsList
[
index
])
console
.
log
(
index
);
}
}
...
@@ -264,18 +264,47 @@ export class HomePage {
...
@@ -264,18 +264,47 @@ export class HomePage {
//上拉加载
//上拉加载
doInfinite
(
e
)
{
doInfinite
(
e
)
{
this
.
renderer
.
setStyle
(
this
.
infiniteScrollContent
.
nativeElement
,
'height'
,
'84px'
);
if
(
this
.
totalNum
==
this
.
slideList
[
this
.
index
].
length
){
setTimeout
(()
=>
{
e
.
complete
();
e
.
complete
();
this
.
renderer
.
setStyle
(
this
.
infiniteScrollContent
.
nativeElement
,
'height'
,
'0px'
);
this
.
commonSer
.
toastTime
(
'没有更多数据了'
,
1000
);
},
1000
)
return
false
}
this
.
pageSize
++
;
const
data
=
{
pageSize
:
this
.
pageSize
,
pageCount
:
this
.
pageCount
,
obj
:
{
'plateType'
:
this
.
plateType
,
'resourceType'
:
1
}
}
this
.
tabsSer
.
stuffPage
(
data
).
subscribe
(
(
res
)
=>
{
let
arr
=
res
.
data
.
list
;
if
(
arr
.
length
>
0
){
arr
.
forEach
(
e
=>
{
if
(
e
.
attachments
.
length
>
0
)
{
e
.
imgUrl
=
e
.
attachments
[
0
].
path
;
}
this
.
slideList
[
this
.
index
].
push
(
e
);
});
}
this
.
renderer
.
setStyle
(
this
.
infiniteScrollContent
.
nativeElement
,
'height'
,
'84px'
);
setTimeout
(()
=>
{
e
.
complete
();
this
.
renderer
.
setStyle
(
this
.
infiniteScrollContent
.
nativeElement
,
'height'
,
'0px'
);
},
800
)
}
)
}
}
//下拉刷新
//下拉刷新
doRefresh
(
e
)
{
doRefresh
(
e
)
{
const
data
=
{
const
data
=
{
pageSize
:
1
,
pageSize
:
1
,
pageCount
:
100
,
pageCount
:
this
.
pageCount
,
obj
:
{
obj
:
{
'plateType'
:
this
.
plateType
,
'plateType'
:
this
.
plateType
,
'resourceType'
:
1
'resourceType'
:
1
...
@@ -293,9 +322,9 @@ export class HomePage {
...
@@ -293,9 +322,9 @@ export class HomePage {
}
}
this
.
slideList
[
this
.
index
]
=
arr
;
this
.
slideList
[
this
.
index
]
=
arr
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
commonSer
.
toastTime
(
'刷新成功!'
,
800
)
this
.
commonSer
.
toastTime
(
'刷新成功!'
,
800
)
;
e
.
complete
();
e
.
complete
();
},
10
00
)
},
8
00
)
}
}
)
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment