修复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
@@ -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>
-151
View File
@@ -1,151 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using COMCMS.Core;
using COMCMS.Common;
using XCode;
namespace COMCMS.Web.Common
{
/// <summary>
/// 识图方法
/// </summary>
public class ViewsHelper
{
#region 获取分类链接
/// <summary>
/// 文章分类
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static string EchoURL(ArticleCategory model)
{
if (model == null)
return "javascript:;";
if (!string.IsNullOrEmpty(model.FilePath))
return model.FilePath + "/index.html";
else
return $"/article/index/{model.Id}";
}
/// <summary>
/// 商品分类
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static string EchoURL(Category model)
{
if (model == null)
return "javascript:;";
if (!string.IsNullOrEmpty(model.FilePath))
return model.FilePath + "/index.html";
else
return $"/product/index/{model.Id}";
}
/// <summary>
/// 生成文章详情地址
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static string EchoURL(Article model)
{
if (model == null)
return "javascript:;";
if (!string.IsNullOrEmpty(model.ArticleKind.FilePath))
{
string url = $"{model.ArticleKind.FilePath}/{model.Id}.html";
if (!string.IsNullOrEmpty(model.FileName))
{
url = $"{model.ArticleKind.FilePath}/{model.FileName}";
}
return url;
}
else
return $"/article/detail/{model.Id}";
}
/// <summary>
/// 商品
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static string EchoURL(Product model)
{
return $"/product/detail/{model.Id}";
}
/// <summary>
///
/// </summary>
/// <param name="ctype"></param>
/// <param name="id"></param>
/// <returns></returns>
public static string EchoURL(Utils.CMSType ctype,int id)
{
string url = "/";
switch (ctype)
{
case Utils.CMSType.ArticleCategory:
ArticleCategory ac = ArticleCategory.FindById(id);
url = EchoURL(ac);
break;
case Utils.CMSType.ProductCategory:
Category pc = Category.FindById(id);
url = EchoURL(pc);
break;
case Utils.CMSType.Article:
Article a = Article.FindById(id);
url = EchoURL(a);
break;
case Utils.CMSType.Product:
Product p = Product.FindById(id);
url = EchoURL(p);
break;
default:
url= "/";
break;
}
return url;
}
#endregion
#region 生成详情地址
/// <summary>
/// 生成文章详情地址
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static string EchoArticleURL(Article model)
{
if (model == null)
return "javascript:;";
if (!string.IsNullOrEmpty(model.ArticleKind.FilePath))
{
string url = $"{model.ArticleKind.FilePath}/{model.Id}.html";
if (!string.IsNullOrEmpty(model.FileName))
{
url = $"{model.ArticleKind.FilePath}/{model.FileName}";
}
return url;
}
else
return $"/article/detail/{model.Id}";
}
/// <summary>
/// 生成文章详情地址
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static string EchoArticleURL(int id)
{
Article model = Article.FindById(id);
return EchoArticleURL(model);
}
#endregion
}
}
+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 + '吗?', {