index.js 3.7 KB
import Mock from 'mockjs'
import loginAPI from './login'
import permissionAPI from './permission'
import systemAPI from './system'
import dictionaryAPI from './dictionary'
import operationLogAPI from './operationLog'
import roleManageAPI from './roleManage'
import dashBoardAPI from './dashboard'
// import { Module } from 'module';

// 修复在使用 MockJS 情况下,设置 withCredentials = true,且未被拦截的跨域请求丢失 Cookies 的问题
// https://github.com/nuysoft/Mock/issues/300
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
Mock.XHR.prototype.send = function() {
  if (this.custom.xhr) {
    this.custom.xhr.withCredentials = this.withCredentials || false
  }
  this.proxy_send(...arguments)
}

Mock.setup({
  timeout: '350-600'
})

// 登录相关
Mock.mock(/\/carservice\/usercenter\/user\/login/, 'post', loginAPI.loginByUsername)
Mock.mock(/\/carservice\/usercenter\/user\/logout/, 'post', loginAPI.logout)
Mock.mock(/\/user\/info\.*/, 'get', loginAPI.getUserInfo)
//权限相关
Mock.mock(/\/permission\/routes\.*/, 'post', permissionAPI.getUserPermission)

/*系统管理  开始*/
Mock.mock(/\/carservice\/manager\/user\/getUserList/, 'post', systemAPI.getSystemUserList)
Mock.mock(/\/carservice\/manager\/user\/saveUser/, 'post', systemAPI.addListData)
Mock.mock(/\/carservice\/manager\/user\/deleteUser/, 'post', systemAPI.deleteListData)


Mock.mock(/\/system\/user\/getMenu/, 'post', systemAPI.getSystemUserMenu)
Mock.mock(/\/system\/user\/getOrginMenu/, 'post', systemAPI.getSystemUserOrginMenu)
Mock.mock(/\/system\/user\/getDataMenu/, 'post', systemAPI.getSystemUserDataMenu)
Mock.mock(/\/system\/menu\/getList/, 'post', systemAPI.getSystemMenuList)
Mock.mock(/\/system\/orgin\/getList/, 'post', systemAPI.getSystemOrgiList)


/*系统管理  结束*/ 
// 字典相关
Mock.mock(/\/dictionary\/list/, 'get', dictionaryAPI.getDictionaryList)
Mock.mock(/\/carservice\/manager\/dictionaryData\/getDictDataListByKey/, 'get', dictionaryAPI.getDictDataListByKey)
Mock.mock(/\/dictionary\/create/, 'get', dictionaryAPI.createDictionary)
Mock.mock(/\/dictionary\/update/, 'get', dictionaryAPI.updateDictionary)
Mock.mock(/\/dictionary\/delete/, 'get', dictionaryAPI.deleteDictionary)
Mock.mock(/\/dictionary\/export/, 'get', dictionaryAPI.exportDictionary)
Mock.mock(/\/dictionary\/dataList/, 'get', dictionaryAPI.getDictDataList)
Mock.mock(/\/dictionary\/createData/, 'get', dictionaryAPI.createDictData)
Mock.mock(/\/dictionary\/updateData/, 'get', dictionaryAPI.updateDictData)
Mock.mock(/\/dictionary\/deleteData/, 'get', dictionaryAPI.deleteDictData)
Mock.mock(/\/dictionary\/exportData/, 'get', dictionaryAPI.exportDictData)

// 操作日志
Mock.mock(/\/operationLog\/list/, 'get', operationLogAPI.getOperationLogList)
Mock.mock(/\/operationLog\/delete/, 'get', operationLogAPI.deleteOperationLog)
Mock.mock(/\/operationLog\/export/, 'get', operationLogAPI.exportOperationLog)

// 角色管理
Mock.mock(/\/roleManage\/list/, 'get', roleManageAPI.getRoleManageList)
Mock.mock(/\/roleManage\/add/, 'get', roleManageAPI.addRoleManage)
Mock.mock(/\/roleManage\/delete/, 'get', roleManageAPI.deleteRoleManage)
Mock.mock(/\/roleManage\/export/, 'get', roleManageAPI.exportRoleManage)


//监控台
Mock.mock(/\/dashBoard\/getserviceproport/, 'post', dashBoardAPI.getDashServiceProportion)
Mock.mock(/\/dashBoard\/getbusinesstrend/, 'post', dashBoardAPI.getDashBusinessTrend)
Mock.mock(/\/dashBoard\/getstoreranking/, 'post', dashBoardAPI.getDashStoreRanking)
Mock.mock(/\/dashBoard\/gettechnicianlist/, 'post', dashBoardAPI.getTechnicianList)
Mock.mock(/\/dashBoard\/getTechnicianLine/, 'post', dashBoardAPI.getTechnicianLine)
Mock.mock(/\/carservice\/manager\/user\/deleteUser/, 'post', roleManageAPI.getServiceTypes)


export default Mock