enc-framework
Version:
enc-framework 核心组件.
44 lines (35 loc) • 1.23 kB
JavaScript
// 爱加密http请求对象
import AjmHttp from '../utils/ajm-http';
import {base64Utils} from '../utils/ajm-utils';
import AjmConfig from '../utils/ajm-config'
// 用户api
function UserApi(store,options){
this.options = options || {};
this.store = store || {};
this.baseUrl = this.options.baseUrl || "";
this.contextPath = AjmConfig.get("OAUTH_CONTEXT_PATH") || this.options.contextPath || "";
// $http对象
this.$http = new AjmHttp({baseUrl: this.baseUrl,contextPath: this.contextPath}).getHttpClient();
return this;
}
//修改用户密码
UserApi.prototype.editUserPsw = function (params) {
return this.$http.post('/api/user/updatePassword', params).then(resp => resp.data);
}
//加载用户信息
UserApi.prototype.loadUser = function () {
return this.$http.get('/api/user/getUser').then(resp => resp.data);
}
// 加载权限集合
UserApi.prototype.loadPermissions = function () {
let params = {
systemCode: this.options.systemCode
};
if (!params) {
params = {};
}else{
params = params;
}
return this.$http.post('/api/user/getUserResourceTree', params).then(resp => resp.data);
}
export default UserApi