Commit d3e2fd09 by junxiang wang

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

parent 88053b1a
......@@ -172,7 +172,7 @@ class Swiper {
}
}
function disabledPrev(e) {
e.preventDefault();
// e.preventDefault();
}
setTimer()
......
......@@ -197,7 +197,7 @@
<body>
<div class="page-wrap" id="app">
<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">
<img :src="item.icon" class="nav-item__icon" />
</div>
......@@ -231,6 +231,41 @@
</div>
</div>
<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({
el:'#app',
data(){
......@@ -265,11 +300,15 @@ var vueInstance = new Vue({
this.posterUrl = currentInfo.poster
this.showPoster = true
},
setActive(item,idx){
this.activeIdx = idx
setActive(idx){
this.activeIdx = Number(idx)
}
},
created(){
var idx = getQueryByString(location.href,'idx')
if(!isNaN(idx) && idx>=0){
this.setActive(idx)
}
}
})
......
......@@ -62,25 +62,25 @@
<div class="swiper-container ">
<ul class="swiper-wrap">
<li>
<img src="/images/slide/0.png">
<img class="img-item" onclick="toShow(0)" src="/images/slide/0.png">
</li>
<li>
<img src="/images/slide/5.jpg">
<img class="img-item" onclick="toShow(1)" src="/images/slide/5.jpg">
</li>
<li>
<img src="/images/slide/6.jpg">
<img class="img-item" onclick="toShow(2)" src="/images/slide/6.jpg">
</li>
<li>
<img src="/images/slide/7.jpg">
<img class="img-item" onclick="toShow(3)" src="/images/slide/7.jpg">
</li>
<li>
<img src="/images/slide/8.jpg">
<img class="img-item" onclick="toShow(false)" src="/images/slide/8.jpg">
</li>
<li>
<img src="/images/slide/9.jpg">
<img class="img-item" onclick="toShow(false)" src="/images/slide/9.jpg">
</li>
<li>
<img src="/images/slide/10.jpg">
<img class="img-item" onclick="toShow(false)" src="/images/slide/10.jpg">
</li>
</ul>
<!-- <ul class="swiper-wrap">-->
......@@ -122,6 +122,17 @@ new Swiper(".swiper-container",{
delay: 4000,
autoPlay: true
});
function toShow(idx) {
console.log(idx)
if(idx!==false){
location.href = '/show.html?idx='+idx
}else{
location.href = '/show.html'
}
}
</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