Browse Source

集成pjzs

qianyi
shanji 2 years ago
parent
commit
c5be91af5c
  1. 2
      BBWY.Client/ViewModels/MainViewModel.cs
  2. 3
      BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs
  3. 58
      PJZS/APIServices/BaseApiService.cs
  4. 108
      PJZS/APIServices/MdsApiService.cs
  5. 39
      PJZS/APIServices/ShopService.cs
  6. 8
      PJZS/App.xaml
  7. 52
      PJZS/App.xaml.cs
  8. 22
      PJZS/GlobalContext.cs
  9. 23
      PJZS/Html/dist/index.html
  10. 2
      PJZS/Html/dist/static/css/app.a4e18ce2b041f5c908ac58d5ad921361.css
  11. 1
      PJZS/Html/dist/static/css/app.a4e18ce2b041f5c908ac58d5ad921361.css.map
  12. 2
      PJZS/Html/dist/static/css/app.a828b8d18486d868662c5154405dcf22.css
  13. 1
      PJZS/Html/dist/static/css/app.a828b8d18486d868662c5154405dcf22.css.map
  14. BIN
      PJZS/Html/dist/static/fonts/element-icons.535877f.woff
  15. BIN
      PJZS/Html/dist/static/fonts/element-icons.732389d.ttf
  16. 2
      PJZS/Html/dist/static/js/app.69fb11397dc05d5bc53f.js
  17. 1
      PJZS/Html/dist/static/js/app.69fb11397dc05d5bc53f.js.map
  18. 2
      PJZS/Html/dist/static/js/app.82c9f2a5fbb128871aef.js
  19. 1
      PJZS/Html/dist/static/js/app.82c9f2a5fbb128871aef.js.map
  20. 2
      PJZS/Html/dist/static/js/manifest.2ae2e69a05c33dfc65f8.js
  21. 1
      PJZS/Html/dist/static/js/manifest.2ae2e69a05c33dfc65f8.js.map
  22. 2
      PJZS/Html/dist/static/js/manifest.3ad1d5771e9b13dbdad2.js
  23. 1
      PJZS/Html/dist/static/js/manifest.3ad1d5771e9b13dbdad2.js.map
  24. 44
      PJZS/Html/dist/static/js/vendor.734e8241e9563adaaa32.js
  25. 1
      PJZS/Html/dist/static/js/vendor.734e8241e9563adaaa32.js.map
  26. 35
      PJZS/MainWindow.xaml
  27. 201
      PJZS/MainWindow.xaml.cs
  28. 19
      PJZS/Models/APIModel/Shop/PurchaseAccountResponse.cs
  29. 76
      PJZS/Models/APIModel/Shop/ShopResponse.cs
  30. 17
      PJZS/Models/APIModel/User/MDSUserResponse.cs
  31. 21
      PJZS/Models/MappingProfile.cs
  32. 2
      PJZS/Models/Shop/Shop.cs
  33. 73
      PJZS/PJZS.csproj
  34. 37
      PJZS/ViewModels/BaseVM.cs
  35. 14
      PJZS/ViewModels/MainViewModel.cs
  36. 26
      PJZS/ViewModels/ViewModelLocator.cs
  37. 4
      PJZS/appSettings.json

2
BBWY.Client/ViewModels/MainViewModel.cs

@ -378,7 +378,7 @@ namespace BBWY.Client.ViewModels
var dw = new HttpDownloader(httpClientFactory, null);
dw.OnDownloadProgressChanged += Dw_OnDownloadProgressChanged;
dw.OnDownloadComplated += Dw_OnDownloadComplated;
var url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/f72be533-7a03-499e-be21-bfc3e89e9cd5/MicrosoftEdgeWebView2RuntimeInstallerX64.exe";
var url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/238fc310-c6c1-4a3e-a806-4a7c3c17b377/MicrosoftEdgeWebView2RuntimeInstallerX64.exe";
dw.DownloadFile(url, System.IO.Path.GetTempPath(), "MicrosoftEdgeWebView2RuntimeInstallerX64.exe", null);
dw.OnDownloadProgressChanged -= Dw_OnDownloadProgressChanged;
dw.OnDownloadComplated -= Dw_OnDownloadComplated;

3
BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs

@ -138,7 +138,8 @@ namespace BBWY.Server.Business
Sort = sort + 1,
UpdateSortTime = DateTime.Now,
SpuLogo = spuResponse.Data.Items[0].Logo,
SpuPublishTime = spuResponse.Data.Items[0].CreateTime
SpuPublishTime = spuResponse.Data.Items[0].CreateTime,
TaskCount = request.TaskCount
};
fsql.Insert(promotionTask).ExecuteAffrows();
}

58
PJZS/APIServices/BaseApiService.cs

