@using System.Text @using System.Data; @using ZoomLa.Common @using ZoomLa.BLL @using ZoomLa.BLL.Content @using ZoomLa.Model @using ZoomLa.Components @using Newtonsoft.Json @using Newtonsoft.Json.Linq @model ZoomLaCMS.Models.Field.VM_FieldModel @functions{ private bool HasValue(DataRow dr,string name) { if (dr == null||!dr.Table.Columns.Contains(name) ||string.IsNullOrEmpty(DataConverter.CStr(dr[name]))) { return false; } return true; } public string ImagesCode() { string Name = Model.fieldMod.FieldName; DataRow dr = Model.valueDR; try { FieldModel model = new FieldModel(Model.fieldMod.Content); string tlp = "" + "
" + "
" + "
" //+ "" //+ "" + ""; string value = "", lis = ""; string imgtlp = "
  • 删除编辑
  • "; if (HasValue(dr,Name))//有值 { value = dr[Name].ToString().Trim(','); try { value = "[" + value.TrimStart('[').TrimEnd(']').TrimEnd(',') + "]"; JArray arr = JsonConvert.DeserializeObject(value); foreach (JObject jobj in arr) { lis += string.Format(imgtlp, function.GetImgUrl(jobj["url"])); } } catch (Exception ex) { lis = "(异常:非标准JSON格式," + ex.Message + ")"; } } JObject obj = new JObject(); obj.Add(new JProperty("field", "images"));//标识自己为组图字段 obj.Add(new JProperty("nodeid", Model.NodeID)); obj.Add(new JProperty("inputid", Name)); obj.Add(new JProperty("name", Name)); obj.Add(new JProperty("uploaddir", SiteConfig.SiteOption.UploadDir)); obj.Add(new JProperty("iswater", model.GetValue("IsWater"))); return string.Format(tlp, Name, value, JsonConvert.SerializeObject(obj), lis); } catch (Exception ex) { throw new Exception("组图字段" + Name + "出错,原因:" + ex.Message); } } } @{ FieldModel fdmod = new FieldModel(Model.fieldMod.Content); int maxcount = DataConverter.CLng(fdmod.GetValue("maxcount"), 5); string name = Model.fieldMod.FieldName; } @if (fdmod.GetValue("type") == "mobile") {

    图片上传

    0/@maxcount
      } else { @MvcHtmlString.Create(ImagesCode()) }