import axios from '@/utils/axios';  //引入axios
let apiFunc = {};

/*
*进入微应用js鉴权
**/
apiFunc.getConfig = function() {
    return axios.post("http://192.168.0.41:8080/config",'url='+window.location.href.replace(window.location.hash, ""))
}
/*
*登录
**/
apiFunc.login = function(code) {
    return axios.post("http://192.168.0.41:8080/login",'authCode='+code)
}

apiFunc.getdepartments = function() {
    return axios.get("http://192.168.0.41:8080/department/list")
}

apiFunc.getdepartmentlist = function(id) {
    return axios.get("http://192.168.0.41:8080/user/simplelist?department_id="+ id)
}

apiFunc.postMessages = function(users,message,title) {
    return axios.post("http://192.168.0.41:8080/user/message",'users=' + users +'&message=' + message + '&title='+ title)
}

apiFunc.getWords = function() {
    return axios.get("http://192.168.0.41:8080/findByRandom")
}

apiFunc.submitGrade = function(score,userName) {
    return axios.post("http://192.168.0.41:8080/submitGrade",'score='+score+'&userName='+userName)
}

apiFunc.getGrade = function(name) {
    return axios.post("http://192.168.0.41:8080/getGrade",'name='+name)
}

apiFunc.setTimer = function(pinlv,time,userid) {
    return axios.post("http://192.168.0.41:8080/setTimer",'pinlv='+pinlv+'&time='+time+'&userid='+userid)
}

apiFunc.selectTimer = function(userid) {
    return axios.post("http://192.168.0.41:8080/selectTimer",'userid='+userid)
}

apiFunc.deleteTimer = function(frequency,userid) {
    return axios.post("http://192.168.0.41:8080/deleteTimer",'userid='+userid+'&frequency='+frequency)
}
export default apiFunc;
