Exemplo n.º 1
0
    public void upload(GameObject container)
    {
        UIPopupList wjs_list    = container.transform.FindChild("wjs").GetComponent <UIPopupList>();
        UIPopupList yhk_list    = container.transform.FindChild("yhk").GetComponent <UIPopupList>();
        UIInput     tel_input   = container.transform.FindChild("tel").GetComponent <UIInput>();
        UIInput     email_input = container.transform.FindChild("email").GetComponent <UIInput>();

        //UIInput token_input = container.transform.FindChild("token").GetComponent<UIInput>();
        if (MyUtilTools.stringIsNull(tel_input.value))
        {
            DialogUtil.tip("请输入开户手机号码");
            return;
        }
        if (tel_input.value.Length != 11)
        {
            DialogUtil.tip("手机号码尾数不对");
            return;
        }
        if (!MyUtilTools.checkEmail(email_input.value))
        {
            DialogUtil.tip("请输入合法的email");
            return;
        }

        /*
         * if (MyUtilTools.checkEmail(token_input.value))
         * {
         *  DialogUtil.tip("请输入验证码");
         *  return;
         * }*/
        Transform indent_trans         = container.transform.FindChild("indents");
        UITexture indent_front_texture = indent_trans.FindChild("front").FindChild("context").GetComponent <UITexture>();

        if (indent_front_texture.mainTexture == null)
        {
            DialogUtil.tip("请上传身份证正面");
            return;
        }
        UITexture indent_back_texture = indent_trans.FindChild("back").FindChild("context").GetComponent <UITexture>();

        if (indent_back_texture.mainTexture == null)
        {
            DialogUtil.tip("请上传身份证反面");
            return;
        }
        UITexture bank_texture = container.transform.FindChild("bank").FindChild("front").FindChild("context").GetComponent <UITexture>();

        if (bank_texture.mainTexture == null)
        {
            DialogUtil.tip("请上传银行卡正面");
            return;
        }
        SendMessageEntity entity = new SendMessageEntity();

        System.DateTime tody    = System.DateTime.Now;
        string          dateStr = tody.Year + "-" + tody.Month + "-" + tody.Day + "-" + tody.Hour + "-" + tody.Minute + "-" + tody.Second + ".jpg";

        entity.names.Add(tel_input.value + "-indent-front-" + dateStr);
        entity.names.Add(tel_input.value + "-indent-back-" + dateStr);
        entity.names.Add(tel_input.value + "-bank-front-" + dateStr);
        entity.buffer.skip(4);
        entity.buffer.WriteString("OpenAccountApply");
        entity.buffer.WriteString(wjs_list.value);
        entity.buffer.WriteString(yhk_list.value);
        entity.buffer.WriteString(tel_input.value);
        entity.buffer.WriteString(email_input.value);
        //entity.buffer.WriteString(token_input.value);
        entity.buffer.WriteString(entity.names[0]);
        entity.buffer.WriteString(entity.names[1]);
        entity.buffer.WriteString(entity.names[2]);
        if (!isUploaded)
        {
            EventDelegate ok = new EventDelegate(this, "uploadPicOk");
            ok.parameters[0]     = new EventDelegate.Parameter();
            ok.parameters[0].obj = entity;
            ok.parameters[1]     = new EventDelegate.Parameter();
            ok.parameters[1].obj = indent_back_texture;
            ok.parameters[2]     = new EventDelegate.Parameter();
            ok.parameters[2].obj = bank_texture;
            LoadUtil.show(true, "上传图片中请稍后");
            JustRun.Instance.upLoadPic(entity.names[0], ((Texture2D)indent_front_texture.mainTexture).EncodeToJPG(), ok, new EventDelegate(uploadPicFail));
        }
        else
        {
            sendMessage(entity);
        }
    }