homepage.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. const app = getApp();
  2. Page({
  3. data: {
  4. images: {
  5. logo: '/static_file/logo.png',
  6. background: '/static_file/background.png',
  7. card: '/static_file/card.png',
  8. tzd: '/static_file/backgrountzdd.png',
  9. phone: '/static_file/phone.png',
  10. yl: '/static_file/background.yl',
  11. jcsfcjtzd: '/static_file/jcsfcjtzd.png',
  12. kapiantubiao: '/static_file/kapiantubiao.png'
  13. },
  14. // 用户信息
  15. userInfo: {
  16. name: "",
  17. accountNumber: "",
  18. address: ""
  19. },
  20. // 账单信息
  21. billInfo: {
  22. totalAmount: "", // 总计应缴
  23. waterUsage: "", // 用水量
  24. balance: "" // 账户余额
  25. },
  26. // 功能按钮配置
  27. functionList: [{
  28. icon: '/static_file/zdlb.png',
  29. text: '账单列表',
  30. url: '/pages/zhangdanlist/zhangdanlist'
  31. },
  32. {
  33. icon: '/static_file/jfjl.png',
  34. text: '缴费记录',
  35. url: '/pages/jiaofeiList/jiaofeiList'
  36. },
  37. {
  38. icon: '/static_file/yhbx.png',
  39. text: '用户报修',
  40. url: '/pages/baoxiudj/baoxiudj'
  41. },
  42. {
  43. icon: '/static_file/tzgg.png',
  44. text: '消息通知',
  45. url: '/pages/tongzhiList/tongzhiList'
  46. },
  47. {
  48. icon: '/static_file/ckys.png',
  49. text: '户号绑定',
  50. url: '/pages/huhaoguanli/huhaoguanli'
  51. },
  52. {
  53. icon: '/static_file/yjfk.png',
  54. text: '投诉建议',
  55. url: '/pages/tousujianyi/tousujianyi'
  56. }
  57. ],
  58. currentIndex: 0,
  59. noticeList: [],
  60. // 活动信息
  61. activity: {
  62. title: '净水器活动',
  63. subtitle: '预留入口',
  64. imageUrl: '/static_file/background.png'
  65. },
  66. currentAccountInfo: {},
  67. unreadCount: 0
  68. },
  69. onLoad() {
  70. // 检查是否刚刚绑定了新户号
  71. const justBoundNewAccount = wx.getStorageSync('justBoundNewAccount');
  72. if (justBoundNewAccount) {
  73. // 清除标记
  74. wx.removeStorageSync('justBoundNewAccount');
  75. // 直接加载页面数据
  76. this.loadPageData();
  77. return;
  78. }
  79. // 检查是否所有户号已解绑
  80. const allAccountsUnbound = wx.getStorageSync('allAccountsUnbound');
  81. if (allAccountsUnbound) {
  82. // 清除标记
  83. wx.removeStorageSync('allAccountsUnbound');
  84. // 跳转到首次绑定页面
  85. wx.redirectTo({
  86. url: '/pages/FirstBangDing/FirstBangDing',
  87. });
  88. return;
  89. }
  90. // 检查全局用户信息是否存在
  91. if (!app.globalData.currentAccountInfo ||
  92. !app.globalData.currentAccountInfo.usernumber ||
  93. app.globalData.userWxInfo.currentDsKey === "") {
  94. wx.redirectTo({
  95. url: '/pages/FirstBangDing/FirstBangDing',
  96. });
  97. return;
  98. }
  99. let refresh = app.globalData.refresh;
  100. if (refresh == 1) {
  101. wx.showLoading({
  102. title: '加载中...',
  103. });
  104. if (!app.globalData.userWxInfo.token) {
  105. wx.hideLoading();
  106. return;
  107. }
  108. const _this = this;
  109. wx.request({
  110. url: app.globalData.interfaceUrls.homePageInfo + app.globalData.currentAccountInfo.usernumber,
  111. method: 'GET',
  112. header: {
  113. 'content-type': 'application/json', // 默认值
  114. 'token': app.globalData.userWxInfo.token,
  115. 'source': "wc",
  116. '!SAAS_LOGIN_TOKEN_!': app.globalData.currentAccountInfo.dsKey
  117. },
  118. success(res) {
  119. wx.hideLoading();
  120. let apiReturnData = res.data;
  121. apiReturnData.data.swNotificationAnnouncementDos.forEach(data => {
  122. data.publishtime = data.publishtime.slice(0, 10);
  123. })
  124. // 所有的通知公告
  125. app.globalData.notices = apiReturnData.data.swNotificationAnnouncementDos;
  126. // 该用户所有的消息通知
  127. app.globalData.userNoticesList = apiReturnData.data.sysNotifyAnnounceUserDos;
  128. // 需要轮播的公告
  129. let data = apiReturnData.data.swNotificationAnnouncementDos.filter(data => {
  130. return data.homepageslider == '1';
  131. });
  132. if (app.globalData.userNoticesList) {
  133. // 假设 userNoticesList 中有一个 isRead 属性表示消息是否已读
  134. const unreadCount = app.globalData.userNoticesList.filter(notice => notice.readstate === '2').length;
  135. _this.setData({
  136. unreadCount: unreadCount
  137. });
  138. } else {
  139. _this.setData({
  140. unreadCount: 0
  141. });
  142. }
  143. _this.setData({
  144. billInfo: {
  145. totalAmount: apiReturnData.data.duFees ?? 0, // 总计应缴
  146. waterUsage: apiReturnData.data.waterConsumption ?? 0, // 用水量
  147. balance: apiReturnData.data.accountbalance ?? 0 // 账户余额
  148. },
  149. userInfo: {
  150. name: apiReturnData.data.username,
  151. accountNumber: apiReturnData.data.usernumber,
  152. address: apiReturnData.data.address
  153. },
  154. noticeList: data,
  155. isScrolling: true,
  156. })
  157. },
  158. fail(error) {
  159. wx.hideLoading()
  160. utils.simleInfo('登录失败,请稍后再试')
  161. }
  162. })
  163. }
  164. // 加载账户和账单信息
  165. this.loadAccountInfo();
  166. },
  167. onShow() {
  168. // 检查是否刚刚绑定了新户号
  169. const justBoundNewAccount = wx.getStorageSync('justBoundNewAccount');
  170. if (justBoundNewAccount) {
  171. // 清除标记
  172. wx.removeStorageSync('justBoundNewAccount');
  173. // 直接加载页面数据
  174. this.loadPageData();
  175. return;
  176. }
  177. // 首先检查全局用户信息是否存在,如果没有则跳转到首次绑定页面
  178. if (!app.globalData.currentAccountInfo ||
  179. !app.globalData.currentAccountInfo.usernumber ||
  180. app.globalData.userWxInfo.currentDsKey === "") {
  181. wx.redirectTo({
  182. url: '/pages/FirstBangDing/FirstBangDing',
  183. });
  184. return;
  185. }
  186. // 检查是否需要刷新
  187. const needRefresh = wx.getStorageSync('needRefreshHomepage');
  188. if (needRefresh) {
  189. // 清除刷新标记
  190. wx.removeStorageSync('needRefreshHomepage');
  191. this.loadPageData();
  192. }
  193. // 检查是否从户号管理页面返回
  194. const backFromHuHao = wx.getStorageSync('backFromHuHao');
  195. if (backFromHuHao) {
  196. wx.removeStorageSync('backFromHuHao');
  197. // 从户号管理页面返回时重新加载全部数据
  198. this.loadHomepageData();
  199. } else {
  200. // 即使不是从户号管理页面返回,也更新未读消息数
  201. this.getUnreadNoticeCount();
  202. }
  203. },
  204. loadPageData: function () {
  205. const _this = this;
  206. wx.showLoading({
  207. title: '加载中...',
  208. });
  209. // 检查token和账户信息是否存在
  210. if (!app.globalData.userWxInfo.token ||
  211. !app.globalData.currentAccountInfo ||
  212. !app.globalData.currentAccountInfo.usernumber ||
  213. !app.globalData.userWxInfo.currentDsKey) {
  214. wx.hideLoading();
  215. console.error('缺少必要的账户信息');
  216. // 尝试从本地存储恢复账户信息
  217. const storedHuHao = wx.getStorageSync('currentHuHao');
  218. if (storedHuHao && storedHuHao.usernumber) {
  219. app.globalData.currentAccountInfo = storedHuHao;
  220. app.globalData.userWxInfo.currentDsKey = storedHuHao.dsKey;
  221. // 重新尝试加载
  222. setTimeout(() => {
  223. this.loadPageData();
  224. }, 100);
  225. return;
  226. }
  227. // 如果无法恢复,则跳转到首次绑定页面
  228. wx.redirectTo({
  229. url: '/pages/FirstBangDing/FirstBangDing',
  230. });
  231. return;
  232. }
  233. wx.request({
  234. url: app.globalData.interfaceUrls.homePageInfo + app.globalData.currentAccountInfo.usernumber,
  235. method: 'GET',
  236. header: {
  237. 'content-type': 'application/json',
  238. 'token': app.globalData.userWxInfo.token,
  239. 'source': "wc",
  240. '!SAAS_LOGIN_TOKEN_!': app.globalData.userWxInfo.currentDsKey
  241. },
  242. success(res) {
  243. wx.hideLoading();
  244. let apiReturnData = res.data;
  245. // 该用户所有的消息通知
  246. app.globalData.userNoticesList = apiReturnData.data.sysNotifyAnnounceUserDos;
  247. // 更新页面数据
  248. _this.setData({
  249. billInfo: {
  250. totalAmount: apiReturnData.data.duFees ?? 0, // 总计应缴
  251. waterUsage: apiReturnData.data.waterConsumption ?? 0, // 用水量
  252. balance: apiReturnData.data.accountbalance ?? 0 // 账户余额
  253. },
  254. userInfo: {
  255. name: apiReturnData.data.username,
  256. accountNumber: apiReturnData.data.usernumber,
  257. address: apiReturnData.data.address
  258. },
  259. });
  260. },
  261. fail(error) {
  262. wx.hideLoading();
  263. wx.showToast({
  264. title: '数据加载失败,请稍后再试',
  265. icon: 'none',
  266. duration: 2000
  267. });
  268. }
  269. });
  270. },
  271. // 切换户号
  272. handleSwitchMeter() {
  273. wx.navigateTo({
  274. url: '/pages/huhaoguanli/huhaoguanli'
  275. })
  276. },
  277. // 充值缴费
  278. handlePayment() {
  279. wx.navigateTo({
  280. // url: '/pages/payment/payment'
  281. })
  282. },
  283. // 功能按钮点击事件
  284. handleFunctionClick(e) {
  285. const index = e.currentTarget.dataset.index
  286. const item = this.data.functionList[index]
  287. if (item && item.url) {
  288. wx.navigateTo({
  289. url: item.url,
  290. fail: function (err) {
  291. console.error('页面跳转失败:', err)
  292. wx.showToast({
  293. title: '功能开发中',
  294. icon: 'none',
  295. duration: 2000
  296. })
  297. }
  298. })
  299. } else {
  300. wx.showToast({
  301. title: '功能开发中',
  302. icon: 'none',
  303. duration: 2000
  304. })
  305. }
  306. },
  307. // 查看账单列表
  308. handleViewBill() {
  309. wx.navigateTo({
  310. // url: '/pages/billList/billList'
  311. })
  312. },
  313. // 查看更多活动
  314. handleMoreActivity() {
  315. wx.navigateTo({
  316. // url: '/pages/activityList/activityList'
  317. })
  318. },
  319. // 添加或修改立即缴费按钮点击事件
  320. goToPayment: function (e) {
  321. // 获取当前账单信息
  322. debugger
  323. // const billInfo = {
  324. // amount: this.data.billInfo.totalAmount, // 应缴金额
  325. // amountDue:this.data.billInfo.totalAmount, // 总计应缴
  326. // balance: this.data.billInfo.balance // 账户余额
  327. // };
  328. // 编码账单信息并传递到缴费页面
  329. // const billInfoStr = encodeURIComponent(JSON.stringify(billInfo));
  330. wx.navigateTo({
  331. url: `/pages/lijijiaofei/lijijiaofei`
  332. // url: `/pages/lijijiaofei/lijijiaofei?billInfo=${billInfoStr}`
  333. });
  334. },
  335. // 跳转到通知公告列表页面
  336. goToNoticeList: function () {
  337. wx.navigateTo({
  338. url: '/pages/tongzhiList/tongzhiList'
  339. })
  340. },
  341. // 跳转到通知详情页面
  342. goToNoticeDetail: function () {
  343. const currentNotice = this.data.noticeList[this.data.currentIndex];
  344. wx.navigateTo({
  345. url: `/pages/tzxq/tzxq?id=${currentNotice.id}`
  346. });
  347. },
  348. onReady: function () {
  349. this.startNoticeScroll();
  350. },
  351. startNoticeScroll: function () {
  352. if (this.data.noticeList.length == 0) {
  353. return;
  354. }
  355. let data = (this.data.noticeList || []).filter(data => {
  356. return data.homepageslider == '1';
  357. });
  358. const content = data[this.data.currentIndex].scrollingcontent;
  359. const title = data[this.data.currentIndex].noticetitle;
  360. const duration = (title.length + content.length) * 0.5;
  361. this.setData({
  362. scrollDuration: duration,
  363. isScrolling: true,
  364. });
  365. },
  366. onScrollComplete: function () {
  367. this.setData({
  368. isScrolling: false
  369. });
  370. // 等待2秒后切换到下一条
  371. setTimeout(() => {
  372. const nextIndex = (this.data.currentIndex + 1) % this.data.noticeList.length;
  373. this.setData({
  374. currentIndex: nextIndex
  375. }, () => {
  376. this.startNoticeScroll();
  377. });
  378. }, 1000);
  379. },
  380. // 加载账户和账单信息
  381. loadAccountInfo: function () {
  382. const accountInfo = app.globalData.currentAccountInfo || {};
  383. // 检查账户信息是否为空(解绑后返回的情况)
  384. if (!accountInfo || !accountInfo.usernumber) {
  385. // 检查是否已全部解绑
  386. const allAccountsUnbound = wx.getStorageSync('allAccountsUnbound');
  387. if (allAccountsUnbound) {
  388. // 清除标记
  389. wx.removeStorageSync('allAccountsUnbound');
  390. // 跳转到首次绑定页面
  391. wx.redirectTo({
  392. url: '/pages/FirstBangDing/FirstBangDing',
  393. });
  394. return;
  395. }
  396. // 尝试请求账户列表,查看是否有其他账户
  397. this.checkAndFetchAccounts();
  398. return;
  399. }
  400. // 检查是否是首次加载
  401. const isFirstLoad = wx.getStorageSync('isFirstLoad') !== 'false';
  402. // 检查是否在户号管理页面切换过账户
  403. const hasUserSwitchedAccount = wx.getStorageSync('hasUserSwitchedAccount') === true;
  404. if (isFirstLoad && !hasUserSwitchedAccount) {
  405. // 首次加载且未切换过账户,查找并设置默认账户
  406. this.loadDefaultAccount();
  407. // 设置标记,表示已不是首次加载
  408. wx.setStorageSync('isFirstLoad', 'false');
  409. } else {
  410. if (!isFirstLoad && hasUserSwitchedAccount) {
  411. // 未切换过账户,查找并设置默认账户
  412. this.loadDefaultAccount();
  413. } else {
  414. // 非首次加载或已在户号管理中切换过账户,直接使用当前账户
  415. this.setData({
  416. currentAccountInfo: accountInfo
  417. });
  418. // 如果是从户号管理页面切换了账户,需要清除该标记
  419. if (hasUserSwitchedAccount) {
  420. wx.removeStorageSync('hasUserSwitchedAccount');
  421. }
  422. }
  423. }
  424. },
  425. // 检查并获取账户列表
  426. checkAndFetchAccounts: function() {
  427. if (!app.globalData.userWxInfo.token) {
  428. // 没有token,直接跳转到首次绑定页面
  429. wx.redirectTo({
  430. url: '/pages/FirstBangDing/FirstBangDing',
  431. });
  432. return;
  433. }
  434. const _this = this;
  435. wx.showLoading({
  436. title: '加载中...',
  437. });
  438. wx.request({
  439. url: app.globalData.interfaceUrls.accountList,
  440. method: 'GET',
  441. header: {
  442. 'content-type': 'application/json',
  443. 'token': app.globalData.userWxInfo.token,
  444. 'source': "wc"
  445. },
  446. success(res) {
  447. wx.hideLoading();
  448. if (res.data && res.data.data && res.data.data.length > 0) {
  449. // 找到了账户,设置默认账户
  450. const defaultAccount = res.data.data.find(account => account.defaultAccount === "0") || res.data.data[0];
  451. // 更新全局账户信息
  452. app.globalData.currentAccountInfo = defaultAccount;
  453. app.globalData.userWxInfo.currentDsKey = defaultAccount.dsKey;
  454. app.globalData.userWxInfo.username = defaultAccount.username;
  455. app.globalData.userWxInfo.usernumber = defaultAccount.usernumber;
  456. app.globalData.userWxInfo.address = defaultAccount.address;
  457. app.globalData.userWxInfo.groupName = defaultAccount.groupName;
  458. // 保存到本地存储
  459. wx.setStorageSync('currentHuHao', defaultAccount);
  460. // 更新页面数据并加载详细信息
  461. _this.setData({
  462. currentAccountInfo: defaultAccount
  463. });
  464. _this.loadPageData();
  465. } else {
  466. // 没有找到任何账户,跳转到首次绑定页面
  467. wx.redirectTo({
  468. url: '/pages/FirstBangDing/FirstBangDing',
  469. });
  470. }
  471. },
  472. fail(error) {
  473. wx.hideLoading();
  474. // 请求失败,跳转到首次绑定页面
  475. wx.redirectTo({
  476. url: '/pages/FirstBangDing/FirstBangDing',
  477. });
  478. }
  479. });
  480. },
  481. // 加载默认账户
  482. loadDefaultAccount: function () {
  483. if (!app.globalData.userWxInfo.token) {
  484. return;
  485. }
  486. const _this = this;
  487. wx.showLoading({
  488. title: '加载中...',
  489. });
  490. wx.request({
  491. url: app.globalData.interfaceUrls.accountList,
  492. method: 'GET',
  493. header: {
  494. 'content-type': 'application/json',
  495. 'token': app.globalData.userWxInfo.token,
  496. 'source': "wc"
  497. },
  498. success(res) {
  499. wx.hideLoading();
  500. if (res.data && res.data.data) {
  501. // 查找 defaultAccount 为 0 的账户
  502. const defaultAccount = res.data.data.find(account => account.defaultAccount === "0");
  503. debugger
  504. if (defaultAccount) {
  505. // 设置为当前账户
  506. app.globalData.currentAccountInfo = defaultAccount;
  507. _this.setData({
  508. currentAccountInfo: defaultAccount
  509. });
  510. // 加载该默认账户的详细信息
  511. _this.loadPageData();
  512. } else {
  513. // 没有找到默认账户,使用当前账户
  514. _this.setData({
  515. currentAccountInfo: app.globalData.currentAccountInfo || {}
  516. });
  517. }
  518. }
  519. },
  520. fail(error) {
  521. wx.hideLoading();
  522. wx.showToast({
  523. title: '加载默认账户失败',
  524. icon: 'none',
  525. duration: 2000
  526. });
  527. // 使用当前账户作为备选
  528. _this.setData({
  529. currentAccountInfo: app.globalData.currentAccountInfo || {}
  530. });
  531. }
  532. });
  533. },
  534. onPullDownRefresh: function () {
  535. // 刷新数据
  536. this.refreshData();
  537. },
  538. // 修改刷新数据的函数
  539. refreshData: function () {
  540. console.log('正在刷新数据...');
  541. this.loadPageData();
  542. // 刷新完成后停止下拉刷新动画
  543. wx.stopPullDownRefresh({
  544. success: (res) => {
  545. wx.showToast({
  546. title: '刷新成功',
  547. icon: 'success',
  548. duration: 1000
  549. });
  550. }
  551. });
  552. },
  553. // 获取未读消息数量的方法
  554. getUnreadNoticeCount: function () {
  555. const _this = this;
  556. // 从服务器获取最新的消息通知数据
  557. if (app.globalData.userWxInfo.token && app.globalData.currentAccountInfo) {
  558. wx.request({
  559. url: app.globalData.interfaceUrls.homePageInfo + app.globalData.currentAccountInfo.usernumber,
  560. method: 'GET',
  561. header: {
  562. 'content-type': 'application/json',
  563. 'token': app.globalData.userWxInfo.token,
  564. 'source': "wc",
  565. '!SAAS_LOGIN_TOKEN_!': app.globalData.currentAccountInfo.dsKey
  566. },
  567. success(res) {
  568. if (res.data && res.data.data) {
  569. // 更新全局的用户通知列表
  570. app.globalData.userNoticesList = res.data.data.sysNotifyAnnounceUserDos;
  571. // 计算未读消息数量
  572. const unreadCount = app.globalData.userNoticesList.filter(notice => notice.readstate === '2').length;
  573. _this.setData({
  574. unreadCount: unreadCount
  575. });
  576. }
  577. }
  578. });
  579. } else {
  580. this.setData({
  581. unreadCount: 0
  582. });
  583. }
  584. },
  585. // 新增方法:加载主页全部数据(包括消息通知)
  586. loadHomepageData: function () {
  587. const _this = this;
  588. wx.showLoading({
  589. title: '加载中...',
  590. });
  591. if (!app.globalData.userWxInfo.token) {
  592. wx.hideLoading();
  593. return;
  594. }
  595. wx.request({
  596. url: app.globalData.interfaceUrls.homePageInfo + app.globalData.currentAccountInfo.usernumber,
  597. method: 'GET',
  598. header: {
  599. 'content-type': 'application/json',
  600. 'token': app.globalData.userWxInfo.token,
  601. 'source': "wc",
  602. '!SAAS_LOGIN_TOKEN_!': app.globalData.currentAccountInfo.dsKey
  603. },
  604. success(res) {
  605. wx.hideLoading();
  606. if (res.data && res.data.data) {
  607. let apiReturnData = res.data;
  608. // 更新消息通知数据
  609. apiReturnData.data.swNotificationAnnouncementDos.forEach(data => {
  610. data.publishtime = data.publishtime.slice(0, 10);
  611. });
  612. // 更新全局数据
  613. app.globalData.notices = apiReturnData.data.swNotificationAnnouncementDos;
  614. app.globalData.userNoticesList = apiReturnData.data.sysNotifyAnnounceUserDos;
  615. // 需要轮播的公告
  616. let data = apiReturnData.data.swNotificationAnnouncementDos.filter(data => {
  617. return data.homepageslider == '1';
  618. });
  619. // 更新未读消息数
  620. _this.getUnreadNoticeCount();
  621. // 更新页面数据
  622. _this.setData({
  623. billInfo: {
  624. totalAmount: apiReturnData.data.duFees ?? 0,
  625. waterUsage: apiReturnData.data.waterConsumption ?? 0,
  626. balance: apiReturnData.data.accountbalance ?? 0
  627. },
  628. userInfo: {
  629. name: apiReturnData.data.username,
  630. accountNumber: apiReturnData.data.usernumber,
  631. address: apiReturnData.data.address
  632. },
  633. noticeList: data,
  634. isScrolling: true
  635. });
  636. // 如果有轮播公告,重新开始轮播
  637. if (data && data.length > 0) {
  638. _this.startNoticeScroll();
  639. }
  640. }
  641. },
  642. fail(error) {
  643. wx.hideLoading();
  644. wx.showToast({
  645. title: '数据加载失败',
  646. icon: 'none',
  647. duration: 2000
  648. });
  649. }
  650. });
  651. }
  652. })