init
This commit is contained in:
61
wx05cb767e6530b48f/pages/index_back/index.js
Normal file
61
wx05cb767e6530b48f/pages/index_back/index.js
Normal file
@@ -0,0 +1,61 @@
|
||||
var t = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
indicatorDots: !0,
|
||||
autoplay: !0,
|
||||
interval: 3e3,
|
||||
duration: 800,
|
||||
imgHeights: {},
|
||||
imgCurrent: {},
|
||||
items: {},
|
||||
newest: {},
|
||||
best: {},
|
||||
scrollTop: 0
|
||||
},
|
||||
onLoad: function() {
|
||||
t.setTitle(), t.setNavigationBar(), this.getIndexData();
|
||||
},
|
||||
getIndexData: function() {
|
||||
var a = this;
|
||||
t._get("index/page", {}, function(t) {
|
||||
a.setData(t.data);
|
||||
});
|
||||
},
|
||||
imagesHeight: function(t) {
|
||||
var a = t.target.dataset.id, e = t.target.dataset.itemKey, i = 750 / (t.detail.width / t.detail.height), s = this.data.imgHeights;
|
||||
void 0 === s[e] && (s[e] = {}), s[e][a] = i;
|
||||
var n = this.data.imgCurrent;
|
||||
void 0 === n[e] && (n[e] = Object.keys(this.data.items[e].data)[0]), this.setData({
|
||||
imgHeights: s,
|
||||
imgCurrent: n
|
||||
});
|
||||
},
|
||||
bindChange: function(t) {
|
||||
var a = t.target.dataset.itemKey, e = this.data.imgCurrent;
|
||||
e[a] = t.detail.currentItemId, this.setData({
|
||||
imgCurrent: e
|
||||
});
|
||||
},
|
||||
goTop: function(t) {
|
||||
this.setData({
|
||||
scrollTop: 0
|
||||
});
|
||||
},
|
||||
scroll: function(t) {
|
||||
this.setData({
|
||||
indexSearch: t.detail.scrollTop
|
||||
}), t.detail.scrollTop > 300 ? this.setData({
|
||||
floorstatus: !0
|
||||
}) : this.setData({
|
||||
floorstatus: !1
|
||||
});
|
||||
},
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: "小程序首页",
|
||||
desc: "",
|
||||
path: "/pages/index/index"
|
||||
};
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user