import {HttpClient} from "@angular/common/http";
import {Injectable} from "@angular/core";
import {Observable} from "rxjs/Observable";
import {SERVER_API_BBWX, SERVER_API_URL} from "../../app/app.constants";
import {DataFormatService} from "../../core/dataFormat.service";

@Injectable()
export class LoginService {

    constructor(private http: HttpClient,
                private dataForm: DataFormatService) {
    }

    //登录
    login(data): Observable<any> {
        return this.http.post(SERVER_API_URL + "/index/login.do", data);
    }

    //获取登录的用户信息
    userInfo(data): Observable<any> {
        return this.http.post(SERVER_API_URL + "/user/info.do", data);
    }

    //获取区属
    getArea(data): Observable<any> {
        return this.http.post(SERVER_API_URL + "/user/area.do", data);
    }

    //用户权限
    getRoleMenu(data): Observable<any> {
        return this.http.get(SERVER_API_BBWX + "/role/getRoleMenu" + this.dataForm.toQuery(data));
    }

}
