index.js
5.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import pageInit from "../../../minixs/pageInit.js";
import {businessApp} from "../../../../assets/img/data/serviceSecond.js";
export default {
name: 'businessApp',
template: '',
mixins:[pageInit],
components: {},
props: [],
setup(props, {attrs, slots, emit}) {
let businessAppData=businessApp();
//页签高亮显示
let tabActive=Vue.ref(0);
//价值的简介
let valueContent=Vue.ref();
//价值的hover显示的图标
let valueIcon=Vue.ref();
//价值的hover显示
let valueIndex=Vue.ref(0);
//特点hover显示的图片
let characterImg=Vue.ref();
let setcharacter=()=>{
if(businessAppData.data && businessAppData.data.length>0){
businessAppData.data.map(item=>{
if(item.type=='character'){
characterImg.value=item.dataFour[0].img;
}
if(item.type == 'value'){
valueContent.value=item.dataFive[0].introData;
valueIcon.value=item.dataFive[0].iconA;
}
})
}
}
setcharacter();
//优势hover高亮显示
let characterActive=Vue.ref(0);
//特点是否显示
let isMouseover=Vue.ref(false);
//优势鼠标移入事件
let showHover=(indexA)=>{
valueIndex.value=indexA;
if(businessAppData.data && businessAppData.data.length>0){
businessAppData.data.map(item=>{
if(item.type == 'value'){
valueContent.value=item.dataFive[indexA].introData;
valueIcon.value=item.dataFive[indexA].iconA;
}
})
}
}
//优势鼠标移出事件
let hideHover=()=>{
setcharacter();
}
//页签点击跳转到对应的目标
let goItemType=(type)=>{
let top=$("[data-type='"+type+"']").offset().top;
let total=top-100;
let distance = document.documentElement.scrollTop || document.body.scrollTop
//计算每一小段的距离
let step=total/6;
(function smoothDown (){
if(distance < total){
distance += step;
//移动一小段
document.body.scrollTop =distance;
document.documentElement.scrollTop = distance;
//设定每一次跳到的时间间隔为10ms
setTimeout(smoothDown,10)
}else{
//限制股东停止的距离
document.body.scrollTop = total;
document.documentElement.scrollTop = total;
}
})()
}
//特点的事件
let prev=(dataLength)=>{
if(characterActive.value>0){
characterActive.value--
if(characterActive.value == 0){
setDisplay();
}
}else if(characterActive.value == 0){
characterActive.value=dataLength-1
changeDot(dataLength);
}
}
let next=(dataLength)=>{
if((characterActive.value+1)!=dataLength) {
characterActive.value++
}else{
characterActive.value=0;
}
changeDot(dataLength);
}
let changeCharacter=(indexC)=>{
characterActive.value=indexC;
}
//特点左右点击切换
let changeDot=(dataLength)=>{
if(characterActive.value>2 && characterActive.value<dataLength){
if(businessAppData.data && businessAppData.data.length>0){
businessAppData.data.map((item,index)=>{
if(item.type == 'character'){
item.dataFour[characterActive.value-3].isDisplay=false;
}
})
}
}else{
setDisplay();
}
}
//设置特点dot全部显示
let setDisplay=()=>{
if(businessAppData.data && businessAppData.data.length>0){
businessAppData.data.map((item,index)=>{
if(item.type == 'character'){
item.dataFour.map(v=>{
v.isDisplay=true;
})
}
})
}
}
// 挂载完
Vue.onMounted(() => {
})
return {
characterImg,
businessAppData,
tabActive,
characterActive,
isMouseover,
showHover,
hideHover,
setcharacter,
goItemType,
valueContent,
valueIcon,
valueIndex,
prev,
next,
changeCharacter,
changeDot,
setDisplay
}
}
}