1.2.2 • Published 1 year ago

cloud-toplion v1.2.2

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

order: 2

title: 云联前端体系

云联体系项目创建及原有项目升级到云联体系


新建项目


原项目升级

  • (注:子系统需是基于umi 3.x版本搭建)
   $ yarn add cross-env
  • 在package.json里修改或添加scripts配置
    "start": "cross-env UMI_ENV=dev umi dev",
    "start:test": "cross-env UMI_ENV=test umi dev",
    "start:prod": "cross-env UMI_ENV=prod umi dev",
    "build": "cross-env UMI_ENV=prod umi build",
    "build:test": "cross-env UMI_ENV=test umi build",
  • 添加配置文件,分 umirc和 config两种方式,根据项目配置选择对应方式即可
  //umirc方式:在根目录添加 .umirc.dev.js   .umirc.test.js   .umirc.prod.js 文件
  //config方式:在config文件夹添加 config.dev.js   config.test.js   config.prod.js 文件

  export default {
     define: {
        UMI_ENV: 'dev' / 'test' / 'prod', //基于文件选择内容
     }
  };
  • 请求域名文件调整,src/service.js
export const devService = {
  // commonService: 'http://192.168.80.246:8891', //开发环境
  // ssoService: 'http://192.168.80.246:8090', //开发环境
  // businessService: 'http://192.168.80.246:8892', //开发环境
  commonService: 'https://test.common.yx.toplion.com.cn',
  ssoService: 'https://test.sso.yx.toplion.com.cn',
  businessService: 'https://test.iot.yx.toplion.com.cn',
  dataIService: 'https://test.iot-open-server.toplion.com.cn',
  superCardService: 'https://test.super-card.server.toplion.com.cn', // 超卡通
  canteenService: 'https://test.canteen.server.toplion.com.cn', // 餐厅
  cloudCoreService: 'https://test.cloud-core.server.toplion.com.cn', // 云芯
  dormitoryService: 'https://test.dormitory-server.toplion.com.cn', // 宿管
  lockService: 'https://test.lock-server.toplion.com.cn', // 门锁
  microBaseService: 'https://test.micro-base-server.toplion.com.cn', // 基础服务
  gateService: 'https://test.gate.server.toplion.com.cn', // 门禁
  topLionServer: 'https://directive.toplion.com.cn',
  sourceCenterService: 'https://test.source-center.server.toplion.com.cn', // 基础资源中心

  // 微服务
  personServer_ms: 'http://192.168.80.246:20000', // 人员服务  (存学生信息等)
  cardServer_ms: 'http://192.168.80.246:20001', // 卡片服务
  walletServer_ms: 'http://192.168.80.246:20002', // 钱包服务  (存学生信息等)
  resourceServer_ms: 'http://192.168.80.246:20003', // 资源服务  (存学生信息等)
  consumeOrderServer_ms: 'http://192.168.80.246:20004', // 消费订单服务  (存学生信息等)
  rechargeOrderServer_ms: 'http://192.168.80.246:20005', // 充值订单服务
  refundOrderServer_ms: 'http://192.168.80.246:20006', // 退款订单服务
  userServer_ms: 'http://192.168.80.246:20007', //  用户服务 (账号相关)
  permissionServer_ms: 'http://192.168.80.246:20008', //  权限服务
  basicServer_ms: 'http://192.168.80.246:20009', // 基础服务
};

