Browse Source

增加接口页面

“hujiajun” 1 tháng trước cách đây
mục cha
commit
da814d7b5d

+ 39 - 134
Assets/CaoZuoRizhi.cs

@@ -8,10 +8,10 @@ using UnityEngine.UI;
 
 public class CaoZuoRizhi : MonoBehaviour
 {
+    public PageBtnControl pbt;
     public UIScrollScript uiScroll;
-    public GameObject go;
     
-    List<GameObject> list = new List<GameObject>();
+    public List<GameObject> list = new List<GameObject>();
 
     long startl;
     long sendl;
@@ -45,151 +45,56 @@ sendl=l+86400;
 
     public void sousuo()
     {
-        RemoveAll();
-        JsonData d =new JsonData();
-        d["start_time"] =startl;
-        d["end_time"] =sendl;
-        d["page"] =1;
-        d["size"] =MaxLiebiao;
-        Debug.Log("sousuo==>"+d.ToJson());
-        startinit=false;
-        StartCoroutine(getreplist(d));
+        page(1);
     }
-    bool startinit=false;
     void OnEnable()
     {  
+        startl = 0;
+        sendl =((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds();
+        pbt.curretPage =1;
+        page(1);
+
         ds1.Label.text ="选择日期";
         ds2.Label.text ="选择日期";
-        uiScroll.Init();
-        RemoveAll();
+    }
+    int total =1;
+    public void page(int i)
+    {       
         JsonData d =new JsonData();
-        d["start_time"] =0;
-        d["end_time"] =((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds();
-        startl = 0;
-        sendl =((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds();
-        d["page"] =1;
+        d["start_time"] =startl;
+        d["end_time"] =sendl;
+        d["page"] =i;
         d["size"] =MaxLiebiao;
-        startinit=false;
-        StartCoroutine(getreplist(d));
- 
-        uiScroll.onUpdateItem -= ContentUpdateItem;
-        uiScroll.onUpdateItem += ContentUpdateItem;
- 
-        uiScroll.onEatUpItem -= EatUpItem;
-        uiScroll.onEatUpItem += EatUpItem;
+        Debug.Log("initPage"+i);
+        StartCoroutine(DataManager.Instance.GetRePort(d,(msg)=>{
+            JsonData jd =JsonMapper.ToObject(msg);   
+            total = int.Parse( jd["data"]["page"]["total_page"].ToString());
+            if( pbt.allPage!=total)
+            {
+                pbt.allPage = total;
+                pbt.InitData();
+            }
+            Debug.Log("总共"+int.Parse( jd["data"]["page"]["total_count"].ToString()));
+            for (int i = 0; i < MaxLiebiao; i++)
+            {
+                if(jd["data"]["list"].ToString()!="[]"&&jd["data"]["list"].Count> i)
+                {
+                    list[i].GetComponent<RiZhiItem>().init(jd["data"]["list"][i]);   
+                    list[i].SetActive(true);
+                }else
+                {
+                    list[i].SetActive(false);
+                }
+            }  
+        }));
 
-        
-    }
 
-    private void EatUpItem()
-    {
-        if(nextdata!=null)
-            StartCoroutine(getreplist(nextdata));
-        nextdata=null;
     }
 
-    private void ContentUpdateItem(GameObject item, int wrapIndex, int realIndex)
-    {
-
-        if (realIndex >= 0&&datamsg.Count>realIndex)
-        {
-            RiZhiItem xitem = item.GetComponent<RiZhiItem>();
-            xitem.init(datamsg[realIndex]);
-            item.SetActive(true);
-
-        }
-        else
-        {
-            item.SetActive(false);
-        }
-    }
     private void Awake() {
-        
-        list.Add(go);
-    }
-    public void RemoveAll()
-    {
-        uiScroll.Init();
-        nextdata=null;
-        datamsg=new List<JsonData>();
+    
     }
-    List<JsonData> datamsg =new List<JsonData>();
-   int MaxLiebiao=15;
-
-   public JsonData nextdata;
-   public  IEnumerator getreplist(JsonData jd)
-   {
-        int page =int.Parse( jd["page"].ToString());
-        int total =int.Parse( jd["page"].ToString());
-        Debug.Log("getreplist start"+uiScroll.GetComponent<RectTransform>().anchoredPosition.y);
-        yield return  StartCoroutine(DataManager.Instance.GetRePort(jd,(msg)=>{
-                JsonData jd =JsonMapper.ToObject(msg);
-                for (int i = list.Count; i < MaxLiebiao; i++)
-                {
-                    GameObject n =GameObject.Instantiate(go,go.transform.parent);
-                    list.Add(n);
-                }      
-                total=int.Parse( jd["data"]["page"]["total_page"].ToString());
-                if(!startinit)
-                {
-                    Debug.Log("总共"+int.Parse( jd["data"]["page"]["total_count"].ToString()));
-
-                    for (int i = 0; i < MaxLiebiao; i++)
-                    {
+   int MaxLiebiao=10;
 
-                        if(jd["data"]["list"].ToString()!="[]"&&jd["data"]["list"].Count> i)
-                        {
-                            list[i].GetComponent<RiZhiItem>().init(jd["data"]["list"][i]);   
-                            list[i].SetActive(true);
-                            datamsg.Add(jd["data"]["list"][i]);
-                        }else
-                        {
-                            list[i].SetActive(false);
-                        }
-                    }
-                    uiScroll.InitList(0, datamsg.Count);
-                }
-                else
-                {
-
-                    for (int i = 0; i < MaxLiebiao; i++)
-                    {
-                        if(jd["data"]["list"].Count> i)
-                        {
-                            datamsg.Add(jd["data"]["list"][i]);
-                        }
-                    }
-                    uiScroll.InitList(0, datamsg.Count);
-                }
-                startinit=true;
-                Debug.Log("getreplist end"+datamsg.Count);
-                if(datamsg.Count == 0 )
-                {
-                    go.transform.parent.parent.parent.gameObject.SetActive(false);
-                }
-                else
-                {
-                    go.transform.parent.parent.parent.gameObject.SetActive(true);
 
-                }
-                Invoke("UpdatePos",0.1f);
-        Debug.Log("getreplist start"+uiScroll.GetComponent<RectTransform>().anchoredPosition.y);
-                     
-        }));
-        if(page+1<=total)
-        {
-            jd["page"] = (page+1);
-            nextdata = jd;
-           // yield return  getreplist(jd);
-        }
-        else
-        {
-            nextdata=null;
-        }
-        
-   }
-   void UpdatePos()
-   {
-    uiScroll.GetComponent<RectTransform>().anchoredPosition= new Vector2(uiScroll.GetComponent<RectTransform>().anchoredPosition.x,uiScroll.GetComponent<RectTransform>().anchoredPosition.y+1);
-   }
 }

+ 8 - 0
Assets/DataManager.cs

@@ -80,6 +80,14 @@ public class DataManager : MonoBehaviour
         
     }
 
+    public IEnumerator GetqueryThirdParty(JsonData data,Action<string> callback)
+    {
+        yield return StartCoroutine(Post_Demo("/admin/queryThirdPartyCallLog", data.ToJson(), (string msg) => {
+            callback.Invoke(msg);
+        }));
+        
+    }
+
     public IEnumerator GetRePort(JsonData data,Action<string> callback)
     {
         yield return StartCoroutine(Post_Demo("/admin/queryOperateLog", data.ToJson(), (string msg) => {

+ 97 - 0
Assets/JieKouDiaoYongRiZhi.cs

@@ -0,0 +1,97 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using Bitsplash.DatePicker;
+using LitJson;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class JieKouDiaoYongRiZhi : MonoBehaviour
+{
+    public PageBtnControl pbt;
+    
+    public List<GameObject> list = new List<GameObject>();
+
+    long startl;
+    long sendl;
+    public DatePickerDropDown ds1;
+    public DatePickerDropDown ds2;
+    public void chooseA()
+    {
+        
+        StartCoroutine(chooseYanChi(ds1.Label,(l)=> {
+startl=l;
+
+        }));
+    }
+    public void chooseB()
+    {
+        StartCoroutine(chooseYanChi(ds2.Label, (l) => {
+sendl=l+86400;
+
+        }));
+    }
+    IEnumerator chooseYanChi(Text t,Action<long> callback)
+    {
+        yield return null;
+        string dateString = t.text;
+        Debug.Log("chooseYanChi===>"+ds1.Label.text);
+        DateTime dateTime = DateTime.Parse(dateString);
+        long timestamp = ((DateTimeOffset)dateTime).ToUnixTimeSeconds();
+        Debug.Log("Timestamp: " + timestamp);
+        callback.Invoke(timestamp);
+    }
+
+    public void sousuo()
+    {
+        page(1);
+    }
+    void OnEnable()
+    {  
+        startl = 0;
+        sendl =((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds();
+        pbt.curretPage =1;
+        page(1);
+
+        ds1.Label.text ="选择日期";
+        ds2.Label.text ="选择日期";
+    }
+    int total =1;
+    public void page(int i)
+    {       
+        JsonData d =new JsonData();
+        d["start_time"] =startl;
+        d["end_time"] =sendl;
+        d["page"] =i;
+        d["size"] =MaxLiebiao;
+        Debug.Log("initPage"+i);
+        StartCoroutine(DataManager.Instance.GetqueryThirdParty(d,(msg)=>{
+            JsonData jd =JsonMapper.ToObject(msg);   
+            total = int.Parse( jd["data"]["page"]["total_page"].ToString());
+            if( pbt.allPage!=total)
+            {
+                pbt.allPage = total;
+                pbt.InitData();
+            }
+            Debug.Log("总共"+int.Parse( jd["data"]["page"]["total_count"].ToString()));
+            for (int i = 0; i < MaxLiebiao; i++)
+            {
+                if(jd["data"]["list"].ToString()!="[]"&&jd["data"]["list"].Count> i)
+                {
+                    list[i].GetComponent<JieKouRiZhiItem>().init(jd["data"]["list"][i]);   
+                    list[i].SetActive(true);
+                }else
+                {
+                    list[i].SetActive(false);
+                }
+            }  
+        }));
+
+
+    }
+
+    private void Awake() {
+    
+    }
+   int MaxLiebiao=5;
+}

+ 11 - 0
Assets/JieKouDiaoYongRiZhi.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0ebae07d16cac4f728fee1e929330294
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 26 - 0
Assets/JieKouRiZhiItem.cs

@@ -0,0 +1,26 @@
+using System.Collections;
+using System.Collections.Generic;
+using LitJson;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class JieKouRiZhiItem : MonoBehaviour
+{
+    public Text call_name;
+    public Text call_date;
+    public Text source;
+    public Text input;
+    public Text output;
+    public Text result;
+    public Text receive_date;
+    public void init(JsonData data)
+    {
+        call_name.text = data["call_name"].ToString();
+        call_date.text = data["call_date"].ToString();
+        source.text = data["source"].ToString();
+        input.text = data["input"].ToString();
+        output.text = data["output"].ToString();
+        result.text = data["result"].ToString();
+        receive_date.text = data["receive_date"].ToString();
+    }
+}

+ 11 - 0
Assets/JieKouRiZhiItem.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 028b74447d47f40e9a6b944cf9324605
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 27 - 46
Assets/Page/Scripts/PageBtnControl.cs

@@ -1,6 +1,8 @@
 using System.Collections;
 using System.Collections.Generic;
+using Unity.VisualScripting;
 using UnityEngine;
+using UnityEngine.Events;
 using UnityEngine.UI;
 
 public class PageBtnControl : MonoBehaviour
@@ -14,23 +16,12 @@ public class PageBtnControl : MonoBehaviour
     public GameObject rigNextBtn2;
     public GameObject leftNextBtn1;
     public GameObject leftNextBtn2;
+    public  UnityEvent<int> onValueChanged ;
 
     private bool isRight = true;
     private void Start()
     {
 
-        curretPage = 1;
-       
-
-    }
-    private void Update()
-    {
-        if (Input.GetKeyDown(KeyCode.K))
-        {
-            listPageItems[0].ShowUI();
-
-            InitData();
-        }
     }
     public void UpdateMiddleData(int itemNum)
     {
@@ -44,6 +35,12 @@ public class PageBtnControl : MonoBehaviour
     }
     public void InitData()
     {
+        for (int i = 0; i < listPageItems.Count; i++)
+        {
+            listPageItems[i].gameObject.SetActive(true);
+        }
+        curretPage=1;
+        listPageItems[0].ShowUI();
         if (allPage <10)
         {
             for (int i = 0; i < listPageItems.Count; i++)
@@ -52,10 +49,11 @@ public class PageBtnControl : MonoBehaviour
             }
             for (int i = 0; i < allPage; i++)
             {
+                listPageItems[i].UpdatePage(i+1);
                 listPageItems[i].gameObject.SetActive(true);
             }
 
-            NextBtn(false, false);
+            NextBtn();
         }
         else
         {
@@ -72,7 +70,7 @@ public class PageBtnControl : MonoBehaviour
                 listPageItems[listPageItems.Count - 2].UpdateString(".....");
             }
 
-            NextBtn(false, true);
+            NextBtn();
         }
         listPageItems[0].ShowUI();
       
@@ -84,6 +82,11 @@ public class PageBtnControl : MonoBehaviour
             Debug.LogError(" Not Num AllPage");
             return;
         }
+        if (pageNum < 1)
+        {
+            Debug.LogError(" Not Num AllPage");
+            return;
+        }
         Debug.Log(" Page " + pageNum);
 
         if (allPage < 10)
@@ -102,7 +105,6 @@ public class PageBtnControl : MonoBehaviour
                 listPageItems[listPageItems.Count - 1].UpdatePage(allPage);
                 listPageItems[listPageItems.Count - 2].UpdateString(".....");
 
-                NextBtn(false, true);
 
             }
             else if (allPage - pageNum < 6)
@@ -113,7 +115,6 @@ public class PageBtnControl : MonoBehaviour
                 }
                 listPageItems[0].UpdatePage(1);
                 listPageItems[1].UpdateString(".....");
-                NextBtn(true, false);
             }
             else
             {
@@ -145,11 +146,12 @@ public class PageBtnControl : MonoBehaviour
                     listPageItems[listPageItems.Count - 1].UpdatePage(allPage);
                     listPageItems[listPageItems.Count - 2].UpdateString(".....");
                 }
-                NextBtn(false, false);
             }
         }
         curretPage = pageNum;
 
+         NextBtn();
+       onValueChanged.Invoke(curretPage);
 
 
         for (int i = 0; i < listPageItems.Count; i++)
@@ -161,11 +163,6 @@ public class PageBtnControl : MonoBehaviour
                
             }
         }
-     
-
-      
-
-
 
     }
 
@@ -181,30 +178,14 @@ public class PageBtnControl : MonoBehaviour
         }
     }
 
