Profile.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * 配置文件
  3. */
  4. const {ccclass, property} = cc._decorator;
  5. export const ChannelType = cc.Enum({
  6. DEV: 3,
  7. TEST: 1,
  8. FQ: 2,
  9. });
  10. @ccclass
  11. export default class Profile extends cc.Component {
  12. public url:string = null;
  13. @property({
  14. displayName:'开发环境地址'
  15. })
  16. url_dev: string = 'http://127.0.0.1:9999';
  17. @property({
  18. displayName:'测试环境地址'
  19. })
  20. url_test: string = 'http://127.0.0.1:9999';
  21. @property({
  22. displayName:'正式环境地址'
  23. })
  24. url_prod: string = 'http://127.0.0.1:9999';
  25. @property({
  26. type: ChannelType,
  27. displayName: '渠道',
  28. })
  29. mChannel = ChannelType.TEST;
  30. onLoad(){
  31. // if (CC_DEBUG) {
  32. // this.url = this.url_dev;
  33. // }else{
  34. // this.url = this.url_prod;
  35. // }
  36. if(this.mChannel == ChannelType.DEV){
  37. this.url = this.url_dev;
  38. }else if(this.mChannel == ChannelType.TEST){
  39. this.url = this.url_test;
  40. }else if(this.mChannel == ChannelType.FQ){
  41. this.url = this.url_prod;
  42. }
  43. // let http:CHttp = new CHttp(this.url);
  44. // let fd = new FormData();
  45. // fd.append('userName','admin');
  46. // fd.append('passWord','123');
  47. // http.sendForm('/login',fd,(state,reve)=>{
  48. // cc.log('state : ',state);
  49. // cc.log('reve : ',reve);
  50. // })
  51. }
  52. }