增加设置页面
增加礼物发货 超出6元 则发礼物二
This commit is contained in:
1 parent
d18460c83f
commit
5003ea93f8
11 files changed
+642
-46
No files matched your search
@@ -35,6 +35,7 @@
|
||||
<ResourceDictionary Source="/Ctrls/Statistics/General.xaml" />
|
||||
|
||||
<ResourceDictionary Source="pack://application:,,,/WxOrder.Framework;component/Resources/Theme.xaml" />
|
||||
<ResourceDictionary Source="Styles/TabControlStyle.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
xmlns:usercontrols="clr-namespace:_29WxOrderWpf.UserControls"
|
||||
xmlns:utils="clr-namespace:_29WxOrderWpf.Utils"
|
||||
xmlns:wpf="WPFCommon"
|
||||
d:DataContext="{d:DesignInstance Type=local:OrderListCtrl}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="1560"
|
||||
Loaded="Window_Loaded"
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
<Window
|
||||
x:Class="_29WxOrderWpf.Ctrls.Settings.SettingsView"
|
||||
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:local="clr-namespace:_29WxOrderWpf.Ctrls.Settings"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="[vm ]clr-namespace:_29WxOrderWpf.ViewModels"
|
||||
xmlns:wpf="WPFCommon"
|
||||
Title="设置"
|
||||
Width="800"
|
||||
Height="450"
|
||||
d:DataContext="{d:DesignInstance Type=vm:SettingViewModel}"
|
||||
ResizeMode="NoResize"
|
||||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowState="Normal"
|
||||
mc:Ignorable="d">
|
||||
<Border BorderBrush="#e8eaed" BorderThickness="1">
|
||||
<TabControl
|
||||
ItemContainerStyle="{StaticResource SideTabItem}"
|
||||
Style="{StaticResource SideTabControl}"
|
||||
TabStripPlacement="Left">
|
||||
|
||||
<TabItem Header="发货">
|
||||
<StackPanel>
|
||||
<Border Style="{StaticResource SettingRow}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel>
|
||||
<TextBlock Style="{StaticResource SettingTitle}" Text="礼品单发送" />
|
||||
<TextBlock Style="{StaticResource SettingDesc}" Text="超出6元自动改为礼品二(实物)" />
|
||||
</StackPanel>
|
||||
<CheckBox
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
IsChecked="{Binding AutoSwitchGiftType}"
|
||||
Style="{StaticResource ToggleSwitch}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
<!-- ========== 外观 ========== -->
|
||||
<!--
|
||||
<TabItem Header="外观" Tag="🎨">
|
||||
<StackPanel
|
||||
MaxWidth="720"
|
||||
Margin="40,32,40,32"
|
||||
HorizontalAlignment="Left">
|
||||
<TextBlock Style="{StaticResource PageTitle}" Text="外观" />
|
||||
<TextBlock Style="{StaticResource PageSubtitle}" Text="自定义界面的主题、颜色和字体。" />
|
||||
|
||||
<Border Style="{StaticResource SettingsCard}">
|
||||
<StackPanel>
|
||||
<Border Style="{StaticResource SettingRow}">
|
||||
<StackPanel>
|
||||
<TextBlock Style="{StaticResource SettingTitle}" Text="主题" />
|
||||
<TextBlock Style="{StaticResource SettingDesc}" Text="选择浅色、深色或跟随系统" />
|
||||
<StackPanel Margin="0,12,0,0" Orientation="Horizontal">
|
||||
<RadioButton
|
||||
Margin="0,0,20,0"
|
||||
Content="浅色"
|
||||
IsChecked="True" />
|
||||
<RadioButton Margin="0,0,20,0" Content="深色" />
|
||||
<RadioButton Content="跟随系统" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border BorderThickness="0" Style="{StaticResource SettingRow}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel>
|
||||
<TextBlock Style="{StaticResource SettingTitle}" Text="强调色" />
|
||||
<TextBlock Style="{StaticResource SettingDesc}" Text="用于按钮、选中项等强调元素" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border
|
||||
Width="24"
|
||||
Height="24"
|
||||
Margin="0,0,8,0"
|
||||
Background="#0078D4"
|
||||
CornerRadius="12" />
|
||||
<Border
|
||||
Width="24"
|
||||
Height="24"
|
||||
Margin="0,0,8,0"
|
||||
Background="#6E4AFF"
|
||||
CornerRadius="12" />
|
||||
<Border
|
||||
Width="24"
|
||||
Height="24"
|
||||
Background="#E73C3C"
|
||||
CornerRadius="12" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
-->
|
||||
<!-- ========== 账户 ========== -->
|
||||
<!--
|
||||
<TabItem Header="账户" Tag="👤">
|
||||
<StackPanel
|
||||
MaxWidth="720"
|
||||
Margin="40,32,40,32"
|
||||
HorizontalAlignment="Left">
|
||||
<TextBlock Style="{StaticResource PageTitle}" Text="账户" />
|
||||
<TextBlock Style="{StaticResource PageSubtitle}" Text="管理你的账号、头像和登录方式。" />
|
||||
|
||||
<Border Padding="20" Style="{StaticResource SettingsCard}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border
|
||||
Width="64"
|
||||
Height="64"
|
||||
Background="#0078D4"
|
||||
CornerRadius="32">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="28"
|
||||
Foreground="White"
|
||||
Text="A" />
|
||||
</Border>
|
||||
<StackPanel Margin="16,0,0,0" VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#1F2329"
|
||||
Text="Alex" />
|
||||
<TextBlock
|
||||
Margin="0,2,0,0"
|
||||
FontSize="13"
|
||||
Foreground="#8A9099"
|
||||
Text="alex@example.com" />
|
||||
</StackPanel>
|
||||
<Button
|
||||
Margin="20,0,0,0"
|
||||
Padding="16,6"
|
||||
VerticalAlignment="Center"
|
||||
Content="编辑资料" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
-->
|
||||
<!-- ========== 隐私 ========== -->
|
||||
<!--
|
||||
<TabItem Header="隐私" Tag="🔒">
|
||||
<StackPanel
|
||||
MaxWidth="720"
|
||||
Margin="40,32,40,32"
|
||||
HorizontalAlignment="Left">
|
||||
<TextBlock Style="{StaticResource PageTitle}" Text="隐私" />
|
||||
<TextBlock Style="{StaticResource PageSubtitle}" Text="控制应用如何使用你的数据。" />
|
||||
|
||||
<Border Style="{StaticResource SettingsCard}">
|
||||
<StackPanel>
|
||||
<Border Style="{StaticResource SettingRow}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel>
|
||||
<TextBlock Style="{StaticResource SettingTitle}" Text="发送匿名使用数据" />
|
||||
<TextBlock Style="{StaticResource SettingDesc}" Text="帮助改进产品,不含个人身份信息" />
|
||||
</StackPanel>
|
||||
<CheckBox
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
IsChecked="True"
|
||||
Style="{StaticResource ToggleSwitch}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border BorderThickness="0" Style="{StaticResource SettingRow}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel>
|
||||
<TextBlock Style="{StaticResource SettingTitle}" Text="个性化推荐" />
|
||||
<TextBlock Style="{StaticResource SettingDesc}" Text="根据使用习惯推荐内容" />
|
||||
</StackPanel>
|
||||
<CheckBox
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToggleSwitch}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
-->
|
||||
<!-- ========== 关于 ========== -->
|
||||
<!--
|
||||
<TabItem Header="关于" Tag="{StaticResource txt-table_stack_above}">
|
||||
<StackPanel
|
||||
MaxWidth="720"
|
||||
Margin="40,32,40,32"
|
||||
HorizontalAlignment="Left">
|
||||
<TextBlock Style="{StaticResource PageTitle}" Text="关于" />
|
||||
<TextBlock Style="{StaticResource PageSubtitle}" Text="版本与许可信息。" />
|
||||
|
||||
<Border Padding="20" Style="{StaticResource SettingsCard}">
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontSize="18"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#1F2329"
|
||||
Text="MyApp" />
|
||||
<TextBlock
|
||||
Margin="0,4,0,0"
|
||||
FontSize="13"
|
||||
Foreground="#8A9099"
|
||||
Text="版本 1.0.0 (Build 20261005)" />
|
||||
<TextBlock
|
||||
Margin="0,16,0,0"
|
||||
FontSize="12"
|
||||
Foreground="#8A9099"
|
||||
Text="© 2026 My Company. All rights reserved." />
|
||||
<StackPanel Margin="0,16,0,0" Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="0,0,8,0"
|
||||
Padding="16,6"
|
||||
Content="检查更新" />
|
||||
<Button Padding="16,6" Content="查看许可" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</TabItem>-->
|
||||
|
||||
</TabControl>
|
||||
</Border>
|
||||
</Window>
|
||||
@@ -0,0 +1,57 @@
|
||||
using _29WxOrderWpf.ViewModels;
|
||||
using AllBase;
|
||||
using AllBase.Model.Config;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
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.Shapes;
|
||||
using Work.BaseForms;
|
||||
|
||||
namespace _29WxOrderWpf.Ctrls.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// SettingsView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SettingsView : Window
|
||||
{
|
||||
private SettingViewModel vm;
|
||||
public SettingsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
vm = new SettingViewModel();
|
||||
this.DataContext = vm;
|
||||
this.Loaded += SettingsView_Loaded;
|
||||
this.Closed += SettingsView_Closed;
|
||||
}
|
||||
private void SettingsView_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var setting = NaiBa.Util.Helper.ConfigHelper.LoadConfig<SettingConfig>(SettingViewModel.SettingFileName);
|
||||
if (setting == null) setting = new SettingConfig();
|
||||
vm.Assign(setting);
|
||||
}
|
||||
private void SettingsView_Closed(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var setting = vm.ToConfig();
|
||||
BaseClass.Setting = setting;
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig(SettingViewModel.SettingFileName, JsonConvert.SerializeObject(setting));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BaseMsgForm.ShowError("配置保存错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -34,8 +34,9 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image
|
||||
Width="50"
|
||||
@@ -56,48 +57,68 @@
|
||||
Foreground="{StaticResource mainColorLightBrush}" />
|
||||
|
||||
<WrapPanel
|
||||
Grid.Column="12"
|
||||
Margin="0,4,80,0"
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center">
|
||||
<Button Click="bt_setting" Style="{StaticResource IconButtonStyle}">
|
||||
<TextBlock
|
||||
FontSize="22"
|
||||
Foreground="{StaticResource mainColorLightBrush}"
|
||||
Style="{StaticResource TextBlockIcon}"
|
||||
Text="{StaticResource txt-settings}" />
|
||||
</Button>
|
||||
<Border
|
||||
Width="1"
|
||||
Height="20"
|
||||
Margin="10,0"
|
||||
Background="#b893b2" />
|
||||
</WrapPanel>
|
||||
<WrapPanel
|
||||
Grid.Column="3"
|
||||
HorizontalAlignment="Right"
|
||||
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" />
|
||||
|
||||
<UniformGrid Rows="2">
|
||||
<WrapPanel>
|
||||
<Label
|
||||
x:Name="lblDebug"
|
||||
Margin="2,4,0,0"
|
||||
Content="[release]"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource mainColorLightBrush}"
|
||||
Opacity="0.7" />
|
||||
<Label
|
||||
x:Name="lblVersion"
|
||||
Margin="2,4,0,0"
|
||||
Content="版本信息"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource mainColorLightBrush}"
|
||||
Opacity="0.7" />
|
||||
|
||||
</WrapPanel>
|
||||
<Label
|
||||
x:Name="lblBalance"
|
||||
Grid.Column="4"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
VerticalContentAlignment="Center"
|
||||
d:Content="快递余额:999.99"
|
||||
Content="{Binding Balance}"
|
||||
Cursor="Hand"
|
||||
FontSize="12"
|
||||
Foreground="#60ff66"
|
||||
MouseLeftButtonUp="lblBalance_MouseLeftButtonUp"
|
||||
Opacity="0.7" />
|
||||
</UniformGrid>
|
||||
</WrapPanel>
|
||||
|
||||
<Label
|
||||
x:Name="lblBalance"
|
||||
<userctrls:UcWindowBoxes
|
||||
x:Name="ucWindowBox"
|
||||
Grid.Column="4"
|
||||
Margin="0,25,80,0"
|
||||
Margin="4"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="{Binding Balance}"
|
||||
Cursor="Hand"
|
||||
FontSize="12"
|
||||
Foreground="#60ff66"
|
||||
MouseLeftButtonUp="lblBalance_MouseLeftButtonUp"
|
||||
Opacity="0.7" />
|
||||
MaxBoxVisibility="Visible" />
|
||||
</Grid>
|
||||
<Grid
|
||||
x:Name="gridContainer"
|
||||
@@ -162,12 +183,7 @@
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<userctrls:UcWindowBoxes
|
||||
x:Name="ucWindowBox"
|
||||
Margin="4"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
MaxBoxVisibility="Visible" />
|
||||
|
||||
|
||||
<Border
|
||||
x:Name="borderMessage"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using _29WxOrderWpf.BaseWindows;
|
||||
using _29WxOrderWpf.Ctrls.BuyerCtrls;
|
||||
using _29WxOrderWpf.Ctrls.OrderCtrls;
|
||||
using _29WxOrderWpf.Ctrls.Settings;
|
||||
using _29WxOrderWpf.Windows.LoginWindows;
|
||||
using AllBase;
|
||||
using AllBase.DouYinModel.Result;
|
||||
@@ -562,5 +563,12 @@ namespace _29WxOrderWpf
|
||||
this.DragMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void bt_setting(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SettingsView view = new SettingsView();
|
||||
view.ShowDialog();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace _29WxOrderWpf.Services;
|
||||
/// 礼物单服务
|
||||
///
|
||||
/// </summary>
|
||||
public class ShipGiftService: SingleInstance<ShipGiftService>
|
||||
public class ShipGiftService : SingleInstance<ShipGiftService>
|
||||
{
|
||||
public enum GiftType
|
||||
{
|
||||
@@ -42,6 +42,11 @@ public class ShipGiftService: SingleInstance<ShipGiftService>
|
||||
{
|
||||
giftAmount = 1.55m;
|
||||
}
|
||||
|
||||
if (BaseClass.Setting.AutoSwitchGiftType && (item.product_price ?? 0) > 6 * 1000)
|
||||
{
|
||||
giftAmount = 1.6m;
|
||||
}
|
||||
decimal amount = giftAmount + BaseClass.OemGiftAmount;
|
||||
|
||||
|
||||
@@ -78,6 +83,6 @@ public class ShipGiftService: SingleInstance<ShipGiftService>
|
||||
var ret = await _api.SendShipGift([orderId], (int)giftType, amount, BaseClass.OemGiftAmount);
|
||||
return ret;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- ========== 侧边 TabControl ========== -->
|
||||
<Style x:Key="SideTabControl" TargetType="TabControl">
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TabControl">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 左侧导航 -->
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
Background="#F7F8FA"
|
||||
BorderBrush="#E8EAED"
|
||||
BorderThickness="0,0,1,0">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="0,12">
|
||||
<TextBlock
|
||||
Margin="20,8,0,16"
|
||||
FontSize="20"
|
||||
FontWeight="Bold"
|
||||
Foreground="{StaticResource mainColorBrush}"
|
||||
Text="设置" />
|
||||
<TabPanel IsItemsHost="True" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
|
||||
<!-- 右侧内容 -->
|
||||
<ScrollViewer
|
||||
Grid.Column="1"
|
||||
Padding="0"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<ContentPresenter ContentSource="SelectedContent" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ========== 侧边 TabItem ========== -->
|
||||
<Style x:Key="SideTabItem" TargetType="TabItem">
|
||||
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TabItem">
|
||||
<Border
|
||||
x:Name="Bd"
|
||||
Margin="0,2"
|
||||
Padding="12,10"
|
||||
Background="Transparent">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
x:Name="Icon"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,12,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="22"
|
||||
Foreground="{StaticResource mainColorBrush}"
|
||||
Style="{StaticResource TextBlockIcon}"
|
||||
Text="{TemplateBinding Tag}" />
|
||||
|
||||
|
||||
<!-- 只给 Header 文字设字号/颜色 -->
|
||||
<ContentPresenter
|
||||
x:Name="HeaderHost"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
ContentSource="Header"
|
||||
TextElement.FontSize="14"
|
||||
TextElement.FontWeight="Normal"
|
||||
TextElement.Foreground="{StaticResource mainColorBrush}" />
|
||||
|
||||
<!-- 选中时的右侧小圆点 -->
|
||||
<Ellipse
|
||||
x:Name="Dot"
|
||||
Grid.Column="2"
|
||||
Width="6"
|
||||
Height="6"
|
||||
VerticalAlignment="Center"
|
||||
Fill="#0078D4"
|
||||
Visibility="Collapsed" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="#ECEEF2" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="#E6F0FB" />
|
||||
<Setter TargetName="Dot" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="HeaderHost" Property="TextElement.Foreground" Value="{StaticResource mainColorBrush}" />
|
||||
<Setter TargetName="HeaderHost" Property="TextElement.FontWeight" Value="SemiBold" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ========== 设置卡片 ========== -->
|
||||
<Style x:Key="SettingsCard" TargetType="Border">
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="BorderBrush" Value="#E8EAED" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="8" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="Margin" Value="0,0,0,16" />
|
||||
</Style>
|
||||
|
||||
<!-- ========== 设置项行 ========== -->
|
||||
<Style x:Key="SettingRow" TargetType="Border">
|
||||
<Setter Property="Padding" Value="16,14" />
|
||||
<Setter Property="BorderBrush" Value="#F0F1F3" />
|
||||
<Setter Property="BorderThickness" Value="0,0,0,1" />
|
||||
</Style>
|
||||
|
||||
<!-- ========== 设置项标题 ========== -->
|
||||
<Style x:Key="SettingTitle" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Foreground" Value="#1F2329" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<!-- ========== 设置项说明 ========== -->
|
||||
<Style x:Key="SettingDesc" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="Foreground" Value="#8A9099" />
|
||||
<Setter Property="Margin" Value="0,4,0,0" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
</Style>
|
||||
|
||||
<!-- ========== 页面标题 ========== -->
|
||||
<Style x:Key="PageTitle" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="22" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="Foreground" Value="#1F2329" />
|
||||
<Setter Property="Margin" Value="0,0,0,4" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="PageSubtitle" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="Foreground" Value="#8A9099" />
|
||||
<Setter Property="Margin" Value="0,0,0,24" />
|
||||
</Style>
|
||||
|
||||
<!-- ========== 开关样式 ========== -->
|
||||
<Style x:Key="ToggleSwitch" TargetType="CheckBox">
|
||||
<Setter Property="Width" Value="44" />
|
||||
<Setter Property="Height" Value="24" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="CheckBox">
|
||||
<Border
|
||||
x:Name="Track"
|
||||
Width="44"
|
||||
Height="24"
|
||||
Background="#D0D3D8"
|
||||
CornerRadius="12">
|
||||
<Ellipse
|
||||
x:Name="Thumb"
|
||||
Width="18"
|
||||
Height="18"
|
||||
Margin="3,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Fill="White" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="Track" Property="Background" Value="#0078D4" />
|
||||
<Setter TargetName="Thumb" Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter TargetName="Thumb" Property="Margin" Value="0,0,3,0" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Track" Property="Opacity" Value="0.9" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,40 @@
|
||||
using AllBase.Model.Config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WPFCommon.Models;
|
||||
|
||||
namespace _29WxOrderWpf.ViewModels;
|
||||
|
||||
public class SettingViewModel : BindableBaseEx
|
||||
{
|
||||
public const string SettingFileName = "setting";
|
||||
public SettingViewModel()
|
||||
{
|
||||
}
|
||||
/// <summary>版本号</summary>
|
||||
public string Version
|
||||
{
|
||||
get => GetValue<string>();
|
||||
private set => SetValue(value);
|
||||
}
|
||||
|
||||
public bool AutoSwitchGiftType
|
||||
{
|
||||
get => GetValue<bool>();
|
||||
set => SetValue(value);
|
||||
}
|
||||
public void Assign(SettingConfig config)
|
||||
{
|
||||
AutoSwitchGiftType = config.AutoSwitchGiftType;
|
||||
}
|
||||
public SettingConfig ToConfig()
|
||||
{
|
||||
return new SettingConfig
|
||||
{
|
||||
AutoSwitchGiftType = AutoSwitchGiftType
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
* 2012-5-9
|
||||
*/
|
||||
using AllBase.DouYinModel.Result;
|
||||
using AllBase.Model.Config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -600,7 +601,7 @@ namespace AllBase
|
||||
public static string MainUserName { get { return string.IsNullOrEmpty(ParentUserName) ? UserName : ParentUserName; } }
|
||||
public static int SaLevel { get; set; }
|
||||
public static bool IsLoginSuccess { get; set; }
|
||||
|
||||
public static SettingConfig Setting { get; set; }
|
||||
/// <summary>
|
||||
/// CPU使用率更新线程
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Model.Config;
|
||||
|
||||
public class SettingConfig
|
||||
{
|
||||
#region 发货
|
||||
/// <summary>
|
||||
/// 自动切换礼物类型
|
||||
/// 超出6元
|
||||
/// </summary>
|
||||
public bool AutoSwitchGiftType { get; set; } = true;
|
||||
#endregion
|
||||
}
|
||||
Reference in new issue
Block a user