base-service.js 638 Bytes
/**
 * 网络请求基类
 * @param url 网络请求地址(可选)
 * @param other 其他参数(自选)
 * 
 */
import { GET } from '../../../libs/request';
import config from '../../../config.js';
import regeneratorRuntime from '../../libs/regenerator-runtime/index.js';

export default class BaseService {
  constructor() {
    this.url = config.domains.service;
  }

  async GET(params, options) {
    let path = options && options.path ? options.path: '';
    let url = this.url + path;
    return await GET(url, {
      ...params
    }).then(res => {
      if (res.code === 200) {
        return res.data
      }
    })
  }
}