在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
想写个类似时间轴的效果 就找了一个插件
前端不济 找了一个简单的插件地址http://sc.chinaz.com/jiaoben/130509308250.htm
这是实体类 public class TimnAxis : BaseEntity<int>
{
[Required(ErrorMessage = "{0}是必须的")]
[Display(Name = "时间")]
public DateTime Time { get; set; }
[Required(ErrorMessage = "{0}是必须的")]
[Display(Name = "标题")]
[StringLength(50, ErrorMessage = "长度必须少于{1}个字")]
public string Title { get; set; }
[Required(ErrorMessage = "{0}是必须的")]
[Display(Name = "内容")]
[StringLength(1000, ErrorMessage = "长度必须少于{1}个字")]
public string Content { get; set; }
}
这是控制器
[HttpGet] public ActionResult TimnAxis(bool isAll=false) { ViewBag.WebInfo = webInfo; List<TimnAxis> timnAxises=new List<TimnAxis>(); if (isAll) { timnAxises = ItimnAxisManager.FindList().OrderBy(t => t.Time).ToList(); } else { timnAxises = ItimnAxisManager.FindList().OrderBy(t => t.Time).Take(30).ToList(); } return View(timnAxises); }
依赖的脚本和循环出内容 @section style { <link rel="stylesheet" type="text/css" href="/Content/timeaxis/css/default.css" /> <link rel="stylesheet" type="text/css" href="/Content/timeaxis/css/component.css" /> } @section scripts { <script src="/Content/timeaxis/js/modernizr.custom.js"></script> } <div class="main "> <ul class="cbp_tmtimeline"> @{ foreach (var item in Model) { <li> <time class="cbp_tmtime" datetime="2013-04-18 09:56"> <span style="font-size: 20px"> @item.Time.ToString("yyyy/MM/dd") </span> <span style="font-size: 25px">@item.Time.Hour :@item.Time.Minute</span> </time> <div class="cbp_tmicon cbp_tmicon-phone"></div> <div class="cbp_tmlabel"> <h2>@item.Title</h2> <p> @item.Content </p> </div> </li> } } </ul> </div> 前台
后台 用的bootstrap table 做简单的管理
|
请发表评论