scheduling.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. const app = getApp();
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. CustomBar: app.globalData.CustomBar,
  8. list: [],
  9. tabCur: 0,
  10. mainCur: 0,
  11. verticalNavTop: 0,
  12. load: true
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad(options) {
  18. this.getList();
  19. },
  20. getList(){
  21. const self = this;
  22. app.get('talent/admin/getScheduling',function(res){
  23. self.setData({list:res});
  24. })
  25. },
  26. TabSelect(e) {
  27. this.setData({
  28. tabCur: e.currentTarget.dataset.id,
  29. mainCur:e.currentTarget.dataset.id,
  30. verticalNavTop:(e.currentTarget.dataset.id - 1) * 50
  31. });
  32. },
  33. VerticalMain(e) {
  34. let that = this;
  35. let tabHeight = 0;
  36. if (that.data.load) {
  37. for (let i = 0; i < that.data.list.length; i++) {
  38. let view = wx.createSelectorQuery().select("#main-" + i);
  39. view.fields({
  40. size: true
  41. }, data => {
  42. if (!data) {
  43. data = {height:0};
  44. }
  45. let list = that.data.list;
  46. list[i].top = tabHeight;
  47. tabHeight = tabHeight + +data?.height;
  48. list[i].bottom = tabHeight;
  49. that.setData({list:list});
  50. }).exec();
  51. }
  52. that.setData({load:false});
  53. }
  54. let scrollTop = e.detail.scrollTop + 10;
  55. for (let i = 0; i < that.data.list.length; i++) {
  56. if (scrollTop > that.data.list[i].top && scrollTop < that.data.list[i].bottom) {
  57. that.setData({
  58. verticalNavTop:i * 50,
  59. tabCur: i
  60. });
  61. return false
  62. }
  63. }
  64. },
  65. toIndex() {
  66. wx.redirectTo({
  67. url: '/pages/talent/admin/index',
  68. })
  69. },
  70. //拔打电话
  71. callMobile(e){
  72. let mobile = e.currentTarget.dataset.mobile;
  73. if (mobile == '') {
  74. app.msg('暂无联系方式!');
  75. return false;
  76. }
  77. wx.makePhoneCall({
  78. phoneNumber: mobile
  79. })
  80. },
  81. })