修改主窗口 header 拖动bug.

拼多多登录 改为WPF 。PddMobileLoginForm 不再使用
This commit is contained in:
chfei committed 2026-09-01 14:34:26 +08:00
1 parent 2fa313d480
commit 0eae9f7706
14 files changed
+942 -81

No files matched your search

+6 -7
View File
@@ -1,15 +1,16 @@
<Window x:Class="_29WxOrderWpf.Common.DialogWindow" <Window
x:Class="_29WxOrderWpf.Common.DialogWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:_29WxOrderWpf.Common" xmlns:local="clr-namespace:_29WxOrderWpf.Common"
mc:Ignorable="d" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{Binding Title}" Title="{Binding Title}"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
Background="#FFFFFF" Background="#FFFFFF"
WindowStartupLocation="CenterOwner"> WindowStartupLocation="CenterOwner"
mc:Ignorable="d">
<Window.Resources> <Window.Resources>
<Style x:Key="DialogWindowStyle" TargetType="Window"> <Style x:Key="DialogWindowStyle" TargetType="Window">
<Setter Property="Tag" Value="Default" /> <Setter Property="Tag" Value="Default" />
@@ -18,7 +19,5 @@
<Setter Property="WindowChrome.GlassFrameThickness" Value="-1" /> <Setter Property="WindowChrome.GlassFrameThickness" Value="-1" />
</Style> </Style>
</Window.Resources> </Window.Resources>
<Grid> <Grid />
</Grid>
</Window> </Window>
@@ -37,7 +37,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Xml.XPath; using System.Xml.XPath;
using TemuKJD.ToolForms; using _29WxOrderWpf.ViewModels;
using Work; using Work;
using Work._29Tools.BLL; using Work._29Tools.BLL;
using Work._29Tools.CefTools; using Work._29Tools.CefTools;
@@ -641,7 +641,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (data.Contains("\"error_code\":40001")) if (data.Contains("\"error_code\":40001"))
{ {
currentReadBuyer = ""; currentReadBuyer = "";
PddMobileLoginForm.CheckBuyerLogin(new List<BuyerLoginInfo> { buyer }, false); PddMobileLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo> { buyer }, false);
return; return;
} }
@@ -957,7 +957,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
//{"errorCode":72004,"errorMsg":"","error_code":72004,"error_msg":"","result":null} //{"errorCode":72004,"errorMsg":"","error_code":72004,"error_msg":"","result":null}
if (data.Contains("\"error_code\":40001") || data.Contains("\"error_code\":50000") || data.Contains("\"error_code\":72004")) if (data.Contains("\"error_code\":40001") || data.Contains("\"error_code\":50000") || data.Contains("\"error_code\":72004"))
{ {
PddMobileLoginForm.CheckBuyerLogin(new List<BuyerLoginInfo> { buyer }, false); PddMobileLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo> { buyer }, false);
if (buyer.status == "掉线") if (buyer.status == "掉线")
currentReadBuyer = ""; currentReadBuyer = "";
return; return;
@@ -1364,7 +1364,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (tokenSource.IsCancellationRequested) if (tokenSource.IsCancellationRequested)
break; break;
PddMobileLoginForm.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer }); PddMobileLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer });
if (buyer.status != "在线") if (buyer.status != "在线")
continue; continue;
@@ -1446,7 +1446,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (lastCefReadOrderTime < DateTime.Now.AddSeconds(-30)) if (lastCefReadOrderTime < DateTime.Now.AddSeconds(-30))
{ {
PddMobileLoginForm.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer }); PddMobileLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer });
if (buyer.status != "在线") if (buyer.status != "在线")
{ {
BindBuyer(buyer, "店铺掉线"); BindBuyer(buyer, "店铺掉线");
@@ -1522,7 +1522,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (lastCefReadOrderTime < DateTime.Now.AddSeconds(-30)) if (lastCefReadOrderTime < DateTime.Now.AddSeconds(-30))
{ {
PddMobileLoginForm.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer }); PddMobileLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer });
if (buyer.status != "在线") if (buyer.status != "在线")
{ {
BindBuyer(buyer, "店铺掉线"); BindBuyer(buyer, "店铺掉线");
@@ -1534,7 +1534,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (times % 100 == 0) if (times % 100 == 0)
{ {
PddMobileLoginForm.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer }); PddMobileLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer });
} }
if (buyer.status != "在线") if (buyer.status != "在线")
break; break;
@@ -1604,7 +1604,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (lastCefReadOrderTime < DateTime.Now.AddSeconds(-30)) if (lastCefReadOrderTime < DateTime.Now.AddSeconds(-30))
{ {
PddMobileLoginForm.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer }); PddMobileLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo>() { buyer });
if (buyer.status != "在线") if (buyer.status != "在线")
{ {
BindBuyer(buyer, "店铺掉线"); BindBuyer(buyer, "店铺掉线");
@@ -1,4 +1,7 @@
using _29WxOrderWpf.BaseWindows; using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.Common;
using _29WxOrderWpf.ViewModels;
using _29WxOrderWpf.Views;
using AllBase; using AllBase;
using AllBase.Helper; using AllBase.Helper;
using AllBase.Model.DBModel; using AllBase.Model.DBModel;
@@ -47,11 +50,24 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
buyer = cmbPddBuyer.SelectedItem as BuyerLoginInfo; buyer = cmbPddBuyer.SelectedItem as BuyerLoginInfo;
} }
PddMobileLoginForm pddBuyerForm = new PddMobileLoginForm(buyer); PddMobileLoginView pddBuyerForm = new PddMobileLoginView(buyer);
pddBuyerForm.openType = EnumOpenType.login; pddBuyerForm.ViewModel.OpenType = EnumOpenType.login;
pddBuyerForm.InitUrl = "https://mobile.yangkeduo.com/login.html?from=https%3A%2F%2Fmobile.yangkeduo.com%2Fpersonal.html"; pddBuyerForm.ViewModel.InitUrl = "https://mobile.yangkeduo.com/login.html?from=https%3A%2F%2Fmobile.yangkeduo.com%2Fpersonal.html";
pddBuyerForm.ShowDialog(); //pddBuyerForm.ShowDialog();
new DialogWindow()
{
Title = "买手登录",
Content = pddBuyerForm,
}.ShowDialog();
MainWindow.Instance.GetPddBuyer(); MainWindow.Instance.GetPddBuyer();
//PddMobileLoginForm pddBuyerForm = new PddMobileLoginForm(buyer);
//pddBuyerForm.openType = TemuKJD.ToolForms.EnumOpenType.login;
//pddBuyerForm.InitUrl = "https://mobile.yangkeduo.com/login.html?from=https%3A%2F%2Fmobile.yangkeduo.com%2Fpersonal.html";
//pddBuyerForm.ShowDialog();
//MainWindow.Instance.GetPddBuyer();
} }
private void cmbPddBuyer_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) private void cmbPddBuyer_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
@@ -67,23 +83,30 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
if (buyer == null) if (buyer == null)
return; return;
PddMobileLoginForm.CheckBuyerLogin(new List<BuyerLoginInfo> { buyer }, false); bool islogin = false;
PddMobileLoginViewModel.CheckBuyerLogin(new List<BuyerLoginInfo> { buyer }, false);
PddMobileLoginView shopLoginForm = new PddMobileLoginView(buyer);
if (buyer.status == "在线") if (buyer.status == "在线")
{ {
PddMobileLoginForm shopLoginForm = new PddMobileLoginForm(buyer); shopLoginForm.ViewModel.OpenType = EnumOpenType.manage;
shopLoginForm.openType = EnumOpenType.manage; shopLoginForm.ViewModel.InitUrl = "https://mobile.yangkeduo.com";
//shopLoginForm.WindowState = FormWindowState.Maximized; //shopLoginForm.Show();
shopLoginForm.InitUrl = "https://mobile.yangkeduo.com";
shopLoginForm.Show();
} }
else else
{ {
PddMobileLoginForm shopLoginForm = new PddMobileLoginForm(buyer); shopLoginForm.ViewModel.OpenType = EnumOpenType.login;
shopLoginForm.openType = EnumOpenType.login; shopLoginForm.ViewModel.InitUrl = "https://mobile.yangkeduo.com/login.html?from=https%3A%2F%2Fmobile.yangkeduo.com%2Fpersonal.html";
shopLoginForm.InitUrl = "https://mobile.yangkeduo.com/login.html?from=https%3A%2F%2Fmobile.yangkeduo.com%2Fpersonal.html"; //shopLoginForm.ShowDialog();
shopLoginForm.ShowDialog(); islogin = true;
MainWindow.Instance.GetPddBuyer();
} }
new DialogWindow()
{
Title = "买手登录",
Content = shopLoginForm,
}.ShowDialog();
if (islogin)
MainWindow.Instance.GetPddBuyer();
} }
private void cmbPddBuyer_SelectionChanged(object sender, SelectionChangedEventArgs e) private void cmbPddBuyer_SelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -42,7 +42,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using TemuKJD.ToolForms; using _29WxOrderWpf.ViewModels;
using Work; using Work;
using Work._29Tools.BLL; using Work._29Tools.BLL;
using Work.BuyUsers; using Work.BuyUsers;
@@ -2136,7 +2136,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 检测一下买手号 // 检测一下买手号
if (buyer.status == "在线") if (buyer.status == "在线")
{ {
PddMobileLoginForm.CheckBuyerLogin(buyer); PddMobileLoginViewModel.CheckBuyerLogin(buyer);
} }
if (buyer.status != "在线") if (buyer.status != "在线")
{ {
@@ -30,6 +30,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Windows.Threading; using System.Windows.Threading;
using _29WxOrderWpf.ViewModels;
using TemuKJD.ToolForms; using TemuKJD.ToolForms;
using Work; using Work;
using Work._29Tools.BLL; using Work._29Tools.BLL;
@@ -381,7 +382,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 拍单前检测买手号是否在线 // 拍单前检测买手号是否在线
if (GlobalConfig.CurrentPddBuyer.status == "在线") if (GlobalConfig.CurrentPddBuyer.status == "在线")
{ {
PddMobileLoginForm.CheckBuyerLogin(GlobalConfig.CurrentPddBuyer); PddMobileLoginViewModel.CheckBuyerLogin(GlobalConfig.CurrentPddBuyer);
} }
if (GlobalConfig.CurrentPddBuyer.status != "在线") if (GlobalConfig.CurrentPddBuyer.status != "在线")
{ {
@@ -751,7 +752,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 拍单的时候检测一下买手号 // 拍单的时候检测一下买手号
if (buyer.status == "在线") if (buyer.status == "在线")
{ {
PddMobileLoginForm.CheckBuyerLogin(buyer); PddMobileLoginViewModel.CheckBuyerLogin(buyer);
} }
if (buyer.status != "在线") if (buyer.status != "在线")
{ {
@@ -811,7 +812,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 拍单的时候检测一下买手号 // 拍单的时候检测一下买手号
if (buyer.status == "在线") if (buyer.status == "在线")
{ {
PddMobileLoginForm.CheckBuyerLogin(buyer); PddMobileLoginViewModel.CheckBuyerLogin(buyer);
} }
if (buyer.status != "在线") if (buyer.status != "在线")
{ {
@@ -946,7 +947,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
{ {
await Task.Run(() => await Task.Run(() =>
{ {
PddMobileLoginForm.CheckBuyerLogin(GlobalConfig.CurrentPddBuyer); PddMobileLoginViewModel.CheckBuyerLogin(GlobalConfig.CurrentPddBuyer);
}); });
} }
if (GlobalConfig.CurrentPddBuyer.status != "在线") if (GlobalConfig.CurrentPddBuyer.status != "在线")
@@ -1265,7 +1266,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 检测买手号是否掉线 // 检测买手号是否掉线
if (GlobalConfig.CurrentPddBuyer.status == "在线") if (GlobalConfig.CurrentPddBuyer.status == "在线")
{ {
PddMobileLoginForm.CheckBuyerLogin(GlobalConfig.CurrentPddBuyer); PddMobileLoginViewModel.CheckBuyerLogin(GlobalConfig.CurrentPddBuyer);
} }
if (GlobalConfig.CurrentPddBuyer.status != "在线") if (GlobalConfig.CurrentPddBuyer.status != "在线")
{ {
@@ -1478,7 +1479,7 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
// 检测一下买手号 // 检测一下买手号
if (buyer.status == "在线") if (buyer.status == "在线")
{ {
PddMobileLoginForm.CheckBuyerLogin(buyer); PddMobileLoginViewModel.CheckBuyerLogin(buyer);
} }
if (buyer.status != "在线") if (buyer.status != "在线")
{ {
+174 -42
View File
@@ -1,71 +1,203 @@
<basewindows:BaseWindow xmlns:basewindows="clr-namespace:_29WxOrderWpf.BaseWindows" x:Class="_29WxOrderWpf.MainWindow" <basewindows:BaseWindow
x:Class="_29WxOrderWpf.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:basewindows="clr-namespace:_29WxOrderWpf.BaseWindows"
xmlns:buyerctrls="clr-namespace:_29WxOrderWpf.Ctrls.BuyerCtrls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:_29WxOrderWpf" xmlns:local="clr-namespace:_29WxOrderWpf"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:orderctrls="clr-namespace:_29WxOrderWpf.Ctrls.OrderCtrls" xmlns:orderctrls="clr-namespace:_29WxOrderWpf.Ctrls.OrderCtrls"
xmlns:shopctrls="clr-namespace:_29WxOrderWpf.Ctrls.ShopCtrls" xmlns:shopctrls="clr-namespace:_29WxOrderWpf.Ctrls.ShopCtrls"
xmlns:userctrls="clr-namespace:_29WxOrderWpf.UserControls" xmlns:buyerctrls="clr-namespace:_29WxOrderWpf.Ctrls.BuyerCtrls" xmlns:userctrls="clr-namespace:_29WxOrderWpf.UserControls"
mc:Ignorable="d" Style="{StaticResource BaseNoneBorderWindowStyle}" x:Name="mainWindow"
x:Name="mainWindow" Title="MainWindow" Height="900" Width="1600" Loaded="Window_Loaded" Closing="BaseWindow_Closing"> Title="MainWindow"
Width="1600"
Height="900"
Closing="BaseWindow_Closing"
Loaded="Window_Loaded"
Style="{StaticResource BaseNoneBorderWindowStyle}"
mc:Ignorable="d">
<Grid Background="Transparent" x:Name="mainGrid" Margin="{Binding ElementName=mainWindow, Path=Padding}"> <Grid
x:Name="mainGrid"
Margin="{Binding ElementName=mainWindow, Path=Padding}"
Background="Transparent">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition> <RowDefinition Height="60" />
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid x:Name="gridTitle"> <Grid
x:Name="gridTitle"
Background="Transparent"
MouseLeftButtonDown="gridTitle_MouseLeftButtonDown">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition> <ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto"></ColumnDefinition> <ColumnDefinition Width="auto" />
<ColumnDefinition></ColumnDefinition> <ColumnDefinition />
<ColumnDefinition></ColumnDefinition> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Image Source="{StaticResource main29WeixinIcon}" Height="50" Width="50" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4"></Image> <Image
<Label x:Name="lblAppName" FontSize="20" Margin="0,0,0,0" Foreground="{StaticResource mainColorLightBrush}" HorizontalAlignment="Center" Width="50"
VerticalAlignment="Center" VerticalContentAlignment="Center" Content="拍单软件" Grid.Column="1"></Label> Height="50"
Margin="4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Source="{StaticResource main29WeixinIcon}" />
<Label
x:Name="lblAppName"
Grid.Column="1"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
Content="拍单软件"
FontSize="20"
Foreground="{StaticResource mainColorLightBrush}" />
<WrapPanel Margin="0,4,80,0" Grid.Column="12" HorizontalAlignment="Right" VerticalAlignment="Top"> <WrapPanel
<Label x:Name="lblDebug" FontSize="12" Margin="2,4,0,0" Foreground="{StaticResource mainColorLightBrush}" HorizontalAlignment="Right" Grid.Column="12"
VerticalAlignment="Top" VerticalContentAlignment="Center" Content="[release]" Opacity="0.7" Grid.Column="4"></Label> Margin="0,4,80,0"
<Label x:Name="lblVersion" FontSize="12" Margin="2,4,0,0" Foreground="{StaticResource mainColorLightBrush}" HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Top" VerticalContentAlignment="Center" Content="版本信息" Opacity="0.7" Grid.Column="4"></Label> VerticalAlignment="Top">
<Label
x:Name="lblDebug"
Grid.Column="4"
Margin="2,4,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
Content="[release]"
FontSize="12"
Foreground="{StaticResource mainColorLightBrush}"
Opacity="0.7" />
<Label
x:Name="lblVersion"
Grid.Column="4"
Margin="2,4,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
Content="版本信息"
FontSize="12"
Foreground="{StaticResource mainColorLightBrush}"
Opacity="0.7" />
</WrapPanel> </WrapPanel>
<Label x:Name="lblBalance" FontSize="12" Margin="0,25,80,0" HorizontalAlignment="Right" Foreground="#60ff66" MouseLeftButtonUp="lblBalance_MouseLeftButtonUp" <Label
VerticalAlignment="Top" VerticalContentAlignment="Center" Content="{Binding Balance}" Opacity="0.7" Grid.Column="4" Cursor="Hand"></Label> x:Name="lblBalance"
Grid.Column="4"
Margin="0,25,80,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
Content="{Binding Balance}"
Cursor="Hand"
FontSize="12"
Foreground="#60ff66"
MouseLeftButtonUp="lblBalance_MouseLeftButtonUp"
Opacity="0.7" />
</Grid> </Grid>
<Grid x:Name="gridContainer" Grid.Row="1" Background="White" Margin="2,0,2,2"> <Grid
x:Name="gridContainer"
Grid.Row="1"
Margin="2,0,2,2"
Background="White">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition> <ColumnDefinition Width="auto" />
<ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<orderctrls:OrderListCtrl x:Name="orderListCtrl" Grid.Column="1" Visibility="Collapsed"></orderctrls:OrderListCtrl> <orderctrls:OrderListCtrl
<Grid x:Name="gridPddBuyerOrderReadCtrl" Visibility="Hidden" Grid.ColumnSpan="2" Background="#7F000000" MouseLeftButtonUp="gridPddBuyerOrderReadCtrl_MouseLeftButtonUp"> x:Name="orderListCtrl"
<Border CornerRadius="10" HorizontalAlignment="Right" Height="auto" Background="White" Margin="0,50,0,0"> Grid.Column="1"
<buyerctrls:PDDBuyerOrderReadCtrl x:Name="pddBuyerOrderReadCtrl" Grid.Column="1" Visibility="Collapsed" Panel.ZIndex="-1" Width="1200" Visibility="Collapsed" />
HorizontalAlignment="Right"/> <Grid
x:Name="gridPddBuyerOrderReadCtrl"
Grid.ColumnSpan="2"
Background="#7F000000"
MouseLeftButtonUp="gridPddBuyerOrderReadCtrl_MouseLeftButtonUp"
Visibility="Hidden">
<Border
Height="auto"
Margin="0,50,0,0"
HorizontalAlignment="Right"
Background="White"
CornerRadius="10">
<buyerctrls:PDDBuyerOrderReadCtrl
x:Name="pddBuyerOrderReadCtrl"
Grid.Column="1"
Width="1200"
HorizontalAlignment="Right"
Panel.ZIndex="-1"
Visibility="Collapsed" />
</Border> </Border>
</Grid> </Grid>
<buyerctrls:PDDBuyerSelectCtrl x:Name="pddBuyerSelectCtrl" Visibility="Collapsed" Width="280" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="8"/> <buyerctrls:PDDBuyerSelectCtrl
<Grid x:Name="gridUser" Visibility="Hidden" Grid.ColumnSpan="2" Background="#7F000000"> x:Name="pddBuyerSelectCtrl"
<Border CornerRadius="4" Width="500" Height="600" Background="White"> Grid.Column="1"
<shopctrls:ShopListCtrl x:Name="shopListCtrl" Visibility="{Binding ElementName=gridUser,Mode=TwoWay,Path=Visibility}" Margin="2" Width="280"
Grid.ColumnSpan="2"></shopctrls:ShopListCtrl> Margin="8"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Visibility="Collapsed" />
<Grid
x:Name="gridUser"
Grid.ColumnSpan="2"
Background="#7F000000"
Visibility="Hidden">
<Border
Width="500"
Height="600"
Background="White"
CornerRadius="4">
<shopctrls:ShopListCtrl
x:Name="shopListCtrl"
Grid.ColumnSpan="2"
Margin="2"
Visibility="{Binding ElementName=gridUser, Mode=TwoWay, Path=Visibility}" />
</Border> </Border>
</Grid> </Grid>
</Grid> </Grid>
<userctrls:UcWindowBoxes x:Name="ucWindowBox" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="4" MaxBoxVisibility="Visible"/> <userctrls:UcWindowBoxes
x:Name="ucWindowBox"
Margin="4"
HorizontalAlignment="Right"
VerticalAlignment="Top"
MaxBoxVisibility="Visible" />
<Border x:Name="borderMessage" Grid.Row="1" Width="auto" Height="auto" HorizontalAlignment="Center" Margin="10,50" VerticalAlignment="Top" BorderThickness="1" Opacity="0" <Border
BorderBrush="{StaticResource pageColorBrush}" CornerRadius="6" Background="White" IsHitTestVisible="False" x:Name="borderMessage"
MinWidth="120" MinHeight="2" MaxWidth="1200" Panel.ZIndex="1000000"> Grid.Row="1"
Width="auto"
Height="auto"
MinWidth="120"
MinHeight="2"
MaxWidth="1200"
Margin="10,50"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Panel.ZIndex="1000000"
Background="White"
BorderBrush="{StaticResource pageColorBrush}"
BorderThickness="1"
CornerRadius="6"
IsHitTestVisible="False"
Opacity="0">
<Border.Effect> <Border.Effect>
<DropShadowEffect ShadowDepth="5" Color="#FF98638f" BlurRadius="40" Opacity="0.2"/> <DropShadowEffect
BlurRadius="40"
Opacity="0.2"
ShadowDepth="5"
Color="#FF98638f" />
</Border.Effect> </Border.Effect>
<TextBlock Text="这里是默认提示信息" Margin="10" VerticalAlignment="Center" HorizontalAlignment="Center" x:Name="tbMessage" TextWrapping="Wrap"></TextBlock> <TextBlock
x:Name="tbMessage"
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="这里是默认提示信息"
TextWrapping="Wrap" />
</Border> </Border>
<!--<Image x:Name="imageBig" HorizontalAlignment="Left" Height="800" Width="800" VerticalAlignment="Center" Grid.Row="1" Margin="200,0,0,0"/>--> <!--<Image x:Name="imageBig" HorizontalAlignment="Left" Height="800" Width="800" VerticalAlignment="Center" Grid.Row="1" Margin="200,0,0,0"/>-->
</Grid> </Grid>
+15
View File
@@ -450,5 +450,20 @@ namespace _29WxOrderWpf
//else //else
// Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, -1); // Panel.SetZIndex(MainWindow.Instance.gridPddBuyerOrderReadCtrl, -1);
} }
private void gridTitle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.ClickCount == 2)
{
// 双击切换窗口状态
this.WindowState = this.WindowState == WindowState.Maximized
? WindowState.Normal
: WindowState.Maximized;
}
else if (e.LeftButton == MouseButtonState.Pressed)
{
this.DragMove();
}
}
} }
} }
@@ -0,0 +1,511 @@
using _29WxOrderWpf.CefHelper;
using _29WxOrderWpf.Commands;
using AllBase;
using AllBase.Helper;
using AllBase.Model.DBModel;
using AllBase.Model.MvvmBaseClasses;
using CefSharp;
using CefSharp.Handler;
using CefSharp.Wpf;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using TemuKJD.ToolForms;
using Work;
using Work._29Tools.BLL;
using Work._29Tools.CefTools;
namespace _29WxOrderWpf.ViewModels
{
/// <summary>
/// 拼多多买手移动版登录窗口 视图模型(WPF 版 PddMobileLoginForm)
/// </summary>
public class PddMobileLoginViewModel : PropertyNotifyObject
{
// 拼多多买手退货退款售后地址
// https://mobile.yangkeduo.com/complaint.html?order_sn=260718-101481213440980&after_sales_reason=0&after_sales_type=2&after_sales_code=1002
public static PddMobileLoginViewModel PddMobileLoginInstance { get; set; } = null;
/// <summary>浏览器创建完成后触发(视图在此把浏览器加入可视树)</summary>
public event Action<ChromiumWebBrowser> BrowserCreated;
/// <summary>请求关闭窗口</summary>
public event Action RequestClose;
public int CloseAfterSecond { get; set; }
private EnumOpenType _openType = EnumOpenType.manage;
public EnumOpenType OpenType
{
get { return _openType; }
set
{
_openType = value;
OnPropertyChanged(nameof(OpenType));
OnPropertyChanged(nameof(IsLoginMode));
}
}
public string InitUrl { get; set; } = "";
private string shopCookieHead = "yangkeduo.com";
private string shopLoginUrl = "https://mobile.yangkeduo.com/login.html?from=https%3A%2F%2Fmobile.yangkeduo.com%2Fpersonal.html";
private string shopMainUrl = "https://mobile.yangkeduo.com/index.html";
public ChromiumWebBrowser CefWebBrowser { get; private set; }
private BuyerLoginInfo buyer = null;
private List<ShopCompany> lstShopCompany = new List<ShopCompany>();
private string currentUrl = "";
private volatile bool _isWindowLoaded = false;
#region 界面绑定属性
/// <summary>用户名</summary>
public string UserName
{
get { return this.GetValue(x => x.UserName); }
set { this.SetValue(x => x.UserName, value); }
}
/// <summary>密码</summary>
public string PassWord
{
get { return this.GetValue(x => x.PassWord); }
set { this.SetValue(x => x.PassWord, value); }
}
/// <summary>地址栏</summary>
public string Address
{
get { return this.GetValue(x => x.Address); }
set { this.SetValue(x => x.Address, value); }
}
/// <summary>登录成功后关闭窗口</summary>
public bool IsCloseAfterLogin
{
get { return this.GetValue(x => x.IsCloseAfterLogin); }
set { this.SetValue(x => x.IsCloseAfterLogin, value); }
}
/// <summary>登录模式(显示扫码提示和导入PDDAccessToken面板)</summary>
public bool IsLoginMode
{
get { return this.GetValue(x => x.IsLoginMode); }
set { this.SetValue(x => x.IsLoginMode, value); }
}
/// <summary>导入的PDDAccessToken</summary>
public string AccessToken
{
get { return this.GetValue(x => x.AccessToken); }
set { this.SetValue(x => x.AccessToken, value); }
}
#endregion
#region 命令
public ICommand ReloadCommand { get; }
public ICommand LoginAgainCommand { get; }
public ICommand StopCommand { get; }
public ICommand CopyUserNameCommand { get; }
public ICommand CopyPasswordCommand { get; }
public ICommand SaveCookieCommand { get; }
#endregion
public PddMobileLoginViewModel(BuyerLoginInfo buyerInfo)
{
PddMobileLoginInstance = this;
buyer = buyerInfo;
UserName = buyerInfo?.buyer_name;
PassWord = ""; //DataOpenSSL.DecryptString(buyerInfo.Password);
IsCloseAfterLogin = true;
IsLoginMode = OpenType == EnumOpenType.login;
ReloadCommand = new DelegateCommand(Reload);
LoginAgainCommand = new DelegateCommand(LoginAgain);
StopCommand = new DelegateCommand(StopButton);
CopyUserNameCommand = new DelegateCommand(CopyUserName);
CopyPasswordCommand = new DelegateCommand(CopyPassword);
SaveCookieCommand = new DelegateCommand(SaveCookie);
}
/// <summary>
/// 窗口加载完成时调用
/// </summary>
public void Start()
{
IsLoginMode = OpenType == EnumOpenType.login;
_isWindowLoaded = true;
if (CloseAfterSecond > 0)
{
Task.Run(() =>
{
Thread.Sleep(1000 * CloseAfterSecond);
if (_isWindowLoaded)
{
Application.Current?.Dispatcher.Invoke(new Action(() =>
{
if (_isWindowLoaded)
RequestClose?.Invoke();
}));
}
});
}
AutoLogin();
}
/// <summary>
/// 窗口关闭时调用,停止后台任务
/// </summary>
public void Stop()
{
_isWindowLoaded = false;
}
/// <summary>
/// 自动登录店铺后台
/// </summary>
private void AutoLogin()
{
if (OpenType != EnumOpenType.login && buyer == null)
return;
if (CefWebBrowser == null)
{
if (!string.IsNullOrEmpty(InitUrl))
CefWebBrowser = WPFCEFBrowser.CreateChromiumWebBrowser(InitUrl, false);
else
CefWebBrowser = WPFCEFBrowser.CreateChromiumWebBrowser(shopMainUrl, false);
LocalResourceRequestHandler resourceRequestHandler = new LocalResourceRequestHandler();
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
resourceRequestHandler.BeforeResourceLoadEvent += RequestHandler_BeforeResourceLoad;
CefWebBrowser.RequestHandler = new LocalRequestHandler(resourceRequestHandler);
var lifeSapnHandler = new LocalLifeSpanHandler(PopWindowType.SelfWindow);
CefWebBrowser.LifeSpanHandler = lifeSapnHandler;
CefWebBrowser.KeyboardHandler = new KeyboardHandler();
CefWebBrowser.FrameLoadEnd += CefWebBrowser_FrameLoadEnd;
CefWebBrowser.AddressChanged += CefWebBrowser_AddressChanged;
CefWebBrowser.LoadError += CefWebBrowser_LoadError;
// 通知视图把浏览器加入可视树(必须在等待浏览器初始化之前完成)
BrowserCreated?.Invoke(CefWebBrowser);
List<Cookie> cookieLst = new List<Cookie>();
try
{
if (buyer != null)
{
cookieLst = JsonHelper.DeserializeJsonToList<CefSharp.Cookie>(buyer?.cookie);
if (cookieLst == null)
cookieLst = new List<Cookie>();
}
}
catch
{
}
Task.Run(() =>
{
// cef138必须init后方可设置或删除cookie
while (!CefWebBrowser.IsBrowserInitialized || !CefWebBrowser.GetBrowser().MainFrame.IsValid)
Thread.Sleep(20);
WPFCEFBrowser.DeleteCookie(CefWebBrowser.GetCookieManager(null));
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
var t = WPFCEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), CefWebBrowser.GetCookieManager(null));
foreach (var cook in cookieLst)
{
//var t = CEFBrowser.SetCookieAsync(cook.Domain.Trim('.'), cook.Name + "=" + cook.Value + ";", CefWebBrowser.GetCookieManager(null));
//t.Wait(5000);
}
//根据登录的具体店铺设置local storage
if (!string.IsNullOrEmpty(buyer?.buyer_id))
{
//var storageJsCode = "window.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');\r\n";
//storageJsCode += "window.localStorage.setItem('" + "agentseller-mall-info-id" + "', '" + shop.ShopId + "');\r\n";
//while (!CefWebBrowser.IsBrowserInitialized || !CefWebBrowser.GetBrowser().MainFrame.IsValid)
// Thread.Sleep(20);
//CefWebBrowser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(storageJsCode);
}
if (!string.IsNullOrEmpty(InitUrl))
CefWebBrowser.Load(InitUrl);
else
CefWebBrowser.Load(shopMainUrl);
//不是登录的话就此返回
if (OpenType != EnumOpenType.login)
{
return;
}
for (int i = 0; i < 50; i++)
{
if (CefWebBrowser.IsLoading)
Thread.Sleep(100);
}
Thread.Sleep(Randomx.GetId(1500, 2000));
if (!_isWindowLoaded)
return;
while (!CefWebBrowser.Address.StartsWith(shopLoginUrl))
{
Thread.Sleep(1000);
if (!_isWindowLoaded)
return;
}
});
}
}
private void CefWebBrowser_LoadError(object sender, CefSharp.LoadErrorEventArgs e)
{
}
private void CefWebBrowser_AddressChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (Application.Current?.Dispatcher != null)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
currentUrl = e.NewValue.ParseToString();
Address = e.NewValue.ParseToString();
}));
}
}
private void CefWebBrowser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e)
{
//js绑定C#对象 html页面内声明绑定的C#对象
StringBuilder sb = new StringBuilder();
sb.Append("(function(){");
sb.Append("CefSharp.BindObjectAsync('shopObj');");
sb.Append("})();");
CefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sb.ToString());
}
private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request)
{
return false;
}
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
if (url.Contains("https://mobile.yangkeduo.com/index.html") && OpenType == EnumOpenType.login)
{
Task.Run(() => { CefWebBrowser.Load("https://mobile.yangkeduo.com/personal.html"); });
}
if (url.Contains("https://mobile.yangkeduo.com/personal.html"))
{
if (OpenType == EnumOpenType.login)
{
Task.Run(() =>
{
var data = responseData;
if (data.Contains("\"success\":true") || data.Contains("nickname"))
{
var uid = BaseRegex.GetStringJson(ref data, "uid");
var nickname = BaseRegex.GetStringJson(ref data, "nickname");
var username = nickname;
if (!string.IsNullOrEmpty(nickname) && !string.IsNullOrEmpty(uid))
{
Thread.Sleep(2000);
List<Cookie> cookieList = WPFCEFBrowser.GetCookieList(shopCookieHead, CefWebBrowser.GetCookieManager(null));
var buyerUrl = BaseClass.Build29PDDObjString("user/add_buyer");
if (this.buyer == null || this.buyer.buyer_id != uid)
this.buyer = GlobalConfig.PDDBuyerLoginList.FirstOrDefault(b => b.buyer_id == uid);
if (this.buyer != null)
{
this.buyer.user_name = username;
this.buyer.buyer_nick = nickname;
this.buyer.cookie = JsonHelper.SerializeObject(cookieList);
buyerUrl = BaseClass.Build29PDDObjString("user/mdy_buyer");
}
var buyerData = UserLogin.GetSignaturex()
+ "&buyer_id=" + uid
+ "&buyer_name=" + username
+ "&buyer_nick=" + nickname;
var result = GetHtml.PostUtf8(buyerUrl, buyerData);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(buyerUrl, buyerData);
buyerUrl = BaseClass.Build29PDDObjString("user/mdy_buyer_cookie");
buyerData = UserLogin.GetSignaturex()
+ "&buyer_id=" + uid
+ "&status=" + "在线"
+ "&cookie=" + GetHtml.UrlEncodeUtf8(JsonHelper.SerializeObject(cookieList));
result = GetHtml.PostUtf8(buyerUrl, buyerData);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(buyerUrl, buyerData);
Application.Current?.Dispatcher.Invoke(new Action(() =>
{
try
{
if (IsCloseAfterLogin)
RequestClose?.Invoke();
}
catch (Exception ex)
{ }
}));
}
}
});
}
}
}
private void StopButton()
{
}
private void CopyUserName()
{
if (!string.IsNullOrEmpty(UserName))
Clipboard.SetDataObject(UserName);
}
private void CopyPassword()
{
if (!string.IsNullOrEmpty(PassWord))
Clipboard.SetDataObject(PassWord);
}
private void Reload()
{
if (CefWebBrowser != null)
{
if (Address != "about:blank")
CefWebBrowser.Load(Address);
else
CefWebBrowser.Load(shopMainUrl);
}
}
private void LoginAgain()
{
if (this.currentUrl != shopLoginUrl)
this.CefWebBrowser?.Load(shopLoginUrl);
}
private void SaveCookie()
{
Cookie cookie = new Cookie();
cookie.Name = "PDDAccessToken";
cookie.Domain = "mobile.yangkeduo.com";
cookie.Expires = DateTime.Now.AddDays(465);
cookie.HttpOnly = true;
cookie.Secure = true;
cookie.Value = AccessToken.Trim();
if (this.CefWebBrowser != null)
{
var t = WPFCEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(new List<Cookie> { cookie }), CefWebBrowser.GetCookieManager(null));
t.Wait(2000);
CefWebBrowser.Load("https://mobile.yangkeduo.com/personal.html");
}
}
#region 静态方法(检测/更新买手登录状态)
public static void CheckBuyerLogin(List<BuyerLoginInfo> checkBuyers, bool isShowProgress = true)
{
for (int i = 0; i < checkBuyers.Count; i++)
{
var buyer = GlobalConfig.PDDBuyerLoginList.FirstOrDefault(v => v.buyer_id == checkBuyers[i].buyer_id);
var buys = GlobalConfig.PDDBuyerLoginList.Where(v => v.buyer_id == checkBuyers[i].buyer_id).ToList();
if (buyer == null)
continue;
// 先从服务端取最新cookie
var url = BaseClass.Build29PDDObjString("user/get_buyer");
var data = UserLogin.GetSignaturex();
data += "&buyer_ids=" + buyer.buyer_id;
data += "&page_size=1";
var result = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
continue;
List<BuyerLoginInfo> loginInfoLst = JsonHelper.DeserializeJsonToList<BuyerLoginInfo>(JsonHelper.JObjectParse(result)["data"].ParseToString());
var serverBuyer = loginInfoLst.FirstOrDefault();
if (buyer != null && serverBuyer != null)
{
buyer.cookie = serverBuyer.cookie;
foreach (var buy in buys)
{
buy.cookie = serverBuyer.cookie;
}
}
if (buyer != null)
{
var loginResult = CheckBuyerLogin(buyer);
if (!loginResult.Contains("\"success\":true") && !loginResult.Contains("\"login\":true") && !loginResult.Contains("\"nickname\""))
{
buyer.cookie = "[]";
foreach (var buy in buys)
{
buy.status = "掉线";
buy.cookie = "[]";
}
}
else
{
foreach (var buy in buys)
{
buy.status = "在线";
}
}
UpdateServerBuyerCookies(buyer); // 店铺cookie和状态写入服务端
}
}
}
public static string CheckBuyerLogin(BuyerLoginInfo buyer, string refere = "https://mobile.yangkeduo.com/goods.html")
{
string url = "https://mobile.yangkeduo.com/proxy/api/api/apollo/v3/user/me?pdduid=" + buyer.buyer_id;
return HttpResponseYkdBLL.YangkeduoGetResponse(buyer, url, refere);
}
public static string UpdateServerBuyerCookies(BuyerLoginInfo buyer, string fromTool = null)
{
var url = BaseClass.Build29PDDObjString("user/mdy_buyer_cookie");
var data = UserLogin.GetSignaturex()
+ "&status=" + buyer.status
+ "&cookie=" + GetHtml.UrlEncodeUtf8(buyer.cookie)
+ "&buyer_id=" + buyer.buyer_id;
var result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(url, data);
return result;
}
#endregion
}
}
+112
View File
@@ -0,0 +1,112 @@
<UserControl
x:Class="_29WxOrderWpf.Views.PddMobileLoginView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:basewindows="clr-namespace:_29WxOrderWpf.BaseWindows"
xmlns:comn="clr-namespace:_29WxOrderWpf.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="WPFCommon"
x:Name="pddMobileLoginView"
Width="1024"
Height="768"
MinWidth="800"
MinHeight="600"
comn:DialogWindowProperty.ResizeMode="CanResizeWithGrip"
comn:DialogWindowProperty.ShowMinButton="False"
comn:DialogWindowProperty.Width="1300"
Loaded="PddMobileLoginView_Loaded"
mc:Ignorable="d">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis" />
</UserControl.Resources>
<Grid Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 地址栏 -->
<Border
Grid.Row="0"
Background="White"
BorderBrush="#E0E0E0"
BorderThickness="0,0,0,1">
<TextBox
x:Name="txtAddress"
Margin="3,2"
VerticalContentAlignment="Center"
BorderBrush="#D0D0D0"
BorderThickness="1"
KeyDown="txtAddress_KeyDown"
Text="{Binding Address, UpdateSourceTrigger=PropertyChanged}" />
</Border>
<!-- 主区域:浏览器 + 右侧面板 -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="530" />
</Grid.ColumnDefinitions>
<!-- 浏览器容器 -->
<Grid
x:Name="BrowserHost"
Grid.Column="0"
Background="White"
ClipToBounds="True" />
<GridSplitter
Grid.Column="1"
Width="3"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="#E0E0E0"
ResizeBehavior="PreviousAndNext"
ShowsPreview="True" />
<!-- 右侧面板 -->
<Border
Grid.Column="2"
Background="White"
BorderBrush="#E0E0E0"
BorderThickness="1,0,0,0">
<StackPanel Margin="24,24,24,0">
<TextBlock
Margin="0,0,0,20"
HorizontalAlignment="Center"
FontSize="15"
Foreground="#333333"
Text="请使用拼多多手机版扫码登录"
Visibility="{Binding IsLoginMode, Converter={StaticResource BoolToVis}}" />
<StackPanel Visibility="{Binding IsLoginMode, Converter={StaticResource BoolToVis}}">
<TextBlock
Margin="0,0,0,8"
Foreground="#555555"
Text="导入PDDAccessToken:" />
<TextBox
x:Name="txtAccessToken"
Height="120"
VerticalContentAlignment="Top"
AcceptsReturn="True"
BorderBrush="#D0D0D0"
BorderThickness="1"
Text="{Binding AccessToken, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto" />
<Button
Width="64"
Height="26"
Margin="0,10,0,0"
HorizontalAlignment="Right"
Command="{Binding SaveCookieCommand}"
Content="保存"
Style="{StaticResource BasePageButtonStyle}" />
</StackPanel>
</StackPanel>
</Border>
</Grid>
</Grid>
</UserControl>
@@ -0,0 +1,61 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.ViewModels;
using AllBase.Model.DBModel;
using CefSharp.Wpf;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace _29WxOrderWpf.Views
{
/// <summary>
/// 拼多多买手移动版登录窗口(WPF 版 PddMobileLoginForm)
/// </summary>
public partial class PddMobileLoginView : UserControl
{
/// <summary>视图模型</summary>
public PddMobileLoginViewModel ViewModel { get; }
public PddMobileLoginView(BuyerLoginInfo buyerInfo)
{
InitializeComponent();
ViewModel = new PddMobileLoginViewModel(buyerInfo);
ViewModel.BrowserCreated += ViewModel_BrowserCreated;
//ViewModel.RequestClose += ViewModel_RequestClose;
DataContext = ViewModel;
}
private void PddMobileLoginView_Loaded(object sender, RoutedEventArgs e)
{
ViewModel.Start();
}
private void PddMobileLoginView_Closed(object sender, System.EventArgs e)
{
ViewModel.Stop();
}
private void ViewModel_BrowserCreated(ChromiumWebBrowser browser)
{
Grid.SetRow(browser, 0);
Grid.SetColumn(browser, 0);
BrowserHost.Children.Add(browser);
}
//private void ViewModel_RequestClose()
//{
// if (this.IsLoaded)
// this.Close();
//}
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
ViewModel.ReloadCommand.Execute(null);
}
}
}
}
+1
View File
@@ -14,6 +14,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Threading; using System.Windows.Threading;
using Color = System.Windows.Media.Color;
namespace AllBase.Helper namespace AllBase.Helper
{ {
@@ -13,6 +13,7 @@ using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Media; using System.Windows.Media;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
using Color = System.Windows.Media.Color;
namespace AllBase.Model.DBModel namespace AllBase.Model.DBModel
{ {
+5
View File
@@ -10,6 +10,7 @@
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<UseWPF>true</UseWPF>
<!-- Properties\AssemblyInfo.cs already contains assembly attributes, <!-- Properties\AssemblyInfo.cs already contains assembly attributes,
so disable the SDK's auto-generated AssemblyInfo to avoid duplicates. --> so disable the SDK's auto-generated AssemblyInfo to avoid duplicates. -->
@@ -150,6 +151,10 @@
<None Include="Resources\icon.ico" /> <None Include="Resources\icon.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Views\" />
<Folder Include="ViewModels\" />
</ItemGroup>
<!-- app.config is picked up automatically by the SDK's default None glob <!-- app.config is picked up automatically by the SDK's default None glob
and MSBuild's app.config handling (based on the filename), so no and MSBuild's app.config handling (based on the filename), so no
+1 -1
View File
@@ -35,7 +35,7 @@ namespace TemuKJD.ToolForms
refresh_cookie, refresh_cookie,
order_login, order_login,
} }
[Obsolete]
public partial class PddMobileLoginForm : BaseGeneralForm public partial class PddMobileLoginForm : BaseGeneralForm
{ {
// 拼多多买手退货退款售后地址 // 拼多多买手退货退款售后地址