@ -0,0 +1,58 @@
using BBWY.Common.Http;
using BBWY.Common.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net.Http;
using Microsoft.Extensions.Configuration;
namespace PJZS.APIServices
{
public class BaseApiService
{
private RestApiService restApiService;
protected GlobalContext globalContext;
public BaseApiService(RestApiService restApiService, GlobalContext globalContext)
{
this.restApiService = restApiService;
this.globalContext = globalContext;
}
protected ApiResponse<T> SendRequest<T>(string apiHost,
string apiPath,
object param,
IDictionary<string, string> headers,
HttpMethod httpMethod,
string contentType = RestApiService.ContentType_Json,
ParamPosition paramPosition = ParamPosition.Body,
bool enableRandomTimeStamp = false)
{
try
{
if (headers == null)
headers = new Dictionary<string, string>();
if (!headers.ContainsKey("ClientCode"))
headers.Add("ClientCode", "BBWY");
if (!headers.ContainsKey("ClientVersion"))
headers.Add("ClientVersion", "1.0.0.0");
if (!headers.ContainsKey("Authorization") && !string.IsNullOrEmpty(globalContext.UserToken))
headers.Add("Authorization", $"Bearer {globalContext.UserToken}");
if (!headers.ContainsKey("qy"))
headers.Add("qy", "qy");
var result = restApiService.SendRequest(apiHost, apiPath, param, headers, httpMethod, contentType, paramPosition, enableRandomTimeStamp);
if (result.StatusCode != System.Net.HttpStatusCode.OK &&
result.Content.Contains("\"Success\"") &&
result.Content.Contains("\"Msg\"") &&
result.Content.Contains("\"Data\""))
throw new BusinessException($"{result.StatusCode} {result.Content}") { Code = (int)result.StatusCode };
return JsonConvert.DeserializeObject<ApiResponse<T>>(result.Content);
}
catch (Exception ex)
{
return ApiResponse<T>.Error((ex is BusinessException) ? (ex as BusinessException).Code : 0, ex.Message);
}
}
}
}

108
PJZS/APIServices/MdsApiService.cs

@ -0,0 +1,108 @@
using BBWY.Common.Http;
using BBWY.Common.Models;
using Newtonsoft.Json.Linq;
using PJZS.Models;
using System;
using System.Collections.Generic;
using System.Net.Http;
namespace PJZS.APIServices
{
public class MdsApiService : BaseApiService, IDenpendency
{
public MdsApiService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext)
{
}
public ApiResponse<MDSUserResponse> GetUserInfo(string userToken)
{
return SendRequest<MDSUserResponse>(globalContext.MDSApiHost,
"/TaskList/User/GetUserInfo",
null,
new Dictionary<string, string>()
{
{ "Authorization", $"Bearer {userToken}" }
}, HttpMethod.Get);
}
//public ApiResponse<IList<ShopResponse>> GetShopsByUserTeam(long userId)
//{
// return SendRequest<IList<ShopResponse>>(globalContext.MDSApiHost, "TaskList/Shop/GetShopsByUserTeam", $"userId={userId}", null, System.Net.Http.HttpMethod.Get);
//}
public ApiResponse<IList<Department>> GetShopDetailList()
{
var response = new ApiResponse<IList<Department>>();
var response2 = SendRequest<JArray>(globalContext.MDSApiHost, "TaskList/UserDepartment/GetShopDetailList", null, null, HttpMethod.Get);
if (!response.Success)
{
response.Code = response2.Code;
response.Msg = response2.Msg;
return response;
}
response.Data = new List<Department>();
foreach (var jDepartment in response2.Data)
{
var jayShops = jDepartment.Value<JArray>("ShopList");
if (jayShops == null || !jayShops.HasValues)
continue; //排除空店部门
var d = new Department()
{
Id = jDepartment.Value<string>("Id"),
Name = jDepartment.Value<string>("DepartmentName")
};
response.Data.Add(d);
foreach (var jShop in jayShops)
{
if (jShop.Value<long?>("ShopId") == null || string.IsNullOrEmpty(jShop.Value<string>("AppToken")))
continue; //排除未授权
try
{
var shop = new Shop()
{
ShopId = jShop.Value<long>("ShopId"),
AppKey = jShop.Value<string>("AppKey"),
AppSecret = jShop.Value<string>("AppSecret"),
AppToken = jShop.Value<string>("AppToken"),
ManagePwd = jShop.Value<string>("ManagePwd"),
Platform = (Platform)jShop.Value<int>("PlatformId"),
PlatformCommissionRatio = jShop.Value<decimal?>("PlatformCommissionRatio") ?? 0.05M,
ShopName = jShop.Value<string>("ShopName"),
VenderType = jShop.Value<string>("ShopType"),
TeamId = jShop.Value<string>("TeamId")
};
d.ShopList.Add(shop);
//var jayAccounts = jShop.Value<JArray>("AccountList");
//if (jayAccounts == null || !jayAccounts.HasValues)
// continue;
//shop.PurchaseAccountList = new List<PurchaseAccount>();
//foreach (var jPurchaseAccount in jayAccounts)
//{
// shop.PurchaseAccountList.Add(new PurchaseAccount()
// {
// Id = jPurchaseAccount.Value<long>("Id"),
// AccountName = jPurchaseAccount.Value<string>("AccountName"),
// AppKey = jPurchaseAccount.Value<string>("AppKey"),
// AppSecret = jPurchaseAccount.Value<string>("AppSecret"),
// AppToken = jPurchaseAccount.Value<string>("AppToken"),
// ShopId = shop.ShopId
// //PurchasePlatformId = jPurchaseAccount.Value<long>()
// });
//}
}
catch (Exception ex)
{
Console.WriteLine(jShop.ToString());
throw;
}
}
}
return response;
}
}
}

