public override void ProcessActivity(WebRequest request, WebResponse response) { var identity = UMC.Security.Identity.Current; var userId = identity.Id; var form = (request.SendValues ?? new UMC.Web.WebMeta()).GetDictionary(); var webr = UMC.Data.WebResource.Instance(); if (form.ContainsKey("limit") == false) { var buider = new UISectionBuilder(request.Model, request.Command, request.Arguments); this.Context.Send(buider.Builder(), true); } var logoUrl = webr.ResolveUrl(userId.Value, "1", 4); var members = identity.IsAuthenticated ? Utility.CMS.ObjectEntity <UMC.Data.Entities.ProjectMember>() .Where.And().Equal(new Data.Entities.ProjectMember { user_id = userId }) .Entities.Count() : 0; var suject = identity.IsAuthenticated ? Utility.CMS.ObjectEntity <Subject>() .Where.And().Equal(new Subject { user_id = userId }) .Entities.GroupBy().Sum(new Subject { Reply = 0 }) .Sum(new Subject { Look = 0 }).Count(new Subject { Seq = 0 }).Single() : new Subject() { Seq = 0, Reply = 0, Look = 0 }; if (identity.IsAuthenticated) { members += Utility.CMS.ObjectEntity <UMC.Data.Entities.Project>() .Where.And().Equal(new Data.Entities.Project { user_id = userId }) .Entities.Count(); } var Discount = new UIHeader.Portrait(identity.IsAuthenticated ? logoUrl : "https://oss.365lu.cn/css/images/header_image.png"); ; var user = identity; Discount.Value(user.IsAuthenticated ? user.Alias : "请登录"); Discount.Click(new UIClick().Send("Account", "Self")); if (user.IsAuthenticated) { var sign = Data.Database.Instance().ObjectEntity <Data.Entities.Account>() .Where.And().Equal(new Data.Entities.Account { user_id = userId, Type = Security.Account.SIGNATURE_ACCOUNT_KEY }).Entities.Single(); //if (sign != null) Discount.Time(sign != null ? sign.Name : " ");// user.ActiveTime.ToString()); } else { Discount.Time(" "); } var color = 0x63b359; Discount.Gradient(color, color); var header = new UIHeader(); var title = UITitle.Create(); title.Title = "我的"; header.AddPortrait(Discount); title.Style.BgColor(color); title.Style.Color(0xfff); var ui = UISection.Create(header, title); var uIIcon = new UIIconNameDesc(new UIIconNameDesc.Item('\uF19d', "参与项目", members + "项").Color(0x40c9c6)); if (user.IsAuthenticated) { uIIcon.Button("查看", UIClick.Pager("Subject", "Account", new WebMeta().Put("selectIndex", 1)), 0x1890ff); } else { uIIcon.Button("请登录", new UIClick().Send("Account", "Login"), 0xb7babb); } ui.Add(uIIcon); uIIcon = new UIIconNameDesc(new UIIconNameDesc.Item('\uF02d', "知识创作", suject.Seq + "篇").Color(0x36a3f7), new UIIconNameDesc.Item('\uf0e6', "被评论", suject.Reply + "次").Color(0x34bfa3)); //new UIIconNameDesc.Item('\uf06e', "被浏览", suject.Look + "次").Color(0xf4516c), ui.Add(uIIcon); ui.NewSection() .AddCell('\uf198', "新建文档", "采用Markdown格式编写", new Web.UIClick("Markdown").Send("Subject", "Content")) .AddCell('\uf13b', "新建富文本文档", "采用富文本格式编写", new Web.UIClick("News").Send("Subject", "Content")) .AddCell('\uf0c5', "抓取文档", "从粘贴板版网址中抓取文档", new Web.UIClick() { Key = "CaseCMS" }); ui.NewSection().AddCell('\uf2e1', "扫一扫", "", new Web.UIClick() { Key = "Scanning" }); ui.NewSection() //.AddCell('\uf19c', "切换企业", "", Web.UIClick.Pager("Platform", "Corp", true)) .AddCell('\uf013', "设置", "", Web.UIClick.Pager("UI", "Setting", true, "Close")); response.Redirect(ui); }
public override void ProcessActivity(WebRequest request, WebResponse response) { var Type = this.AsyncDialog("Type", "Client"); var user = UMC.Security.Identity.Current; switch (Type) { case "Client": if (user.IsAuthenticated == false) { response.Redirect(request.Model, "Login"); } break; case "Cashier": if (request.IsCashier == false) { response.Redirect("Settings", "Login"); } break; } var Model = this.AsyncDialog("Model", gkey => { WebMeta form = request.SendValues ?? new UMC.Web.WebMeta(); if (form.ContainsKey("limit") == false) { this.Context.Send(new UISectionBuilder(request.Model, request.Command, request.Arguments) .RefreshEvent("UI.Setting", "image", "Email", "Mobile") .Builder(), true); } var account = Security.Account.Create(user.Id.Value); var dic = UMC.Web.UISection.Create(); var name = user.Name; switch (Type) { default: dic.Title = new UITitle("账户信息"); var imageTextView = new UMC.Web.UI.UIImageTextValue(Data.WebResource.Instance().ImageResolve(user.Id.Value, "1", 4), "头像", ""); imageTextView.Style.Name("image-width", "100"); imageTextView.Click(new UIClick("id", user.Id.ToString(), "seq", "1") { Model = "Design", Command = "Picture" }); //dic.AddImageTextValue(Data.WebResource.Instance().ImageResolve(user.Id.Value, "1", 4), "头像", 100, new UIClick("id", user.Id.ToString(), "seq", "1") //{ Model = "Design", Command = "Picture" }); dic.Add(imageTextView); dic.AddCell("昵称", user.Alias, new UIClick(new WebMeta(request.Arguments).Put(gkey, "Alias")).Send(request.Model, request.Command)); dic.AddCell('\uf084', "登录账号", name, new UIClick() { Model = "Account", Command = "Password" }); break; case "Small": var Discount = new UIHeader.Portrait(Data.WebResource.Instance().ImageResolve(user.Id.Value, "1", 4)); Discount.Value(user.Alias); var ac2 = account[Security.Account.SIGNATURE_ACCOUNT_KEY]; Discount.Time(ac2 == null ? "未有签名" : ac2.Name); var color = 0xfff; Discount.Gradient(color, color); Discount.Click(new UIClick("id", user.Id.ToString(), "seq", "1") { Model = "Design", Command = "Picture" }); var header = new UIHeader(); var style = new UIStyle(); header.AddPortrait(Discount); header.Put("style", style); style.Name("value").Color(0x111).Size(18).Click(new UIClick(new WebMeta(request.Arguments).Put(gkey, "Alias")).Send(request.Model, request.Command)); style.Name("time").Click(new UIClick(new WebMeta(request.Arguments).Put(gkey, "Signature")).Send(request.Model, request.Command)); dic.UIHeader = header; break; } var ac = account[Security.Account.EMAIL_ACCOUNT_KEY]; if (ac != null && String.IsNullOrEmpty(ac.Name) == false) { name = ac.Name; int c = name.IndexOf('@'); if (c > 0) { var cname = name.Substring(0, c); name = name.Substring(0, 2) + "***" + name.Substring(c); } if ((ac.Flags & Security.UserFlags.UnVerification) == Security.UserFlags.UnVerification) { name = name + "(未验证)"; } } else { name = "点击绑定"; } var cui = Type == "Small" ? dic : dic.NewSection(); cui.AddCell('\uf199', "邮箱", name, new UIClick() { Command = "Email", Model = "Account" }); ac = account[Security.Account.MOBILE_ACCOUNT_KEY]; if (ac != null && String.IsNullOrEmpty(ac.Name) == false) { name = ac.Name; if (name.Length > 3) { name = name.Substring(0, 3) + "****" + name.Substring(name.Length - 3); } if ((ac.Flags & Security.UserFlags.UnVerification) == Security.UserFlags.UnVerification) { name = name + "(未验证)"; } } else { name = "点击绑定"; } cui.AddCell('\ue91a', "手机号码", name, new UIClick() { Command = "Mobile", Model = "Account" }); switch (Type) { case "Small": response.Redirect(dic); break; default: ac = account[Security.Account.SIGNATURE_ACCOUNT_KEY]; dic.NewSection().AddCell("个性签名", ac == null ? "未有签名" : ac.Name, new UIClick(new WebMeta(request.Arguments).Put(gkey, "Signature")).Send(request.Model, request.Command)); break; } if (request.IsApp == false && request.IsWeiXin == false) { UICell cell = UICell.Create("UI", new UMC.Web.WebMeta().Put("text", "退出登录").Put("Icon", "\uf011").Put("click", new UIClick() { Model = "Account", Command = "Close" })); cell.Style.Name("text", new UIStyle().Color(0xf00)); dic.NewSection().NewSection().Add(cell); } response.Redirect(dic); return(this.DialogValue("none")); }); switch (Model) { case "Alias": String Alias = this.AsyncDialog("Alias", a => new UITextDialog() { Title = "修改别名", DefaultValue = user.Alias }); Membership.Instance().ChangeAlias(user.Name, Alias); this.Prompt(String.Format("您的账户的别名已修改成{0}", Alias), false); this.Context.Send("UI.Setting", true); break; case "Signature": var account = Security.Account.Create(user.Id.Value); var ac = account[Security.Account.SIGNATURE_ACCOUNT_KEY]; var reset = Web.UIFormDialog.AsyncDialog("value", g => { var selt = new Web.UIFormDialog(); selt.Title = "个性签名"; selt.AddTextarea("个性签名", "Signature", ac == null ? "" : ac.Name); selt.Submit("确认提交", request, "UI.Setting"); return(selt); }); var Signature = reset["Signature"]; Security.Account.Post(Signature, user.Id.Value, Security.UserFlags.Normal, Security.Account.SIGNATURE_ACCOUNT_KEY); WebMeta print = new UMC.Web.WebMeta(); print["type"] = "UI.Setting"; print["Signature"] = Signature; this.Context.Send(print, true); break; } }