Browse Source

对接webview2

updatebug
shanji 2 years ago
parent
commit
0bc6706730
  1. 4
      BBWYB.Client/GlobalContext.cs
  2. 4
      BBWYB.Client/Models/User/User.cs
  3. 2
      BBWYB.Client/ViewModels/MainViewModel.cs
  4. 2
      BBWYB.Client/Views/WebB/WebB.xaml.cs

4
BBWYB.Client/GlobalContext.cs

@ -2,9 +2,13 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace BBWYB.Client
{
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public class GlobalContext : ObservableObject
{
public GlobalContext()

4
BBWYB.Client/Models/User/User.cs

@ -24,9 +24,11 @@ namespace BBWYB.Client.Models
public IList<Department> DepartmentList { get; set; }
/// <summary>
/// 店铺列表 (暂时只有刷单组才需要)
/// 店铺列表
/// </summary>
public IList<Shop> ShopList { get; set; }
public string Token { get; set; }
}
}

2
BBWYB.Client/ViewModels/MainViewModel.cs

@ -4,6 +4,7 @@ using BBWYB.Client.Views.SelectShop;
using BBWYB.Common.Extensions;
using BBWYB.Common.Models;
using CommunityToolkit.Mvvm.Input;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@ -139,6 +140,7 @@ namespace BBWYB.Client.ViewModels
throw new Exception($"获取磨刀石用户信息失败 {mdsUserResponse.Msg}");
GlobalContext.User = mdsUserResponse.Data.Map<User>();
GlobalContext.User.Token = GlobalContext.UserToken;
GlobalContext.User.SonDepartmentNames = string.Empty;
if (mdsUserResponse.Data.SonDepartmentList != null && mdsUserResponse.Data.SonDepartmentList.Count > 0)
GlobalContext.User.SonDepartmentNames = string.Join(',', mdsUserResponse.Data.SonDepartmentList.Select(sd => sd.DepartmentName));

2
BBWYB.Client/Views/WebB/WebB.xaml.cs

@ -50,8 +50,6 @@ namespace BBWYB.Client.Views.WebB
w2m.wb2.Margin = new Thickness(1, 0, 1, 0);
grid.Children.Add(w2m.wb2);
if (w2m.IsInitializationCompleted && !isNavigated)
{
w2m.wb2.CoreWebView2.Navigate(url);

Loading…
Cancel
Save