39
PJZS/APIServices/ShopService.cs

@ -0,0 +1,39 @@
using BBWY.Common.Http;
using BBWY.Common.Models;
using PJZS.Models;
using System.Collections.Generic;
using System.Net.Http;
namespace PJZS.APIServices
{
public class ShopService : BaseApiService, IDenpendency
{
public ShopService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) { }
/// <summary>
/// 获取部门及下属店铺
/// </summary>
/// <returns></returns>
public ApiResponse<IList<DepartmentResponse>> GetDepartmentList()
{
return SendRequest<IList<DepartmentResponse>>(globalContext.BBYWApiHost, "api/vender/GetDeparmentList", null,
new Dictionary<string, string>()
{
{ "bbwyTempKey", "21jfhayu27q" }
}, HttpMethod.Get);
}
public ApiResponse<IList<ShopResponse>> GetShopListByIds(IList<string> shopIds)
{
return SendRequest<IList<ShopResponse>>(globalContext.BBYWApiHost, "api/vender/GetShopListByShopIds", new
{
shopIds
}, new Dictionary<string, string>()
{
{ "bbwyTempKey", "21jfhayu27q" }
}, HttpMethod.Post);
}
}
}

8
PJZS/App.xaml

@ -2,8 +2,12 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PJZS"
StartupUri="MainWindow.xaml">
xmlns:vm="clr-namespace:PJZS.ViewModels"
StartupUri="MainWindow.xaml"
ShutdownMode="OnExplicitShutdown">
<Application.Resources>
<!--<ResourceDictionary>
<vm:ViewModelLocator x:Key="Locator"></vm:ViewModelLocator>
</ResourceDictionary>-->
</Application.Resources>
</Application>

52
PJZS/App.xaml.cs

@ -1,4 +1,14 @@
using System.Windows;
using BBWY.Common.Http;
using BBWY.Common.Models;
using BBWY.Common.Extensions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using PJZS.Models;
namespace PJZS
{
@ -7,6 +17,9 @@ namespace PJZS
/// </summary>
public partial class App : Application
{
public IServiceProvider ServiceProvider { get; private set; }
public IConfiguration Configuration { get; private set; }
protected override void OnStartup(StartupEventArgs e)
{
var gl = new GlobalContext();
@ -31,7 +44,44 @@ namespace PJZS
}
#endif
gl.UserToken = userToken;
#region 注册全局异常
this.DispatcherUnhandledException += App_DispatcherUnhandledException; ;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
#endregion
var applicationPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var builder = new ConfigurationBuilder().SetBasePath(applicationPath).AddJsonFile("appSettings.json", false, true);
Configuration = builder.Build();
gl.BBYWApiHost = Configuration.GetSection("BBWYApiHost").Value;
gl.MDSApiHost = Configuration.GetSection("MDSApiHost").Value;
IServiceCollection serviceCollection = new ServiceCollection();
serviceCollection.AddHttpClient();
serviceCollection.AddSingleton<RestApiService>();
serviceCollection.AddSingleton(gl);
serviceCollection.BatchRegisterServices(new Assembly[] { Assembly.Load("PJZS") }, typeof(IDenpendency));
serviceCollection.AddMapper(new MappingProfile());
ServiceProvider = serviceCollection.BuildServiceProvider();
base.OnStartup(e);
}
private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
{
throw new NotImplementedException();
}
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
throw new NotImplementedException();
}
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
throw new NotImplementedException();
}
}
}

22
PJZS/GlobalContext.cs

@ -1,10 +1,13 @@
namespace PJZS
using Newtonsoft.Json;
using System.Runtime.InteropServices;
namespace PJZS
{
public class GlobalContext : NotifyObject
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public class GlobalContext
{
private User user;
public User User { get => user; set { Set(ref user, value); } }
public User User { get; set; }
public string UserToken { get; set; }
@ -13,10 +16,11 @@
public string BBYWApiHost { get; set; }
public string MDSApiHost { get; set; }
public string JOSApiHost { get; set; }
public string _1688ApiHost { get; set; }
#endregion
public string GetUserString()
{
return JsonConvert.SerializeObject(User);
}
}
}

