//api集合
let apiAuth = {
	login: "/api/nurse/auth/login",
	me: "/api/nurse/auth/me",
	logout: "/api/nurse/auth/logout",
	save: "/api/nurse/auth/save",
};

let apiTask = {
	nurseList: "/api/nurse/nurse-list",
	nurseDetail: "/api/nurse/nurse-detail",
	nurseSave: "/api/nurse/nurse-save",
	processSave: "/api/nurse/process-save",
	nurseCalendar: "/api/nurse/nurse-calendar",
	noticeList: "/api/nurse/notice-list",
	noticeDetail: "/api/nurse/notice-detail",
	statistic: "/api/nurse/statistic",
};
// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作
const install = (Vue, vm) => {
	//api方法
	let login = (data = {}) => vm.$u.post(apiAuth.login, data);
	let me = (data = {}) => vm.$u.post(apiAuth.me, data);
	let logout = (data = {}) => vm.$u.post(apiAuth.logout, data);
	let save = (data = {}) => vm.$u.post(apiAuth.save, data);

	let nurseList = (params = {}) => vm.$u.get(apiTask.nurseList, params);
	let nurseDetail = (params = {}) => vm.$u.get(apiTask.nurseDetail, params);
	let nurseSave = (data = {}) => vm.$u.post(apiTask.nurseSave, data);
	let processSave = (data = {}) => vm.$u.post(apiTask.processSave, data);
	let nurseCalendar = (params = {}) => vm.$u.get(apiTask.nurseCalendar, params);
	let noticeList = (params = {}) => vm.$u.get(apiTask.noticeList, params);
	let noticeDetail = (params = {}) => vm.$u.get(apiTask.noticeDetail, params);
	let statistic = (params = {}) => vm.$u.get(apiTask.statistic, params);
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		login,
		me,
		logout,
		save,
		nurseList,
		nurseDetail,
		nurseSave,
		processSave,
		nurseCalendar,
		noticeList,
		noticeDetail,
		statistic
	};
};

export default {
	install,
};
