更新至大部分功能
This commit is contained in:
@@ -60,16 +60,16 @@ namespace COMCMS.Core
|
||||
}
|
||||
}
|
||||
|
||||
public static class Extension
|
||||
{
|
||||
public static void EchoTip(this JsonTip json)
|
||||
{
|
||||
string strJson = JsonTip.GetJsonString(json);
|
||||
//public static class Extension
|
||||
//{
|
||||
// public static void EchoTip(this JsonTip json)
|
||||
// {
|
||||
// string strJson = JsonTip.GetJsonString(json);
|
||||
|
||||
Byte[] bytes = Encoding.UTF8.GetBytes(strJson);
|
||||
Stream stream = new MemoryStream(bytes);
|
||||
MyHttpContext.Current.Response.ContentType = "text/plain";
|
||||
MyHttpContext.Current.Response.Body = stream;
|
||||
}
|
||||
}
|
||||
// Byte[] bytes = Encoding.UTF8.GetBytes(strJson);
|
||||
// Stream stream = new MemoryStream(bytes);
|
||||
// MyHttpContext.Current.Response.ContentType = "text/plain";
|
||||
// MyHttpContext.Current.Response.Body = stream;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,147 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
DateTime StartTime, EndTime;
|
||||
StartTime = Convert.ToDateTime("2000-01-01");
|
||||
EndTime = Convert.ToDateTime("2999-01-01");
|
||||
GetRequestAdsString(model.TId, ref content);
|
||||
#region 获取数据
|
||||
switch (model.TId)
|
||||
{
|
||||
case 0://代码
|
||||
ScriptAds script = new ScriptAds();
|
||||
script.content = Request.Form["txtScript"];
|
||||
if (string.IsNullOrEmpty(script.content))
|
||||
{
|
||||
tip.Message = "代码不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
content = JsonConvert.SerializeObject(script);
|
||||
break;
|
||||
case 1://文字
|
||||
TextAds text = new TextAds();
|
||||
text.txt = Request.Form["txt_Txt"];
|
||||
text.link = Request.Form["txt_Link"];
|
||||
text.style = Request.Form["txt_Style"];
|
||||
if (string.IsNullOrEmpty(text.txt))
|
||||
{
|
||||
tip.Message = "文字内容不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (string.IsNullOrEmpty(text.link))
|
||||
{
|
||||
tip.Message = "文字链接不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
content = JsonConvert.SerializeObject(text);
|
||||
break;
|
||||
case 2://图片
|
||||
ImgAds img = new ImgAds();
|
||||
img.img = Request.Form["img_Img"];
|
||||
img.link = Request.Form["img_Link"];
|
||||
img.alt = Request.Form["img_Alt"];
|
||||
string iw = Request.Form["img_Width"];
|
||||
string ih = Request.Form["img_Height"];
|
||||
if (!string.IsNullOrEmpty(iw) && Utils.IsInt(iw))
|
||||
img.width = int.Parse(iw);
|
||||
if (!string.IsNullOrEmpty(ih) && Utils.IsInt(ih))
|
||||
img.height = int.Parse(ih);
|
||||
if (string.IsNullOrEmpty(img.img))
|
||||
{
|
||||
tip.Message = "图片地址不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (string.IsNullOrEmpty(img.link))
|
||||
{
|
||||
tip.Message = "图片链接不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
content = JsonConvert.SerializeObject(img);
|
||||
break;
|
||||
case 3://Flash
|
||||
FlashAds flash = new FlashAds();
|
||||
flash.swf = Request.Form["flash_Swf"];
|
||||
string fw = Request.Form["flash_Width"];
|
||||
string fh = Request.Form["flash_Height"];
|
||||
if (string.IsNullOrEmpty(flash.swf))
|
||||
{
|
||||
tip.Message = "Flash 地址不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(fw) || !Utils.IsInt(fw))
|
||||
{
|
||||
tip.Message = "Flash 宽度不能为空或者不是整数!";
|
||||
return Json(tip);
|
||||
}
|
||||
else
|
||||
{
|
||||
flash.width = int.Parse(fw);
|
||||
}
|
||||
if (string.IsNullOrEmpty(fh) || !Utils.IsInt(fh))
|
||||
{
|
||||
tip.Message = "Flash 高度不能为空或者不是整数!";
|
||||
return Json(tip);
|
||||
}
|
||||
else
|
||||
{
|
||||
flash.height = int.Parse(fh);
|
||||
}
|
||||
content = JsonConvert.SerializeObject(flash);
|
||||
break;
|
||||
case 4://幻灯片
|
||||
string sw = Request.Form["slide_Width"];
|
||||
string sh = Request.Form["slide_Height"];
|
||||
if (string.IsNullOrEmpty(sw) || !Utils.IsInt(sw))
|
||||
{
|
||||
tip.Message = "幻灯片宽度不能为空或者不是整数!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (string.IsNullOrEmpty(sh) || !Utils.IsInt(sh))
|
||||
{
|
||||
tip.Message = "幻灯片高度不能为空或者不是整数!";
|
||||
return Json(tip); ;
|
||||
}
|
||||
string[] arrsimg = Request.Form["slide_Img"];// SImg.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
string[] arrslink = Request.Form["slide_Link"]; //SLink.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
string[] arralt = Request.Form["slide_Alt"]; //SAlt.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
List<ImgAds> listimg = new List<ImgAds>();
|
||||
for (int i = 0; i < arrsimg.Length; i++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(arrsimg[i]) && !string.IsNullOrEmpty(arrslink[i]))//图片跟地址都不为空
|
||||
{
|
||||
ImgAds tplimgads = new ImgAds();
|
||||
tplimgads.img = arrsimg[i];
|
||||
tplimgads.link = arrslink[i];
|
||||
tplimgads.height = int.Parse(sh);
|
||||
tplimgads.width = int.Parse(sw);
|
||||
tplimgads.alt = arralt[i];
|
||||
listimg.Add(tplimgads);
|
||||
}
|
||||
}
|
||||
if (listimg == null || listimg.Count <= 0)
|
||||
{
|
||||
tip.Message = "幻灯片请至少添加一张图片!";
|
||||
return Json(tip); ;
|
||||
}
|
||||
content = JsonConvert.SerializeObject(listimg);
|
||||
break;
|
||||
case 7://视频广告
|
||||
VideoAds video = new VideoAds();
|
||||
video.poster = Request.Form["video_Poster"];
|
||||
video.src = Request.Form["video_Src"];
|
||||
video.title = Request.Form["video_Title"];
|
||||
string vw = Request.Form["video_Width"];
|
||||
string vh = Request.Form["video_Height"];
|
||||
if (!string.IsNullOrEmpty(vw) && Utils.IsInt(vw))
|
||||
video.width = int.Parse(vw);
|
||||
if (!string.IsNullOrEmpty(vh) && Utils.IsInt(vh))
|
||||
video.height = int.Parse(vh);
|
||||
if (string.IsNullOrEmpty(video.src))
|
||||
{
|
||||
tip.Message = "视频广告地址不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
content = JsonConvert.SerializeObject(video);
|
||||
break;
|
||||
}
|
||||
#endregion
|
||||
model.StartTime = StartTime;
|
||||
model.EndTime = EndTime;
|
||||
model.Content = content;
|
||||
@@ -207,7 +347,149 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
DateTime StartTime, EndTime;
|
||||
StartTime = Convert.ToDateTime("2000-01-01");
|
||||
EndTime = Convert.ToDateTime("2999-01-01");
|
||||
GetRequestAdsString(model.TId, ref content);
|
||||
|
||||
#region 获取数据
|
||||
switch (model.TId)
|
||||
{
|
||||
case 0://代码
|
||||
ScriptAds script = new ScriptAds();
|
||||
script.content = Request.Form["txtScript"];
|
||||
if (string.IsNullOrEmpty(script.content))
|
||||
{
|
||||
tip.Message = "代码不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
content = JsonConvert.SerializeObject(script);
|
||||
break;
|
||||
case 1://文字
|
||||
TextAds text = new TextAds();
|
||||
text.txt = Request.Form["txt_Txt"];
|
||||
text.link = Request.Form["txt_Link"];
|
||||
text.style = Request.Form["txt_Style"];
|
||||
if (string.IsNullOrEmpty(text.txt))
|
||||
{
|
||||
tip.Message = "文字内容不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (string.IsNullOrEmpty(text.link))
|
||||
{
|
||||
tip.Message = "文字链接不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
content = JsonConvert.SerializeObject(text);
|
||||
break;
|
||||
case 2://图片
|
||||
ImgAds img = new ImgAds();
|
||||
img.img = Request.Form["img_Img"];
|
||||
img.link = Request.Form["img_Link"];
|
||||
img.alt = Request.Form["img_Alt"];
|
||||
string iw = Request.Form["img_Width"];
|
||||
string ih = Request.Form["img_Height"];
|
||||
if (!string.IsNullOrEmpty(iw) && Utils.IsInt(iw))
|
||||
img.width = int.Parse(iw);
|
||||
if (!string.IsNullOrEmpty(ih) && Utils.IsInt(ih))
|
||||
img.height = int.Parse(ih);
|
||||
if (string.IsNullOrEmpty(img.img))
|
||||
{
|
||||
tip.Message = "图片地址不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (string.IsNullOrEmpty(img.link))
|
||||
{
|
||||
tip.Message = "图片链接不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
content = JsonConvert.SerializeObject(img);
|
||||
break;
|
||||
case 3://Flash
|
||||
FlashAds flash = new FlashAds();
|
||||
flash.swf = Request.Form["flash_Swf"];
|
||||
string fw = Request.Form["flash_Width"];
|
||||
string fh = Request.Form["flash_Height"];
|
||||
if (string.IsNullOrEmpty(flash.swf))
|
||||
{
|
||||
tip.Message = "Flash 地址不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(fw) || !Utils.IsInt(fw))
|
||||
{
|
||||
tip.Message = "Flash 宽度不能为空或者不是整数!";
|
||||
return Json(tip);
|
||||
}
|
||||
else
|
||||
{
|
||||
flash.width = int.Parse(fw);
|
||||
}
|
||||
if (string.IsNullOrEmpty(fh) || !Utils.IsInt(fh))
|
||||
{
|
||||
tip.Message = "Flash 高度不能为空或者不是整数!";
|
||||
return Json(tip);
|
||||
}
|
||||
else
|
||||
{
|
||||
flash.height = int.Parse(fh);
|
||||
}
|
||||
content = JsonConvert.SerializeObject(flash);
|
||||
break;
|
||||
case 4://幻灯片
|
||||
string sw = Request.Form["slide_Width"];
|
||||
string sh = Request.Form["slide_Height"];
|
||||
if (string.IsNullOrEmpty(sw) || !Utils.IsInt(sw))
|
||||
{
|
||||
tip.Message = "幻灯片宽度不能为空或者不是整数!";
|
||||
return Json(tip);
|
||||
}
|
||||
if (string.IsNullOrEmpty(sh) || !Utils.IsInt(sh))
|
||||
{
|
||||
tip.Message = "幻灯片高度不能为空或者不是整数!";
|
||||
return Json(tip); ;
|
||||
}
|
||||
string[] arrsimg = Request.Form["slide_Img"];// SImg.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
string[] arrslink = Request.Form["slide_Link"]; //SLink.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
string[] arralt = Request.Form["slide_Alt"]; //SAlt.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
List<ImgAds> listimg = new List<ImgAds>();
|
||||
for (int i = 0; i < arrsimg.Length; i++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(arrsimg[i]) && !string.IsNullOrEmpty(arrslink[i]))//图片跟地址都不为空
|
||||
{
|
||||
ImgAds tplimgads = new ImgAds();
|
||||
tplimgads.img = arrsimg[i];
|
||||
tplimgads.link = arrslink[i];
|
||||
tplimgads.height = int.Parse(sh);
|
||||
tplimgads.width = int.Parse(sw);
|
||||
tplimgads.alt = arralt[i];
|
||||
listimg.Add(tplimgads);
|
||||
}
|
||||
}
|
||||
if (listimg == null || listimg.Count <= 0)
|
||||
{
|
||||
tip.Message = "幻灯片请至少添加一张图片!";
|
||||
return Json(tip); ;
|
||||
}
|
||||
content = JsonConvert.SerializeObject(listimg);
|
||||
break;
|
||||
case 7://视频广告
|
||||
VideoAds video = new VideoAds();
|
||||
video.poster = Request.Form["video_Poster"];
|
||||
video.src = Request.Form["video_Src"];
|
||||
video.title = Request.Form["video_Title"];
|
||||
string vw = Request.Form["video_Width"];
|
||||
string vh = Request.Form["video_Height"];
|
||||
if (!string.IsNullOrEmpty(vw) && Utils.IsInt(vw))
|
||||
video.width = int.Parse(vw);
|
||||
if (!string.IsNullOrEmpty(vh) && Utils.IsInt(vh))
|
||||
video.height = int.Parse(vh);
|
||||
if (string.IsNullOrEmpty(video.src))
|
||||
{
|
||||
tip.Message = "视频广告地址不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
content = JsonConvert.SerializeObject(video);
|
||||
break;
|
||||
}
|
||||
#endregion
|
||||
|
||||
model.StartTime = StartTime;
|
||||
model.EndTime = EndTime;
|
||||
model.Content = content;
|
||||
@@ -239,186 +521,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
#region 获取广告代码
|
||||
/// <summary>
|
||||
/// 获取
|
||||
/// </summary>
|
||||
/// <param name="tid">ID</param>
|
||||
/// <returns></returns>
|
||||
private void GetRequestAdsString(int tid, ref string adsString)
|
||||
{
|
||||
JsonTip mytip = new JsonTip();
|
||||
mytip.Status = JsonTip.ERROR;
|
||||
|
||||
string str = "";
|
||||
switch (tid)
|
||||
{
|
||||
case 0://代码
|
||||
ScriptAds script = new ScriptAds();
|
||||
script.content = Request.Form["txtScript"];
|
||||
if (string.IsNullOrEmpty(script.content))
|
||||
{
|
||||
mytip.Message = "代码不能为空!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
str = JsonConvert.SerializeObject(script);
|
||||
}
|
||||
break;
|
||||
case 1://文字类
|
||||
TextAds text = new TextAds();
|
||||
text.txt = Request.Form["txt_Txt"];
|
||||
text.link = Request.Form["txt_Link"];
|
||||
text.style = Request.Form["txt_Style"];
|
||||
if (string.IsNullOrEmpty(text.txt))
|
||||
{
|
||||
mytip.Message = "文字内容不能为空!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(text.link))
|
||||
{
|
||||
mytip.Message = "文字链接不能为空!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
str = JsonConvert.SerializeObject(text);
|
||||
break;
|
||||
case 2://图片类
|
||||
ImgAds img = new ImgAds();
|
||||
img.img = Request.Form["img_Img"];
|
||||
img.link = Request.Form["img_Link"];
|
||||
img.alt = Request.Form["img_Alt"];
|
||||
string iw = Request.Form["img_Width"];
|
||||
string ih = Request.Form["img_Height"];
|
||||
if (!string.IsNullOrEmpty(iw) && Utils.IsInt(iw))
|
||||
img.width = int.Parse(iw);
|
||||
if (!string.IsNullOrEmpty(ih) && Utils.IsInt(ih))
|
||||
img.height = int.Parse(ih);
|
||||
if (string.IsNullOrEmpty(img.img))
|
||||
{
|
||||
mytip.Message = "图片地址不能为空!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(img.link))
|
||||
{
|
||||
mytip.Message = "图片链接不能为空!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
str = JsonConvert.SerializeObject(img);
|
||||
break;
|
||||
case 3://Flash类
|
||||
FlashAds flash = new FlashAds();
|
||||
flash.swf = Request.Form["flash_Swf"];
|
||||
string fw = Request.Form["flash_Width"];
|
||||
string fh = Request.Form["flash_Height"];
|
||||
if (string.IsNullOrEmpty(flash.swf))
|
||||
{
|
||||
mytip.Message = "Flash 地址不能为空!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(fw) || !Utils.IsInt(fw))
|
||||
{
|
||||
mytip.Message = "Flash 宽度不能为空或者不是整数!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
flash.width = int.Parse(fw);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(fh) || !Utils.IsInt(fh))
|
||||
{
|
||||
mytip.Message = "Flash 高度不能为空或者不是整数!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
flash.height = int.Parse(fh);
|
||||
}
|
||||
str = JsonConvert.SerializeObject(flash);
|
||||
break;
|
||||
case 4://幻灯片
|
||||
string sw = Request.Form["slide_Width"];
|
||||
string sh = Request.Form["slide_Height"];
|
||||
if (string.IsNullOrEmpty(sw) || !Utils.IsInt(sw))
|
||||
{
|
||||
mytip.Message = "幻灯片宽度不能为空或者不是整数!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(sh) || !Utils.IsInt(sh))
|
||||
{
|
||||
mytip.Message = "幻灯片高度不能为空或者不是整数!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
string SImg = Request.Form["slide_Img"];
|
||||
string SLink = Request.Form["slide_Link"];
|
||||
string SAlt = Request.Form["slide_Alt"];
|
||||
if (string.IsNullOrEmpty(SImg))
|
||||
{
|
||||
mytip.Message = "幻灯片图片不能为空!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(SLink))
|
||||
{
|
||||
mytip.Message = "幻灯片图片链接不能为空!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
string[] arrsimg = SImg.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
string[] arrslink = SLink.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
string[] arralt = SAlt.Split(new string[] { "," }, StringSplitOptions.None);
|
||||
List<ImgAds> listimg = new List<ImgAds>();
|
||||
for (int i = 0; i < arrsimg.Length; i++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(arrsimg[i]) && !string.IsNullOrEmpty(arrslink[i]))//图片跟地址都不为空
|
||||
{
|
||||
ImgAds tplimgads = new ImgAds();
|
||||
tplimgads.img = arrsimg[i];
|
||||
tplimgads.link = arrslink[i];
|
||||
tplimgads.height = int.Parse(sh);
|
||||
tplimgads.width = int.Parse(sw);
|
||||
tplimgads.alt = arralt[i];
|
||||
//listimg.Add(new ImgAds { img = arrsimg[i], link = arrslink[i], height = int.Parse(sh), width = int.Parse(sw), alt = arralt[i] });
|
||||
listimg.Add(tplimgads);
|
||||
}
|
||||
}
|
||||
str = JsonConvert.SerializeObject(listimg);
|
||||
break;
|
||||
case 7://视频广告
|
||||
VideoAds video = new VideoAds();
|
||||
video.poster = Request.Form["video_Poster"];
|
||||
video.src = Request.Form["video_Src"];
|
||||
video.title = Request.Form["video_Title"];
|
||||
string vw = Request.Form["video_Width"];
|
||||
string vh = Request.Form["video_Height"];
|
||||
if (!string.IsNullOrEmpty(vw) && Utils.IsInt(vw))
|
||||
video.width = int.Parse(vw);
|
||||
if (!string.IsNullOrEmpty(vh) && Utils.IsInt(vh))
|
||||
video.height = int.Parse(vh);
|
||||
if (string.IsNullOrEmpty(video.src))
|
||||
{
|
||||
mytip.Message = "视频广告地址不能为空!";
|
||||
mytip.EchoTip();
|
||||
return;
|
||||
}
|
||||
str = JsonConvert.SerializeObject(video);
|
||||
break;
|
||||
}
|
||||
adsString = str;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -442,6 +545,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "广告分类名称不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
model.Insert();
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
tip.Message = "添加友情链接分类成功";
|
||||
@@ -557,7 +661,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "网站链接不能为空!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
model.IsHide = Request.Form["IsHide"] == "1";
|
||||
model.Insert();
|
||||
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
@@ -608,7 +712,7 @@ namespace COMCMS.Web.Areas.AdminCP.Controllers
|
||||
tip.Message = "系统找不到本记录!";
|
||||
return Json(tip);
|
||||
}
|
||||
|
||||
model.IsHide = Request.Form["IsHide"] == "1";
|
||||
model.Update();
|
||||
|
||||
tip.Status = JsonTip.SUCCESS;
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
|
||||
@{
|
||||
ViewBag.title = "添加广告";
|
||||
}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addAdsForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">广告分类:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="KId" id="KId">
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">广告标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Title" name="Title" maxlength="100" type="text" class="form-control" required aria-required="true" placeholder="填写广告标题">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">禁用广告:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="1" name="IsDisabled" id="IsDisabled"> 禁用广告(该广告不显示)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Sequence" type="number" class="form-control" name="Sequence" value="999" maxlength="20" placeholder="越小排得越前" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">广告类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control" id="TId" name="TId" onchange="ChangeType()">
|
||||
<option value="0">HTML代码</option>
|
||||
<option value="1">文字广告</option>
|
||||
<option value="2">图片广告</option>
|
||||
<option value="3">Flash广告</option>
|
||||
<option value="4">幻灯片广告</option>
|
||||
<option value="7">视频广告</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="adstype_0">
|
||||
<label class="col-sm-3 control-label">HTML代码:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea class="form-control" id="txtScript" name="txtScript" rows="3" placeholder="请输入广告HTML代码"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div id="adstype_1" class="hide">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文字内容(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="txt_Txt" name="txt_Txt" value="" placeholder="请输入文字广告的显示内容">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文字链接(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="txt_Link" name="txt_Link" value="" placeholder="请输入文字广告指向的 URL 链接地址">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文字样式(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="txt_Style" name="txt_Style" value="" placeholder="请输入文字广告的内容显示字体样式,即style内容">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="adstype_2" class="hide">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片地址(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="img_Img" name="img_Img" maxlength="250" type="text" class="form-control upload-path" placeholder="请输入图片广告的图片调用地址" value="">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片链接(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="img_Link" name="img_Link" value="" placeholder="请输入图片广告图片链接地址">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片宽度(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" class="form-control" id="img_Width" name="img_Width" value="" placeholder="请输入图片广告的宽度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片高度(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" class="form-control" id="img_Height" name="img_Height" value="" placeholder="请输入图片广告的高度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片替换文字(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="img_Alt" name="img_Alt" value="" placeholder="请输入图片广告的鼠标悬停文字信息">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="adstype_3" class="hide">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Flash 地址(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control upload-path" id="flash_Swf" name="flash_Swf" value="" placeholder="请输入 Flash 广告的调用地址">
|
||||
<span class="input-group-addon my-upload-span upload-swf"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Flash 宽度(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="flash_Width" name="flash_Width" value="" placeholder="请输入 Flash 广告的宽度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片高度(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="flash_Height" name="flash_Height" value="" placeholder="请输入 Flash 广告的高度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="adstype_4" class="hide">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">幻灯片宽度(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="slide_Width" name="slide_Width" value="" placeholder="请输入幻灯片广告的宽度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">幻灯片高度(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="slide_Height" name="slide_Height" value="" placeholder="请输入幻灯片广告的高度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">幻灯片详情:</label>
|
||||
<div class="col-sm-8">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:30%">图片(必填)</th>
|
||||
<th>链接地址(必填)</th>
|
||||
<th>图片标题</th>
|
||||
<th style="width:80px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="SildeImgs">
|
||||
<tr>
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_0" name="slide_Img" value="" placeholder="请输入图片地址"><span class="input-group-addon my-upload-span upload-img" id="basic-addon2"></span></div></td>
|
||||
<td><input type="text" class="form-control" id="slide_Link_0" name="slide_Link" value="" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="slide_Alt_0" name="slide_Alt" value="" placeholder="请输入图片标题"></td>
|
||||
<td><button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="adstype_7" class="hide">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">视频地址(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="video_Src" name="video_Src" maxlength="250" type="text" class="form-control upload-path" placeholder="请输入视频地址,必须是h264编码MP4" value="">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">视频封面(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="video_Poster" name="video_Poster" maxlength="250" type="text" class="form-control upload-path" placeholder="请输入视频封面图片地址" value="">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">视频宽度(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" class="form-control" id="video_Width" name="video_Width" value="" placeholder="请输入图片广告的宽度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">视频高度(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" class="form-control" id="video_Height" name="video_Height" value="" placeholder="请输入图片广告的高度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">视频标题(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="video_Title" name="video_Title" value="" placeholder="请输入图片广告的鼠标悬停文字信息">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function ChangeType() {
|
||||
var styles, key, val;
|
||||
val = $('#TId').val();
|
||||
styles = new Array('0', '1', '2', '3', '4', '7');
|
||||
for (key in styles) {
|
||||
if (styles[key] == val) {
|
||||
$("#adstype_" + styles[key]).removeClass('hide');
|
||||
} else {
|
||||
$("#adstype_" + styles[key]).addClass('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
var htmlText = '<tr id="slideTR_{0}">';
|
||||
htmlText += '<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_{0}" name="slide_Img" value="" placeholder="请输入图片地址"><span class="input-group-btn"><button type="button" class="btn btn-primary" onclick="BrowseServer(\'slide_Img_{0}\')"><i class="fa fa-search"></i></button></span></div></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Link_{0}" name="slide_Link" value="" placeholder="请输入链接地址"></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Alt_{0}" name="slide_Alt" value="" placeholder="请输入图片标题"></td>';
|
||||
htmlText += '<td><button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow({0})"><i class="fa fa-minus-square"></i> 删除</button></td></tr>';
|
||||
var items = 1;
|
||||
|
||||
function addSlideRow() {
|
||||
var lastitem = items - 1;
|
||||
var newHtmlTr = htmlText.replace(/\{0\}/g, items);
|
||||
$('#SildeImgs').append(newHtmlTr);
|
||||
$("#basic-addon_" + items).InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderImage", swf: "/js/webuploader/uploader.swf", filetypes: "gif,jpg,png,bmp,jpeg", notwater: true });
|
||||
items += 1;
|
||||
}
|
||||
function delmySlideRow(id) {
|
||||
$("#slideTR_" + id).remove();
|
||||
}
|
||||
|
||||
|
||||
$(function () {
|
||||
//初始化上传控件
|
||||
$(".upload-img").InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderImage", swf: "/js/webuploader/uploader.swf", filetypes: "gif,jpg,png,bmp,jpeg", notwater: true });
|
||||
$(".upload-swf").InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderFile", swf: "/js/webuploader/uploader.swf", filetypes: "swf", notwater: true });
|
||||
DoPost("addAdsForm");
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,86 @@
|
||||
|
||||
@{
|
||||
ViewBag.title = "添加友情链接";
|
||||
}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addLinkForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">友情链接分类:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" name="KId" id="KId">
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">友情链接标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Title" name="Title" maxlength="100" type="text" class="form-control" required aria-required="true" placeholder="填写友情链接标题">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">站点地址:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="LinkURL" name="LinkURL" maxlength="100" type="text" class="form-control" required aria-required="true" placeholder="填写友情链接站点URL地址">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">站点LOGO:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="Logo" name="Logo" maxlength="250" type="text" class="form-control upload-path" placeholder="请输入友情链接站点LOGO地址" value="">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">友情链接介绍:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Info" name="Info" maxlength="100" type="text" class="form-control" placeholder="填写友情链接介绍,非必选">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Sequence" type="number" class="form-control" name="Sequence" value="999" maxlength="20" placeholder="越小排得越前" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">隐藏友情链接:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="1" name="IsHide" id="IsHide"> 隐藏友情链接(该友情链接不显示)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
DoPost("addLinkForm");
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,95 @@
|
||||
@model IList<COMCMS.Core.AdsKind>
|
||||
@{
|
||||
ViewBag.title = "广告分类管理";
|
||||
}
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.title</h5>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="showAddRow();">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="toolbar2" class="btn-group pull-right">
|
||||
<button id="btn_refresh" type="button" class="btn btn-outline btn-default" onclick="refresh();">
|
||||
<span class="fa fa-refresh" aria-hidden="true"></span>刷新
|
||||
</button>
|
||||
</div>
|
||||
<form name="listAdsCategoryForm" id="listAdsCategoryForm" method="post" onsubmit="return false">
|
||||
<table class="tree table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>类别名称</th>
|
||||
<th class="text-center">排序</th>
|
||||
<th>简单说明</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@if (Model.Count == 0)
|
||||
{
|
||||
<tr><td colspan="5" class="text-center">暂无记录</td></tr>
|
||||
}
|
||||
@foreach (var m in Model)
|
||||
{
|
||||
<tr id="row_@m.Id">
|
||||
<td>
|
||||
<div class="rt-editpanel">@m.Id</div>
|
||||
<div class="rt-savepanel hidden">
|
||||
@m.Id
|
||||
<input type="hidden" name="Id" id="Id_@m.Id" value="@m.Id" class="rt-edit" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="rt-editpanel">@m.KindName</div>
|
||||
<div class="rt-savepanel hidden">
|
||||
<input name="KindName" id="KindName_@m.Id" type="text" class="form-control rt-edit" placeholder="请输入类别名称" maxlength="100" value="@m.KindName" />
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<div class="rt-editpanel">@m.Rank</div>
|
||||
<div class="rt-savepanel hidden">
|
||||
<input type="number" name="Rank" id="Rank_@m.Id" class="form-control rt-edit" value="@m.Rank" maxlength="3" placeholder="请输入类别排序,只能填写数字" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="rt-editpanel">@m.KindInfo</div>
|
||||
<div class="rt-savepanel hidden">
|
||||
<input type="text" name="KindInfo" id="KindInfo_@m.Id" class="form-control rt-edit" value="@m.KindInfo" placeholder="类别简介,非必填" maxlength="200" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="rt-editpanel">
|
||||
<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="showEdit(@m.Id)"><i class="fa fa-edit"></i> 编辑</a>
|
||||
<a href="javascript:;" class="btn btn-xs btn-danger" title="删除" onclick="doDel('/AdminCP/Other/DelAdsKind',@m.Id);"><i class="fa fa-close"></i> 删除</a>
|
||||
</div>
|
||||
<div class="rt-savepanel hidden">
|
||||
<a href="javascript:;" class="btn btn-xs btn-success" title="保存" onclick="doEdit('listAdsCategoryForm', '/AdminCP/Other/EditAdsKind',@m.Id)"><i class="fa fa-save"></i> 保存</a>
|
||||
<a href="javascript:;" class="btn btn-xs btn-default" title="取消" onclick="cancelEdit(@m.Id);"><i class="fa fa-mail-reply"></i> 取消</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr id="addnew" class="hidden">
|
||||
<td>
|
||||
<span class="text-primary">新增</span>
|
||||
</td>
|
||||
<td><input name="KindName" id="KindName" type="text" class="form-control addnew" placeholder="请输入类别名称" required maxlength="100" /></td>
|
||||
<td class="text-center"><input type="number" name="Rank" id="Rank" class="form-control addnew" value="0" maxlength="3" placeholder="请输入类别排序,只能填写数字" /></td>
|
||||
<td><input type="text" name="KindInfo" id="KindInfo" class="form-control addnew" placeholder="类别简介,非必填" maxlength="200" /></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-success" title="保存" onclick="doAdd('listAdsCategoryForm', '/AdminCP/Other/AddAdsKind');"><i class="fa fa-save"></i> 保存</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
|
||||
@{
|
||||
ViewBag.title = "广告管理";
|
||||
}
|
||||
<div class="wrapper wrapper-content ">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">筛选条件</div>
|
||||
<div class="panel-body">
|
||||
<form id="formSearch" class="form-horizontal form-inline">
|
||||
<div>
|
||||
<label class="control-label">广告分类:</label>
|
||||
|
||||
<select class="form-control" name="kid" id="kid">
|
||||
<option value="0">所有栏目</option>
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
</select>
|
||||
<label class="control-label">关键字:</label>
|
||||
<input type="text" placeholder="标题关键字" name="keyword" id="keyword" class="form-control">
|
||||
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="doSearch();">查询</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addads','添加广告','/AdminCP/Other/AddAds',0,0)">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
</div>
|
||||
<table id="tb_departments"></table>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
//1.初始化Table
|
||||
var oTable = new TableInit();
|
||||
oTable.Init();
|
||||
|
||||
//2.初始化Button的点击事件
|
||||
var oButtonInit = new ButtonInit();
|
||||
oButtonInit.Init();
|
||||
|
||||
});
|
||||
function doSearch() {
|
||||
var params = $('#tb_departments').bootstrapTable('getOptions');
|
||||
//console.log(params);
|
||||
params.queryParams = function (params) {
|
||||
|
||||
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
||||
limit: params.limit, //页面大小
|
||||
page: (params.offset / params.limit) + 1, //页码
|
||||
kid: $("#kid").val(),
|
||||
keyword: $("#keyword").val()
|
||||
};
|
||||
return temp;
|
||||
}
|
||||
$('#tb_departments').bootstrapTable('refresh', params);
|
||||
}
|
||||
var TableInit = function () {
|
||||
var oTableInit = new Object();
|
||||
//初始化Table
|
||||
oTableInit.Init = function () {
|
||||
$('#tb_departments').bootstrapTable({
|
||||
url: '/AdminCP/Other/GetAdsList', //请求后台的URL(*)
|
||||
method: 'get', //请求方式(*)
|
||||
toolbar: '#toolbar', //工具按钮用哪个容器
|
||||
striped: true, //是否显示行间隔色
|
||||
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
||||
pagination: true, //是否显示分页(*)
|
||||
sortable: false, //是否启用排序
|
||||
sortOrder: "asc", //排序方式
|
||||
queryParams: oTableInit.queryParams,//传递参数(*)
|
||||
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
|
||||
pageNumber: 1, //初始化加载第一页,默认第一页
|
||||
pageSize: 25, //每页的记录行数(*)
|
||||
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
|
||||
search: true, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
|
||||
strictSearch: true,
|
||||
showColumns: true, //是否显示所有的列
|
||||
showRefresh: true, //是否显示刷新按钮
|
||||
minimumCountColumns: 2, //最少允许的列数
|
||||
clickToSelect: true, //是否启用点击选中行
|
||||
height: 0, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
|
||||
uniqueId: "Id", //每一行的唯一标识,一般为主键列
|
||||
showToggle: true, //是否显示详细视图和列表视图的切换按钮
|
||||
cardView: false, //是否显示详细视图
|
||||
detailView: false, //是否显示父子表
|
||||
columns: [{
|
||||
checkbox: true
|
||||
}, {
|
||||
field: 'Id',
|
||||
title: 'ID'
|
||||
}, {
|
||||
field: 'AdsKind.KindName',
|
||||
title: '所属分类'
|
||||
}, {
|
||||
field: 'Title',
|
||||
title: '广告标题'
|
||||
}, {
|
||||
field: 'Sequence',
|
||||
title: '排序'
|
||||
},
|
||||
{
|
||||
field: 'Id',
|
||||
title: '操作',
|
||||
formatter: 'actionFormatter'
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
//得到查询的参数
|
||||
oTableInit.queryParams = function (params) {
|
||||
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
||||
limit: params.limit, //页面大小
|
||||
page: (params.offset / params.limit) + 1, //页码
|
||||
kid:$("#kid").val(),
|
||||
departmentname: $("#keyword").val()
|
||||
};
|
||||
return temp;
|
||||
};
|
||||
return oTableInit;
|
||||
};
|
||||
|
||||
function actionFormatter(value, row, index) {
|
||||
return [
|
||||
'<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="top.showDialog(\'eidtads\', \'编辑广告详情\', \'/AdminCP/Other/EditAds/' + value + '\', 0, 0)"><i class="fa fa-edit"></i> 编辑</a>',
|
||||
'<a href="javascript:;" class="btn btn-xs btn-danger m-l-xs" title="删除" onclick="doDel(\'/AdminCP/Other/DelAds\',' + value + ');"><i class="fa fa-close"></i> 删除</a>',
|
||||
].join('');
|
||||
}
|
||||
|
||||
var ButtonInit = function () {
|
||||
var oInit = new Object();
|
||||
var postdata = {};
|
||||
|
||||
oInit.Init = function () {
|
||||
//初始化页面上面的按钮事件
|
||||
};
|
||||
|
||||
return oInit;
|
||||
};
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,334 @@
|
||||
@model COMCMS.Core.Ads
|
||||
@{
|
||||
ViewBag.Title = "添加广告";
|
||||
if (string.IsNullOrEmpty(Model.Content))
|
||||
{
|
||||
Model.Content = "[]";
|
||||
}
|
||||
}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.Title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editAdsForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">广告分类:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" asp-for="KId" id="KId">
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id" >@m.KindName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">广告标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Title" name="Title" maxlength="100" type="text" value="@Model.Title" class="form-control" required aria-required="true" placeholder="填写广告标题">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">禁用广告:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="1" name="IsDisabled" id="IsDisabled" @(Model.IsDisabled ? "checked" : "")> 禁用广告(该广告不显示)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Sequence" type="number" class="form-control" name="Sequence" value="@Model.Sequence" maxlength="20" placeholder="越小排得越前" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">广告类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control" asp-for="TId" name="TId" onchange="ChangeType()">
|
||||
<option value="0" >HTML代码</option>
|
||||
<option value="1" >文字广告</option>
|
||||
<option value="2" >图片广告</option>
|
||||
<option value="3" >Flash广告</option>
|
||||
<option value="4">幻灯片广告</option>
|
||||
<option value="7" >视频广告</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="adstype_0">
|
||||
<label class="col-sm-3 control-label">HTML代码:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea class="form-control" id="txtScript" name="txtScript" rows="3" placeholder="请输入广告HTML代码"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div id="adstype_1" class="hide">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文字内容(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="txt_Txt" name="txt_Txt" value="" placeholder="请输入文字广告的显示内容">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文字链接(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="txt_Link" name="txt_Link" value="" placeholder="请输入文字广告指向的 URL 链接地址">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文字样式(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="txt_Style" name="txt_Style" value="" placeholder="请输入文字广告的内容显示字体样式,即style内容">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="adstype_2" class="hide">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片地址(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="img_Img" name="img_Img" maxlength="250" type="text" class="form-control upload-path" placeholder="请输入图片广告的图片调用地址" value="">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片链接(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="img_Link" name="img_Link" value="" placeholder="请输入图片广告图片链接地址">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片宽度(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" class="form-control" id="img_Width" name="img_Width" value="" placeholder="请输入图片广告的宽度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片高度(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" class="form-control" id="img_Height" name="img_Height" value="" placeholder="请输入图片广告的高度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片替换文字(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="img_Alt" name="img_Alt" value="" placeholder="请输入图片广告的鼠标悬停文字信息">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="adstype_3" class="hide">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Flash 地址(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control upload-path" id="flash_Swf" name="flash_Swf" value="" placeholder="请输入 Flash 广告的调用地址">
|
||||
<span class="input-group-addon my-upload-span upload-swf"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">Flash 宽度(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="flash_Width" name="flash_Width" value="" placeholder="请输入 Flash 广告的宽度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">图片高度(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="flash_Height" name="flash_Height" value="" placeholder="请输入 Flash 广告的高度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="adstype_4" class="hide">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">幻灯片宽度(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="slide_Width" name="slide_Width" value="" placeholder="请输入幻灯片广告的宽度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">幻灯片高度(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="slide_Height" name="slide_Height" value="" placeholder="请输入幻灯片广告的高度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">幻灯片详情:</label>
|
||||
<div class="col-sm-8">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:30%">图片(必填)</th>
|
||||
<th>链接地址(必填)</th>
|
||||
<th>图片标题</th>
|
||||
<th style="width:80px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="SildeImgs">
|
||||
<tr>
|
||||
<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_0" name="slide_Img" value="" placeholder="请输入图片地址"><span class="input-group-addon my-upload-span upload-img" id="basic-addon2"></span></div></td>
|
||||
<td><input type="text" class="form-control" id="slide_Link_0" name="slide_Link" value="" placeholder="请输入链接地址"></td>
|
||||
<td><input type="text" class="form-control" id="slide_Alt_0" name="slide_Alt" value="" placeholder="请输入图片标题"></td>
|
||||
<td><button type="button" class="btn btn-sm btn-success" onClick="addSlideRow();"><i class="fa fa-plus-square"></i> 添加</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="adstype_7" class="hide">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">视频地址(必填):</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="video_Src" name="video_Src" maxlength="250" type="text" class="form-contro upload-pathl" placeholder="请输入视频地址,必须是h264编码MP4" value="">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">视频封面(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="video_Poster" name="video_Poster" maxlength="250" type="text" class="form-control upload-path" placeholder="请输入视频封面图片地址" value="">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">视频宽度(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" class="form-control" id="video_Width" name="video_Width" value="" placeholder="请输入图片广告的宽度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">视频高度(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" class="form-control" id="video_Height" name="video_Height" value="" placeholder="请输入图片广告的高度,单位为像素">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">视频标题(选填):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="video_Title" name="video_Title" value="" placeholder="请输入图片广告的鼠标悬停文字信息">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<input type="hidden" id="Id" name="Id" value="@Model.Id" />
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function ChangeType() {
|
||||
var styles, key, val;
|
||||
val = $('#TId').val();
|
||||
styles = new Array('0', '1', '2', '3', '4', '7');
|
||||
for (key in styles) {
|
||||
if (styles[key] == val) {
|
||||
$("#adstype_" + styles[key]).removeClass('hide');
|
||||
} else {
|
||||
$("#adstype_" + styles[key]).addClass('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
var htmlText = '<tr id="slideTR_{0}">';
|
||||
htmlText += '<td><div class="input-group"><input type="text" class="form-control upload-path" id="slide_Img_{0}" name="slide_Img" value="" placeholder="请输入图片地址"><span class="input-group-addon my-upload-span upload-img" id="basic-addon_{0}"></span></div></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Link_{0}" name="slide_Link" value="" placeholder="请输入链接地址"></td>';
|
||||
htmlText += '<td><input type="text" class="form-control" id="slide_Alt_{0}" name="slide_Alt" value="" placeholder="请输入图片标题"></td>';
|
||||
htmlText += '<td><button type="button" class="btn btn-sm btn-danger" onclick="delmySlideRow({0})"><i class="fa fa-minus-square"></i> 删除</button></td></tr>';
|
||||
var items = 1;
|
||||
|
||||
function addSlideRow() {
|
||||
var lastitem = items - 1;
|
||||
var newHtmlTr = htmlText.replace(/\{0\}/g, items);
|
||||
$('#SildeImgs').append(newHtmlTr);
|
||||
$("#basic-addon_" + items).InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderImage", swf: "/js/webuploader/uploader.swf", filetypes: "gif,jpg,png,bmp,jpeg", notwater: true });
|
||||
items += 1;
|
||||
}
|
||||
function delmySlideRow(id) {
|
||||
$("#slideTR_" + id).remove();
|
||||
}
|
||||
|
||||
var jsonstr =@Html.Raw(Model.Content);
|
||||
$(function () {
|
||||
DoPost("editAdsForm");
|
||||
$(".upload-img").InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderImage", swf: "/js/webuploader/uploader.swf", filetypes: "gif,jpg,png,bmp,jpeg", notwater: true });
|
||||
$(".upload-swf").InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderFile", swf: "/js/webuploader/uploader.swf", filetypes: "swf", notwater: true });
|
||||
//加载内容
|
||||
FillAds(@Model.TId,jsonstr);
|
||||
ChangeType();
|
||||
})
|
||||
|
||||
|
||||
//JS加载广告内容
|
||||
function FillAds(tid, content) {
|
||||
var json = content;
|
||||
switch (tid) {
|
||||
case 0: //代码
|
||||
$('#txtScript').val(json.content);
|
||||
break;
|
||||
case 1: //文字类型
|
||||
$('#txt_Txt').val(json.txt);
|
||||
$('#txt_Link').val(json.link);
|
||||
$('#txt_Style').val(json.style);
|
||||
break;
|
||||
case 2: //图片类
|
||||
$('#img_Img').val(json.img);
|
||||
$('#img_Link').val(json.link);
|
||||
if(json.width !=0){
|
||||
$('#img_Width').val(json.width);
|
||||
}
|
||||
if(json.height !=0){
|
||||
$('#img_Height').val(json.height);
|
||||
}
|
||||
$('#img_Alt').val(json.alt);
|
||||
break;
|
||||
case 3://Flash类型
|
||||
$('#flash_Swf').val(json.swf);
|
||||
$('#flash_Height').val(json.height);
|
||||
$('#flash_Width').val(json.width);
|
||||
break;
|
||||
case 4://幻灯片
|
||||
for (i = 0; i < json.length; i++) {
|
||||
if (i == 0) {
|
||||
$("#slide_Width").val(json[0].width);
|
||||
$("#slide_Height").val(json[0].height);
|
||||
}
|
||||
else {
|
||||
addSlideRow();//增加一行
|
||||
}
|
||||
$("#slide_Img_" + i).val(json[i].img);
|
||||
$("#slide_Link_" + i).val(json[i].link);
|
||||
$("#slide_Alt_" + i).val(json[i].alt);
|
||||
}
|
||||
break;
|
||||
case 7://视频
|
||||
$('#video_Src').val(json.src);
|
||||
$('#video_Poster').val(json.poster);
|
||||
$('#video_Width').val(json.width);
|
||||
$('#video_Height').val(json.height);
|
||||
$('#video_Title').val(json.title);
|
||||
break;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,89 @@
|
||||
@model COMCMS.Core.Link
|
||||
@{
|
||||
ViewBag.title = "编辑友情链接";
|
||||
}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "editLinkForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">友情链接分类:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control m-b" asp-for="KId">
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">友情链接标题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Title" name="Title" maxlength="100" type="text" class="form-control" required aria-required="true" placeholder="填写友情链接标题" value="@Model.Title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">站点地址:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="LinkURL" name="LinkURL" maxlength="100" type="text" class="form-control" required aria-required="true" placeholder="填写友情链接站点URL地址" value="@Model.LinkURL">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">站点LOGO:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input id="Logo" name="Logo" maxlength="250" type="text" class="form-control upload-path" placeholder="请输入友情链接站点LOGO地址" value="@Model.Logo">
|
||||
<span class="input-group-addon my-upload-span upload-img"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">友情链接介绍:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Info" name="Info" maxlength="100" type="text" class="form-control" aria-required="true" placeholder="填写友情链接介绍,非必选" value="@Model.Info">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="Sequence" type="number" class="form-control" name="Sequence" value="@Model.Sequence" maxlength="20" placeholder="越小排得越前" aria-required="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">隐藏友情链接:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="checkbox-inline i-checks">
|
||||
<input type="checkbox" value="1" name="IsHide" id="IsHide" @(Model.IsHide ? "checked" : "")> 隐藏友情链接(该友情链接不显示)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-3">
|
||||
<input type="hidden" id="Id" name="Id" value="@Model.Id" />
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 提交 </button>
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$(".upload-img").InitUploader({ filesize: "10240", sendurl: "/AdminCP/Upload/DoWebuploaderImage", swf: "/js/webuploader/uploader.swf", filetypes: "gif,jpg,png,bmp,jpeg", notwater: true });
|
||||
DoPost("editLinkForm");
|
||||
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,95 @@
|
||||
@model IList<COMCMS.Core.LinkKind>
|
||||
@{
|
||||
|
||||
ViewBag.title = "友情链接分类管理";
|
||||
}
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.title</h5>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="showAddRow();">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="toolbar2" class="btn-group pull-right">
|
||||
<button id="btn_refresh" type="button" class="btn btn-outline btn-default" onclick="refresh();">
|
||||
<span class="fa fa-refresh" aria-hidden="true"></span>刷新
|
||||
</button>
|
||||
</div>
|
||||
<form name="listLinkCategoryForm" id="listLinkCategoryForm" method="post" onsubmit="return false">
|
||||
<table class="tree table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>类别名称</th>
|
||||
<th class="text-center">排序</th>
|
||||
<th>简单说明</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@if (Model.Count == 0)
|
||||
{
|
||||
<tr><td colspan="5" class="text-center">暂无记录</td></tr>
|
||||
}
|
||||
@foreach (var m in Model)
|
||||
{
|
||||
<tr id="row_@m.Id">
|
||||
<td>
|
||||
<div class="rt-editpanel">@m.Id</div>
|
||||
<div class="rt-savepanel hidden">
|
||||
@m.Id
|
||||
<input type="hidden" name="Id" id="Id_@m.Id" value="@m.Id" class="rt-edit" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="rt-editpanel">@m.KindName</div>
|
||||
<div class="rt-savepanel hidden">
|
||||
<input name="KindName" id="KindName_@m.Id" type="text" class="form-control rt-edit" placeholder="请输入类别名称" maxlength="100" value="@m.KindName" />
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<div class="rt-editpanel">@m.Rank</div>
|
||||
<div class="rt-savepanel hidden">
|
||||
<input type="number" name="Rank" id="Rank_@m.Id" class="form-control rt-edit" value="@m.Rank" maxlength="3" placeholder="请输入类别排序,只能填写数字" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="rt-editpanel">@m.KindInfo</div>
|
||||
<div class="rt-savepanel hidden">
|
||||
<input type="text" name="KindInfo" id="KindInfo_@m.Id" class="form-control rt-edit" value="@m.KindInfo" placeholder="类别简介,非必填" maxlength="200" />
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="rt-editpanel">
|
||||
<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="showEdit(@m.Id)"><i class="fa fa-edit"></i> 编辑</a>
|
||||
<a href="javascript:;" class="btn btn-xs btn-danger" title="删除" onclick="doDel('/AdminCP/Other/DelLinkKind',@m.Id);"><i class="fa fa-close"></i> 删除</a>
|
||||
</div>
|
||||
<div class="rt-savepanel hidden">
|
||||
<a href="javascript:;" class="btn btn-xs btn-success" title="保存" onclick="doEdit('listLinkCategoryForm', '/AdminCP/Other/EditLinkKind',@m.Id)"><i class="fa fa-save"></i> 保存</a>
|
||||
<a href="javascript:;" class="btn btn-xs btn-default" title="取消" onclick="cancelEdit(@m.Id);"><i class="fa fa-mail-reply"></i> 取消</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr id="addnew" class="hidden">
|
||||
<td>
|
||||
<span class="text-primary">新增</span>
|
||||
</td>
|
||||
<td><input name="KindName" id="KindName" type="text" class="form-control addnew" placeholder="请输入类别名称" required maxlength="100" /></td>
|
||||
<td class="text-center"><input type="number" name="Rank" id="Rank" class="form-control addnew" value="0" maxlength="3" placeholder="请输入类别排序,只能填写数字" /></td>
|
||||
<td><input type="text" name="KindInfo" id="KindInfo" class="form-control addnew" placeholder="类别简介,非必填" maxlength="200" /></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-success" title="保存" onclick="doAdd('listLinkCategoryForm', '/AdminCP/Other/AddLinkKind');"><i class="fa fa-save"></i> 保存</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,145 @@
|
||||
|
||||
@{
|
||||
ViewBag.title = "友情链接管理";
|
||||
}
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>@ViewBag.title</h5>
|
||||
<div class="ibox-tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">筛选条件</div>
|
||||
<div class="panel-body">
|
||||
<form id="formSearch" class="form-horizontal form-inline">
|
||||
<div>
|
||||
<label class="control-label">友情链接分类:</label>
|
||||
|
||||
<select class="form-control" name="kid" id="kid">
|
||||
<option value="0">所有分类</option>
|
||||
@foreach (var m in ViewBag.ListKinds)
|
||||
{
|
||||
<option value="@m.Id">@m.KindName</option>
|
||||
}
|
||||
</select>
|
||||
<label class="control-label">关键字:</label>
|
||||
<input type="text" placeholder="标题关键字" name="keyword" id="keyword" class="form-control">
|
||||
<button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary">查询</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="toolbar" class="btn-group">
|
||||
<button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addads', '添加友情链接', '/AdminCP/Other/AddLink', 0, 0)">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
</div>
|
||||
<table id="tb_departments"></table>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
//1.初始化Table
|
||||
var oTable = new TableInit();
|
||||
oTable.Init();
|
||||
|
||||
//2.初始化Button的点击事件
|
||||
var oButtonInit = new ButtonInit();
|
||||
oButtonInit.Init();
|
||||
|
||||
});
|
||||
var TableInit = function () {
|
||||
var oTableInit = new Object();
|
||||
//初始化Table
|
||||
oTableInit.Init = function () {
|
||||
$('#tb_departments').bootstrapTable({
|
||||
url: '/AdminCP/Other/GetLinkList', //请求后台的URL(*)
|
||||
method: 'get', //请求方式(*)
|
||||
toolbar: '#toolbar', //工具按钮用哪个容器
|
||||
striped: true, //是否显示行间隔色
|
||||
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
|
||||
pagination: true, //是否显示分页(*)
|
||||
sortable: false, //是否启用排序
|
||||
sortOrder: "asc", //排序方式
|
||||
queryParams: oTableInit.queryParams,//传递参数(*)
|
||||
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
|
||||
pageNumber: 1, //初始化加载第一页,默认第一页
|
||||
pageSize: 25, //每页的记录行数(*)
|
||||
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
|
||||
search: true, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
|
||||
strictSearch: true,
|
||||
showColumns: true, //是否显示所有的列
|
||||
showRefresh: true, //是否显示刷新按钮
|
||||
minimumCountColumns: 2, //最少允许的列数
|
||||
clickToSelect: true, //是否启用点击选中行
|
||||
height: 0, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
|
||||
uniqueId: "Id", //每一行的唯一标识,一般为主键列
|
||||
showToggle: true, //是否显示详细视图和列表视图的切换按钮
|
||||
cardView: false, //是否显示详细视图
|
||||
detailView: false, //是否显示父子表
|
||||
columns: [{
|
||||
checkbox: true
|
||||
}, {
|
||||
field: 'Id',
|
||||
title: 'ID'
|
||||
}, {
|
||||
field: 'LinkKind.KindName',
|
||||
title: '所属分类'
|
||||
}, {
|
||||
field: 'Title',
|
||||
title: '友情链接标题'
|
||||
}, {
|
||||
field: 'Sequence',
|
||||
title: '排序'
|
||||
},
|
||||
{
|
||||
field: 'LinkURL',
|
||||
title: '站点URL'
|
||||
},
|
||||
{
|
||||
field: 'Id',
|
||||
title: '操作',
|
||||
formatter: 'actionFormatter'
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
//得到查询的参数
|
||||
oTableInit.queryParams = function (params) {
|
||||
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
||||
limit: params.limit, //页面大小
|
||||
page: (params.offset / params.limit) + 1, //页码
|
||||
kid:$("#kid").val(),
|
||||
departmentname: $("#keyword").val()
|
||||
};
|
||||
return temp;
|
||||
};
|
||||
return oTableInit;
|
||||
};
|
||||
|
||||
function actionFormatter(value, row, index) {
|
||||
return [
|
||||
'<a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="top.showDialog(\'eidtads\', \'编辑友情链接详情\', \'/AdminCP/Other/EditLink/' + value + '\', 1000, 600)"><i class="fa fa-edit"></i> 编辑</a>',
|
||||
'<a href="javascript:;" class="btn btn-xs btn-danger m-l-xs" title="删除" onclick="doDel(\'/AdminCP/Other/DelLink\',' + value + ');"><i class="fa fa-close"></i> 删除</a>',
|
||||
].join('');
|
||||
}
|
||||
|
||||
var ButtonInit = function () {
|
||||
var oInit = new Object();
|
||||
var postdata = {};
|
||||
|
||||
oInit.Init = function () {
|
||||
//初始化页面上面的按钮事件
|
||||
};
|
||||
|
||||
return oInit;
|
||||
};
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -8,6 +8,8 @@ using COMCMS.Web.Models;
|
||||
using COMCMS.Common;
|
||||
using COMCMS.Core;
|
||||
using XCode;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace COMCMS.Web.Controllers
|
||||
{
|
||||
@@ -43,5 +45,20 @@ namespace COMCMS.Web.Controllers
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
|
||||
#region 测试
|
||||
public IActionResult Test()
|
||||
{
|
||||
JsonTip json = new JsonTip();
|
||||
string strJson = JsonTip.GetJsonString(json);
|
||||
|
||||
//Byte[] bytes = Encoding.UTF8.GetBytes(strJson);
|
||||
//Stream stream = new MemoryStream(bytes);
|
||||
//MyHttpContext.Current.Response.ContentType = "text/plain";
|
||||
//MyHttpContext.Current.Response.Body = stream;
|
||||
|
||||
return Content("ok");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user