23
PJZS/Html/dist/index.html

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<meta name=viewport content="width=device-width,initial-scale=1">
<title>manage_mould</title>
<link href=./static/css/app.a4e18ce2b041f5c908ac58d5ad921361.css rel=stylesheet>
</head>
<body>
<script>
function getContext() {
var pj = window.chrome.webview.hostObjects.pjzsContext;
var u = pj.GetUser();
console.log(u.Name);
}
</script>
<input type="button" value="获取上下文" onclick="getContext()"/>
<div id=app></div>
<script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script>
<script type=text/javascript src=./static/js/vendor.734e8241e9563adaaa32.js></script>
<script type=text/javascript src=./static/js/app.82c9f2a5fbb128871aef.js></script>
</body>
</html>

2
PJZS/Html/dist/static/css/app.a4e18ce2b041f5c908ac58d5ad921361.css

File diff suppressed because one or more lines are too long

1
PJZS/Html/dist/static/css/app.a4e18ce2b041f5c908ac58d5ad921361.css.map

File diff suppressed because one or more lines are too long

2
PJZS/Html/dist/static/css/app.a828b8d18486d868662c5154405dcf22.css

File diff suppressed because one or more lines are too long

1
PJZS/Html/dist/static/css/app.a828b8d18486d868662c5154405dcf22.css.map

File diff suppressed because one or more lines are too long

BIN
PJZS/Html/dist/static/fonts/element-icons.535877f.woff

Binary file not shown.

BIN
PJZS/Html/dist/static/fonts/element-icons.732389d.ttf

Binary file not shown.

2
PJZS/Html/dist/static/js/app.69fb11397dc05d5bc53f.js

File diff suppressed because one or more lines are too long

1
PJZS/Html/dist/static/js/app.69fb11397dc05d5bc53f.js.map

File diff suppressed because one or more lines are too long

2
PJZS/Html/dist/static/js/app.82c9f2a5fbb128871aef.js

File diff suppressed because one or more lines are too long

1
PJZS/Html/dist/static/js/app.82c9f2a5fbb128871aef.js.map

File diff suppressed because one or more lines are too long

2
PJZS/Html/dist/static/js/manifest.2ae2e69a05c33dfc65f8.js

@ -0,0 +1,2 @@
!function(r){var n=window.webpackJsonp;window.webpackJsonp=function(e,u,c){for(var f,i,p,a=0,l=[];a<e.length;a++)i=e[a],o[i]&&l.push(o[i][0]),o[i]=0;for(f in u)Object.prototype.hasOwnProperty.call(u,f)&&(r[f]=u[f]);for(n&&n(e,u,c);l.length;)l.shift()();if(c)for(a=0;a<c.length;a++)p=t(t.s=c[a]);return p};var e={},o={2:0};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=r,t.c=e,t.d=function(r,n,e){t.o(r,n)||Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:e})},t.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(n,"a",n),n},t.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},t.p="/",t.oe=function(r){throw console.error(r),r}}([]);
//# sourceMappingURL=manifest.2ae2e69a05c33dfc65f8.js.map

1
PJZS/Html/dist/static/js/manifest.2ae2e69a05c33dfc65f8.js.map

@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap be34f0738e217286ce1a"],"names":["parentJsonpFunction","window","chunkIds","moreModules","executeModules","moduleId","chunkId","result","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","shift","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","p","oe","err","console","error"],"mappings":"aACA,IAAAA,EAAAC,OAAA,aACAA,OAAA,sBAAAC,EAAAC,EAAAC,GAIA,IADA,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,EAAAC,KACQD,EAAAN,EAAAQ,OAAoBF,IAC5BF,EAAAJ,EAAAM,GACAG,EAAAL,IACAG,EAAAG,KAAAD,EAAAL,GAAA,IAEAK,EAAAL,GAAA,EAEA,IAAAD,KAAAF,EACAU,OAAAC,UAAAC,eAAAC,KAAAb,EAAAE,KACAY,EAAAZ,GAAAF,EAAAE,IAIA,IADAL,KAAAE,EAAAC,EAAAC,GACAK,EAAAC,QACAD,EAAAS,OAAAT,GAEA,GAAAL,EACA,IAAAI,EAAA,EAAYA,EAAAJ,EAAAM,OAA2BF,IACvCD,EAAAY,IAAAC,EAAAhB,EAAAI,IAGA,OAAAD,GAIA,IAAAc,KAGAV,GACAW,EAAA,GAIA,SAAAH,EAAAd,GAGA,GAAAgB,EAAAhB,GACA,OAAAgB,EAAAhB,GAAAkB,QAGA,IAAAC,EAAAH,EAAAhB,IACAG,EAAAH,EACAoB,GAAA,EACAF,YAUA,OANAN,EAAAZ,GAAAW,KAAAQ,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAT,EAGAE,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACAhB,OAAAmB,eAAAT,EAAAM,GACAI,cAAA,EACAC,YAAA,EACAC,IAAAL,KAMAX,EAAAiB,EAAA,SAAAZ,GACA,IAAAM,EAAAN,KAAAa,WACA,WAA2B,OAAAb,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAO,EAAAC,GAAsD,OAAA1B,OAAAC,UAAAC,eAAAC,KAAAsB,EAAAC,IAGtDpB,EAAAqB,EAAA,IAGArB,EAAAsB,GAAA,SAAAC,GAA8D,MAApBC,QAAAC,MAAAF,GAAoBA","file":"static/js/manifest.2ae2e69a05c33dfc65f8.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap be34f0738e217286ce1a"],"sourceRoot":""}

