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
| const app = getApp()
| Page({
| data: {
| StatusBar: app.globalData.StatusBar,
| CustomBar: app.globalData.CustomBar,
| Custom: app.globalData.Custom,
| TabCur: 0,
| MainCur: 0,
| VerticalNavTop: 0,
| moduleDiv:0,
| list: [{
| name: '业务办理'
| }, {
| name: '办事指南'
| }, {
| name: '智慧未检'
| }, {
| name: '南检活动'
| }, {
| name: '检务信息公开'
| }, {
| name: '法治培训服务'
| }, {
| name: '控告与申诉'
| }, {
| name: '营商环境'
| }, {
| name: '知识产权'
| }],
| load: true
| },
| onLoad() {
| wx.showLoading({
| title: '加载中...',
| mask: true
| });
| },
| onReady() {
| wx.hideLoading()
| },
| tabSelect(e) {
| console.log(e.currentTarget.dataset.id)
| this.setData({
| moduleDiv: e.currentTarget.dataset.id,
| TabCur: e.currentTarget.dataset.id,
| })
| },
| VerticalMain(e) {
| let that = this;
| let list = this.data.list;
| let tabHeight = 0;
| if (this.data.load) {
| for (let i = 0; i < list.length; i++) {
| let view = wx.createSelectorQuery().select("#main-" + list[i].id);
| view.fields({
| size: true
| }, data => {
| list[i].top = tabHeight;
| tabHeight = tabHeight + data.height;
| list[i].bottom = tabHeight;
| }).exec();
| }
| that.setData({
| load: false,
| list: list
| })
| }
| let scrollTop = e.detail.scrollTop + 20;
| for (let i = 0; i < list.length; i++) {
| if (scrollTop > list[i].top && scrollTop < list[i].bottom) {
| that.setData({
| VerticalNavTop: (list[i].id - 1) * 50,
| TabCur: list[i].id
| })
| return false
| }
| }
| }
| })
|
|