1 修复淘宝拍单窗口可能崩溃问题

2 拼多多中转仓拍单随机地址支持随机繁体字
This commit is contained in:
wule_5900x committed 2026-11-07 22:35:03 +08:00
1 parent 5b9ed01fa1
commit ac93305d5f
8 files changed
+155 -21

No files matched your search

@@ -31,10 +31,16 @@ public class SettingViewModel : BindableBaseEx
get => GetValue<bool>();
set => SetValue(value);
}
public bool SwitchEnablePddTransitTraditionalAddress
{
get => GetValue<bool>();
set => SetValue(value);
}
public void Assign(SettingConfig config)
{
AutoSwitchGiftType = config.AutoSwitchGiftType;
SwitchEnableDirectBuy = config.SwitchEnableDirectBuy;
SwitchEnablePddTransitTraditionalAddress = config.SwitchEnablePddTransitTraditionalAddress;
}
public SettingConfig ToConfig()
{
@@ -42,6 +48,7 @@ public class SettingViewModel : BindableBaseEx
{
AutoSwitchGiftType = AutoSwitchGiftType,
SwitchEnableDirectBuy = SwitchEnableDirectBuy,
SwitchEnablePddTransitTraditionalAddress = SwitchEnablePddTransitTraditionalAddress,
};
}
}
+15 -12
View File
@@ -345,18 +345,20 @@ namespace _29WxOrderWpf.ViewModels
// cef138必须init后方可设置或删除cookie
while (!CefWebBrowser.IsBrowserInitialized || !CefWebBrowser.GetBrowser().MainFrame.IsValid)
while (_isWindowLoaded && (!CefWebBrowser.IsBrowserInitialized || !CefWebBrowser.GetBrowser().MainFrame.IsValid))
await Task.Delay(20);
//await WPFCEFBrowser.DeleteCookieAsync(CefWebBrowser.GetCookieManager(null));
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
//await WPFCEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), CefWebBrowser.GetCookieManager(null));
if (OpenType != EnumOpenType.login)
{
foreach (var cook in cookieLst)
{
await WPFCEFBrowser.SetCookieAsync(cook.Domain.Trim('.'), cook.Name + "=" + cook.Value + ";", CefWebBrowser.GetCookieManager(null));
//t.Wait(5000);
if (_isWindowLoaded)
await WPFCEFBrowser.SetCookieAsync(cook.Domain.Trim('.'), cook.Name + "=" + cook.Value + ";", CefWebBrowser.GetCookieManager(null));
}
}
//根据登录的具体店铺设置local storage
if (!string.IsNullOrEmpty(buyer?.buyer_id))
@@ -369,9 +371,9 @@ namespace _29WxOrderWpf.ViewModels
}
if (!string.IsNullOrEmpty(InitUrl))
CefWebBrowser.Load(InitUrl);
CefWebBrowser?.Load(InitUrl);
else
CefWebBrowser.Load(buyerMainUrl);
CefWebBrowser?.Load(buyerMainUrl);
//不是登录的话就此返回
if (OpenType != EnumOpenType.login)
@@ -381,14 +383,14 @@ namespace _29WxOrderWpf.ViewModels
for (int i = 0; i < 50; i++)
{
if (CefWebBrowser.IsLoading)
if (CefWebBrowser?.IsLoading == true)
await Task.Delay(100);
}
await Task.Delay(Randomx.GetId(1500, 2000));
if (!_isWindowLoaded)
return;
while (!CefWebBrowser.Address?.StartsWith(buyerLoginUrl) ?? false)
while (!CefWebBrowser?.Address?.StartsWith(buyerLoginUrl) ?? false)
{
await Task.Delay(1000);
if (!_isWindowLoaded)
@@ -396,8 +398,7 @@ namespace _29WxOrderWpf.ViewModels
}
}
}
);
});
}
@@ -426,7 +427,7 @@ namespace _29WxOrderWpf.ViewModels
sb.Append("(function(){");
sb.Append("CefSharp.BindObjectAsync('shopObj');");
sb.Append("})();");
CefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sb.ToString());
CefWebBrowser?.GetBrowser().MainFrame.EvaluateScriptAsync(sb.ToString());
}
private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request)
@@ -489,6 +490,8 @@ namespace _29WxOrderWpf.ViewModels
{
Thread.Sleep(2000);
if (!_isWindowLoaded)
return;
//List<Cookie> cookieList = WPFCEFBrowser.GetCookieList(shopCookieHead, CefWebBrowser.GetCookieManager(null));
List<Cookie> cookieList = WPFCEFBrowser.GetCookieList("", CefWebBrowser.GetCookieManager(null));
@@ -555,9 +558,9 @@ namespace _29WxOrderWpf.ViewModels
if (CefWebBrowser != null)
{
if (Address != "about:blank")
CefWebBrowser.Load(Address);
CefWebBrowser?.Load(Address);
else
CefWebBrowser.Load(buyerMainUrl);
CefWebBrowser?.Load(buyerMainUrl);
}
}