前后台接口的对接

后台使用.NET开发

Teacher_Course.ashx
//班级列表

else if (type == 73102)


前台使用VUX组件开发

定义访问后台的函数

function homeFetch(data) {
return postFetch(‘Teacher_HomePage.ashx’, data)
}

页面得到结果并绑定数据

    getTeacherInfo(){ 
     //获取教师信息函数
  req.homeFetch({type: 74101}).then(response => {
    let data = response.data[0];
    console.log(data)
    this.avatar = data.HeadImage !== '' ? baseServerUrl +                                               data.HeadImage : imgHeader;
    this.name = data.UserName;
    this.id = data.TeacherID;
    this.sex[0] = '女男'.charAt(data.Sex);
    this.mail = data.Email;
    this.phoneNumber = data.Phone;
    this.oldPhone = data.Phone;
    // this.subject = response.data.subject;
  })
}