|
@@ -2,14 +2,14 @@ const app = getApp();
|
|
|
Page({
|
|
|
data: {
|
|
|
images: {
|
|
|
- logo:'/static_file/logo.png',
|
|
|
- background:'/static_file/background.png',
|
|
|
- card:'/static_file/card.png',
|
|
|
- tzd:'/static_file/backgrountzdd.png',
|
|
|
- phone:'/static_file/phone.png',
|
|
|
- yl:'/static_file/background.yl',
|
|
|
- jcsfcjtzd:'/static_file/jcsfcjtzd.png',
|
|
|
- kapiantubiao:'/static_file/kapiantubiao.png'
|
|
|
+ logo: '/static_file/logo.png',
|
|
|
+ background: '/static_file/background.png',
|
|
|
+ card: '/static_file/card.png',
|
|
|
+ tzd: '/static_file/backgrountzdd.png',
|
|
|
+ phone: '/static_file/phone.png',
|
|
|
+ yl: '/static_file/background.yl',
|
|
|
+ jcsfcjtzd: '/static_file/jcsfcjtzd.png',
|
|
|
+ kapiantubiao: '/static_file/kapiantubiao.png'
|
|
|
},
|
|
|
// 用户信息
|
|
|
userInfo: {
|
|
@@ -20,13 +20,12 @@ Page({
|
|
|
|
|
|
// 账单信息
|
|
|
billInfo: {
|
|
|
- totalAmount: "", // 总计应缴
|
|
|
- waterUsage: "", // 用水量
|
|
|
- balance: "" // 账户余额
|
|
|
+ totalAmount: "", // 总计应缴
|
|
|
+ waterUsage: "", // 用水量
|
|
|
+ balance: "" // 账户余额
|
|
|
},
|
|
|
// 功能按钮配置
|
|
|
- functionList: [
|
|
|
- {
|
|
|
+ functionList: [{
|
|
|
icon: '/static_file/zdlb.png',
|
|
|
text: '账单列表',
|
|
|
url: '/pages/zhangdanlist/zhangdanlist'
|
|
@@ -57,8 +56,8 @@ Page({
|
|
|
url: '/pages/tousujianyi/tousujianyi'
|
|
|
}
|
|
|
],
|
|
|
- currentIndex:0,
|
|
|
- noticeList:[],
|
|
|
+ currentIndex: 0,
|
|
|
+ noticeList: [],
|
|
|
// 活动信息
|
|
|
activity: {
|
|
|
title: '净水器活动',
|
|
@@ -70,39 +69,70 @@ Page({
|
|
|
},
|
|
|
|
|
|
onLoad() {
|
|
|
- let refresh= app.globalData.refresh;
|
|
|
- if(refresh==1){
|
|
|
+ // 检查是否刚刚绑定了新户号
|
|
|
+ const justBoundNewAccount = wx.getStorageSync('justBoundNewAccount');
|
|
|
+ if (justBoundNewAccount) {
|
|
|
+ // 清除标记
|
|
|
+ wx.removeStorageSync('justBoundNewAccount');
|
|
|
+ // 直接加载页面数据
|
|
|
+ this.loadPageData();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查是否所有户号已解绑
|
|
|
+ const allAccountsUnbound = wx.getStorageSync('allAccountsUnbound');
|
|
|
+ if (allAccountsUnbound) {
|
|
|
+ // 清除标记
|
|
|
+ wx.removeStorageSync('allAccountsUnbound');
|
|
|
+ // 跳转到首次绑定页面
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/FirstBangDing/FirstBangDing',
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查全局用户信息是否存在
|
|
|
+ if (!app.globalData.currentAccountInfo ||
|
|
|
+ !app.globalData.currentAccountInfo.usernumber ||
|
|
|
+ app.globalData.userWxInfo.currentDsKey === "") {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/FirstBangDing/FirstBangDing',
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ let refresh = app.globalData.refresh;
|
|
|
+ if (refresh == 1) {
|
|
|
wx.showLoading({
|
|
|
title: '加载中...',
|
|
|
});
|
|
|
- if(!app.globalData.userWxInfo.token){
|
|
|
+ if (!app.globalData.userWxInfo.token) {
|
|
|
wx.hideLoading();
|
|
|
return;
|
|
|
}
|
|
|
const _this = this;
|
|
|
wx.request({
|
|
|
- url: app.globalData.interfaceUrls.homePageInfo+app.globalData.currentAccountInfo.usernumber,
|
|
|
+ url: app.globalData.interfaceUrls.homePageInfo + app.globalData.currentAccountInfo.usernumber,
|
|
|
method: 'GET',
|
|
|
header: {
|
|
|
'content-type': 'application/json', // 默认值
|
|
|
- 'token':app.globalData.userWxInfo.token,
|
|
|
- 'source':"wc",
|
|
|
- '!SAAS_LOGIN_TOKEN_!':app.globalData.currentAccountInfo.dsKey
|
|
|
+ 'token': app.globalData.userWxInfo.token,
|
|
|
+ 'source': "wc",
|
|
|
+ '!SAAS_LOGIN_TOKEN_!': app.globalData.currentAccountInfo.dsKey
|
|
|
},
|
|
|
- success (res) {
|
|
|
- debugger
|
|
|
+ success(res) {
|
|
|
wx.hideLoading();
|
|
|
- let apiReturnData=res.data;
|
|
|
- apiReturnData.data.swNotificationAnnouncementDos.forEach(data=>{
|
|
|
- data.publishtime=data.publishtime.slice(0,10);
|
|
|
+ let apiReturnData = res.data;
|
|
|
+ apiReturnData.data.swNotificationAnnouncementDos.forEach(data => {
|
|
|
+ data.publishtime = data.publishtime.slice(0, 10);
|
|
|
})
|
|
|
// 所有的通知公告
|
|
|
- app.globalData.notices= apiReturnData.data.swNotificationAnnouncementDos;
|
|
|
+ app.globalData.notices = apiReturnData.data.swNotificationAnnouncementDos;
|
|
|
// 该用户所有的消息通知
|
|
|
app.globalData.userNoticesList = apiReturnData.data.sysNotifyAnnounceUserDos;
|
|
|
// 需要轮播的公告
|
|
|
- let data= apiReturnData.data.swNotificationAnnouncementDos.filter(data=>{
|
|
|
- return data.homepageslider=='1';
|
|
|
+ let data = apiReturnData.data.swNotificationAnnouncementDos.filter(data => {
|
|
|
+ return data.homepageslider == '1';
|
|
|
});
|
|
|
if (app.globalData.userNoticesList) {
|
|
|
// 假设 userNoticesList 中有一个 isRead 属性表示消息是否已读
|
|
@@ -118,16 +148,16 @@ Page({
|
|
|
|
|
|
_this.setData({
|
|
|
billInfo: {
|
|
|
- totalAmount: apiReturnData.data.duFees ?? 0, // 总计应缴
|
|
|
+ totalAmount: apiReturnData.data.duFees ?? 0, // 总计应缴
|
|
|
waterUsage: apiReturnData.data.waterConsumption ?? 0, // 用水量
|
|
|
- balance: apiReturnData.data.accountbalance ?? 0 // 账户余额
|
|
|
+ balance: apiReturnData.data.accountbalance ?? 0 // 账户余额
|
|
|
},
|
|
|
- userInfo:{
|
|
|
+ userInfo: {
|
|
|
name: apiReturnData.data.username,
|
|
|
accountNumber: apiReturnData.data.usernumber,
|
|
|
address: apiReturnData.data.address
|
|
|
},
|
|
|
- noticeList :data,
|
|
|
+ noticeList: data,
|
|
|
isScrolling: true,
|
|
|
})
|
|
|
},
|
|
@@ -141,6 +171,26 @@ Page({
|
|
|
this.loadAccountInfo();
|
|
|
},
|
|
|
onShow() {
|
|
|
+ // 检查是否刚刚绑定了新户号
|
|
|
+ const justBoundNewAccount = wx.getStorageSync('justBoundNewAccount');
|
|
|
+ if (justBoundNewAccount) {
|
|
|
+ // 清除标记
|
|
|
+ wx.removeStorageSync('justBoundNewAccount');
|
|
|
+ // 直接加载页面数据
|
|
|
+ this.loadPageData();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 首先检查全局用户信息是否存在,如果没有则跳转到首次绑定页面
|
|
|
+ if (!app.globalData.currentAccountInfo ||
|
|
|
+ !app.globalData.currentAccountInfo.usernumber ||
|
|
|
+ app.globalData.userWxInfo.currentDsKey === "") {
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/FirstBangDing/FirstBangDing',
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 检查是否需要刷新
|
|
|
const needRefresh = wx.getStorageSync('needRefreshHomepage');
|
|
|
if (needRefresh) {
|
|
@@ -148,7 +198,7 @@ Page({
|
|
|
wx.removeStorageSync('needRefreshHomepage');
|
|
|
this.loadPageData();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 检查是否从户号管理页面返回
|
|
|
const backFromHuHao = wx.getStorageSync('backFromHuHao');
|
|
|
if (backFromHuHao) {
|
|
@@ -161,17 +211,39 @@ Page({
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- loadPageData: function() {
|
|
|
+ loadPageData: function () {
|
|
|
const _this = this;
|
|
|
wx.showLoading({
|
|
|
title: '加载中...',
|
|
|
});
|
|
|
|
|
|
- // 检查token是否存在
|
|
|
- if(!app.globalData.userWxInfo.token){
|
|
|
+ // 检查token和账户信息是否存在
|
|
|
+ if (!app.globalData.userWxInfo.token ||
|
|
|
+ !app.globalData.currentAccountInfo ||
|
|
|
+ !app.globalData.currentAccountInfo.usernumber ||
|
|
|
+ !app.globalData.userWxInfo.currentDsKey) {
|
|
|
wx.hideLoading();
|
|
|
+ console.error('缺少必要的账户信息');
|
|
|
+
|
|
|
+ // 尝试从本地存储恢复账户信息
|
|
|
+ const storedHuHao = wx.getStorageSync('currentHuHao');
|
|
|
+ if (storedHuHao && storedHuHao.usernumber) {
|
|
|
+ app.globalData.currentAccountInfo = storedHuHao;
|
|
|
+ app.globalData.userWxInfo.currentDsKey = storedHuHao.dsKey;
|
|
|
+ // 重新尝试加载
|
|
|
+ setTimeout(() => {
|
|
|
+ this.loadPageData();
|
|
|
+ }, 100);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果无法恢复,则跳转到首次绑定页面
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/FirstBangDing/FirstBangDing',
|
|
|
+ });
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
wx.request({
|
|
|
url: app.globalData.interfaceUrls.homePageInfo + app.globalData.currentAccountInfo.usernumber,
|
|
|
method: 'GET',
|
|
@@ -179,7 +251,7 @@ Page({
|
|
|
'content-type': 'application/json',
|
|
|
'token': app.globalData.userWxInfo.token,
|
|
|
'source': "wc",
|
|
|
- '!SAAS_LOGIN_TOKEN_!': app.globalData.currentAccountInfo.dsKey
|
|
|
+ '!SAAS_LOGIN_TOKEN_!': app.globalData.userWxInfo.currentDsKey
|
|
|
},
|
|
|
success(res) {
|
|
|
wx.hideLoading();
|
|
@@ -189,9 +261,9 @@ Page({
|
|
|
// 更新页面数据
|
|
|
_this.setData({
|
|
|
billInfo: {
|
|
|
- totalAmount: apiReturnData.data.duFees ?? 0, // 总计应缴
|
|
|
+ totalAmount: apiReturnData.data.duFees ?? 0, // 总计应缴
|
|
|
waterUsage: apiReturnData.data.waterConsumption ?? 0, // 用水量
|
|
|
- balance: apiReturnData.data.accountbalance ?? 0 // 账户余额
|
|
|
+ balance: apiReturnData.data.accountbalance ?? 0 // 账户余额
|
|
|
},
|
|
|
userInfo: {
|
|
|
name: apiReturnData.data.username,
|
|
@@ -214,7 +286,7 @@ Page({
|
|
|
// 切换户号
|
|
|
handleSwitchMeter() {
|
|
|
wx.navigateTo({
|
|
|
- url: '/pages/huhaoguanli/huhaoguanli'
|
|
|
+ url: '/pages/huhaoguanli/huhaoguanli'
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -233,7 +305,7 @@ Page({
|
|
|
if (item && item.url) {
|
|
|
wx.navigateTo({
|
|
|
url: item.url,
|
|
|
- fail: function(err) {
|
|
|
+ fail: function (err) {
|
|
|
console.error('页面跳转失败:', err)
|
|
|
wx.showToast({
|
|
|
title: '功能开发中',
|
|
@@ -266,7 +338,7 @@ Page({
|
|
|
},
|
|
|
|
|
|
// 添加或修改立即缴费按钮点击事件
|
|
|
- goToPayment: function(e) {
|
|
|
+ goToPayment: function (e) {
|
|
|
// 获取当前账单信息
|
|
|
debugger
|
|
|
// const billInfo = {
|
|
@@ -285,14 +357,14 @@ Page({
|
|
|
},
|
|
|
|
|
|
// 跳转到通知公告列表页面
|
|
|
- goToNoticeList: function() {
|
|
|
+ goToNoticeList: function () {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/tongzhiList/tongzhiList'
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 跳转到通知详情页面
|
|
|
- goToNoticeDetail: function() {
|
|
|
+ goToNoticeDetail: function () {
|
|
|
const currentNotice = this.data.noticeList[this.data.currentIndex];
|
|
|
|
|
|
wx.navigateTo({
|
|
@@ -300,17 +372,17 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- onReady: function() {
|
|
|
+ onReady: function () {
|
|
|
this.startNoticeScroll();
|
|
|
},
|
|
|
|
|
|
- startNoticeScroll: function() {
|
|
|
- if(this.data.noticeList.length==0){
|
|
|
+ startNoticeScroll: function () {
|
|
|
+ if (this.data.noticeList.length == 0) {
|
|
|
return;
|
|
|
}
|
|
|
- let data= (this.data.noticeList||[]).filter(data=>{
|
|
|
- return data.homepageslider=='1';
|
|
|
- });
|
|
|
+ let data = (this.data.noticeList || []).filter(data => {
|
|
|
+ return data.homepageslider == '1';
|
|
|
+ });
|
|
|
|
|
|
const content = data[this.data.currentIndex].scrollingcontent;
|
|
|
const title = data[this.data.currentIndex].noticetitle;
|
|
@@ -322,7 +394,7 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- onScrollComplete: function() {
|
|
|
+ onScrollComplete: function () {
|
|
|
this.setData({
|
|
|
isScrolling: false
|
|
|
});
|
|
@@ -339,29 +411,124 @@ Page({
|
|
|
},
|
|
|
|
|
|
// 加载账户和账单信息
|
|
|
- loadAccountInfo: function() {
|
|
|
+ loadAccountInfo: function () {
|
|
|
const accountInfo = app.globalData.currentAccountInfo || {};
|
|
|
+
|
|
|
+ // 检查账户信息是否为空(解绑后返回的情况)
|
|
|
+ if (!accountInfo || !accountInfo.usernumber) {
|
|
|
+ // 检查是否已全部解绑
|
|
|
+ const allAccountsUnbound = wx.getStorageSync('allAccountsUnbound');
|
|
|
+ if (allAccountsUnbound) {
|
|
|
+ // 清除标记
|
|
|
+ wx.removeStorageSync('allAccountsUnbound');
|
|
|
+ // 跳转到首次绑定页面
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/FirstBangDing/FirstBangDing',
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 尝试请求账户列表,查看是否有其他账户
|
|
|
+ this.checkAndFetchAccounts();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 检查是否是首次加载
|
|
|
const isFirstLoad = wx.getStorageSync('isFirstLoad') !== 'false';
|
|
|
+ // 检查是否在户号管理页面切换过账户
|
|
|
+ const hasUserSwitchedAccount = wx.getStorageSync('hasUserSwitchedAccount') === true;
|
|
|
|
|
|
- if (isFirstLoad) {
|
|
|
- // 首次加载,查找并设置默认账户
|
|
|
+ if (isFirstLoad && !hasUserSwitchedAccount) {
|
|
|
+ // 首次加载且未切换过账户,查找并设置默认账户
|
|
|
this.loadDefaultAccount();
|
|
|
// 设置标记,表示已不是首次加载
|
|
|
wx.setStorageSync('isFirstLoad', 'false');
|
|
|
} else {
|
|
|
- this.setData({
|
|
|
- currentAccountInfo: accountInfo
|
|
|
- });
|
|
|
+ if (!isFirstLoad && hasUserSwitchedAccount) {
|
|
|
+ // 未切换过账户,查找并设置默认账户
|
|
|
+ this.loadDefaultAccount();
|
|
|
+ } else {
|
|
|
+ // 非首次加载或已在户号管理中切换过账户,直接使用当前账户
|
|
|
+ this.setData({
|
|
|
+ currentAccountInfo: accountInfo
|
|
|
+ });
|
|
|
+
|
|
|
+ // 如果是从户号管理页面切换了账户,需要清除该标记
|
|
|
+ if (hasUserSwitchedAccount) {
|
|
|
+ wx.removeStorageSync('hasUserSwitchedAccount');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- // 加载默认账户
|
|
|
- loadDefaultAccount: function() {
|
|
|
+ // 检查并获取账户列表
|
|
|
+ checkAndFetchAccounts: function() {
|
|
|
if (!app.globalData.userWxInfo.token) {
|
|
|
+ // 没有token,直接跳转到首次绑定页面
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/FirstBangDing/FirstBangDing',
|
|
|
+ });
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ const _this = this;
|
|
|
+ wx.showLoading({
|
|
|
+ title: '加载中...',
|
|
|
+ });
|
|
|
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.interfaceUrls.accountList,
|
|
|
+ method: 'GET',
|
|
|
+ header: {
|
|
|
+ 'content-type': 'application/json',
|
|
|
+ 'token': app.globalData.userWxInfo.token,
|
|
|
+ 'source': "wc"
|
|
|
+ },
|
|
|
+ success(res) {
|
|
|
+ wx.hideLoading();
|
|
|
+ if (res.data && res.data.data && res.data.data.length > 0) {
|
|
|
+ // 找到了账户,设置默认账户
|
|
|
+ const defaultAccount = res.data.data.find(account => account.defaultAccount === "0") || res.data.data[0];
|
|
|
+
|
|
|
+ // 更新全局账户信息
|
|
|
+ app.globalData.currentAccountInfo = defaultAccount;
|
|
|
+ app.globalData.userWxInfo.currentDsKey = defaultAccount.dsKey;
|
|
|
+ app.globalData.userWxInfo.username = defaultAccount.username;
|
|
|
+ app.globalData.userWxInfo.usernumber = defaultAccount.usernumber;
|
|
|
+ app.globalData.userWxInfo.address = defaultAccount.address;
|
|
|
+ app.globalData.userWxInfo.groupName = defaultAccount.groupName;
|
|
|
+
|
|
|
+ // 保存到本地存储
|
|
|
+ wx.setStorageSync('currentHuHao', defaultAccount);
|
|
|
+
|
|
|
+ // 更新页面数据并加载详细信息
|
|
|
+ _this.setData({
|
|
|
+ currentAccountInfo: defaultAccount
|
|
|
+ });
|
|
|
+ _this.loadPageData();
|
|
|
+ } else {
|
|
|
+ // 没有找到任何账户,跳转到首次绑定页面
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/FirstBangDing/FirstBangDing',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail(error) {
|
|
|
+ wx.hideLoading();
|
|
|
+ // 请求失败,跳转到首次绑定页面
|
|
|
+ wx.redirectTo({
|
|
|
+ url: '/pages/FirstBangDing/FirstBangDing',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 加载默认账户
|
|
|
+ loadDefaultAccount: function () {
|
|
|
+ if (!app.globalData.userWxInfo.token) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
const _this = this;
|
|
|
wx.showLoading({
|
|
|
title: '加载中...',
|
|
@@ -379,14 +546,14 @@ Page({
|
|
|
if (res.data && res.data.data) {
|
|
|
// 查找 defaultAccount 为 0 的账户
|
|
|
const defaultAccount = res.data.data.find(account => account.defaultAccount === "0");
|
|
|
-
|
|
|
+ debugger
|
|
|
if (defaultAccount) {
|
|
|
// 设置为当前账户
|
|
|
app.globalData.currentAccountInfo = defaultAccount;
|
|
|
_this.setData({
|
|
|
currentAccountInfo: defaultAccount
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
// 加载该默认账户的详细信息
|
|
|
_this.loadPageData();
|
|
|
} else {
|
|
@@ -412,13 +579,13 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- onPullDownRefresh: function() {
|
|
|
+ onPullDownRefresh: function () {
|
|
|
// 刷新数据
|
|
|
this.refreshData();
|
|
|
},
|
|
|
|
|
|
// 修改刷新数据的函数
|
|
|
- refreshData: function() {
|
|
|
+ refreshData: function () {
|
|
|
console.log('正在刷新数据...');
|
|
|
this.loadPageData();
|
|
|
// 刷新完成后停止下拉刷新动画
|
|
@@ -434,7 +601,7 @@ Page({
|
|
|
},
|
|
|
|
|
|
// 获取未读消息数量的方法
|
|
|
- getUnreadNoticeCount: function() {
|
|
|
+ getUnreadNoticeCount: function () {
|
|
|
const _this = this;
|
|
|
// 从服务器获取最新的消息通知数据
|
|
|
if (app.globalData.userWxInfo.token && app.globalData.currentAccountInfo) {
|
|
@@ -467,17 +634,17 @@ Page({
|
|
|
},
|
|
|
|
|
|
// 新增方法:加载主页全部数据(包括消息通知)
|
|
|
- loadHomepageData: function() {
|
|
|
+ loadHomepageData: function () {
|
|
|
const _this = this;
|
|
|
wx.showLoading({
|
|
|
title: '加载中...',
|
|
|
});
|
|
|
-
|
|
|
- if(!app.globalData.userWxInfo.token){
|
|
|
+
|
|
|
+ if (!app.globalData.userWxInfo.token) {
|
|
|
wx.hideLoading();
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
wx.request({
|
|
|
url: app.globalData.interfaceUrls.homePageInfo + app.globalData.currentAccountInfo.usernumber,
|
|
|
method: 'GET',
|
|
@@ -491,24 +658,24 @@ Page({
|
|
|
wx.hideLoading();
|
|
|
if (res.data && res.data.data) {
|
|
|
let apiReturnData = res.data;
|
|
|
-
|
|
|
+
|
|
|
// 更新消息通知数据
|
|
|
apiReturnData.data.swNotificationAnnouncementDos.forEach(data => {
|
|
|
- data.publishtime = data.publishtime.slice(0,10);
|
|
|
+ data.publishtime = data.publishtime.slice(0, 10);
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
// 更新全局数据
|
|
|
app.globalData.notices = apiReturnData.data.swNotificationAnnouncementDos;
|
|
|
app.globalData.userNoticesList = apiReturnData.data.sysNotifyAnnounceUserDos;
|
|
|
-
|
|
|
+
|
|
|
// 需要轮播的公告
|
|
|
let data = apiReturnData.data.swNotificationAnnouncementDos.filter(data => {
|
|
|
return data.homepageslider == '1';
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
// 更新未读消息数
|
|
|
_this.getUnreadNoticeCount();
|
|
|
-
|
|
|
+
|
|
|
// 更新页面数据
|
|
|
_this.setData({
|
|
|
billInfo: {
|
|
@@ -524,9 +691,9 @@ Page({
|
|
|
noticeList: data,
|
|
|
isScrolling: true
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
// 如果有轮播公告,重新开始轮播
|
|
|
- if(data && data.length > 0) {
|
|
|
+ if (data && data.length > 0) {
|
|
|
_this.startNoticeScroll();
|
|
|
}
|
|
|
}
|
|
@@ -541,4 +708,4 @@ Page({
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-})
|
|
|
+})
|