提交代码

This commit is contained in:
2023-12-04 12:11:39 +08:00
parent ea22fad037
commit 1ce0a6da17
14 changed files with 334 additions and 61 deletions
@@ -0,0 +1,26 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LookPic.aspx.cs" Inherits="FineUIPro.Web.AttachFile.LookPic" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="TabStrip1" runat="server" />
<f:TabStrip ID="TabStrip1" IsFluid="true" ShowBorder="true" ActiveTabIndex="0"
runat="server">
<Tabs>
<f:Tab ID="Tab1" EnableIFrame="true"
Title="预览" runat="server">
</f:Tab>
</Tabs>
</f:TabStrip>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" hidden="true" Text="关闭" runat="server" Icon="SystemClose" Size="Medium">
</f:Button>
<iframe id="LookHtml" runat="server" width="700" height="600" name="LookHtml" hidden="hidden"></iframe>
</form>
</body>
</html>
@@ -0,0 +1,45 @@
using BLL;
using System;
using System.IO;
namespace FineUIPro.Web.AttachFile
{
public partial class LookPic : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
var url = Request.Params["fileUrl"];
//var Baseurl = "https://view.officeapps.live.com/op/embed.aspx?src=";
// var Baseurl = "https://view.xdocin.com/view?src=";
var Fileurl = Funs.SGGLUrl + url.Replace(Funs.RootPath, "");
//var newurl = "";
//var FiletExtension = Path.GetExtension(url);
//if (FiletExtension == ".docx" || FiletExtension == ".doc" || FiletExtension == ".xls" || FiletExtension == ".xlsx")
//{
// newurl = Baseurl + Fileurl;
//}
//else if (FiletExtension == ".txt" || FiletExtension == "pdf")
//{
// newurl = Fileurl;
//}
//else
//{
// newurl = Fileurl;
//}
this.LookHtml.Src = Fileurl;
this.Tab1.IFrameUrl = Fileurl;
//StreamReader fread = new StreamReader(url, System.Text.Encoding.GetEncoding("gb2312"));
//string ss = fread.ReadToEnd();
//Response.Write(ss);
//fread.Close();
//fread.Dispose();
}
}
}
}
+69
View File
@@ -0,0 +1,69 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.AttachFile {
public partial class LookPic {
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// TabStrip1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TabStrip TabStrip1;
/// <summary>
/// Tab1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Tab Tab1;
/// <summary>
/// btnClose 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnClose;
/// <summary>
/// LookHtml 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlIframe LookHtml;
}
}
@@ -376,8 +376,14 @@ namespace FineUIPro.Web.AttachFile
}
else
{
ShowNotify("不支持预览", MessageBoxIcon.Warning);
if (FiletExtension == ".gif" || FiletExtension == ".jpg" || FiletExtension == ".jpeg" || FiletExtension == ".bmp" || FiletExtension == ".png")
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../AttachFile/LookPic.aspx?fileUrl={0}", url, "查看 -")));
}
else
{
ShowNotify("不支持预览", MessageBoxIcon.Warning);
}
}
//if (FiletExtension == ".docx" || FiletExtension == ".pdf")
//{