import fetch from '@/common/fetch.js';
import BASE_URL from './base.js';
import useNetWork from '@/common/useNetWork.js';


const VERIFY_PHONE = BASE_URL + '/user/userLogin';
const GET_USER_INFO = BASE_URL + '/user/getUserInfo';
const GET_USER_PHONE_NUMBER = BASE_URL + '/user/getUserPhoneNumber';

//验证手机号是否为员工
export function verifyPhone(phone) {
	useNetWork();
  const params = {
    phoneCode: phone,
  };
  return fetch.post(VERIFY_PHONE, params).then(res => res);
}

//获取用户信息
export function getUserInfo(phone) {
	useNetWork();
  return fetch.post(GET_USER_INFO).then(res => res);
}

//获取手机号
export function getUserPhoneNumber(phoneCode) {
	useNetWork();
	const params = {
	  phoneCode: phoneCode,
	};
  return fetch.post(GET_USER_PHONE_NUMBER, params).then(res => res);
}