From bd58d56042660ee004e71850b46ede7ae81f82ff Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Fri, 1 Apr 2022 23:38:36 +0800 Subject: [PATCH 1/3] 10005 --- BBWY.Client/Views/MainWindow.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BBWY.Client/Views/MainWindow.xaml b/BBWY.Client/Views/MainWindow.xaml index 9047104f..4335132d 100644 --- a/BBWY.Client/Views/MainWindow.xaml +++ b/BBWY.Client/Views/MainWindow.xaml @@ -26,7 +26,7 @@ - + From a8645b100c890ed732179d59f2f9c32f42f0c47e Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Sat, 2 Apr 2022 00:19:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=89=A9=E5=A4=A7=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBWY.Client/Views/Order/GrabJDMibole.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BBWY.Client/Views/Order/GrabJDMibole.xaml b/BBWY.Client/Views/Order/GrabJDMibole.xaml index 9be90acf..95b4173a 100644 --- a/BBWY.Client/Views/Order/GrabJDMibole.xaml +++ b/BBWY.Client/Views/Order/GrabJDMibole.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:BBWY.Client.Views.Order" mc:Ignorable="d" WindowStartupLocation="CenterScreen" - Title="GrabJDMibole" Height="350" Width="400"> + Title="GrabJDMibole" Height="600" Width="800"> From 5b026e614c8d72979cdb5492afdb67ba3333338e Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Wed, 6 Apr 2022 02:31:49 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=A6=96=E6=AC=A1=E6=89=93=E5=BC=80?= =?UTF-8?q?=E4=BA=AC=E9=BA=A6=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=20=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/Order/OrderListViewModel.cs | 5 +++++ BBWY.Client/Views/Order/GrabJDMibole.xaml.cs | 17 +++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs index 09e6c6fc..86b6e134 100644 --- a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs +++ b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs @@ -251,6 +251,11 @@ namespace BBWY.Client.ViewModels var grab = new GrabJDMibole(order.Id); if (grab.ShowDialog() == true) plaintextMobile = grab.Tag.ToString(); + if (string.IsNullOrEmpty(plaintextMobile)) + { + MessageBox.Show("未获取到手机号", "提示"); + return; + } IsLoading = true; Task.Factory.StartNew(() => orderService.DecodeConsignee(order.Id, plaintextMobile)).ContinueWith(t => { diff --git a/BBWY.Client/Views/Order/GrabJDMibole.xaml.cs b/BBWY.Client/Views/Order/GrabJDMibole.xaml.cs index 51c819d2..e8d80ad9 100644 --- a/BBWY.Client/Views/Order/GrabJDMibole.xaml.cs +++ b/BBWY.Client/Views/Order/GrabJDMibole.xaml.cs @@ -3,6 +3,7 @@ using Microsoft.Web.WebView2.Core; using Microsoft.Web.WebView2.Wpf; using System; using System.Reflection; +using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Media; @@ -43,7 +44,7 @@ namespace BBWY.Client.Views.Order } grid.Children.Add(w2m.wb2); - if(w2m.IsInitializationCompleted) + if (w2m.IsInitializationCompleted) txtMsg.Text = "Grabbing Mobile"; w2m.CoreWebView2InitializationCompleted = (e) => @@ -54,17 +55,20 @@ namespace BBWY.Client.Views.Order w2m.OnNavigationCompleted = async (e) => { if (w2m.wb2.CoreWebView2.Source.StartsWith("https://passport.shop.jd.com/login")) - { + { //首次打开需要登录 - await w2m.wb2.CoreWebView2.ExecuteScriptAsync("window.scrollTo(790,150)"); - await w2m.wb2.CoreWebView2.ExecuteScriptAsync("document.querySelector(\"div[data-tab-id='form']\").click()"); + Console.WriteLine($"{orderId}触发登录"); + await w2m.wb2.CoreWebView2.ExecuteScriptAsync(@$"var img = document.getElementById('js-login-qrcode'); + if(img.src==null || img.src.length==0){{window.location.href='https://neworder.shop.jd.com/order/orderDetail?orderId={orderId}';}} + else{{window.scrollTo(790,150);document.querySelector(""div[data-tab-id='form']"").click();}}"); } else if (w2m.wb2.CoreWebView2.Source.StartsWith("https://neworder.shop.jd.com/order/orderDetail")) { + Console.WriteLine($"{orderId}触发手机号查看"); //进入订单详情页面,触发点击查看手机号 txtMsg.Text = "Grabbing Mobile"; - w2m.wb2.Width = 0.1; - w2m.wb2.Height = 0.1; + //w2m.wb2.Width = 0.1; + //w2m.wb2.Height = 0.1; var js = @"var mobileNode = document.getElementById('mobile'); mobileNode.addEventListener('DOMNodeInserted',function(e){ var m=mobileNode.innerText; window.chrome.webview.postMessage(m);}); document.getElementById('viewOrderMobile').click();"; @@ -74,6 +78,7 @@ namespace BBWY.Client.Views.Order w2m.OnWebMessageReceived = (e) => { var mobole = e.TryGetWebMessageAsString(); + Console.WriteLine($"{orderId}接收手机号{mobole}"); this.Tag = mobole; this.DialogResult = true; this.Close();