From 9d3d08ba960fc739498b0648d57eaf2c50a40fd1 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 17 六月 2020 19:17:54 +0800 Subject: [PATCH] '登录' --- WindowsFormsApp1/Main.cs | 282 +++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 196 insertions(+), 86 deletions(-) diff --git a/WindowsFormsApp1/Main.cs b/WindowsFormsApp1/Main.cs index ff2e208..140680f 100644 --- a/WindowsFormsApp1/Main.cs +++ b/WindowsFormsApp1/Main.cs @@ -10,10 +10,12 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; +using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using WindowsFormsApp1.entity; using WindowsFormsApp1.utils; +using WindowsFormsApp1.utils.tb; using WindowsFormsApp1.utils.ui; namespace WindowsFormsApp1 @@ -27,17 +29,6 @@ InitDataGridView(); InitData(); initTextBox(); - - - // - - FirstOrderSubInfo goods = new FirstOrderSubInfo(); - goods.Title = "鎷夐潰璇磋睔楠ㄧ暘鑼勮偉鐗�3琚嬪崐骞查矞闈㈤�熼鏂逛究闈㈢伀閿呴潰闈炴补鐐告场闈究闈㈢伀閿呴潰闈炴补鐐告场闈究闈㈢伀閿呴潰闈炴补鐐告场闈�"; - List<String> imgList = new List<String>(); - imgList.Add("https://img.alicdn.com/imgextra/i1/725677994/O1CN013XSsBA28vIkpIkQwp_!!725677994.jpg_430x430q90.jpg"); - imgList.Add("https://img.alicdn.com/imgextra/i4/725677994/O1CN01iTYmFx28vIjvvoUOn_!!725677994.jpg_430x430q90.jpg"); - goods.ImgList = imgList; - SetGoodsDetail(goods); } @@ -45,31 +36,14 @@ private void InitSkin() { //this.textBox - } - private void InitData() { this.ucHorizontalList1.SelectedItemEvent += new System.EventHandler(this.click_Class); - - List<FirstOrderSubInfo> infoList = new List<FirstOrderSubInfo>(); - - for (int i = 0; i < 20; i++) - { - FirstOrderSubInfo info = new FirstOrderSubInfo(); - info.ActualPrice = "12.00"; - info.Commission = "1.02"; - info.CommissionRate = "20%"; - info.CouponPrice = "15.00"; - info.GoodsId = "123456"; - info.ImgList = new List<string>(); - info.ImgList.Add("http://"); - info.LijinAmount = "20.21"; - info.Title = "娴嬭瘯"; - info.ZkPrice = "21.02"; - infoList.Add(info); - } - SetGoodsData(true, infoList); + this.sdljGoodsTimer.Interval = 1000*60*5; + this.sdljGoodsTimer.Start(); + this.tabControl1.SendToBack(); + this.label11.BringToFront(); } @@ -120,7 +94,10 @@ } SetClassData(goodsClassList); - SetGoodsData(false, goodsList); + + var hasMore= obj["data"]["hasMore"]; + + SetGoodsData((bool) hasMore, goodsList); } private void searchSuccess(String result) @@ -134,17 +111,18 @@ OnSuccess onSuccess = searchSuccess; - ApiUtil.searchGoods("", info, page, onSuccess); + ApiUtil.searchGoods( classType, info, page, onSuccess); } int page = 1; + private List<FirstOrderSubInfo> infoList; //璁剧疆鍒楄〃鐨勬暟鎹� private void SetGoodsData(bool hasMore, List<FirstOrderSubInfo> infoList) { + this.infoList = infoList; this.dataGridView1.Rows.Clear(); - foreach (FirstOrderSubInfo info in infoList) { int index = this.dataGridView1.Rows.Add(); - this.dataGridView1.Rows[index].Cells[0].Value = "1"; + this.dataGridView1.Rows[index].Cells[0].Value = info.Index; this.dataGridView1.Rows[index].Cells[1].Value = info.Title; this.dataGridView1.Rows[index].Cells[2].Value = info.ZkPrice; this.dataGridView1.Rows[index].Cells[3].Value = info.CouponPrice; @@ -174,41 +152,6 @@ } - //璁剧疆鍟嗗搧璇︽儏 - private void SetGoodsDetail(FirstOrderSubInfo info) { - //璁剧疆鏍囬 - this.richTextBox1.Text = info.Title; - TextBoxUtil.SetLineSpace(this.richTextBox1,300); - if (info.ImgList != null) - { - - if (info.ImgList.Count > 0) - { - this.pictureBox1.Visible =true; - ImageUtil.DisplayImage(this.pictureBox1, info.ImgList[0]); - } - else - { - this.pictureBox1.Visible = false; - } - - - if (info.ImgList.Count > 1) - { - this.pictureBox2.Visible = true; - ImageUtil.DisplayImage(this.pictureBox2, info.ImgList[1]); - } - else - { - this.pictureBox2.Visible = false; - } - - } - else { - this.pictureBox1.Visible = false; - this.pictureBox2.Visible = false; - } - } private void InitDataGridView() { this.dataGridView1.Columns[0].Width=40; @@ -242,8 +185,20 @@ this.ucHorizontalList1.SetSelect(lstHL[p].Key); } + int classType = 0; + private void click_Class(object sender, EventArgs e) { - Console.WriteLine("鍒嗙被鐐瑰嚮"); + KS_Controls.Controls.KSHorizontalListItem item = (KS_Controls.Controls.KSHorizontalListItem) sender; + int key= Convert.ToInt32(item.DataSource.Key); + if (classType == key) { + return; + } + Console.WriteLine("鍒嗙被:" + item.DataSource.Key); + page = 1; + SearchInfo searchInfo = getSearchFilter(); + classType = Convert.ToInt32(item.DataSource.Key); + searchInfo.Key = this.ucTextBoxEx1.InputText; + search(page, searchInfo); } @@ -274,7 +229,9 @@ //绛涢�� private void button1_Click_1(object sender, EventArgs e) { + page = 1; SearchInfo searchInfo = getSearchFilter(); + classType = 0; search(page, searchInfo); Console.WriteLine(JsonConvert.SerializeObject(searchInfo)); } @@ -283,10 +240,45 @@ //鎼滅储 private void button5_Click_2(object sender, EventArgs e) { + classType = 0; + page = 1; SearchInfo searchInfo = getSearchFilter(); searchInfo.Key = this.ucTextBoxEx1.InputText; search(page, searchInfo); } + + + //涓嬩竴椤� + private void next_Click(object sender, EventArgs e) + { + page++; + SearchInfo searchInfo = getSearchFilter(); + searchInfo.Key = this.ucTextBoxEx1.InputText; + search(page, searchInfo); + } + + //涓婁竴椤� + private void before_Click(object sender, EventArgs e) + { + page--; + SearchInfo searchInfo = getSearchFilter(); + searchInfo.Key = this.ucTextBoxEx1.InputText; + search(page, searchInfo); + } + + //閫変腑鏌愪竴琛� + private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) + { + int index= e.RowIndex; + if (index > -1&& this.infoList!=null) + { + if (this.infoList.Count > index) + { + + } + } + } + /** * @@ -294,6 +286,34 @@ * 鍟嗗搧缁撴潫 * * + */ + + private void getSDLJGoods(object sender, EventArgs e) { + Console.WriteLine("getSDLJGoods"); + if (Login.loginContainer != null) + foreach (int key in Login.loginContainer.Keys) + { + String baseUrl = null; + if (Constant.sdljBaseUrl.ContainsKey(key)) + { + baseUrl = Constant.sdljBaseUrl[key]; + } + if (baseUrl == null || baseUrl.Trim().Length == 0) + continue; + + Thread thread = new Thread(()=> { + Console.WriteLine("鎵ц绾跨▼"); + new SDLJGoodsManager().StartRequestGoods(baseUrl, key); + }); + thread.Start(); + } + } + + + /* + * + *鍒锋柊Cookie缁撴潫 + * */ @@ -313,9 +333,54 @@ tbLogin.ShowDialog(); } - //鐢ㄦ埛鐧诲綍 - private void login_Click(object sender, EventArgs e) { + //璁剧疆鐢ㄦ埛淇℃伅 + private void setUserInfo(UserInfo user) { + this.label37.Visible = true; + if (user.SdljShareExpireTime == null || DateTime.Now > user.SdljShareExpireTime) + { //杩囨湡 + this.button8.Text = "鍗囩骇鍏变韩"; + this.button8.Click -= new System.EventHandler(this.login_Click); + this.button8.Click += new System.EventHandler(this.upgrade_Click);//鍗囩骇 + } + else { + + } + this.button8.Text = "鍗囩骇鍏变韩"; + this.label37.Visible = true; + this.button8.Click -= new System.EventHandler(this.login_Click); + + } + + + //鐢ㄦ埛鐧诲綍 + private void login_Click(object sender, EventArgs e) { + LoginNew loginNew = new LoginNew((UserInfo user)=> { //鐧诲綍鎴愬姛 + //UI绾跨▼ + this.BeginInvoke(new LoginSuccessDelegate((UserInfo user1)=> { //鐧诲綍 + + setUserInfo(user); + + })); + + }); + FormUtil.ShowDialog(loginNew); + + } + + + private void upgrade_Click(object sender, EventArgs e) + { + LoginNew loginNew = new LoginNew((UserInfo user) => { //鐧诲綍鎴愬姛 + //UI绾跨▼ + this.BeginInvoke(new LoginSuccessDelegate((UserInfo user1) => { //鐧诲綍 + + setUserInfo(user); + + })); + + }); + FormUtil.ShowDialog(loginNew); } private void button5_Click(object sender, EventArgs e) @@ -414,10 +479,41 @@ } - private void button8_Click(object sender, EventArgs e) - { + //鎺ㄥ箍杞欢 + private void promotion_Click(object sender, EventArgs e) + { + Promotion pt = new Promotion(); + FormUtil.ShowDialog(pt); } + //寰俊缇� + private void wxGroup_Click(object sender, EventArgs e) + { + WXGroup pt = new WXGroup(); + FormUtil.ShowDialog(pt); + } + + // + + //鍙戝崟鏈哄櫒浜� + private void fadanRobot_Click(object sender, EventArgs e) { + FaDanRobot pt = new FaDanRobot(); + FormUtil.ShowDialog(pt); + } + + //娣樺疂鎺堟潈 + private void tbAuth_Click(object sender, EventArgs e) + { + TBAuth login = new TBAuth(); + FormUtil.ShowDialog(login); + } + //鍙戝崟搴� + private void fadanKu_Click(object sender, EventArgs e) { + FaDanKu login = new FaDanKu(); + FormUtil.ShowDialog(login); + } + + private void groupBox9_Enter(object sender, EventArgs e) { @@ -435,15 +531,6 @@ } - private void label11_Click(object sender, EventArgs e) - { - - } - - private void textBox15_TextChanged(object sender, EventArgs e) - { - - } private void tabPage1_Click(object sender, EventArgs e) { @@ -454,7 +541,9 @@ private void button9_Click(object sender, EventArgs e) { - + //鏂囨缂栬緫 + DocEdit doc=new DocEdit(); + FormUtil.ShowDialog(doc); } /**////鏄惁绗﹀悎鎸囧畾鐨勬鍒欒〃杈惧紡 @@ -468,6 +557,27 @@ return false; } + //鎺堟潈鐧诲綍 + private void button10_Click(object sender, EventArgs e) + { + Login login = new Login(); + FormUtil.ShowDialog(login); + } + //鍒锋柊Cookie + //TODO + private void ReFreshCookie() { + + if (Login.loginContainer != null) + foreach (int key in Login.loginContainer.Keys) { + //鍒锋柊Cookie + Login.loginContainer[key].RefeshCookie(); + } + } + + private void groupBox4_Paint(object sender, PaintEventArgs e) + { + e.Graphics.Clear(this.BackColor); + } } } -- Gitblit v1.8.0