|
|
@@ -187,9 +187,12 @@ Component({ |
|
|
|
type: 1 |
|
|
|
} |
|
|
|
}).then(res => { |
|
|
|
console.log(res) |
|
|
|
let businessObj = [{id:0,title: "全部",type: 1}]; |
|
|
|
that.setData({ |
|
|
|
tabs: res.data.list |
|
|
|
tabs: res.data.list.concat(businessObj).sort(compare("id")) |
|
|
|
}); |
|
|
|
console.log(that.data.tabs) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
wx.showToast({ |
|
|
@@ -208,4 +211,17 @@ Component({ |
|
|
|
}) |
|
|
|
that.getList(0, 1); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
function compare(pro) { |
|
|
|
return function (obj2, obj1) { |
|
|
|
var val1 = obj1[pro]; |
|
|
|
var val2 = obj2[pro]; |
|
|
|
if (val1 < val2) { |
|
|
|
return 1; |
|
|
|
} else if (val1 > val2) { |
|
|
|
return -1; |
|
|
|
} else { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |