using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; using System.Threading.Tasks; using TMPro; using UnityEngine; using UnityEngine.UI; using UnityEngine.Windows; using static OrderPanel; //实名认证消息体 public class RealName { //身份证 public string idCard; //银行卡 public string bank; //名字 public string realName; } public class ShiMingPanel : MonoBehaviour { //姓名 public TMP_InputField inputName; //身份证号 public TMP_InputField inputIDNum; //银行卡 public TMP_InputField inputBankNum; //手机号 public TMP_InputField inputPhone; //认证按钮 public Button btnProve; //实名认证完成页面 public GameObject smFinishPanel; private RealName realNameMsg = new RealName(); //准备请求的头部信息,包含授权令牌 Dictionary headInfo = new Dictionary(); // Start is called before the first frame update void Start() { btnProve.onClick.AddListener(() => { realNameMsg.realName = inputName.text; realNameMsg.bank = inputBankNum.text; realNameMsg.idCard = inputIDNum.text; ReGetOrder(); }); } // Update is called once per frame void Update() { } public class ReturnMsg { public int code; public string message; public string data; } public async Task ReGetOrder() { headInfo.Add("Authorization", Global.global.serverResponse.data.token); // 请求体 //异步发送请求 string responsel6 = await web.SendRequest(web.URL + "/snail/user/cert", "POST", JsonUtility.ToJson(realNameMsg), headInfo); ReturnMsg msg = JsonUtility.FromJson(responsel6); if (msg.code == 200) { Transform parentTransform = transform.parent; GameObject go = Instantiate(smFinishPanel, parentTransform, false); go.GetComponent().UpdatePanel(realNameMsg); Destroy(this.gameObject); } Debug.Log(responsel6); Debug.Log(msg); } }