2
PJZS/Html/dist/static/js/manifest.3ad1d5771e9b13dbdad2.js

@ -0,0 +1,2 @@
!function(r){var n=window.webpackJsonp;window.webpackJsonp=function(e,u,c){for(var f,i,p,a=0,l=[];a<e.length;a++)i=e[a],o[i]&&l.push(o[i][0]),o[i]=0;for(f in u)Object.prototype.hasOwnProperty.call(u,f)&&(r[f]=u[f]);for(n&&n(e,u,c);l.length;)l.shift()();if(c)for(a=0;a<c.length;a++)p=t(t.s=c[a]);return p};var e={},o={2:0};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=r,t.c=e,t.d=function(r,n,e){t.o(r,n)||Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:e})},t.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(n,"a",n),n},t.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},t.p="./",t.oe=function(r){throw console.error(r),r}}([]);
//# sourceMappingURL=manifest.3ad1d5771e9b13dbdad2.js.map

1
PJZS/Html/dist/static/js/manifest.3ad1d5771e9b13dbdad2.js.map

@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap f53176d71b40b7a8a288"],"names":["parentJsonpFunction","window","chunkIds","moreModules","executeModules","moduleId","chunkId","result","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","shift","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","p","oe","err","console","error"],"mappings":"aACA,IAAAA,EAAAC,OAAA,aACAA,OAAA,sBAAAC,EAAAC,EAAAC,GAIA,IADA,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,EAAAC,KACQD,EAAAN,EAAAQ,OAAoBF,IAC5BF,EAAAJ,EAAAM,GACAG,EAAAL,IACAG,EAAAG,KAAAD,EAAAL,GAAA,IAEAK,EAAAL,GAAA,EAEA,IAAAD,KAAAF,EACAU,OAAAC,UAAAC,eAAAC,KAAAb,EAAAE,KACAY,EAAAZ,GAAAF,EAAAE,IAIA,IADAL,KAAAE,EAAAC,EAAAC,GACAK,EAAAC,QACAD,EAAAS,OAAAT,GAEA,GAAAL,EACA,IAAAI,EAAA,EAAYA,EAAAJ,EAAAM,OAA2BF,IACvCD,EAAAY,IAAAC,EAAAhB,EAAAI,IAGA,OAAAD,GAIA,IAAAc,KAGAV,GACAW,EAAA,GAIA,SAAAH,EAAAd,GAGA,GAAAgB,EAAAhB,GACA,OAAAgB,EAAAhB,GAAAkB,QAGA,IAAAC,EAAAH,EAAAhB,IACAG,EAAAH,EACAoB,GAAA,EACAF,YAUA,OANAN,EAAAZ,GAAAW,KAAAQ,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAT,EAGAE,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACAhB,OAAAmB,eAAAT,EAAAM,GACAI,cAAA,EACAC,YAAA,EACAC,IAAAL,KAMAX,EAAAiB,EAAA,SAAAZ,GACA,IAAAM,EAAAN,KAAAa,WACA,WAA2B,OAAAb,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAO,EAAAC,GAAsD,OAAA1B,OAAAC,UAAAC,eAAAC,KAAAsB,EAAAC,IAGtDpB,EAAAqB,EAAA,KAGArB,EAAAsB,GAAA,SAAAC,GAA8D,MAApBC,QAAAC,MAAAF,GAAoBA","file":"static/js/manifest.3ad1d5771e9b13dbdad2.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"./\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f53176d71b40b7a8a288"],"sourceRoot":""}

44
PJZS/Html/dist/static/js/vendor.734e8241e9563adaaa32.js

File diff suppressed because one or more lines are too long

1
PJZS/Html/dist/static/js/vendor.734e8241e9563adaaa32.js.map

File diff suppressed because one or more lines are too long

35
PJZS/MainWindow.xaml

