Commit 402f8751 authored by wuwangwolihui's avatar wuwangwolihui

营地2.0-整合修改

parent 8a9794ef
<template> <template>
<el-container> <el-container id="baseId">
<el-header height="80px"> <el-header height="80px">
<Header :typeFu="1"></Header> <Header :typeFu="1"></Header>
</el-header> </el-header>
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
}; };
}, },
created() { created() {
console.log('created');
}, },
mounted() { mounted() {
window.addEventListener('scroll', this.handleScrollY, true); window.addEventListener('scroll', this.handleScrollY, true);
......
...@@ -61,12 +61,9 @@ ...@@ -61,12 +61,9 @@
</div> </div>
</div> </div>
<div class="active-list" v-if="activeList.length>0"left-area> <div class="active-list" v-if="showActiveList.length>0">
<div class="active-list-item" v-for="(item, index) in activeList" :key="index" <div class="active-list-item" v-for="(item, index) in showActiveList" :key="index"
:style="{ :style="animationTime(index)">
'-webkit-animation-delay': (index+1)*0.1+'s',
'imation-delay': (index+1)*0.1+'s',
}">
<div class="inner"> <div class="inner">
<div class="active-list-item-bg"> <div class="active-list-item-bg">
<el-image :src="item.activityCover" fit="cover"></el-image> <el-image :src="item.activityCover" fit="cover"></el-image>
...@@ -94,7 +91,8 @@ ...@@ -94,7 +91,8 @@
</div> </div>
</div> </div>
</div> </div>
<div class="active-list-item-cont-txt2">{{formatYMD(item.activityStartTime)}} (共{{item.activityTime}}天)</div> <div class="active-list-item-cont-txt2">{{formatYMD(item.activityStartTime)}} (共{{item.activityTime}}天)
</div>
<div class="active-list-item-cont-txt3">报名截止时间:{{formatYMDChina(item.bmEndTime)}}</div> <div class="active-list-item-cont-txt3">报名截止时间:{{formatYMDChina(item.bmEndTime)}}</div>
<div class="active-list-item-cont-bottom" @click="$router.push('/active/'+item.id)"> <div class="active-list-item-cont-bottom" @click="$router.push('/active/'+item.id)">
<div>查看详情</div> <div>查看详情</div>
...@@ -125,7 +123,12 @@ ...@@ -125,7 +123,12 @@
maxDay: null, maxDay: null,
}, },
labelList: [], labelList: [],
activeList: [],
activeList: [],// 通过后台数据得到的所有数据
showActiveList: [],// 前端页面需要渲染的数据
pageSize: 6, //渲染数据的多少根据实际情况设置
baseSize: 6,// 渲染基础页数
totall: 0, //总数据量
supportList: [ supportList: [
{ {
lableId: 2, lableId: 2,
...@@ -146,60 +149,63 @@ ...@@ -146,60 +149,63 @@
this.getLabelType(); this.getLabelType();
this.getList(); this.getList();
}, },
methods: { computed: {
// 确定按钮 // 防抖
searchHandle() { debounce() {
this.getList(); let timer = ''
}, return function (func, wait) {
// 重置按钮 let context = this;
resetHandle() { if (timer) {
this.queryForm = { clearTimeout(timer);
ids: {}, }
isSupport: null, timer = setTimeout(() => {
minDay: null, func.apply(context);
maxDay: null, }, wait)
};
for (let key in this.selectIds) {
this.selectIds[key] = [];
} }
for (let key in this.checkAll) { }
this.checkAll[key] = false; },
mounted() {
window.addEventListener('scroll', this.dataScroll, true)
},
destroyed() {
window.removeEventListener('scroll', this.dataScroll, true)
},
methods: {
// 卡片出现的动画时间
animationTime(index) {
let time = 0;
time = index - (this.pageSize / this.baseSize - 1) * this.baseSize + 1;
return {
'-webkit-animation-delay': time * 0.1 + 's',
'imation-delay': time * 0.1 + 's',
} }
this.isSupport = [];
this.checkAllSupp = false;
console.log(this.checkAll)
this.getList();
}, },
// 全部-标签操作 // 页面滚动获取数据
handleCheckAllChange(val, type = 1, list = [], idx = 0) { scrollLoadData() {
let lableIdArr = list.map(item => item.lableId); //获取滚动条的高度
let arr = val ? lableIdArr : []; let scrollTop = document.documentElement.scrollTop;
if (type == 1) { // 获取视口高度
this.selectIds[idx] = arr; let windowHeight = window.innerHeight;
if (arr.length > 0) { //获取页面内容总高度
this.queryForm.ids[idx] = arr; let scrollHeight = document.querySelector('.active-container').scrollHeight;
} else { if (scrollTop + windowHeight + 100 >= scrollHeight) {
delete this.queryForm.ids[idx] this.pageSize += this.baseSize;
} this.loadData()
} else {
this.isSupport = arr;
this.queryForm.isSupport = arr.join(',');
} }
}, },
// 单个-标签操作 // 页面滚动方法
handleCheckedItemChange(val, type = 1, list = [], idx = 0) { dataScroll() {
let lableIdArr = list.map(item => item.lableId); //防抖函数
let checkedCount = val.length; this.debounce(this.scrollLoadData, 100)
if (type == 1) { },
this.checkAll[idx] = checkedCount === lableIdArr.length; // 处理列表渲染数据
if (checkedCount > 0) { loadData() {
this.queryForm.ids[idx] = val; for (let i = (this.pageSize - this.baseSize); i < this.pageSize; i++) {
} else { if (this.totall >= this.activeList.length) {
delete this.queryForm.ids[idx] return false;
} }
} else { this.showActiveList.push(this.activeList[i]);
this.checkAllSupp = checkedCount === lableIdArr.length; this.totall++;
this.queryForm.isSupport = val.join(',');
} }
}, },
// 获取列表 // 获取列表
...@@ -226,6 +232,7 @@ ...@@ -226,6 +232,7 @@
} }
this.loading = false; this.loading = false;
this.activeList = res.data.data; this.activeList = res.data.data;
this.loadData()
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
this.loading = false; this.loading = false;
...@@ -251,7 +258,62 @@ ...@@ -251,7 +258,62 @@
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
} },
// 确定按钮
searchHandle() {
this.getList();
},
// 重置按钮
resetHandle() {
this.queryForm = {
ids: {},
isSupport: null,
minDay: null,
maxDay: null,
};
for (let key in this.selectIds) {
this.selectIds[key] = [];
}
for (let key in this.checkAll) {
this.checkAll[key] = false;
}
this.isSupport = [];
this.checkAllSupp = false;
console.log(this.checkAll)
this.getList();
},
// 全部-标签操作
handleCheckAllChange(val, type = 1, list = [], idx = 0) {
let lableIdArr = list.map(item => item.lableId);
let arr = val ? lableIdArr : [];
if (type == 1) {
this.selectIds[idx] = arr;
if (arr.length > 0) {
this.queryForm.ids[idx] = arr;
} else {
delete this.queryForm.ids[idx]
}
} else {
this.isSupport = arr;
this.queryForm.isSupport = arr.join(',');
}
},
// 单个-标签操作
handleCheckedItemChange(val, type = 1, list = [], idx = 0) {
let lableIdArr = list.map(item => item.lableId);
let checkedCount = val.length;
if (type == 1) {
this.checkAll[idx] = checkedCount === lableIdArr.length;
if (checkedCount > 0) {
this.queryForm.ids[idx] = val;
} else {
delete this.queryForm.ids[idx]
}
} else {
this.checkAllSupp = checkedCount === lableIdArr.length;
this.queryForm.isSupport = val.join(',');
}
},
} }
} }
</script> </script>
...@@ -259,6 +321,7 @@ ...@@ -259,6 +321,7 @@
<style lang="scss" scoped> <style lang="scss" scoped>
@import "a/scss/common"; @import "a/scss/common";
@import "a/scss/active/activeList"; @import "a/scss/active/activeList";
.active-container { .active-container {
padding: 50px; padding: 50px;
color: #333333; color: #333333;
......
...@@ -56,20 +56,22 @@ ...@@ -56,20 +56,22 @@
</div> </div>
</div> </div>
<div class="active-area"> <div class="active-area">
<div class="left-area card-box"> <div class="left-area card-box" ref="left-area">
<ul v-if="activeContent==1 && anchorList.length>0"> <div class="left-area-box" :style="leftAreaBoxStyle">
<li v-for="(item,index) in anchorList" :key="index"> <ul v-if="activeContent==1 && anchorList.length>0">
<a @click="anchorSkip(item.id)">{{item.name}}</a> <li v-for="(item,index) in anchorList" :key="index">
</li> <a @click="anchorSkip(item.id)">{{item.name}}</a>
</ul> </li>
<ul v-else-if="activeContent==2 && anchorList2.length>0"> </ul>
<li v-for="(item,index) in anchorList2" :key="index"> <ul v-else-if="activeContent==2 && anchorList2.length>0">
<a @click="anchorSkip(item.id)">{{item.name}}</a> <li v-for="(item,index) in anchorList2" :key="index">
</li> <a @click="anchorSkip(item.id)">{{item.name}}</a>
</ul> </li>
<ul v-else> </ul>
<li>暂无锚点</li> <ul v-else>
</ul> <li>暂无锚点</li>
</ul>
</div>
</div> </div>
<div class="center-area card-box" :style="{ <div class="center-area card-box" :style="{
'min-height':minHeight+'px' 'min-height':minHeight+'px'
...@@ -204,6 +206,7 @@ ...@@ -204,6 +206,7 @@
anchorList2: [], anchorList2: [],
activeContent: 1, activeContent: 1,
minHeight: '339', minHeight: '339',
leftAreaBoxStyle: {}
} }
}, },
created() { created() {
...@@ -213,12 +216,53 @@ ...@@ -213,12 +216,53 @@
} }
this.getInfo() this.getInfo()
}, },
mounted() {
window.addEventListener('scroll', this.handleScrollY, true);
},
destroyed() {
window.removeEventListener('scroll', this.handleScrollY, true);
},
methods: { methods: {
handleScrollY() {
// active-area距离顶部的高度
let activeAreaToTop = document.querySelector('.active-area').offsetTop;
// left-area的宽度
let leftAreaWidth = document.querySelector('.left-area').offsetWidth;
// footer的高度
let footerHeight = document.querySelector('.footer').offsetHeight;
// 页面滚动高度
let scrollTop = document.documentElement.scrollTop;
// left-area-box的高度
let Height = document.querySelector('.left-area-box').offsetHeight;
// active-info-container的高度
let contentHeight = document.querySelector('.active-info-container').offsetHeight;
// body的高度
let bodyHeight = document.body.offsetHeight;
if (scrollTop >= (activeAreaToTop - 20)) {
if (scrollTop >= (contentHeight - bodyHeight + 180) &&
bodyHeight <= (footerHeight + Height + 80)) {
this.leftAreaBoxStyle = {
position: 'absolute',
bottom: '0px',
width: leftAreaWidth + 'px',
}
return false;
}
this.leftAreaBoxStyle = {
position: 'fixed',
top: '100px',
width: leftAreaWidth + 'px',
}
} else {
this.leftAreaBoxStyle = {}
}
},
// 立即报名按钮 // 立即报名按钮
signUp() { signUp() {
let allToken = window.localStorage.getItem('index-token-all'); let allToken = window.localStorage.getItem('index-token-all');
if (allToken) { if (allToken) {
this.$store.commit('setIndexIdentity',this.activeInfo.identity) this.$store.commit('setIndexIdentity', this.activeInfo.identity)
this.$router.push('/signUp/examInfo?code=' + this.activeInfo.identity); this.$router.push('/signUp/examInfo?code=' + this.activeInfo.identity);
} else { } else {
this.$router.push('/baseLogin'); this.$router.push('/baseLogin');
...@@ -241,7 +285,7 @@ ...@@ -241,7 +285,7 @@
}, },
// 分离获取html中的锚点 // 分离获取html中的锚点
getAnchor(content) { getAnchor(content) {
if(!content) return []; if (!content) return [];
let attrAndValueArr = content.match(/<a id=\"(.*?)\"><\/a>/g); let attrAndValueArr = content.match(/<a id=\"(.*?)\"><\/a>/g);
let valueArr = [] // 放所有该属性的值 let valueArr = [] // 放所有该属性的值
let anchorList = []; let anchorList = [];
...@@ -466,12 +510,19 @@ ...@@ -466,12 +510,19 @@
flex-flow: row; flex-flow: row;
align-items: self-start; align-items: self-start;
justify-content: space-between; justify-content: space-between;
position: relative;
.left-area { .left-area {
flex: 1; flex: 1;
min-width: 200px; min-width: 200px;
.left-area-box {
border-radius: 4px;
background-color: #ffffff;
}
ul { ul {
margin: 0;
padding: 20px 10px; padding: 20px 10px;
} }
......
<template> <template>
<el-container> <el-container>
<el-header height="104px"> <el-header height="118px">
<Header :typeFu="2"></Header> <Header :typeFu="2"></Header>
<div class="notify flex" v-if="$store.state.isDisplay_num == 1"> <div class="notify flex" v-if="$store.state.isDisplay_num == 1">
<div class="flex"> <div class="flex">
...@@ -19,14 +19,16 @@ ...@@ -19,14 +19,16 @@
<!-- </div>--> <!-- </div>-->
<div class="active-area"> <div class="active-area">
<div class="left-area card-box"> <div class="left-area card-box">
<ul class="left" v-if="anchorList.length>0"> <div class="left-area-box" :style="leftAreaBoxStyle">
<li :key="index" v-for="(item,index) in anchorList"> <ul class="left" v-if="anchorList.length>0">
<a @click="anchorSkip(item.id)">{{item.name}}</a> <li :key="index" v-for="(item,index) in anchorList">
</li> <a @click="anchorSkip(item.id)">{{item.name}}</a>
</ul> </li>
<ul v-else> </ul>
<li>暂无锚点</li> <ul v-else>
</ul> <li>暂无锚点</li>
</ul>
</div>
</div> </div>
<div :style="{ <div :style="{
'min-height':minHeight+'px' 'min-height':minHeight+'px'
...@@ -54,13 +56,14 @@ ...@@ -54,13 +56,14 @@
info: {}, info: {},
anchorList: [], anchorList: [],
minHeight: '339', minHeight: '339',
leftAreaBoxStyle: {}
}; };
}, },
created() { created() {
this.info = this.$store.state.info; this.info = this.$store.state.info;
setTimeout(()=>{ setTimeout(() => {
this.anchorList = this.getAnchor(this.info.student_recruitment_brochure); this.anchorList = this.getAnchor(this.info.student_recruitment_brochure);
},1000) }, 1000)
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
//判断是否关闭了营地(关闭了不需要调用setlog) //判断是否关闭了营地(关闭了不需要调用setlog)
let isCloseCamp = this.$store.state.info.on_off; let isCloseCamp = this.$store.state.info.on_off;
...@@ -74,8 +77,44 @@ ...@@ -74,8 +77,44 @@
}, },
mounted() { mounted() {
window.addEventListener('scroll', this.handleScrollY, true);
},
destroyed() {
window.removeEventListener('scroll', this.handleScrollY, true);
}, },
methods: { methods: {
handleScrollY() {
// left-area的宽度
let leftAreaWidth = document.querySelector('.left-area').offsetWidth;
// footer的高度
let footerHeight = document.querySelector('.footer').offsetHeight;
// 页面滚动高度
let scrollTop = document.documentElement.scrollTop;
// left-area-box的高度
let Height = document.querySelector('.left-area-box').offsetHeight;
// index-container的高度
let contentHeight = document.querySelector('.index-container').offsetHeight;
// body的高度
let bodyHeight = document.body.offsetHeight;
if (scrollTop >= (98)) {
if (scrollTop >= (contentHeight - bodyHeight + 218) &&
bodyHeight <= (footerHeight + Height + 188)) {
this.leftAreaBoxStyle = {
position: 'absolute',
bottom: '0px',
width: leftAreaWidth + 'px',
}
return false;
}
this.leftAreaBoxStyle = {
position: 'fixed',
top: '138px',
width: leftAreaWidth + 'px',
}
} else {
this.leftAreaBoxStyle = {}
}
},
toLogin() { toLogin() {
let code = this.$store.state.indexIdentity; let code = this.$store.state.indexIdentity;
if (!window.localStorage.getItem("index-token-all")) { if (!window.localStorage.getItem("index-token-all")) {
...@@ -93,7 +132,6 @@ ...@@ -93,7 +132,6 @@
}, },
// 分离获取html中的锚点 // 分离获取html中的锚点
getAnchor(content) { getAnchor(content) {
console.log(content)
if (!content) return []; if (!content) return [];
let attrAndValueArr = content.match(/<a id=\"(.*?)\"><\/a>/g); let attrAndValueArr = content.match(/<a id=\"(.*?)\"><\/a>/g);
let valueArr = [] // 放所有该属性的值 let valueArr = [] // 放所有该属性的值
...@@ -105,10 +143,7 @@ ...@@ -105,10 +143,7 @@
.replace(/\"/g, '') .replace(/\"/g, '')
.replace(/><\/a>/g, '')); .replace(/><\/a>/g, ''));
} }
console.log(valueArr)
valueArr.forEach((item, index) => { valueArr.forEach((item, index) => {
console.log(item)
console.log(document.getElementById(item).parentNode)
let father = document.getElementById(item).parentNode; let father = document.getElementById(item).parentNode;
let value = father.innerHTML.replace(/<(.*?)>/g, '').replace(/<\/(.*?)>/g, ''); let value = father.innerHTML.replace(/<(.*?)>/g, '').replace(/<\/(.*?)>/g, '');
if (value && value.length < 10) { if (value && value.length < 10) {
...@@ -167,10 +202,11 @@ ...@@ -167,10 +202,11 @@
width: 100%; width: 100%;
display: flex; display: flex;
flex-flow: column; flex-flow: column;
margin-top: 104px; margin-top: 118px;
.index-container { .index-container {
flex: 1; flex: 1;
padding-bottom: 50px;
.title { .title {
padding: 52px 0 20px 0; padding: 52px 0 20px 0;
...@@ -238,14 +274,21 @@ ...@@ -238,14 +274,21 @@
flex-flow: row; flex-flow: row;
align-items: self-start; align-items: self-start;
justify-content: space-between; justify-content: space-between;
position: relative;
.left-area { .left-area {
flex: 1; flex: 1;
min-width: 200px; min-width: 200px;
background-color: #ffffff; background-color: #ffffff;
border-radius: 8px; border-radius: 8px;
.left-area-box {
border-radius: 8px;
background-color: #ffffff;
}
ul { ul {
padding: 20px ; padding: 20px;
} }
li { li {
...@@ -282,6 +325,7 @@ ...@@ -282,6 +325,7 @@
width: calc(100% - 100px); width: calc(100% - 100px);
border-radius: 8px; border-radius: 8px;
background-color: #ffffff; background-color: #ffffff;
.center-area-title { .center-area-title {
text-align: center; text-align: center;
font-size: 22px; font-size: 22px;
......
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 to comment