//const that = this;
const db = wx.cloud.database().collection("student_Demands");
// pages/MainTest/MainTest.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    currentTab: 0,
    showPopup: false,
    teacher: {}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    // 调用云函数获取教师信息
    wx.cloud.callFunction({
      name: "recommend",
      success: (res) => {
        this.setData({
          teacher: res.result.data
        })
        // console.log(this.data.teacher[1]);
      }
    })
  },

  changeTab(e) {
    const index = e.currentTarget.dataset.index;
    this.setData({
      currentTab: parseInt(index)
    });
  },
  onAddButtonTap: function() {
    this.setData({
      showPopup: true
    });
  },
  onBackButtonTap: function() {
    this.setData({
      showPopup: false
    });
  },

  handleSubmit: function() {
    // 处理....
    // 提交成功后隐藏弹窗
    this.setData({
      showPopup: false
    });
  },

  navToComments: () => {
    wx.navigateTo({
      url: '/pages/Comments/Comments',
    })
  },

  // contactTeacher(event) {
  //   // console.log(event);
  //   wx.makePhoneCall({
  //     phoneNumber: event.currentTarget.dataset.item,
  //   })
  // }
  inputChange(e) {
    this.setData({
      inputValue: e.detail.value
    });
  },
  
})