|
@@ -13,40 +13,46 @@ Component({
|
|
|
value: []
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
options: {
|
|
|
addGlobalClass: true
|
|
|
},
|
|
|
+
|
|
|
lifetimes: {
|
|
|
- ready() {
|
|
|
- /* setTimeout(() => {
|
|
|
- this.setData({
|
|
|
- intoViewId: 'basic1'
|
|
|
- })
|
|
|
- }, 1000) */
|
|
|
- }
|
|
|
+ ready() {}
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 组件的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
+ systemIndex: 0, //系统index
|
|
|
+ portIndex: 0, //选择端口Index
|
|
|
+ moduleIndex: 0, //选择模块Index
|
|
|
result: ['a', 'b'],
|
|
|
+ portID: null, //端口ID
|
|
|
leftIntoViewId: null,
|
|
|
rightIntoViewId: null,
|
|
|
heightList: [],
|
|
|
+ modulesIndex: 0, //模块列表
|
|
|
+ scrollTop: 0
|
|
|
},
|
|
|
|
|
|
observers: {
|
|
|
'list': function (list) {
|
|
|
if (!list.length) return;
|
|
|
- if (this.data.intoViewId == null) this.setData({
|
|
|
- leftIntoViewId: list[0].system + list[0].systemid,
|
|
|
- rightIntoViewId: list[0].system + list[0].systemid
|
|
|
+ let data = list[0].clients[0];
|
|
|
+ console.log("list", list)
|
|
|
+ console.log("data", data)
|
|
|
+ let id = data.modules[0] ? "M" + data.modules[0].systemmoduleid : '';
|
|
|
+ if (this.data.portID == null) this.setData({
|
|
|
+ portID: 'S' + data.systemclientid,
|
|
|
+ leftIntoViewId: id,
|
|
|
+ rightIntoViewId: id
|
|
|
})
|
|
|
setTimeout(() => {
|
|
|
- this.getAppsHeight(list);
|
|
|
-
|
|
|
- }, 500)
|
|
|
+ this.getAppsHeight();
|
|
|
+ }, 200)
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -54,27 +60,48 @@ Component({
|
|
|
* 组件的方法列表
|
|
|
*/
|
|
|
methods: {
|
|
|
- /* 点击左侧分类 */
|
|
|
+ /* 系统分类 */
|
|
|
+ changePortID(e) {
|
|
|
+ const {
|
|
|
+ dataset
|
|
|
+ } = e.currentTarget;
|
|
|
+ this.setData({
|
|
|
+ portID: e.target.id,
|
|
|
+ systemIndex: dataset.index,
|
|
|
+ portIndex: dataset.i,
|
|
|
+ modulesIndex: 0,
|
|
|
+ scrollTop: 0
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ this.getAppsHeight();
|
|
|
+ }, 300)
|
|
|
+ },
|
|
|
+ /* 点击模块分类 */
|
|
|
changeType(e) {
|
|
|
this.setData({
|
|
|
leftIntoViewId: e.target.id,
|
|
|
rightIntoViewId: e.target.id
|
|
|
})
|
|
|
},
|
|
|
- getAppsHeight(list) {
|
|
|
+ getAppsHeight() {
|
|
|
+ const list = this.data.list[this.data.systemIndex].clients[this.data.portIndex].modules,
|
|
|
+ that = this;
|
|
|
let heightList = [];
|
|
|
+ let id = 'M' + list[0].systemmoduleid;
|
|
|
for (let i = 0; i < list.length; i++) {
|
|
|
- let cas = '.' + list[i].system + list[i].systemid;
|
|
|
- let query = wx.createSelectorQuery().in(this).select(cas).boundingClientRect();
|
|
|
+ let query = wx.createSelectorQuery().in(that).select('.' + 'M1' + list[i].systemmoduleid).boundingClientRect();
|
|
|
query.exec(res => {
|
|
|
- if (!res[0]) return this.getAppsHeight(list);
|
|
|
+ if (!res[0]) return this.getAppsHeight();
|
|
|
heightList.push(res[0])
|
|
|
- if (heightList.length == list.length) this.setData({
|
|
|
- heightList
|
|
|
+ if (list.length == heightList.length) this.setData({
|
|
|
+ heightList,
|
|
|
+ leftIntoViewId: id,
|
|
|
+ rightIntoViewId: id
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
viewScroll({
|
|
|
detail
|
|
|
}) {
|
|
@@ -92,7 +119,7 @@ Component({
|
|
|
})
|
|
|
} else if (scrollTop < top) {
|
|
|
if (!arr[i - 1] || id == arr[0].id) return;
|
|
|
- if (scrollTop < Math.abs((arr[i - 1].top - 15 - arr[i - 1].height) / 2)) this.setData({
|
|
|
+ if (scrollTop < Math.abs(arr[i - 1].top - arr[i - 1].height + 80)) this.setData({
|
|
|
leftIntoViewId: arr[i - 1].id
|
|
|
})
|
|
|
} else {
|