微信小程序--评教系统之任课教师,评教

之前做了登录页面,登录之后直接跳转到教师信息页面

这是我写的HTML代码


  
    任课教师
  
  
      
      
      姓名:{{item.teachername}}
      任课:{{item.course}}
      
  
 

css代码

page{  
  background-color: #f2f2f2; 
}   
.main{
  width:100%; 
  margin-top: 10rpx;
   border: 1px solid #e1e1e1; 
   background: #fff; 
  display: flex;
  flex-direction:row;
  height: 200rpx;
  font-size: 38rpx;
}
.main image{
  margin-left: 30rpx; 
  margin-top: 20rpx;
  }
.info{
  margin-left: 40rpx; 
  margin-top: 30rpx;
}  
.header{
  font-size: 50rpx;
  font-weight: bold;
  width: 100%;
  height: 150rpx;
  text-align: center;
  line-height: 150rpx;
  /* border: 1px solid black;  */
  background: #008781;
}

js代码

data: {
    teachers:null
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var url = "https://www.*******.top/pj/index.php/student/api/teachers";
    // let self=this;
    //读取缓存
    var student = wx.getStorageSync('student');
    // console.log(student);
    var classid = '100000-1603';
    // console.log(classid);

    wx.request({
      url: url,//仅为示例,并非真实的接口地址
      data: {
        classid: classid
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: (res)=> {
        console.log(res.data);
        this.setData({teachers:res.data});
      }
    })
  },
 selectTeacher:function(e){
    var teacherid=e.currentTarget.dataset.teacherid;
    wx.navigateTo({
      url:"../testpaper/testpaper?teacherid="+teacherid,
    })
  }
})

显示出教师信息后,点击可进入评教首页面

HTML代码


  
    
      {{teacher.name}}
      {{teacher.sex}}   {{teacher.zhicheng}}
    
    
  
   
    
      {{item.type}}
      
        {{item.start}}
        至{{item.end}}
      
    
    {{item.name}}
   
css代码
page{
  background-color: #f2f2f2;
}
.mycontainer{
  background-color: #f2f2f2;
  margin: 0; 
  padding: 0 15rpx;  
}
.main{
  height: 260rpx; 
  padding-left: 100rpx;
  letter-spacing: 0.1rem;
  margin-bottom: 20rpx;
  font-size: 36rpx;
  background-color: #008781;
  display: flex;
  flex-direction: row; 
}
.list view{
  margin-top: 10rpx;
}
.main image{
   margin-left:  160rpx;
   margin-top: 25rpx;
   border-radius: 100rpx;
}
.text1{ 
  padding-top: 60rpx;
  font-size: 48rpx;
  font-weight: bold;
  letter-spacing: 0.1rem;
}
.text2{
  font-size: 36rpx;
  color: #fff;
  margin-top: 20rpx;
}
.list{
  background-color: white;
  margin-top: 10rpx;
  padding: 10rpx;
}
.box{
  border-bottom: 2px solid #f2f2f2;
  font-size: 28rpx;
  padding-bottom: 10rpx;
  color: #666;
  font-family: '宋体';
}
.name{
  padding: 10rpx 0;
}
.time{
  display: flex;
}
js代码
data: {
    testpaper:null,
    teacher:null
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var teacherid = options.teacherid;
    console.log(teacherid);
    var url= 'https://www.*******.top/pj/index.php/student/api/testpaper';
    wx.request({
      url: url,
      data: {
        teacherid: teacherid
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: (res) => {
        console.log(res.data);
        this.setData({ testpaper: res.data.testpaper });
        this.setData({teacher:res.data.teacher});
      }
    })
  },
  selectTestpaper: function (e) {
    // console.log(e);
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '../paperdetails/paperdetails?id=' + id,
    })
  },



 
  

你可能感兴趣的:(微信小程序--评教系统之任课教师,评教)