@ -1,12 +1,37 @@
<Window x:Class="PJZS.MainWindow"
<c:BWindow x:Class="PJZS.MainWindow"
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PJZS"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
Title="评价助手" Height="768" Width="1024"
RightButtonGroupMargin="0,5,5,0">
<!--<b:Interaction.Triggers>
<b:EventTrigger EventName="Closing">
<b:InvokeCommandAction Command="{Binding ClosingCommand}" PassEventArgsToCommand="True"/>
</b:EventTrigger>
<b:EventTrigger EventName="Loaded">
<b:InvokeCommandAction Command="{Binding LoadCommand}" PassEventArgsToCommand="True"/>
</b:EventTrigger>
</b:Interaction.Triggers>-->
<Grid x:Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border BorderThickness="0,0,0,1" BorderBrush="#D7D7D7" Background="#8080FF">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"
TextBlock.Foreground="White">
<TextBlock Text="评价助手"/>
<TextBlock Text="v10000" Margin="5,0,0,0"/>
<TextBlock x:Name="txtUserName" Margin="5,0,0,0"/>
</StackPanel>
</Border>
</Grid>
</Window>
</c:BWindow>

201
PJZS/MainWindow.xaml.cs

@ -1,28 +1,209 @@
using System;
using BBWY.Common.Extensions;
using BBWY.Controls;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Web.WebView2.Core;
using PJZS.APIServices;
using PJZS.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace PJZS
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
public partial class MainWindow : BWindow
{
private GlobalContext globalContext;
private WebView2Manager w2m;
private bool isNavigated;
private IList<string> managerDepartment;
private MdsApiService mdsApiService;
private ShopService shopService;
public MainWindow()
{
InitializeComponent();
this.managerDepartment = new List<string>() { "董事办", "财务部", "技术部", "总经办" };
this.Loaded += MainWindow_Loaded;
}
private bool CheckWebview2Runtime()
{
bool isInstall = false;
try
{
isInstall = !string.IsNullOrEmpty(CoreWebView2Environment.GetAvailableBrowserVersionString());
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return isInstall;
}
private void MainWindow_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
if (!CheckWebview2Runtime())
{
MessageBox.Show("缺少webview2 runtime,请下载安装之后再运行评价助手");
//下载webview2 runtime
//Task.Factory.StartNew(DownloadWebview2Runtime);
var webview2RuntimeUrl = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/238fc310-c6c1-4a3e-a806-4a7c3c17b377/MicrosoftEdgeWebView2RuntimeInstallerX64.exe";
try
{
System.Diagnostics.Process.Start("explorer.exe", webview2RuntimeUrl);
Thread.Sleep(1000);
}
catch (Exception ex)
{
Clipboard.SetText(webview2RuntimeUrl);
MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示");
}
finally
{
Environment.Exit(Environment.ExitCode);
}
}
var sp = (App.Current as App).ServiceProvider;
using (var s = sp.CreateScope())
{
w2m = s.ServiceProvider.GetRequiredService<WebView2Manager>();
globalContext = s.ServiceProvider.GetRequiredService<GlobalContext>();
mdsApiService = s.ServiceProvider.GetRequiredService<MdsApiService>();
shopService = s.ServiceProvider.GetRequiredService<ShopService>();
}
Login();
txtUserName.Text = globalContext.User.Name;
var url = "http://pjzs.qiyue666.com";
w2m.CoreWebView2InitializationCompleted = (e) =>
{
w2m.wb2.CoreWebView2.AddHostObjectToScript("pjzsContext", this.globalContext);
isNavigated = true;
w2m.wb2.CoreWebView2.Navigate(url);
};
w2m.Init();
w2m.wb2.SetValue(Grid.RowProperty, 1);
w2m.wb2.Margin = new Thickness(1, 0, 1, 0);
grid.Children.Add(w2m.wb2);
if (w2m.IsInitializationCompleted && !isNavigated)
{
w2m.wb2.CoreWebView2.Navigate(url);
//w2m.wb2.CoreWebView2.NavigateToString(content);
isNavigated = true;
}
}
private void Login()
{
try
{
var mdsUserResponse = mdsApiService.GetUserInfo(globalContext.UserToken);
if (!mdsUserResponse.Success)
throw new Exception($"获取磨刀石用户信息失败 {mdsUserResponse.Msg}");
globalContext.User = mdsUserResponse.Data.Map<User>();
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));
IList<Department> departmentList = null;
if (globalContext.User.TeamName == "刷单组" ||
managerDepartment.Contains(globalContext.User.TeamName) ||
managerDepartment.Any(m => globalContext.User.SonDepartmentNames.Contains(m)))
{
var response = shopService.GetDepartmentList();
if (!response.Success)
throw new Exception(response.Msg);
departmentList = response.Data.Map<List<Department>>();
}
else
{
var response = mdsApiService.GetShopDetailList();
if (!response.Success)
throw new Exception(response.Msg);
departmentList = response.Data;
if (departmentList.Count == 0)
throw new Exception("缺少有效的部门数据");
var shopIds = new List<string>();
foreach (var d in departmentList)
{
if (d.ShopList != null && d.ShopList.Count > 0)
{
foreach (var s in d.ShopList)
shopIds.Add(s.ShopId.ToString());
}
}
var shopList2Res = shopService.GetShopListByIds(shopIds);
if (shopList2Res.Success && shopList2Res.Data != null && shopList2Res.Data.Count() > 0)
{
foreach (var d in departmentList)
{
foreach (var shop in d.ShopList)
{
var s2 = shopList2Res.Data.FirstOrDefault(s => s.ShopId == shop.ShopId);
if (s2 != null)
{
shop.DingDingKey = s2.DingDingKey;
shop.DingDingWebHook = s2.DingDingWebHook;
shop.SkuSafeTurnoverDays = s2.SkuSafeTurnoverDays;
shop.SiNanPolicyLevel = s2.SiNanPolicyLevel;
shop.SiNanDingDingKey = s2.SiNanDingDingKey;
shop.SiNanDingDingWebHook = s2.SiNanDingDingWebHook;
shop.AppKey2 = s2.AppKey2;
shop.AppSecret2 = s2.AppSecret2;
shop.AppToken2 = s2.AppToken2;
}
}
}
}
}
for (var i = 0; i < departmentList.Count(); i++)
{
var d = departmentList[i];
for (var j = 0; j < d.ShopList.Count(); j++)
{
var shop = d.ShopList[j];
if (string.IsNullOrEmpty(shop.AppToken2))
{
d.ShopList.RemoveAt(j);
j--;
}
}
if (d.ShopList == null || d.ShopList.Count() == 0)
{
departmentList.RemoveAt(i);
i--;
}
}
globalContext.User.DepartmentList = departmentList;
}
catch (Exception ex)
{
App.Current.Dispatcher.Invoke(() =>
{
MessageBox.Show(ex.Message, "登录失败");
});
Environment.Exit(Environment.ExitCode);
}
}
}
}

