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

const Submit = BASE_URL + '/visitor/apply/submit'
const visitReason = BASE_URL + '/sys/dict/code/visitReason'
const devicePosition = BASE_URL + '/sys/dict/code/devicePosition'

/**
 * 提交访客记录
 * @param {*}  
 */
export function getSubmit(data) {
	useNetWork();
  return fetch.post(Submit,data).then(res => res);
}

/**
 * 获取访问目的
 * @param {*}  
 */
export function getDictCode(code) {
	useNetWork();
  return fetch.get(visitReason).then(res => res);
}

/**
 * 获取访问楼栋
 * @param {*}  
 */
export function getResourceType(code) {
	useNetWork();
  return fetch.get(devicePosition).then(res => res);
}