import { toast } from '../../utils/extendApi';  
import { getStorage, clearStorage, } from '../../utils/storage';  
import { ComponentWithStore } from 'mobx-miniprogram-bindings';  
import { userStore } from '../../stores/userstore';  
  
ComponentWithStore({  
  storeBindings: {  
    store: userStore,  
    fields: ['id'],  
    actions: ['setId']  
  },  
data:{
  name:'',
  identify:getStorage('identify'),
  school:'',
  no:'',
  score:'',
	},
  methods: {  
    onLoad(){
      wx.request({
        url: `http://172.20.10.2:8600/student-api/student/common/getUserInfo/${this.data.id}`,
        method:'GET',
        header: {
          'content-type': 'application/json'
        },
        success:({data})=>{
          this.setData({
            name:data.data.name,
            school:data.data.school,
            no:data.data.no,
            score:data.data.score
          })
        }
      })
    },
    LogOut(){
        clearStorage();
        wx.redirectTo({
          url: '/pages/login/login',
        })
    },
    
    onShow(){
      
    }
  }  
});