19
PJZS/Models/APIModel/Shop/PurchaseAccountResponse.cs

@ -0,0 +1,19 @@
namespace PJZS.Models
{
public class PurchaseAccountResponse
{
public long Id { get; set; }
public string AccountName { get; set; }
public long ShopId { get; set; }
public Platform PurchasePlatformId { get; set; }
public string AppKey { get; set; }
public string AppSecret { get; set; }
public string AppToken { get; set; }
}
}

76
PJZS/Models/APIModel/Shop/ShopResponse.cs

@ -0,0 +1,76 @@
using System.Collections.Generic;
namespace PJZS.Models
{
public class ShopResponse
{
public string Id { get; set; }
public Platform PlatformId { get; set; }
public long? ShopId { get; set; }
public string ShopName { get; set; }
public string ShopType { get; set; }
public string AppKey { get; set; }
public string AppSecret { get; set; }
public string AppToken { get; set; }
public string AppKey2 { get; set; }
public string AppSecret2 { get; set; }
public string AppToken2 { get; set; }
//public IList<PurchaseAccountResponse> PurchaseList { get; set; }
public string ManagePwd { get; set; }
public decimal? PlatformCommissionRatio { get; set; }
public string TeamId { get; set; }
public string TeamName { get; set; }
public string DingDingWebHook { get; set; }
public string DingDingKey { get; set; }
public int SkuSafeTurnoverDays { get; set; }
/// <summary>
/// 司南策略等级
/// </summary>
public int SiNanPolicyLevel { get; set; }
/// <summary>
/// 司南钉钉WebHook地址
/// </summary>
public string SiNanDingDingWebHook { get; set; }
/// <summary>
/// 司南钉钉密钥
/// </summary>
public string SiNanDingDingKey { get; set; }
}
public class DepartmentResponse
{
public string Id { get; set; }
public string Name { get; set; }
public IList<ShopResponse> ShopList { get; set; }
}
public class DepartmentResponse2
{
public string DepartmentId { get; set; }
public string DepartmentName { get; set; }
}
}

17
PJZS/Models/APIModel/User/MDSUserResponse.cs

@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace PJZS.Models
{
public class MDSUserResponse
{
public long Id { get; set; }
public string DepartmentName { get; set; }
public string DepartmentId { get; set; }
public string UserName { get; set; }
public string UserNick { get; set; }
public IList<DepartmentResponse2> SonDepartmentList { get; set; }
}
}

21
PJZS/Models/MappingProfile.cs

