Commit d3e2fd09 by junxiang wang

后台发布版本2020-09-02 23:38

parent 88053b1a
...@@ -35,7 +35,7 @@ class Swiper { ...@@ -35,7 +35,7 @@ class Swiper {
} }
if (lis.length > 6) { if (lis.length > 6) {
p5 = lis[lis.length-2]; p5 = lis[lis.length-2];
p6 = lis[lis.length-1]; p6 = lis[lis.length-1];
for (let i=0; i<lis.length; i++) { for (let i=0; i<lis.length; i++) {
lis[i].classList.add("p4"); lis[i].classList.add("p4");
} }
...@@ -62,7 +62,7 @@ class Swiper { ...@@ -62,7 +62,7 @@ class Swiper {
dots[0].className = "active"; dots[0].className = "active";
} }
bannerWrap.classList.add("transition"); bannerWrap.classList.add("transition");
// 图片移动,dire判断是否滑动过 // 图片移动,dire判断是否滑动过
function move(dire) { function move(dire) {
var arrCls = []; // 保存类名,用来赋值 var arrCls = []; // 保存类名,用来赋值
dire = dire || false; dire = dire || false;
...@@ -124,7 +124,7 @@ class Swiper { ...@@ -124,7 +124,7 @@ class Swiper {
} }
function setTimer() { function setTimer() {
if (autoPlay) { if (autoPlay) {
timer = setInterval(move, delay); timer = setInterval(move, delay);
} }
} }
function addTransition() { function addTransition() {
...@@ -172,7 +172,7 @@ class Swiper { ...@@ -172,7 +172,7 @@ class Swiper {
} }
} }
function disabledPrev(e) { function disabledPrev(e) {
e.preventDefault(); // e.preventDefault();
} }
setTimer() setTimer()
...@@ -259,4 +259,4 @@ class Swiper { ...@@ -259,4 +259,4 @@ class Swiper {
}; };
} }
} }
} }
\ No newline at end of file
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
<body> <body>
<div class="page-wrap" id="app"> <div class="page-wrap" id="app">
<div class="nav-list"> <div class="nav-list">
<div class="nav-item" v-for="(item,idx) in navs" :key="idx" :class="{active:idx===activeIdx}" @click="setActive(item,idx)"> <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"> <div class="nav-item__iconbox">
<img :src="item.icon" class="nav-item__icon" /> <img :src="item.icon" class="nav-item__icon" />
</div> </div>
...@@ -231,6 +231,41 @@ ...@@ -231,6 +231,41 @@
</div> </div>
</div> </div>
<script> <script>
/**
* 获取字符串中参数
* @param str
* @param name
* @returns {string|null}
* @constructor
*/
const getQueryByString = (str, name) => {
// 获取?号出现几次
var tempArr = str.split('?')
// console.log(tempArr)
// //如果大于1
if (tempArr.length - 1 > 1) {
var rt = null
for (var i in tempArr) {
var s = tempArr[i]
var reg1 = new RegExp('(^|&)' + name + '=([^&]*)(&|$)') // 构造一个含有目标参数的正则表达式对象
var r1 = s.match(reg1) // 匹配目标参数
if (r1 != null) {
rt = decodeURIComponent(r1[2])// 一直覆盖,要最后的就行了
}
}
return rt
}
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)') // 构造一个含有目标参数的正则表达式对象
if (!str.split('?')[1]) return null
var r = str.split('?')[1].match(reg) // 匹配目标参数
// console.log(r)
if (r != null) {
return decodeURIComponent(r[2])
}
return null // 返回参数值
}
var vueInstance = new Vue({ var vueInstance = new Vue({
el:'#app', el:'#app',
data(){ data(){
...@@ -265,11 +300,15 @@ var vueInstance = new Vue({ ...@@ -265,11 +300,15 @@ var vueInstance = new Vue({
this.posterUrl = currentInfo.poster this.posterUrl = currentInfo.poster
this.showPoster = true this.showPoster = true
}, },
setActive(item,idx){ setActive(idx){
this.activeIdx = idx this.activeIdx = Number(idx)
} }
}, },
created(){ created(){
var idx = getQueryByString(location.href,'idx')
if(!isNaN(idx) && idx>=0){
this.setActive(idx)
}
} }
}) })
......
...@@ -62,25 +62,25 @@ ...@@ -62,25 +62,25 @@
<div class="swiper-container "> <div class="swiper-container ">
<ul class="swiper-wrap"> <ul class="swiper-wrap">
<li> <li>
<img src="/images/slide/0.png"> <img class="img-item" onclick="toShow(0)" src="/images/slide/0.png">
</li> </li>
<li> <li>
<img src="/images/slide/5.jpg"> <img class="img-item" onclick="toShow(1)" src="/images/slide/5.jpg">
</li> </li>
<li> <li>
<img src="/images/slide/6.jpg"> <img class="img-item" onclick="toShow(2)" src="/images/slide/6.jpg">
</li> </li>
<li> <li>
<img src="/images/slide/7.jpg"> <img class="img-item" onclick="toShow(3)" src="/images/slide/7.jpg">
</li> </li>
<li> <li>
<img src="/images/slide/8.jpg"> <img class="img-item" onclick="toShow(false)" src="/images/slide/8.jpg">
</li> </li>
<li> <li>
<img src="/images/slide/9.jpg"> <img class="img-item" onclick="toShow(false)" src="/images/slide/9.jpg">
</li> </li>
<li> <li>
<img src="/images/slide/10.jpg"> <img class="img-item" onclick="toShow(false)" src="/images/slide/10.jpg">
</li> </li>
</ul> </ul>
<!-- <ul class="swiper-wrap">--> <!-- <ul class="swiper-wrap">-->
...@@ -122,6 +122,17 @@ new Swiper(".swiper-container",{ ...@@ -122,6 +122,17 @@ new Swiper(".swiper-container",{
delay: 4000, delay: 4000,
autoPlay: true autoPlay: true
}); });
function toShow(idx) {
console.log(idx)
if(idx!==false){
location.href = '/show.html?idx='+idx
}else{
location.href = '/show.html'
}
}
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment