添加完成国际化触发器

This commit is contained in:
张航舰 2025-01-09 15:09:34 +08:00
parent c19b32cae3
commit 8fea1ef63f
4 changed files with 395 additions and 596 deletions

View File

@ -3160,3 +3160,84 @@ IP地址:::1
出错时间:11/27/2024 19:32:54
错误信息开始=====>
错误类型:HttpException
错误信息:不允许使用类似“<%$ Resources:Lan, Login %>”的文本表达式。请改用 <asp:Literal runat="server" Text="<%$ Resources:Lan, Login%>" />。
错误堆栈:
在 System.Web.UI.TemplateParser.ProcessError(String message)
在 System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
在 System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
出错时间:01/08/2025 11:15:42
出错文件:http://localhost:1295/Login.aspx
IP地址:::1
出错时间:01/08/2025 11:15:42
错误信息开始=====>
错误类型:HttpException
错误信息:类型“Login”的控件“ctl01”必须放在具有 runat=server 的窗体标记内。
错误堆栈:
在 System.Web.UI.Page.VerifyRenderingInServerForm(Control control)
在 System.Web.UI.WebControls.Login.Render(HtmlTextWriter writer)
在 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
在 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
在 System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
在 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
在 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
在 System.Web.UI.Page.Render(HtmlTextWriter writer)
在 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
在 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
在 System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
出错时间:01/09/2025 02:19:36
出错文件:http://localhost:1295/Login.aspx
IP地址:::1
出错时间:01/09/2025 02:19:36
错误信息开始=====>
错误类型:HttpException
错误信息:不允许使用类似“<%$ Resources:Resources,Login %>”的文本表达式。请改用 <asp:Literal runat="server" Text="<%$ Resources:Resources,Login%>" />。
错误堆栈:
在 System.Web.UI.TemplateParser.ProcessError(String message)
在 System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
在 System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
出错时间:01/09/2025 02:25:08
出错文件:http://localhost:1295/Login.aspx
IP地址:::1
出错时间:01/09/2025 02:25:08
错误信息开始=====>
错误类型:HttpParseException
错误信息:未找到键为“Login”的资源对象。
错误堆栈:
在 System.Web.UI.TemplateParser.ProcessException(Exception ex)
在 System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
在 System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
----错误类型:HttpException
----错误信息:
----未找到键为“Login”的资源对象。
----错误堆栈:
在 System.Web.Compilation.ResourceExpressionBuilder.ParseExpression(String expression, Type propertyType, ExpressionBuilderContext context)
在 System.Web.UI.BoundPropertyEntry.ParseExpression(ExpressionBuilderContext context)
在 System.Web.UI.ControlBuilder.FillUpBoundPropertyEntry(BoundPropertyEntry entry, String name)
在 System.Web.UI.ControlBuilder.AddBoundProperty(String filter, String name, String expressionPrefix, String expression, ExpressionBuilder expressionBuilder, Object parsedExpressionData, Boolean generated, String fieldName, String formatString, Boolean twoWayBound, Boolean encode, Int32 line, Int32 column)
在 System.Web.UI.ControlBuilder.AddBoundProperty(String filter, String name, String expressionPrefix, String expression, ExpressionBuilder expressionBuilder, Object parsedExpressionData, String fieldName, String formatString, Boolean twoWayBound, Boolean encode, Int32 line, Int32 column)
在 System.Web.UI.ControlBuilder.PreprocessAttribute(String filter, String attribname, String attribvalue, Boolean mainDirectiveMode, Int32 line, Int32 column)
在 System.Web.UI.ControlBuilder.PreprocessAttributes(ParsedAttributeCollection attribs)
在 System.Web.UI.ControlBuilder.Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, String tagName, String id, IDictionary attribs)
在 System.Web.UI.ControlBuilder.CreateBuilderFromType(TemplateParser parser, ControlBuilder parentBuilder, Type type, String tagName, String id, IDictionary attribs, Int32 line, String sourceFileName)
在 System.Web.UI.ControlBuilder.CreateChildBuilder(String filter, String tagName, IDictionary attribs, TemplateParser parser, ControlBuilder parentBuilder, String id, Int32 line, VirtualPath virtualPath, Type& childType, Boolean defaultProperty)
在 System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText)
在 System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
出错时间:01/09/2025 02:29:04
出错文件:http://localhost:1295/Login.aspx
IP地址:::1
出错时间:01/09/2025 02:29:04

View File

@ -15,61 +15,24 @@ Inherits="FineUIPro.Web.Login" %>
alt=""
class="bi-single bi-img display-block"
src="./images/login.png"
style="
height: 100%;
left: 0px;
top: 0px;
bottom: 0px;
position: absolute;
display: none;
"
/>
style="height: 100%; left: 0px; top: 0px; bottom: 0px; position: absolute; display: none;" />
<img
alt=""
src="res/index/images/iconlogo.png"
style="
height: auto;
width: 420px;
left: 80px;
top: 65px;
position: absolute;
"
/>
style="height: auto; width: 420px; left: 80px; top: 65px; position: absolute;" />
<div
class="bi-flex-center-adapt-layout login-area"
style="
width: 23%;
right: 10%;
top: 0px;
bottom: 0px;
position: absolute;
"
>
style="width: 23%; right: 10%; top: 0px; bottom: 0px; position: absolute;">
<!-- <div class="bi-absolute-layout edit-area" height: 440px;-->
<div
class="bi-absolute-layout"
style="
width: 100%;
height: 420px;
position: relative;
flex-shrink: 0;
margin: 0px;
"
>
style="width: 100%; height: 420px; position: relative; flex-shrink: 0; margin: 0px;">
<div
class="bi-horizon-auto-layout"
style="
height: 100px;
left: 0px;
right: 0px;
top: 40px;
position: absolute;
"
>
style="height: 100px; left: 0px; right: 0px; top: 40px; position: absolute;">
<div
class="bi-flex-center-adapt-layout"
style="position: relative; margin: 0px auto"
>
style="position: relative; margin: 0px auto">
<%--
<img
class="bi-single bi-img display-block"
@ -85,376 +48,158 @@ Inherits="FineUIPro.Web.Login" %>
</div>
<div
class="bi-single bi-label dec-login-visual-title bi-text"
style="
height: 30px;
line-height: 30px;
text-align: center;
white-space: nowrap;
text-overflow: ellipsis;
position: relative;
margin: 5px auto 0px 5px;
font-family: 'Microsoft YaHei';
font-size: 26px;
letter-spacing: 2px;
font-weight: 600;
"
>
style="height: 30px; line-height: 30px; text-align: center; white-space: nowrap; text-overflow: ellipsis; position: relative; margin: 5px auto 0px 5px; font-family: 'Microsoft YaHei'; font-size: 26px; letter-spacing: 2px; font-weight: 600;">
数字化施工管理信息平台
</div>
</div>
<div
class="dec-login-index bi-tab bi-v-tape-layout edit-area"
style="
left: 0px;
right: 0px;
top: 90px;
bottom: 0px;
position: absolute;
"
>
style="left: 0px; right: 0px; top: 90px; bottom: 0px; position: absolute;">
<div
class="bi-card-layout"
style="
position: absolute;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
"
>
style="position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px;">
<div
class="dec-login-login bi-absolute-layout"
style="
position: relative;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
"
>
style="position: relative; top: 0px; left: 0px; width: 100%; height: 100%;">
<div class="bg-login">
<img
class="bi-single bi-img display-block"
src="res/index/images/loginBg.jpg"
style="
width: auto;
height: 335px;
width: 355px;
position: absolute;
flex-shrink: 0;
margin: 0px;
border-radius: 10px;
box-shadow: 0px 20px 20px #1b1b2a;
"
/>
style="width: auto; height: 335px; width: 355px; position: absolute; flex-shrink: 0; margin: 0px; border-radius: 10px; box-shadow: 0px 20px 20px #1b1b2a;" />
</div>
<div
class="bi-vertical-layout"
style="
overflow: hidden auto;
left: 40px;
right: 40px;
top: 0px;
bottom: 0px;
position: absolute;
"
>
style="overflow: hidden auto; left: 40px; right: 40px; top: 0px; bottom: 0px; position: absolute;">
<div
class="bi-vertical-layout"
style="
overflow: hidden auto;
position: relative;
margin-top: 50px;
border-color: #fff;
"
>
style="overflow: hidden auto; position: relative; margin-top: 50px; border-color: #fff;">
<div
class="dec-login-item bi-vertical-layout"
style="
overflow: hidden auto;
position: relative;
margin-bottom: 10px;
"
>
style="overflow: hidden auto; position: relative; margin-bottom: 10px;">
<div
class="bi-h-tape-layout"
style="height: 36px; position: relative"
>
style="height: 36px; position: relative">
<div
class="bi-flex-vertical-center-adapt-layout item-icon login-username-font bi-flex-horizontal-layout v-middle h-left"
style="
width: 26px;
position: absolute;
top: 0px;
bottom: 0px;
left: 0px;
"
>
style="width: 26px; position: absolute; top: 0px; bottom: 0px; left: 0px;">
<div
class="bi-flex-center-adapt-layout"
style="position: relative; flex-shrink: 0"
>
style="position: relative; flex-shrink: 0">
<i
class="bi-single x-icon b-font horizon-center display-block"
style="
position: relative;
flex-shrink: 0;
margin: 0px;
"
></i>
style="position: relative; flex-shrink: 0; margin: 0px;"></i>
</div>
</div>
<div
class="bi-absolute-layout"
style="
position: absolute;
top: 0px;
bottom: 0px;
left: 30px;
right: 0px;
"
>
style="position: absolute; top: 0px; bottom: 0px; left: 30px; right: 0px;">
<input
type="text"
id="user"
placeholder="用户名"
class="bi-single bi-input display-block overflow-dot"
autocomplete="off"
style="
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
position: absolute;
font-size: 16px;
"
/>
style="left: 0px; right: 0px; top: 0px; bottom: 0px; position: absolute; font-size: 16px;" />
</div>
</div>
<div
class="bi-single bi-label bi-border-top bi-text"
style="
height: 24px;
line-height: 24px;
text-align: center;
white-space: nowrap;
text-overflow: ellipsis;
position: relative;
"
></div>
style="height: 24px; line-height: 24px; text-align: center; white-space: nowrap; text-overflow: ellipsis; position: relative;">
</div>
<div
class="bi-single bi-label bi-border-top error bi-text"
style="
height: 24px;
display: none;
line-height: 24px;
text-align: left;
white-space: nowrap;
text-overflow: ellipsis;
position: relative;
"
></div>
style="height: 24px; display: none; line-height: 24px; text-align: left; white-space: nowrap; text-overflow: ellipsis; position: relative;">
</div>
</div>
<div
class="dec-login-item bi-vertical-layout"
style="
display: none;
overflow: hidden auto;
position: relative;
margin-bottom: 10px;
"
></div>
style="display: none; overflow: hidden auto; position: relative; margin-bottom: 10px;">
</div>
</div>
<div
class="bi-vertical-layout"
style="overflow: hidden auto; position: relative"
>
style="overflow: hidden auto; position: relative">
<div
class="dec-login-item bi-vertical-layout"
style="
overflow: hidden auto;
position: relative;
margin-bottom: 10px;
"
>
style="overflow: hidden auto; position: relative; margin-bottom: 10px;">
<div
class="bi-h-tape-layout"
style="height: 36px; position: relative"
>
style="height: 36px; position: relative">
<div
class="bi-flex-vertical-center-adapt-layout item-icon login-password-font bi-flex-horizontal-layout v-middle h-left"
style="
width: 26px;
position: absolute;
top: 0px;
bottom: 0px;
left: 0px;
"
>
style="width: 26px; position: absolute; top: 0px; bottom: 0px; left: 0px;">
<div
class="bi-flex-center-adapt-layout"
style="position: relative; flex-shrink: 0"
>
style="position: relative; flex-shrink: 0">
<i
class="bi-single x-icon b-font horizon-center display-block"
style="
position: relative;
flex-shrink: 0;
margin: 0px;
"
></i>
style="position: relative; flex-shrink: 0; margin: 0px;"></i>
</div>
</div>
<div
class="bi-absolute-layout"
style="
position: absolute;
top: 0px;
bottom: 0px;
left: 30px;
right: 0px;
"
>
style="position: absolute; top: 0px; bottom: 0px; left: 30px; right: 0px;">
<input
id="pwd"
autocomplete="off"
type="password"
placeholder="密码"
class="bi-single bi-input display-block overflow-dot"
style="
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
position: absolute;
font-size: 16px;
"
/>
style="left: 0px; right: 0px; top: 0px; bottom: 0px; position: absolute; font-size: 16px;" />
</div>
</div>
<div
class="bi-single bi-label bi-border-top bi-text"
style="
height: 24px;
line-height: 24px;
text-align: center;
white-space: nowrap;
text-overflow: ellipsis;
position: relative;
"
></div>
style="height: 24px; line-height: 24px; text-align: center; white-space: nowrap; text-overflow: ellipsis; position: relative;">
</div>
<div
class="bi-single bi-label bi-border-top error bi-text"
style="
height: 24px;
display: none;
line-height: 24px;
text-align: left;
white-space: nowrap;
text-overflow: ellipsis;
position: relative;
"
></div>
style="height: 24px; display: none; line-height: 24px; text-align: left; white-space: nowrap; text-overflow: ellipsis; position: relative;">
</div>
</div>
<div
class="dec-login-item bi-vertical-layout"
style="
display: none;
overflow: hidden auto;
position: relative;
margin-bottom: 10px;
"
></div>
style="display: none; overflow: hidden auto; position: relative; margin-bottom: 10px;">
</div>
</div>
<div
class="bi-horizon-auto-layout"
style="position: relative"
>
style="position: relative">
<div
class="dec-login-slider bi-absolute-layout"
style="
display: none;
width: 190px;
height: 26px;
position: relative;
margin: 0px auto;
"
></div>
style="display: none; width: 190px; height: 26px; position: relative; margin: 0px auto;">
</div>
</div>
<div
class="bi-single bi-label login-error bi-text"
style="
height: 20px;
display: none;
line-height: 20px;
text-align: left;
white-space: nowrap;
text-overflow: ellipsis;
position: relative;
"
></div>
style="height: 20px; display: none; line-height: 20px; text-align: left; white-space: nowrap; text-overflow: ellipsis; position: relative;">
</div>
<div
class="bi-left-right-vertical-adapt-layout bi-float-left-layout clearfix bi-float-right-layout"
style="position: relative; margin-bottom: 30px"
>
style="position: relative; margin-bottom: 30px">
<div
id="activewrap"
class="bi-flex-vertical-center-adapt-layout bi-flex-horizontal-layout v-middle h-left active"
style="height: 100%; position: relative; float: left"
>
style="height: 100%; position: relative; float: left">
<div
class="bi-single bi-basic-button cursor-pointer bi-multi-select-item bi-flex-vertical-center-adapt-layout bi-flex-horizontal-layout v-middle h-left"
style="
height: 16px;
position: relative;
flex-shrink: 0;
margin-left: -5px;
"
>
style="height: 16px; position: relative; flex-shrink: 0; margin-left: -5px;">
<div
class="bi-flex-center-adapt-layout"
style="
width: 26px;
position: relative;
flex-shrink: 0;
"
>
style="width: 26px; position: relative; flex-shrink: 0;">
<div
id="active"
class="bi-single bi-basic-button cursor-pointer bi-checkbox bi-flex-center-adapt-layout active"
style="
width: 16px;
height: 16px;
position: relative;
flex-shrink: 0;
margin: 0px;
"
>
style="width: 16px; height: 16px; position: relative; flex-shrink: 0; margin: 0px;">
<div
class="checkbox-content"
style="
width: 14px;
height: 14px;
position: relative;
flex-shrink: 0;
margin: 0px;
color: #fff;
"
></div>
style="width: 14px; height: 14px; position: relative; flex-shrink: 0; margin: 0px; color: #fff;">
</div>
</div>
</div>
<div
class="bi-single bi-label list-item-text bi-text"
style="
height: 16px;
line-height: 16px;
text-align: left;
white-space: nowrap;
text-overflow: ellipsis;
position: relative;
flex-shrink: 0;
"
>
style="height: 16px; line-height: 16px; text-align: left; white-space: nowrap; text-overflow: ellipsis; position: relative; flex-shrink: 0;">
一周内自动登录
</div>
</div>
@ -463,34 +208,22 @@ Inherits="FineUIPro.Web.Login" %>
<!-- 添加语言切换下拉框 -->
<div
class="bi-horizon-auto-layout"
style="position: relative; margin-bottom: 10px"
>
style="position: relative; margin-bottom: 10px">
<select
id="languageSelect"
class="bi-single bi-input display-block overflow-dot"
style="
height: 30px;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
position: relative;
font-size: 16px;
margin: 8px;
"
>
<option value="zh-CN" style="color: aliceblue">
中文
style="height: 30px; left: 0px; right: 0px; top: 0px; bottom: 0px; position: relative; font-size: 16px; margin: 8px;">
<option value="zh-CN" style="color: aliceblue">中文
</option>
<option value="en-US" style="color: aliceblue">
English
<option value="en-US" style="color: aliceblue">English
</option>
<option value="zh-CN" style="color: aliceblue">中文
</option>
</select>
</div>
<div
class="bi-flex-vertical-center-adapt-layout bi-flex-horizontal-layout v-middle h-left"
style="height: 100%; position: relative; float: right"
>
style="height: 100%; position: relative; float: right">
<%--
<div
class="bi-single bi-basic-button cursor-pointer bi-button button-common bi-label bi-flex-center-adapt-layout clear"
@ -510,45 +243,23 @@ Inherits="FineUIPro.Web.Login" %>
<div
class="bi-horizon-auto-layout"
style="position: relative"
>
style="position: relative">
<div
class="bi-single bi-basic-button cursor-pointer bi-button login-button button-common bi-label bi-flex-center-adapt-layout"
style="
width: 190px;
height: 40px;
line-height: 38px;
min-width: 80px;
position: relative;
margin: 0px auto;
box-shadow: 0px 10px 20px #2d2353;
"
>
style="width: 190px; height: 40px; line-height: 38px; min-width: 80px; position: relative; margin: 0px auto; box-shadow: 0px 10px 20px #2d2353;">
<div
id="login"
class="bi-single bi-text"
style="
padding-left: 10px;
padding-right: 10px;
max-width: 100%;
text-align: left;
white-space: nowrap;
text-overflow: ellipsis;
position: relative;
flex-shrink: 0;
margin: 0px;
font-weight: bold;
"
>
登 录
style="padding-left: 10px; padding-right: 10px; max-width: 100%; text-align: left; white-space: nowrap; text-overflow: ellipsis; position: relative; flex-shrink: 0; margin: 0px;">
<asp:Literal runat="server" Text="<%$ Resources:Lan,Login%>" />
</div>
</div>
</div>
<div
id="error"
class="bi-vertical-layout login-error"
style="display: none; position: relative; margin-top: 20px"
></div>
style="display: none; position: relative; margin-top: 20px">
</div>
</div>
</div>
</div>
@ -559,8 +270,7 @@ Inherits="FineUIPro.Web.Login" %>
</body>
<script
type="text/javascript"
src="res/index/js/jquery-3.4.1.min.js"
></script>
src="res/index/js/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
var $activeWrap = document.getElementById("activewrap");
var $active = document.getElementById("active");
@ -581,22 +291,14 @@ Inherits="FineUIPro.Web.Login" %>
$("#user").val(user);
$("#pwd").val(pwd);
var currentLanguage = getCookie("language") || "zh-CN";
setLanguage(currentLanguage);
var currentLanguage = getCookie("Language") || "zh-CN";
}); // 为下拉框添加事件监听器
$("#languageSelect").change(function () {
currentLanguage = $(this).val();
setLanguage(currentLanguage);
setCookie("language", currentLanguage);
// 刷新页面以应用新的语言设置
setCookie("Language", currentLanguage);
location.reload();
});
// 设置页面语言
function setLanguage(language) {
// 这里可以添加逻辑来动态更新页面文本
// 但由于ASP.NET的资源绑定是在服务器端完成的刷新页面是必要的
}
$("#login").click(function () {
login();
});