@ -0,0 +1,21 @@
using AutoMapper;
namespace PJZS.Models
{
public class MappingProfile : Profile
{
public MappingProfile()
{
CreateMap<MDSUserResponse, User>().ForMember(t => t.TeamId, opt => opt.MapFrom(f => f.DepartmentId))
.ForMember(t => t.TeamName, opt => opt.MapFrom(f => f.DepartmentName))
.ForMember(t => t.Name, opt => opt.MapFrom(f => f.UserName));
CreateMap<ShopResponse, Shop>().ForMember(t => t.VenderType, opt => opt.MapFrom(f => f.ShopType))
.ForMember(t => t.Platform, opt => opt.MapFrom(f => f.PlatformId));
//.ForMember(t => t.PurchaseAccountList, opt => opt.MapFrom(f => f.PurchaseList));
CreateMap<PurchaseAccountResponse, PurchaseAccount>();
CreateMap<DepartmentResponse, Department>();
}
}
}

2
PJZS/Models/Shop/Shop.cs

@ -38,7 +38,7 @@ namespace PJZS
public string ShopName { get => shopName; set { Set(ref shopName, value); } }
public IList<PurchaseAccount> PurchaseAccountList { get; set; }
//public IList<PurchaseAccount> PurchaseAccountList { get; set; }
public string ManagePwd { get; set; }
/// <summary>

73
PJZS/PJZS.csproj

@ -6,9 +6,77 @@
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<None Remove="appSettings.json" />
<None Remove="Html\dist\static\css\app.a4e18ce2b041f5c908ac58d5ad921361.css" />
<None Remove="Html\dist\static\css\app.a4e18ce2b041f5c908ac58d5ad921361.css.map" />
<None Remove="Html\dist\static\js\app.82c9f2a5fbb128871aef.js" />
<None Remove="Html\dist\static\js\app.82c9f2a5fbb128871aef.js.map" />
<None Remove="Html\dist\static\js\manifest.3ad1d5771e9b13dbdad2.js" />
<None Remove="Html\dist\static\js\manifest.3ad1d5771e9b13dbdad2.js.map" />
</ItemGroup>
<ItemGroup>
<Content Include="appSettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\index.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\css\app.a4e18ce2b041f5c908ac58d5ad921361.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\css\app.a4e18ce2b041f5c908ac58d5ad921361.css.map">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\css\app.a828b8d18486d868662c5154405dcf22.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\css\app.a828b8d18486d868662c5154405dcf22.css.map">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\fonts\element-icons.535877f.woff">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\fonts\element-icons.732389d.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\js\app.69fb11397dc05d5bc53f.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\js\app.69fb11397dc05d5bc53f.js.map">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\js\app.82c9f2a5fbb128871aef.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\js\app.82c9f2a5fbb128871aef.js.map">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\js\manifest.2ae2e69a05c33dfc65f8.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\js\manifest.2ae2e69a05c33dfc65f8.js.map">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\js\manifest.3ad1d5771e9b13dbdad2.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\js\manifest.3ad1d5771e9b13dbdad2.js.map">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\js\vendor.734e8241e9563adaaa32.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Html\dist\static\js\vendor.734e8241e9563adaaa32.js.map">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1150.38" />
@ -19,10 +87,7 @@
<ItemGroup>
<ProjectReference Include="..\BBWY.Common\BBWY.Common.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\APIModel\" />
<ProjectReference Include="..\BBWY.Controls\BBWY.Controls.csproj" />
</ItemGroup>
</Project>

37
PJZS/ViewModels/BaseVM.cs

@ -0,0 +1,37 @@
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using System;
using System.Windows.Input;
namespace PJZS.ViewModels
{
public class BaseVM : ViewModelBase
{
public Guid VMId { get; set; }
public ICommand LoadCommand { get; set; }
public ICommand UnloadCommand { get; set; }
public BaseVM()
{
VMId = Guid.NewGuid();
LoadCommand = new RelayCommand(Load);
UnloadCommand = new RelayCommand(Unload);
}
public virtual void Refresh()
{
}
protected virtual void Load()
{
}
protected virtual void Unload()
{
}
}
}

14
PJZS/ViewModels/MainViewModel.cs

@ -0,0 +1,14 @@
using BBWY.Common.Models;
namespace PJZS.ViewModels
{
public class MainViewModel : BaseVM, IDenpendency
{
public GlobalContext GlobalContext { get; set; }
public MainViewModel(GlobalContext globalContext)
{
GlobalContext = globalContext;
}
}
}

26
PJZS/ViewModels/ViewModelLocator.cs

@ -0,0 +1,26 @@
using Microsoft.Extensions.DependencyInjection;
using System;
namespace PJZS.ViewModels
{
public class ViewModelLocator
{
private IServiceProvider sp;
public ViewModelLocator()
{
sp = (App.Current as App).ServiceProvider;
}
public MainViewModel Main
{
get
{
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<MainViewModel>();
}
}
}
}
}

4
PJZS/appSettings.json

@ -0,0 +1,4 @@
{
"BBWYApiHost": "http://bbwytest.qiyue666.com",
"MDSApiHost": "http://mdsapi.qiyue666.com"
}
Loading…
Cancel
Save