export const testService = {
  commonService: 'https://test.common.yx.toplion.com.cn',
  ssoService: 'https://test.sso.yx.toplion.com.cn',
  businessService: 'https://test.iot.yx.toplion.com.cn',
  dataIService: 'https://test.iot-open-server.toplion.com.cn',
  superCardService: 'https://test.super-card.server.toplion.com.cn', // 超卡通
  canteenService: 'https://test.canteen.server.toplion.com.cn', // 餐厅
  dormitoryService: 'https://test.dormitory-server.toplion.com.cn', // 宿管
  microBaseService: 'https://test.micro-base-server.toplion.com.cn', // 基础服务
  cloudCoreService: 'https://test.cloud-core.server.toplion.com.cn', // 云芯
  lockService: 'https://test.lock-server.toplion.com.cn', // 门锁
  gateService: 'https://test.gate.server.toplion.com.cn', // 门禁
  topLionServer: 'https://directive.toplion.com.cn',
  sourceCenterService: 'https://test.source-center.server.toplion.com.cn', // 基础资源中心

  // 微服务
  personServer_ms: 'https://test.micro-person-server.toplion.com.cn', // 人员服务  (存学生信息等)
  cardServer_ms: 'https://test.micro-card-server.toplion.com.cn', // 卡片服务
  walletServer_ms: 'https://test.micro-wallet-server.toplion.com.cn', // 钱包服务  (存学生信息等)
  resourceServer_ms: 'https://test.micro-resource-server.toplion.com.cn', // 资源服务  (存学生信息等)
  consumeOrderServer_ms: 'https://test.micro-order-server.toplion.com.cn', // 消费订单服务  (存学生信息等)
  rechargeOrderServer_ms: 'https://test.micro-recharge-server.toplion.com.cn', // 充值订单服务
  refundOrderServer_ms: 'https://test.micro-refund-server.toplion.com.cn', // 退款订单服务
  userServer_ms: 'https://test.micro-user-server.toplion.com.cn', //  用户服务 (账号相关)
  permissionServer_ms: 'https://test.auth-server.toplion.com.cn', //  权限服务
  basicServer_ms: 'https://test.micro-base-server.toplion.com.cn', // 基础服务
};

export const proService = {
  businessService: 'https://iot-server.toplion.com.cn',
  commonService: 'https://iot-common.toplion.com.cn',
  ssoService: 'https://iot-sso.toplion.com.cn',
  dataIService: 'https://datai-iot-open-server.toplion.com.cn',
  superCardService: 'https://super-card-server.toplion.com.cn', // 超卡通
  canteenService: 'https://canteen-server.toplion.com.cn', // 餐厅
  cloudCoreService: 'https://cloud-core-server.toplion.com.cn', // 云芯
  dormitoryService: 'https://dormitory-server.toplion.com.cn', // 宿管
  lockService: 'https://lock-server.toplion.com.cn', // 门锁
  gateService: 'https://gate-server.toplion.com.cn', // 门禁
  topLionServer: 'https://directive.toplion.com.cn',
  sourceCenterService: 'https://source-center.server.toplion.com.cn', // 基础资源中心

  // 微服务
  personServer_ms: 'https://micro-person-server.toplion.com.cn', // 人员服务  (存学生信息等)
  cardServer_ms: 'https://micro-card-server.toplion.com.cn', // 卡片服务
  walletServer_ms: 'https://micro-wallet-server.toplion.com.cn', // 钱包服务  (存学生信息等)
  resourceServer_ms: 'https://micro-resource-server.toplion.com.cn', // 资源服务  (存学生信息等)
  consumeOrderServer_ms: 'https://micro-order-server.toplion.com.cn', // 消费订单服务  (存学生信息等)
  rechargeOrderServer_ms: 'https://micro-recharge-server.toplion.com.cn', // 充值订单服务
  refundOrderServer_ms: 'https://micro-refund-server.toplion.com.cn', // 退款订单服务
  userServer_ms: 'https://micro-user-server.toplion.com.cn', //  用户服务 (账号相关)
  permissionServer_ms: 'https://auth-server.toplion.com.cn', //  权限服务
  basicServer_ms: 'https://micro-base-server.toplion.com.cn', // 基础服务
};

export const getService = (name = 'businessService') => {
  switch (UMI_ENV) {
    case 'dev':
      {
        return devService[name];
      }
      break;
    case 'test':
      {
        return testService[name];
      }
      break;
    case 'prod':
      {
        return proService[name];
      }
      break;
  }
};

注: 只需要改开发环境域名,测试和生产均不要调整