View File

@ -3,7 +3,9 @@
using BLL;
using System;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Services;
@ -65,7 +67,6 @@
{
if (!IsPostBack)
{
}
}
#endregion

View File

@ -4,10 +4,12 @@ using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Web;
using System.Web.UI;
using AspNet = System.Web.UI.WebControls;
@ -44,6 +46,32 @@ namespace FineUIPro.Web
#region OnInit
/// <summary>
/// 初始化多语言资源
/// </summary>
protected override void InitializeCulture()
{
HttpCookie langCookie = Request.Cookies["Language"];
// 默认为中文
var langName = "zh-CN";
if (langCookie != null)
{
// 简单的转换zh_CN -> zh-CN
langName = langCookie.Value.Replace("_", "-");
if (langName == "en")
{
langName = "en-US";
}
}
// 设置语言
var cultureInfo = CultureInfo.CreateSpecificCulture(langName);
Thread.CurrentThread.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureInfo;
base.InitializeCulture();
}
protected override void OnInit(EventArgs e)
{
string url = HttpContext.Current.Request.Path;
@ -93,21 +121,6 @@ namespace FineUIPro.Web
}
}
HttpCookie langCookie = Request.Cookies["Language"];
if (langCookie != null)
{
string langValue = langCookie.Value;
try
{
// 是否为内置语言
pm.Language = (Language)Enum.Parse(typeof(Language), langValue, true);
}
catch (Exception)
{
pm.CustomLanguage = langValue;
}
}
// 1. 仅显示基础版示例, 2. 基础版
// 上述两种情况都要禁用EnableAnimation、DisplayMode、MobileAdaption
bool showOnlyBase = false;
@ -206,6 +219,8 @@ namespace FineUIPro.Web
//}
}
/// <summary>
/// UNLOAD事件发生在页面装载顺序的最后。
/// 在这里处理的是DBLIST数据库连接字典。