修复cookies删除不成功;修复后台批量操作因更新boottable后无法获取选中id

This commit is contained in:
2020-10-23 14:46:40 +08:00
parent 13c6ee54ab
commit c22c5dd51c
10 changed files with 60 additions and 16 deletions
+8 -1
View File
@@ -57,7 +57,14 @@ namespace COMCMS.Common
/// <param name="strKey"></param>
public static void ClearCookies(string strKey)
{
MyHttpContext.Current.Response.Cookies.Delete(strKey);
CookieOptions op = new CookieOptions
{
Expires = DateTime.Now.AddMinutes(-1),
Path = "/",
HttpOnly = true,
SameSite = SameSiteMode.Lax
};
MyHttpContext.Current.Response.Cookies.Delete(strKey, op);
}
#endregion
}
+1 -1
View File
@@ -38,7 +38,7 @@ namespace COMCMS.Common
StringBuilder strPage = new StringBuilder();
string pageLink = "";// url + "?id=" + HttpContext.Current.Request.QueryString["id"] + "&page={0}";
string strQueryString = MyHttpContext.Current.Request.QueryString.ToString().ToLower();
if (isRewrite != 5)
if (isRewrite != 5 && isRewrite != 99)
url = url.ToLower();
pageLink = url + "?" + strQueryString;
string currPage = MyHttpContext.Current.Request.Query["page"];
+30
View File
@@ -228,6 +228,36 @@ namespace COMCMS.Core
else
return null;
}
/// <summary>
/// 获取前几条文章
/// </summary>
/// <param name="kid">栏目id</param>
/// <param name="records">条数</param>
/// <returns></returns>
public static IList<Article> FindTopList(int kid, int records, bool isShowSub = false)
{
if (!isShowSub)
return FindAll(_.KId == kid & _.IsHide == 0, _.Id.Desc(), null, 0, records);
else
{
Expression ex = _.IsHide == 0;
List<int> kids = new List<int>();
kids.Add(kid);
IList<ArticleCategory> subkinds = ArticleCategory.FindByParentID(kid);
if (subkinds != null && subkinds.Count > 0)
{
foreach (var item in subkinds)
{
kids.Add(item.Id);
}
}
ex &= Article._.KId.In(kids);
return FindAll(ex, _.Id.Desc(), null, 0, records);
}
}
#endregion
}
}
+2 -1
View File
@@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Xml.Serialization;
using COMCMS.Common;
using NewLife;
using NewLife.Data;
using NewLife.Log;
@@ -359,7 +360,7 @@ namespace COMCMS.Core
}
else
{
re += " &gt; " + string.Format(tpl, "/article/index/" + model.Id, model.KindName);
re += " &gt; " + string.Format(tpl, ViewsHelper.EchoURL(Utils.CMSType.ArticleCategory, kid), model.KindName);
if (model.PId != 0)
{
re = GetNav(model.PId) + re;
@@ -7,7 +7,7 @@ using COMCMS.Common;
using XCode;
namespace COMCMS.Web.Common
namespace COMCMS.Core
{
/// <summary>
/// 识图方法
@@ -53,12 +53,14 @@ namespace COMCMS.Web.Common
if (model == null)
return "javascript:;";
if (!string.IsNullOrEmpty(model.ArticleKind.FilePath))
ArticleCategory categoty = ArticleCategory.FindById(model.KId);
if (categoty != null && !string.IsNullOrEmpty(categoty.FilePath))
{
string url = $"{model.ArticleKind.FilePath}/{model.Id}.html";
string url = $"{categoty.FilePath}/{model.Id}.html";
if (!string.IsNullOrEmpty(model.FileName))
{
url = $"{model.ArticleKind.FilePath}/{model.FileName}";
url = $"{categoty.FilePath}/{model.FileName}";
}
return url;
}
@@ -73,7 +75,7 @@ namespace COMCMS.Web.Common
/// <returns></returns>
public static string EchoURL(Product model)
{
return $"/product/detail/{model.Id}";
return $"/product/detail/{model.Id}";
}
/// <summary>
@@ -82,7 +84,7 @@ namespace COMCMS.Web.Common
/// <param name="ctype"></param>
/// <param name="id"></param>
/// <returns></returns>
public static string EchoURL(Utils.CMSType ctype,int id)
public static string EchoURL(Utils.CMSType ctype, int id)
{
string url = "/";
switch (ctype)
@@ -104,7 +106,7 @@ namespace COMCMS.Web.Common
url = EchoURL(p);
break;
default:
url= "/";
url = "/";
break;
}
@@ -137,7 +137,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">跳转链接:</label>
<div class="col-sm-8">
<input id="LinkURL" type="text" class="form-control" name="LinkURL" value="" maxlength="200" placeholder="填写则点击该类别自动跳转到该地址" aria-required="true">
<input id="LinkURL" type="text" class="form-control" name="LinkURL" value="" maxlength="200" placeholder="填写则点击该类别自动跳转到该地址,如果填写数字,则跳转到改id的文章详情" aria-required="true">
</div>
</div>
<div class="form-group">
@@ -145,7 +145,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">跳转链接:</label>
<div class="col-sm-8">
<input id="LinkURL" type="text" class="form-control" name="LinkURL" value="@Model.LinkURL" maxlength="200" placeholder="填写则点击该类别自动跳转到该地址" aria-required="true">
<input id="LinkURL" type="text" class="form-control" name="LinkURL" value="@Model.LinkURL" maxlength="200" placeholder="填写则点击该类别自动跳转到该地址,如果填写数字,则跳转到改id的文章详情" aria-required="true">
</div>
</div>
<div class="form-group">
@@ -156,7 +156,7 @@
<tr>
<td class="text-center small">服务器IP地址</td>
<td>
@Utils.GetIP()
@ViewBag.remoteip
</td>
</tr>
</tbody>
+3 -2
View File
@@ -29,8 +29,9 @@ namespace COMCMS.Web.Controllers
{
if (Utils.IsInt(model.LinkURL))//如果是数字,则跳转到详情
{
//Redirect($"/aritcle/{model.LinkURL}.html");
return Redirect($"/Article/Detail/{model.LinkURL}");
//return Redirect($"/Article/Detail/{model.LinkURL}");
string linkUrl = ViewsHelper.EchoArticleURL(int.Parse(model.LinkURL));
return Redirect(linkUrl);
}
else
{
+4 -1
View File
@@ -354,7 +354,7 @@ function DoAdminLogin(formId, rules, messages) {
//后台列表执行批量操作
function doBatchAction(url, title) {
var list = $('#tb_departments').bootstrapTable('getAllSelections');
var list = $('#tb_departments').bootstrapTable('getSelections');
var ids = [];
if (!list || list.length < 1) {
layer.alert("请至少选择一条记录!", { icon: 2 });
@@ -364,6 +364,9 @@ function doBatchAction(url, title) {
if (item.id) {
ids.push(item.id);
}
if (item.Id) {
ids.push(item.Id);
}
})
layer.confirm('确认要执行批量' + title + '吗?', {