protected void Page_Load(object sender, EventArgs e) { // 不是微信内置浏览器 if (!WXManage.IsWXBrowser(Request)) { Response.Redirect("/RequireWX.aspx?url=" + Request.Url); return; } // 未登录,作为报名页面 if (Session["phone"] == null || Session["iden"] == null) { signBtn1.InnerText = "立即报名"; signBtn2.InnerText = "立即报名"; } // 普通会员、管理员可查看 if (Session["iden"] != null && Session["iden"].ToString() != "1" && Session["iden"].ToString() != "5") { Response.Redirect("/UserIndex.aspx"); return; } // 没有参数 if (!Request.QueryString.AllKeys.Contains("aid")) { Response.Redirect("/Activity.aspx"); return; } // 活动ID string aid = Request.QueryString["aid"].ToString(); // 获取活动 var activity = DataBase.Activity.Get(new Objects.Activity() { id = aid }); activity_name.InnerText = activity_name.InnerText.Replace("#title#", activity.title); end_time.InnerText = end_time.InnerText.Replace("#end-time#", activity.timeEnd.ToString("yyyy-MM-dd HH:mm:ss")); js_content.InnerHtml = js_content.InnerHtml.Replace("#content#", activity.content); Title = activity.brief; /* * appId: appId * timestamp: timestamp * nonceStr: nonceStr * signature: signature */ var timestamp = OSecurity.DateTimeToTimeStamp(DateTime.Now); String script = "var appId = '" + WXManage.appID + "';"; script += "var timestamp = '" + timestamp.ToString() + "';"; script += "var nonceStr = 'chenyanhong';"; script += "var signature = '" + WXManage.WXJSSign("chenyanhong", timestamp, Request.Url.ToString().Split('#')[0]) + "';"; script += "var imgUrl = '" + WXManage.QRCode(Request.Url.ToString() + "&uid=" + Session["phone"]) + "';"; if (Session["phone"] != null) { script += "var uid = '" + Session["phone"].ToString() + "';"; } ScriptManager.RegisterClientScriptBlock(this, GetType(), "wxvar", script, true); }
protected void Page_Load(object sender, EventArgs e) { if (!Request.QueryString.AllKeys.Contains("url")) { Response.Redirect("/UserLogin.aspx"); return; } var url = Request.Url.ToString().Substring(Request.Url.ToString().IndexOf('=') + 1); qrcode.Src = WXManage.QRCode(url); }
protected void Page_Load(object sender, EventArgs e) { // 不是微信内置浏览器 if (!WXManage.IsWXBrowser(Request)) { Response.Redirect("/RequireWX.aspx?url=" + Request.Url); return; } // 只有管理员能查看所有活动 if (Session["phone"] == null || Session["iden"].ToString() != "5") { Response.Redirect("/UserIndex.aspx"); return; } string activityHTML = "<a href=\"/ActivityEditor.aspx?aid=#id#\" class=\"weui-media-box weui-media-box_appmsg\">" + " <div class=\"weui-media-box__hd\">" + " <img class=\"weui-media-box__thumb\" src=\"#img#\" alt=\"\">" + " </div>" + " <div class=\"weui-media-box__bd\">" + " <h4 class=\"weui-media-box__title\">#title#</h4>" + " <p class=\"weui-media-box__desc\">#brief#</p>" + " </div>" + "</a>"; // 获取所有活动 var activityList = DataBase.Activity.GetsAll(); activities.InnerHtml = ""; foreach (var activity in activityList) { if (activity.imgSrc == null || activity.imgSrc == "") { activity.imgSrc = WXManage.QRCode(Request.Url.Host + "/ActivityDetail.aspx?aid=" + activity.id); } activities.InnerHtml += activityHTML .Replace("#id#", activity.id) .Replace("#img#", activity.imgSrc) .Replace("#title#", activity.title) .Replace("#brief#", activity.brief); } }
protected void Page_Load(object sender, EventArgs e) { // 不是微信内置浏览器 if (!WXManage.IsWXBrowser(Request)) { Response.Redirect("/RequireWX.aspx?url=" + Request.Url); return; } string activityHTML = "<a href=\"/ActivityDetail.aspx?aid=#id#\" class=\"weui-media-box weui-media-box_appmsg\">" + " <div class=\"weui-media-box__hd\">" + " <img class=\"weui-media-box__thumb\" src=\"#img#\" alt=\"\">" + " </div>" + " <div class=\"weui-media-box__bd\">" + " <h4 class=\"weui-media-box__title\">#title#</h4>" + " <p class=\"weui-media-box__desc\">#brief#</p>" + " </div>" + "</a>"; var activityList = DataBase.Activity.Gets(); activities.InnerHtml = ""; foreach (var activity in activityList) { if (activity.imgSrc == null || activity.imgSrc == "") { activity.imgSrc = WXManage.QRCode(Request.Url.Host + "/ActivityDetail.aspx?aid=" + activity.id); } activities.InnerHtml += activityHTML .Replace("#id#", activity.id) .Replace("#img#", activity.imgSrc) .Replace("#title#", activity.title) .Replace("#brief#", activity.brief); } if (activityList.Count == 0) { activities.InnerHtml = "<p style=\"text-align:center;\">当前没有活动</p>"; } }