-    public void NextBtn( bool isrig1,bool isleft1 )
+    public void NextBtn( )
     {
-        if (isrig1)
-        {
-            rigNextBtn1.SetActive(true);
-            rigNextBtn2.SetActive(false);
-        }
-        else
-        {
-            rigNextBtn1.SetActive(false);
-            rigNextBtn2.SetActive(true);
-        }
-
+        Debug.Log("当�页"+curretPage+"总页数"+allPage);
+        leftNextBtn2.GetComponent<Button>().interactable=curretPage>1;
+        rigNextBtn2.GetComponent<Button>().interactable=allPage>curretPage;
+       // rigNextBtn2.GetComponent<Button>().interactable=!isrig1;
 
-        if (isleft1)
-        {
-            leftNextBtn1.SetActive(true);
-            leftNextBtn2.SetActive(false);
-        }
-        else
-        {
-            leftNextBtn1.SetActive(false);
-            leftNextBtn2.SetActive(true);
-        }
+      //  
     }
 }
 
@@ -239,7 +220,7 @@ public class PageBtnControl : MonoBehaviour
 //    else
 //    {
 
-//        if (itemNum <= 2)  // µã»÷Ç°Á½¸ö²»ÐèÒª¸ÄÊý¾Ý
+//        if (itemNum <= 2)  // ���ǰ��������Ҫ������
 //        {
 //            if (listPageItems[1].text.text == ".....")
 //            {
@@ -306,7 +287,7 @@ public class PageBtnControl : MonoBehaviour
 //    {
 
 //        {
-//            if (itemNum >= 4)  // µã»÷Ç°Á½¸ö²»ÐèÒª¸ÄÊý¾Ý
+//            if (itemNum >= 4)  // ���ǰ��������Ҫ������
 //            {
 //                if (listPageItems[1].text.text == ".....")
 //                {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 874 - 44
Assets/Scenes/Main.unity


BIN
test2/test/Build/test.data.unityweb


BIN
test2/test/Build/test.framework.js.unityweb


BIN
test2/test/Build/test.symbols.json.unityweb


BIN
test2/test/Build/test.wasm.unityweb


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác