Files
17168ERP/web/admin/item/TabletDesigner.aspx.cs
2026-03-02 17:52:21 +08:00

76 lines
2.9 KiB
C#

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
// 定義與前端一致的元素結構
public class TabletElement
{
public string id { get; set; }
public string type { get; set; }
public string text { get; set; }
public double x { get; set; }
public double y { get; set; }
public double? width { get; set; }
public double? height { get; set; }
public ElementStyle style { get; set; }
public string hidden { get; set; }
}
public class ElementStyle
{
public double fontSize { get; set; }
public string fontFamily { get; set; }
public bool isVertical { get; set; }
public double letterSpacing { get; set; }
public double lineHeight { get; set; }
public double? itemSpacing { get; set; }
public string visibility { get; set; }
}
public partial class admin_item_TabletDesigner :MyWeb.config
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public static string GetConfig()
{
// 模擬原本的 GetConfig() 行為
var config = new
{
elements = new List<TabletElement> {
new TabletElement {
id = "address", type = "address", text = "台中市潭子區中山路", x = 160, y = 80,
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5,visibility="" }
},
new TabletElement {
id = "title1", type = "ancestor", text = "氏歷代祖先", x = 130, y = 80,
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5 ,visibility="" }
},
new TabletElement {
id = "titletriangle", type = "roster", text = "張一\n李二\n陳三", x = 130, y = 80,
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5,visibility="hidden" }
},
new TabletElement
{
id="combined",type="combined-center",text="林張吳\n氏歷代祖先", x = 130, y = 80,
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5 ,visibility="hidden" }
}, new TabletElement
{
id="alive",type="alive",text="劉大哥", x = 60, y = 200,
style = new ElementStyle { fontSize = 18, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5 ,visibility="" }
}
},
paper = new { width = 100, height = 272, name = "Yellow" }
};
return JsonConvert.SerializeObject(config);
}
}