
function init() {
  mtl.ncc.writeUCGConfig({
    "appcode" : "400400812",
    "config":{
      "host" : "ucg-core.test.app.yyuap.com",
      "port" : "80",
      "ishttps" : "false",  //是否使用https
      "default_tp":"none"  //默认的传输协议
    }
  });
}
init();
// 登录
function login() {
  let username = document.getElementById("username").value;
  let password = document.getElementById("password").value;
  //登录代码写在这里
  var userInfo = {
    "userId":username,
    "passwd":password
  };
  localStorage.setItem("userInfo",JSON.stringify(userInfo));
  //window.location = "../modules/index.html"

  //{"code":"200","message":"success","data":{"generatetime":1559628856506,"expiretime":1559636757671,"ncctoken":"eyJhbGciOiJIUzUxMiJ9.eyJyYW5kb21LZXkiOiJkZWZhdWx0U2VjcmV0Iiwic3ViIjoiNzY0NjdmMTM3ODJjNGE2OGJhZjhlZTc0ZjI5MmMwOTkxNTU5NjI5NTU3MDM1IiwidG9rZW5JZCI6Ijc2NDY3ZjEzNzgyYzRhNjhiYWY4ZWU3NGYyOTJjMDk5MTU1OTYyOTU1NzAzNSIsImV4cCI6MTU1OTcxNTk1NywiaWF0IjoxNTU5NjI5NTU3LCJuY1Rva2VuIjoiNjM3NTcyNzI2NTZlNzQyMDc0NmY2YjY1NmUyMDYzNjg2NTYzNmIyMDY5NzMyMDZmNjY2NjIxIiwidXNlckNvZGUiOiJjaWNpIiwicGtfZ3JvdXAiOiIwMDAxQTExMDAwMDAwMDAwUVVBQyIsInVzZXJUeXBlIjowLCJ1c2VyaWQiOiIwMDAxQTExMDAwMDAwMDAwVU1QSyIsImFwcENvZGUiOiJ3YW5zaGkiLCJsYW5nQ29kZSI6InpoIiwidXNlclBob25lIjoiMTIzNDU2Nzg5MTAiLCJ0ZW5hbnRJZCI6IjEyMyIsInlodFVzZXJJZCI6IjM0NSJ9.kOkWHrWpOzBIt2bjJj6KbbKIzLmcFoYo00GobScZw38kddBF7_liRa6s99l2LoIfUkZBgal76TPK0h_Ce55-KA","token":"EnmQ27V9RA8pQfWGt1cTqC0aaNlYIldKJEaEZz6tJSLB3cqxodfT9NF08xKJYlzMzf2e2JKpzQN3CJhnfWOgcVG_uPn-pOqOQbMI0hRuvJZ-KLgdNr4tb_dd92YgikJ-2eHxg8JNsxlEwx1VZ0y4yZBY7WS6RkdNWSsNI8zbV2V1Wg9Wvyxm3mk-usqYR-NF","appcode":"wanshi"}}

  //http://ucg-core.test.app.yyuap.com/oauth/nccLogin?upesncode=42f0bff32b4c400a86b5eaf149099956&appcode=wanshi&langCode=zh
  mtl.ncc.login({
    "appcode" : "400400812",
    "upesncode" :"42f0bff32b4c400a86b5eaf149099956",
    success: (res) => {
      alert(JSON.stringify(res));
      callactionHeader = {
        accessToken: res.ncctoken,
        token: res.token,
      }
        // res.code
        // res.msg
        // res.data
    },
    fail: (err) => {
      alert(err.message);
    }
  })
}

var callactionHeader = null;

function callAction() {
    mtl.ncc.callAction({
        "url": "nccapi/nccloud/mob/pu/mobile/listOrder",
        'upesncode': "42f0bff32b4c400a86b5eaf149099956",
        'appcode': "400400812",
        "header": callactionHeader,
        "params": {
          "busiParamJson": "{\"pageinfo\": {\"page\": 1, \"size\": 5},\"searchcondition\": {\"value\": \"2019\"}, \"billstatus\": 0}",
          "sysParamJson": {
              "appCode": "400400812",
              "langCode": "simpchn",
              "ts": 1557126277441
          }
        },
        "success": function (res) {
            alert(JSON.stringify(res))
            //data是服务返回的数据
            // res.code
            // res.msg
            // res.data
        },
        "fail": (err) => {
            alert(JSON.stringify(err))
        },
        "complete": function (res) {

        }
    });

}

