teacher_information.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // pages/teacher_information/teacher_information.js
  2. import { routers, viewImage, sharePage, isFn, getGlobalVal, formatDateTime, formateNumber, formatDate } from '../../utils/util.js'
  3. import { MyInfo2 } from '../../utils/api.js'
  4. const { navigateTo, redirectTo, navigateBack } = routers()
  5. const { globalData } = getApp()
  6. const { baseImgUrl, thumbnail } = globalData
  7. const app = getApp()
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. baseImgUrl,
  14. thumbnail,
  15. infoList:['学生','教师']
  16. },
  17. /**
  18. * 生命周期函数--监听页面加载
  19. */
  20. onLoad: function (options) {
  21. },
  22. /**
  23. * 生命周期函数--监听页面初次渲染完成
  24. */
  25. onReady: function () {
  26. const obj = { navigateTo, redirectTo, navigateBack, viewImage }
  27. for (const i in obj) {
  28. this[i] = obj[i]
  29. }
  30. },
  31. /**
  32. * 生命周期函数--监听页面显示
  33. */
  34. onShow: function () {
  35. this.getData()
  36. },
  37. /**
  38. * 生命周期函数--监听页面隐藏
  39. */
  40. onHide: function () {
  41. },
  42. /**
  43. * 生命周期函数--监听页面卸载
  44. */
  45. onUnload: function () {
  46. },
  47. /**
  48. * 页面相关事件处理函数--监听用户下拉动作
  49. */
  50. onPullDownRefresh: function () {
  51. },
  52. /**
  53. * 页面上拉触底事件的处理函数
  54. */
  55. onReachBottom: function () {
  56. },
  57. /**
  58. * 用户点击右上角分享
  59. */
  60. onShareAppMessage: function () {
  61. if (app.sharePageDefaultCtl) {
  62. return app.sharePageDefaultCtl()
  63. }
  64. },
  65. /**
  66. * 获取数据
  67. */
  68. getData: function (cb) {
  69. const continuousFn = { fn: this.getData, param: { ...arguments } }
  70. console.log(new Date())
  71. MyInfo2({ data: {}, continuousFn }).then(res => {
  72. const { photo, orgName, phone, studentNum, teacherNum, libService, platformService, libId,schoolName,portNum} = res.data;
  73. wx.setNavigationBarTitle({
  74. title: `${orgName}`,
  75. })
  76. this.setData({ photo, orgName, phone, studentNum, teacherNum, libService, platformService, libId,schoolName,portNum})
  77. if (isFn(cb)) cb()
  78. }).catch(res => {
  79. this.setData({ isLoaded: true })
  80. if (isFn(cb)) cb()
  81. })
  82. },
  83. })