Browse Source

一卡通

Lishi
xxe 2 years ago
parent
commit
bb44810d5d
6 changed files with 79 additions and 21 deletions
  1. +3
    -1
      HKCardIN/HKCardIN.csproj
  2. +13
    -1
      HKCardIN/Helper/DataBus.cs
  3. +28
    -0
      HKCardIN/Logic/BaseLogic.cs
  4. +6
    -2
      HKCardIN/ViewModels/RootViewModel.cs
  5. +25
    -17
      HKCardIN/Views/RootView.xaml
  6. +4
    -0
      HKCardIN/options.json

+ 3
- 1
HKCardIN/HKCardIN.csproj View File

@@ -33,6 +33,8 @@
<Resource Include="HKResouces\背景.jpg" />
</ItemGroup>
<ItemGroup>
<Folder Include="Logic\" />
<None Update="options.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

+ 13
- 1
HKCardIN/Helper/DataBus.cs View File

@@ -1,13 +1,25 @@
using System;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XExten.Advance.LinqFramework;
using XExten.Advance.StaticFramework;

namespace HKCardIN.Helper
{
public class DataBus
{
public static bool NetWordState { get; set; } = false;
public static JObject Option => SyncStatic.ReadFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "options.json")).ToModel<JObject>();
public static string SaasRoute => Option["SaasRoute"].ToString();
public static string LockCode => Option["LockCode"].ToString();
}
public class ApiRoute
{
public const string PullUserAndCardInfo = "";
public const string PushMoneyToServer = "";
}
}

+ 28
- 0
HKCardIN/Logic/BaseLogic.cs View File

@@ -0,0 +1,28 @@
using HKCardIN.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XExten.Advance.HttpFramework.MultiFactory;

namespace HKCardIN.Logic
{
public class BaseLogic : Singleton<BaseLogic>
{
public async Task<dynamic> PullUserAndCardInfo()
{
return await IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = DataBus.SaasRoute + ApiRoute.PullUserAndCardInfo;
}).Build().RunStringFirstAsync();
}
public async Task<dynamic> PushMoneyToServer(dynamic input)
{
return await IHttpMultiClient.HttpMulti.AddNode(t =>
{
t.NodePath = DataBus.SaasRoute + ApiRoute.PushMoneyToServer;
}).Build().RunStringFirstAsync();
}
}
}

+ 6
- 2
HKCardIN/ViewModels/RootViewModel.cs View File

@@ -69,7 +69,7 @@ namespace HKCardIN.ViewModels
}
public void UnLockAction()
{
if (LockCode.Equals("123"))
if (LockCode.Equals(DataBus.LockCode))
{
IsLocker = false;
CodeVisible = Visibility.Collapsed;
@@ -83,7 +83,11 @@ namespace HKCardIN.ViewModels
}
public void SaveAction()
{

if (!DataBus.NetWordState)
{
HandyControl.Controls.Growl.InfoGlobal("系统已离线,请连接网络!!!");
return;
}
}
#endregion



+ 25
- 17
HKCardIN/Views/RootView.xaml View File

@@ -8,8 +8,9 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:viewModels="clr-namespace:HKCardIN.ViewModels"
x:Name="Root"
Title="海科智慧一卡通平台"
Width="700"
Width="800"
Height="420"
d:DataContext="{d:DesignInstance Type=viewModels:RootViewModel}"
ShowMaxButton="False"
@@ -96,6 +97,7 @@
<Grid Visibility="{Binding ContentVisible}">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="13" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Margin="0,12,0,0">
@@ -206,7 +208,11 @@
</WrapPanel>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1">
<hc:Divider
Grid.Column="1"
Height="{Binding ActualHeight, ElementName=Root}"
Orientation="Vertical" />
<StackPanel Grid.Column="2">
<hc:Divider
Content="充值金额"
FontSize="16"
@@ -219,7 +225,7 @@
<Run Foreground="WhiteSmoke" Text="当前充值金额:" />
<Run Foreground="Red" Text="{Binding ShowMoney}" />
</TextBlock>
<WrapPanel>
<WrapPanel HorizontalAlignment="Center">
<Button
Command="{s:Action InputAction}"
CommandParameter="50"
@@ -265,20 +271,22 @@
</Button.Content>
</Button>
</WrapPanel>
<TextBox
Width="330"
Margin="5,10,0,10"
HorizontalAlignment="Left"
hc:InfoElement.Placeholder="请输入自定义金额"
Style="{StaticResource TextBoxExtend}">
<TextBox.Text>
<Binding Path="InputMoney" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<local:ValidataRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<WrapPanel HorizontalAlignment="Center">
<TextBox
Width="330"
Margin="5,10,0,10"
HorizontalAlignment="Left"
hc:InfoElement.Placeholder="请输入自定义金额"
Style="{StaticResource TextBoxExtend}">
<TextBox.Text>
<Binding Path="InputMoney" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<local:ValidataRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
</WrapPanel>
<hc:Divider
Content="操作"
FontSize="16"


+ 4
- 0
HKCardIN/options.json View File

@@ -0,0 +1,4 @@
{
"SaasRoute": "",
"LockCode": "HK123456"
}

Loading…
Cancel
Save