You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.6 KiB
54 lines
1.6 KiB
// pages/stock/index.js
|
|
const request = require('../../../utils/request') //导入模块
|
|
const util = require('../../../utils/util')
|
|
const app = getApp()
|
|
|
|
Component({
|
|
options: {
|
|
addGlobalClass: true,
|
|
multipleSlots: true
|
|
},
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
height: app.globalData.safeFragmentHeight - 190,
|
|
safeBottom: app.globalData.safeBottom,
|
|
firstShow: false,
|
|
tabList: [ '热门', '纸品价格', '车辆排队', '纸厂扣点' ],
|
|
tabIndex: 0
|
|
},
|
|
methods: {
|
|
onRestart: function () {
|
|
var fragment = this.selectComponent('#fragment' + this.data.tabIndex)
|
|
if (fragment) {
|
|
fragment.onRestart()
|
|
}
|
|
if (!this.data.firstShow) {
|
|
this.setData({ height: app.globalData.safeFragmentHeight - 190, tabList: this.data.tabList, safeBottom: app.globalData.safeBottom})
|
|
// request.get('/information-center/article-category/get/article-category-list').then(result => {
|
|
// for (let index = 0; index < result.data.length; index++) {
|
|
// this.data.tabList[index + 1] = result.data[index].name
|
|
// }
|
|
// // this.setData({tabList: this.data.tabList})
|
|
// }).catch(err => {
|
|
// //异常回调
|
|
// })
|
|
}
|
|
this.data.firstShow = true
|
|
},
|
|
onTabChange: function({detail}){
|
|
if(this.data.tabIndex == Number(detail.index)){
|
|
return
|
|
}
|
|
this.setData({ tabIndex: Number(detail.index) })
|
|
this.onRestart()
|
|
},
|
|
stopTouchMove: function(e){
|
|
return false
|
|
},
|
|
postMoment: function(){
|
|
util.navigateTo('/pages/article/publish/index')
|
|
}
|
|
}
|
|
})
|