Browse Source

feat:子系统首页增加loading效果

master
zhaobing’ 1 year ago
parent
commit
6c4f542bfe
  1. 14
      weapp/package/subSystem/subSystem.js

14
weapp/package/subSystem/subSystem.js

@ -116,6 +116,9 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
wx.showLoading({
title: '加载中...',
})
this.subType = options.key this.subType = options.key
const { windowHeight } = wx.getSystemInfoSync() const { windowHeight } = wx.getSystemInfoSync()
const pageHeight = windowHeight - 48 const pageHeight = windowHeight - 48
@ -151,11 +154,14 @@ Page({
}); });
wx.hideLoading() // wx.hideLoading()
}, },
getSubSystemPatrolAbout: function (options) { getSubSystemPatrolAbout: function (options) {
wx.showLoading({
title: '加载中...',
})
// const userInfo=wx.getStorageSync('userInfo'); // const userInfo=wx.getStorageSync('userInfo');
let that = this; let that = this;
const STime = moment('1970-01-01').format('YYYY-MM-DD') const STime = moment('1970-01-01').format('YYYY-MM-DD')
@ -167,6 +173,7 @@ Page({
const query = { STime, ETime, keywords } const query = { STime, ETime, keywords }
Request.get(getSubSystemPatrolAbout(query)).then(res => { Request.get(getSubSystemPatrolAbout(query)).then(res => {
if (res) { if (res) {
//求出最小时间 //求出最小时间
const minTimeObject = res.reduce((min, current) => { const minTimeObject = res.reduce((min, current) => {
// 比较时间,选择最小的时间 // 比较时间,选择最小的时间
@ -284,10 +291,10 @@ Page({
}] }]
}; };
that.initECharts(option); that.initECharts(option);
wx.hideLoading();
wx.hideLoading()
} else { } else {
wx.hideLoading(); // wx.hideLoading();
} }
}) })
}, },
@ -304,6 +311,7 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
// wx.hideLoading()
}, },

Loading…
Cancel
Save