{"size": 1286, "ext": "js", "max_stars_repo_path": "client/utils/apiUrl.js", "max_stars_repo_name": "gaoxl1992/designer", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "client/utils/apiUrl.js", "max_issues_repo_name": "gaoxl1992/designer", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "client/utils/apiUrl.js", "max_forks_repo_name": "gaoxl1992/designer", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.7966101695, "max_line_length": 60, "alphanum_fraction": 0.6143079316}
/* 使用示例
  // post请求
  const res = await this.$http.setPageConfig({
    prefix: 'baidu', //匹配url前缀
    ifHandleError: true, //不对该接口进行全局错误提示。
    method: 'post',
    headers: {
      'Content-Type': 'application/json; charset=UTF-8',
    },
    data: {
      userId: this.idCard,
      userName: this.realName,
      color: 'red',
    }
  })

  // get请求
  this.$http.qryPageConfig({
    method: 'get', //默认
    params: {
      page: 'login'
    },
  }).then((res) => {
    this.pageConfig = res.data;
  }).finally(() => {
    ...
    this.close();
  });
 */
import Vue from 'vue';
import request from './request';

let services = {};

const reportModule = '/report'
// 接口url统一维护
const apiUrl = {
  saveDesignerData: '/template/output/save', // 设计器保存
  fetchDesignerData: '/template/output/detail', // 设计器打开重新编辑
  saveSymbolword: '/template/symbolword/set', //设置特殊词汇
  fetchSymbolword: '/template/symbolword/get', // 查询特殊词汇
  fetchDomin: '/domain' // 查询阈值
}

Object.entries(apiUrl).forEach((item) => {
  services[item[0]] = function (options = {}) {
    return request(Object.assign({
      url: reportModule + item[1]
    }, options))
  }
})

// 将services挂载到vue的原型上
// 业务中引用的方法：this.$http.接口名
Object.defineProperty(Vue.prototype, '$http', {
  value: services
});

export default services;