Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
shuzilixiangwaibao
/
wanda-vr
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f585036b
authored
Sep 10, 2020
by
白宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swiper touch 优化
parent
41c4085e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
76 deletions
+32
-76
libs/rem.js
+0
-1
show copy.html
+1
-1
show.html
+19
-65
show1.html
+12
-9
No files found.
libs/rem.js
View file @
f585036b
...
...
@@ -7,7 +7,6 @@
a
=
function
(){
var
n
=
t
.
clientWidth
||
320
;
n
>
750
&&
(
n
=
750
);
t
.
style
.
fontSize
=
n
/
d
+
"px"
alert
(
1
)
window
.
$rem
=
n
/
d
};
e
.
addEventListener
&&
(
n
.
addEventListener
(
o
,
a
,
!
1
),
e
.
addEventListener
(
"DOMContentLoaded"
,
a
,
!
1
))
...
...
show copy.html
View file @
f585036b
...
...
@@ -336,7 +336,7 @@
</style>
</head>
<body>
<div
id=
"app"
class=
"page-wrap"
v-if=
"loadReady"
:class=
"{fixed:showPoster}"
:style=
"{backgroundImage:'url('+navs[activeIdx].bg_image+'
)'}"
>
<div
id=
"app"
class=
"page-wrap"
v-if=
"loadReady"
:class=
"{fixed:showPoster}"
:style=
"{backgroundImage:'url(./images/show/fupin.png
)'}"
>
<div
class=
"nav-list"
>
<div
class=
"nav-item"
v-for=
"(item,idx) in navs"
:key=
"idx"
:class=
"{active:idx===activeIdx}"
@
click=
"setActive(idx,item)"
>
...
...
show.html
View file @
f585036b
...
...
@@ -7,26 +7,14 @@
<meta
name=
"apple-mobile-web-app-status-bar-style"
content=
"black"
/>
<meta
http-equiv=
"Content-Type"
content=
"text/html;charset=utf-8"
/>
<meta
http-equiv=
"x-ua-compatible"
content=
"IE=edge"
/>
<script
src=
"./libs/rem.js"
></script>
<script
src=
"./libs/helper.js"
></script>
<script
src=
"./libs/html2canvas.js"
></script>
<script
src=
"./libs/vue/vue.js"
></script>
<script
src=
"./libs/axios.min.js"
></script>
<link
rel=
"stylesheet"
href=
"./libs/swiper-bundle.min.css"
>
<script
src=
"./libs/swiper-bundle.min.js"
></script>
<script
src=
"./libs/axios.min.js"
></script>
<style>
html
,
body
{
background
:
#000
;
}
.swiper-container
{
width
:
100%
;
height
:
100%
;
}
.swiper-slide
{
width
:
100%
;
height
:
100%
;
}
}
#canvasEle
{
position
:
fixed
;
left
:
200%
;
...
...
@@ -348,9 +336,9 @@
</style>
</head>
<body>
<div
id=
"app"
class=
"page-wrap"
v-if=
"loadReady"
:class=
"{fixed:showPoster}"
:style=
"{backgroundImage:'url(./images/show/fupin.png)'}"
>
<div
id=
"app"
class=
"page-wrap"
v-if=
"loadReady"
:class=
"{fixed:showPoster}"
:style=
"{backgroundImage:'url(./images/show/fupin.png)'}"
>
<div
class=
"nav-list"
ref=
nav
>
<div
class=
"nav-list"
>
<div
class=
"nav-item"
v-for=
"(item,idx) in navs"
:key=
"idx"
:class=
"{active:idx===activeIdx}"
@
click=
"setActive(idx,item)"
>
<div
class=
"nav-item__iconbox"
>
<img
:src=
"item.small_image"
class=
"nav-item__icon"
/>
...
...
@@ -358,28 +346,15 @@
<div
class=
"nav-item__mtitle"
>
{{item.title}}
</div>
</div>
</div>
<div
class=
"swiper-container"
>
<div
class=
"swiper-wrapper"
>
<div
class=
"swiper-slide"
v-for=
"(item,index) in navs"
:key=
"index"
>
<div
class=
"mtitle"
>
{{navs[index].title}}
</div>
<div
class=
"thumb"
>
<img
class=
"thumb__img"
:src=
"navs[index].image"
/>
</div>
<div
class=
"content"
>
<div
class=
"content__text"
v-html=
"navs[index].content"
></div>
</div>
</div>
</div>
</div>
<div
class=
"mtitle"
>
{{navs[activeIdx].title}}
</div>
<div
class=
"thumb"
>
<img
class=
"thumb__img"
:src=
"navs[activeIdx].image"
/>
</div>
<div
class=
"content"
>
<div
class=
"content__text"
v-html=
"navs[activeIdx].content"
></div>
</div>
<!--:style="{backgroundImage:'url('+navs[activeIdx].bg_image+')'}"-->
<div
class=
"bottom"
v-if=
"!showPoster"
>
<img
@
click=
"bindShareEvent"
class=
"bottom__icon"
src=
"./images/show/share.png"
/>
...
...
@@ -417,7 +392,7 @@
<canvas
id=
"canvasEle"
></canvas>
<script
src=
"./libs/jweixin-1.6.0.js"
></script>
<script>
var
myswiper
var
vueInstance
=
new
Vue
({
el
:
'#app'
,
data
(){
...
...
@@ -603,11 +578,6 @@ var vueInstance = new Vue({
},
async
setActive
(
idx
,
initJsSdk
=
true
){
this
.
activeIdx
=
Number
(
idx
)
try
{
myswiper
.
slideTo
(
Number
(
idx
))
}
catch
(
error
)
{
}
//this.shareDesc = this.navs[this.activeIdx].content
this
.
curShareImg
=
this
.
navs
[
this
.
activeIdx
].
share_image
;
if
(
initJsSdk
)
this
.
shareToFirends
()
...
...
@@ -616,10 +586,9 @@ var vueInstance = new Vue({
var
category_id
=
getQueryByString
(
location
.
href
,
'id'
)
this
.
navs
=
await
$get
(
'/content/list?category_id='
+
category_id
).
then
(
res
=>
res
.
data
).
catch
(
err
=>
{
throw
err
})
console
.
log
(
this
.
navs
)
this
.
contentList
=
await
$get
(
'/travel/desc'
).
then
(
res
=>
res
.
data
).
catch
(
err
=>
{
throw
err
})
this
.
refreshShareText
(
true
)
// var idx = getQueryByString(location.href,'idx')
// if(!isNaN(idx) && idx>=0){
...
...
@@ -644,36 +613,21 @@ var vueInstance = new Vue({
})
this
.
loadReady
=
true
this
.
swiperInit
()
setTimeout
(()
=>
{
this
.
generatePost
();
},
1000
);
},
swiperInit
(){
var
that
=
this
setTimeout
(
function
(){
myswiper
=
new
Swiper
(
'.swiper-container'
,{
on
:
{
slideChangeTransitionEnd
:
function
(){
that
.
activeIdx
=
this
.
activeIndex
that
.
$refs
.
nav
.
scrollLeft
=
1.72
*
this
.
activeIndex
*
$rem
}
}
})
},
100
)
}
},
created
(){
this
.
_init_func
()
},
mounted
(){
},
}
})
</script>
<script
src=
"./libs/rem.js"
></script>
<script>
function
createImgByAsync
(
url
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
show1.html
View file @
f585036b
...
...
@@ -7,7 +7,7 @@
<meta
name=
"apple-mobile-web-app-status-bar-style"
content=
"black"
/>
<meta
http-equiv=
"Content-Type"
content=
"text/html;charset=utf-8"
/>
<meta
http-equiv=
"x-ua-compatible"
content=
"IE=edge"
/>
<script
src=
"./libs/rem.js"
></script>
<script
src=
"./libs/rem.js
?123123
"
></script>
<script
src=
"./libs/helper.js"
></script>
<script
src=
"./libs/html2canvas.js"
></script>
<script
src=
"./libs/vue/vue.js"
></script>
...
...
@@ -376,10 +376,6 @@
</div>
<!--:style="{backgroundImage:'url('+navs[activeIdx].bg_image+')'}"-->
<div
class=
"bottom"
v-if=
"!showPoster"
>
<img
@
click=
"bindShareEvent"
class=
"bottom__icon"
src=
"./images/show/share.png"
/>
...
...
@@ -417,7 +413,8 @@
<canvas
id=
"canvasEle"
></canvas>
<script
src=
"./libs/jweixin-1.6.0.js"
></script>
<script>
var
myswiper
var
myswiper
var
swiperStartType
=
'nav'
//swiper 触发方式 滑动 nav点击
var
vueInstance
=
new
Vue
({
el
:
'#app'
,
data
(){
...
...
@@ -602,6 +599,7 @@ var vueInstance = new Vue({
// showModal()
},
async
setActive
(
idx
,
initJsSdk
=
true
){
swiperStartType
=
'nav'
this
.
activeIdx
=
Number
(
idx
)
try
{
myswiper
.
slideTo
(
Number
(
idx
))
...
...
@@ -656,9 +654,14 @@ var vueInstance = new Vue({
myswiper
=
new
Swiper
(
'.swiper-container'
,{
on
:
{
slideChangeTransitionEnd
:
function
(){
that
.
activeIdx
=
this
.
activeIndex
that
.
$refs
.
nav
.
scrollLeft
=
1.72
*
this
.
activeIndex
*
$rem
}
that
.
activeIdx
=
this
.
activeIndex
;
that
.
curShareImg
=
that
.
navs
[
this
.
activeIndex
].
share_image
;
if
(
swiperStartType
!==
'nav'
)
that
.
$refs
.
nav
.
scrollLeft
=
1.72
*
(
this
.
activeIndex
-
3
)
*
$rem
},
touchMove
:
function
(
swiper
,
event
){
//你的事件
swiperStartType
=
'touchMove'
},
}
})
},
100
)
...
...
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