458 Commits (8b401c7a905a426fd6a9bed0946355218ba135ed)

Author SHA1 Message Date
  luyanan 50eba9dce9 资源导入样式和已收藏样式 7 years ago
  jack 1b130faff1 资源预览浏览发布修改 7 years ago
  xuchunyang e7638939d8 工作台新闻链接修改 7 years ago
  xuchunyang 8ba1cfbc67 新文章功能 7 years ago
  jack 88fa878f88 资源浏览及预览 7 years ago
  happy f062e7709e Merge branch 'dev' of http://121.42.53.174:3000/jiapeng/portal-front.git 7 years ago
  happy 590d259f83 dd 7 years ago
  luyanan d115994ef4 资源图片发布和机构提示 7 years ago
  jack ebd89d015c 资源发布 7 years ago
  luyanan eed2d7968b 相关图片icon 7 years ago
  luyanan 0cbddd4b66 Merge branch 'dev' of http://121.42.53.174:3000/jiapeng/portal-front.git 7 years ago
  luyanan c133dbac39 文章发布标记已合并 7 years ago
  xuchunyang 0583012266 新文章功能 7 years ago
  luyanan 76afd73e86 baidu俩个页面,index添加js 7 years ago
  luyanan f64be2495a 资源发布、预览、浏览、工作台资源列表 7 years ago
  luyanan 8201e6fb83 修改完善文章列表和文章浏览 7 years ago
  jack 1d1aee4e05 链接 7 years ago
  jack 4bbf92db47 改正文字 7 years ago
  jack 5b8d9be495 登录判断条件更改 7 years ago
  jack ca7d5548e7 登录修改 7 years ago
  jack d83f55b64d 样式 7 years ago
  jack 6011db34e4 登录后跳转首页 7 years ago
  jack aeb090f294 校验两次密码 7 years ago
  jack 39fd202092 修改密码 7 years ago
  jack fa60c3b16b 邮箱验证密码都有值的时候,点击跳转 7 years ago
  xuchunyang 50fe1ca7f6 登录,注册,找回密码修改 7 years ago
  jack f3c134db92 注册 7 years ago
  jack ac3a47b3e4 邮箱注册bug修正 7 years ago
  jack 6eaf89c2df 登录注册 7 years ago
  jack 3e04267a34 修正重置密码成功或者失败再去登录bug 7 years ago
  jack a149c42514 样式问题 7 years ago
  jack cb5acc8b57 注册ie点击登录邮箱跳转好多次 7 years ago
  luyanan 97b87c0343 新版搜索 7 years ago
  luyanan 7f6f12af99 新版搜索以及文章相关样式 7 years ago
  luyanan 914082432f 新版文章发布、文章预览、文章详情、工作台文章列表 7 years ago
  luyanan ec47f01ca6 新版文章相关icon 7 years ago
  jack e890d18865 注册样式问题 7 years ago
  jack 1518a5f6c9 修正格式 7 years ago
  jack fd83e29456 注册 7 years ago
  jack a671e32cf7 邮箱发送成功后,手机注册及邮箱注册不能点 7 years ago
  jack b38c2a5f8d 登录 7 years ago
  xuchunyang bc5ca014b7 编辑器修改 7 years ago
  jack cd8528516e 注册及发邮箱 7 years ago
  xuchunyang 205ba4beb3 注册 7 years ago
  jack 71cd9f160c 注册新页面 7 years ago
  xuchunyang 833bd16dba 登陆,忘记密码,改版 7 years ago
  luyanan 34cb7c8459 完善信息中的错误提示样式 7 years ago
  xuchunyang 3b38de652a 邀请码登录后,设置密码页面改版 7 years ago
  xuchunyang 58fcd89a92 登录,首次登录个人信息页面改版 7 years ago
  luyanan d60cd98165 完善信息身份选择,特邀专家首次登录设置密码 7 years ago
console-front - Gogs: Go Git Service

Brak opisu

dyn-select.js 9.4KB

    $.use(["jQuery", "form", "doc", "util", "dropdown", "dict"], function($, form, doc, util, dd, dict) { var m_rd = "必选的", readOnly = "readOnly", showOnly = "showOnly", modelName = 'dyn-select', mModelName = "dyn-mselect", tInt = "int", def = "defVal", placeholder = "placeholder", required = "required", tree = "tree", queried = "queried", handCode = { an: "code", av: "" }, spanCode = { an: "code", av: "" }, pa = [""], jhref = { an: "href", av: "javascript:;" }, dd_hand = { an: "class", av: "dd-hand" }, icon_drop = { tn: "i", attrs: [{ an: "class", av: "icon icon-drop" }] }, icon_close = { tn: "i", attrs: [{ an: "class", av: "icon icon-close" }] }, a_placeHolder = { tn: "a", attrs: [jhref, { an: "class", av: placeholder }], chs: pa }, hand = { tn: "a", attrs: [ dd_hand, jhref, handCode, ], chs: [ icon_drop, { tn: "span", attrs: [spanCode] }, icon_close, a_placeHolder, ] }, seim = { an: "class", av: "select-item" }, sebi = { an: "class", av: "branch-item" }, buildTreeDrop = function(isQueried, items, pa) { items.forEach(function(item) { if(isQueried || item.enabled) { var li = { tn: "li", attrs: [{ an: "code", av: item.code }, { an: "caption", av: item.caption }], chs: [] }; if(item.children && item.children.length) { var bhand = { tn: "a", attrs: [{ an: "code", av: item.code }], chs: [{ tn: "span", chs: [item.caption] }] }; li.attrs.push(sebi); li.chs.push(bhand); var ul = { tn: "ul", chs: [] }; li.chs.push(ul); buildTreeDrop(isQueried, item.children, ul.chs); } else { li.attrs.push(seim); li.chs.push(item.caption); } pa.push(li); } }); }, buildShown = function($e, cache, clss) { return clss[tree] ? function(evt) { var items = cache.ready ? cache.items : null; var drop = { tn: "div", attrs: [{ an: "class", av: "dd-drop" }], chs: [] }; if(items) { var ul = { tn: "ul", chs: [] }; buildTreeDrop(clss[queried], items, ul.chs); drop.chs.push(ul); } else { drop.chs.push("loading........."); } util.appendChild($e[0], drop); } : function(evt) { var items = cache.ready ? cache.items : null; var drop = { tn: "div", attrs: [{ an: "class", av: "dd-drop" }], chs: [] }; if(items) { var ul = { tn: "ul", chs: [] }; items.forEach(function(item) { if(clss[queried] || item.enabled) { this.push({ tn: "li", attrs: [seim, { an: "code", av: item.code }, { an: "caption", av: item.caption }], chs: [item.caption] }); } }, ul.chs); drop.chs.push(ul); } else { drop.chs.push("loading........."); } util.appendChild($e[0], drop); }; }; form.register(function($e, options) { var cls = util.classCheck($e[0], [readOnly, showOnly, modelName, tInt, required, tree, queried]), rv, dynCache = {}; if(cls[modelName]) { var n = $e.attr("name") || $e.attr("id"), ve, rules = []; if(!n) { throw "Attribute[name] is invalid"; } var dv = $e.attr(def) || "", dynUri = $e.attr("uri") || ""; rv = dv; $.extend(dynCache, options ? options[n] || {} : {}); if(dynUri) { dynCache.uri = dynUri; } $e.empty().addClass("dd-ctn").addClass("dd-clean"); handCode.av = spanCode.av = dv; pa[0] = $e.attr(placeholder) || "请选择......"; util.appendChild($e[0], hand); var $h = $e.children("a"); var $span = $h.children("span"); var select_change = function(nv, cap, evt) { if(rv != nv) { rv = nv; $h.attr("code", rv); $span.attr("code", rv).text(cap).removeClass("invalid-dict"); if(evt) { $e.addClass("dd-hold-once"); } } }; if(!(cls[readOnly] || cls[showOnly])) { $e.on("shown.dropdown", buildShown($e, dynCache, cls)); $e.find(".icon-close").on("click", function(evt) { select_change("", "", evt); }); $e.on("click", "div .select-item", function() { select_change(this.getAttribute("code"), this.getAttribute("caption")); }); if(cls[tree]) { $e.on("click", "div .branch-item>a", function(evt) { $(this).toggleClass("open"); $e.addClass("dd-hold-once"); }); } } if(rv) { dict.dynTransfer(dynCache, $span, rv); } else { dict.dynApply(dynCache, util.noop); } return { name: n, get: function() { if((!cls[showOnly]) && rv) { return cls[tInt] ? parseInt(rv) : rv; } }, set: function(data) { if(data) { var cc = data === true ? "1" : ("" + data); select_change(cc, ""); dict.dynTransfer(dynCache, $span, cc); } else if(data === false || data === 0) { select_change("0", ""); dict.dynTransfer(dynCache, $span, cc); } else { select_change("", ""); } }, validate: function() { if(cls[required]) { if(!rv) { this.invalid(m_rd); return m_rd; } } return util.validate(rules, this); }, addRules: function(rule) { util.addRules(rules, rule); }, reset: function() { this.set(dv); }, valid: function() { util.valid($e); }, invalid: function(reson) { util.invalid($e); util.error(reson); } }; } }); var selCap = { an: "class", av: "select-caption" }, mhand = { tn: "a", attrs: [dd_hand], chs: [icon_drop, { tn: "ul" }, a_placeHolder] }; form.register(function($e, options) { var cls = util.classCheck($e[0], [readOnly, showOnly, mModelName, tInt, required, tree, queried]); if(cls[mModelName]) { var n = $e.attr("name") || $e.attr("id"), rules = []; if(!n) { throw "Attribute[name] is invalid"; } var dv = [], rv = [], dynCache = {}, tmp = ($e.attr(def) || "").split(","), dynUri = $e.attr("uri") || ""; $.extend(dynCache, options[n] || {}); if(dynUri) { dynCache.uri = dynUri; } tmp.forEach(function(item) { if(item) { item = item.trim(); if(item) { dv.push(item); rv.push(item); } } }); $e.empty().addClass("dd-ctn").addClass("dd-clean"); pa[0] = $e.attr(placeholder) || "请选择......"; var lis = mhand.chs[1].chs = []; dv.forEach(function(item) { lis.push({ tn: "li", attrs: [{ an: "code", av: item }], chs: [icon_close, { tn: "span", attrs: [{ an: "code", av: item }, selCap] }] }); }); util.appendChild($e[0], mhand); var $ul = $e.find("ul"); var mselect_add = function(nv, cp) { if(rv.indexOf(nv) > -1) { return false; } rv.push(nv); var li = { tn: "li", attrs: [{ an: "code", av: nv }], chs: [icon_close, { tn: "span", attrs: [{ an: "code", av: nv }, selCap], chs: [cp] } ] }; util.appendChild($ul[0], li); return true; }; var mselect_change = function(na) { rv = [], nlis = []; $ul.empty(); na.forEach(function(item) { rv.push("" + item); }); if(rv.length) { rv.forEach(function(item) { nlis.push({ tn: "li", attrs: [{ an: "code", av: item }, selCap], chs: [icon_close, { tn: "span", attrs: [{ an: "code", av: item }, { an: "class", av: "hand-dyn-dict" }] }] }); }); util.appendChild($ul[0], nlis); dict.doTransfer(); $ul.find(".hand-dyn-dict").each(function() { var $this = $(this); dict.dynTransfer(dynCache, $this); $this.removeClass("hand-dyn-dict"); }); } }; if(lis.length) { $ul.find("span").each(function() { dict.dynTransfer(dynCache, $(this)); }); } else { dict.dynApply(dynCache, util.noop); } if(!(cls[readOnly] || cls[showOnly])) { $e.on("shown.dropdown", buildShown($e, dynCache, cls)); $ul.on("click", "li>i", function(e) { $e.addClass("dd-hold-one"); var idx = rv.indexOf(this.parentNode.getAttribute("code")); if(idx > -1) { rv.splice(idx, 1); } $(this).parent().remove(); }); $e.on("click", "div .select-item", function() { if(!mselect_add(this.getAttribute("code"), this.getAttribute("caption"))) { $e.addClass("dd-hold-once"); } }); if(cls[tree]) { $e.on("click", "div .branch-item>a", function(evt) { $(this).toggleClass("open"); $e.addClass("dd-hold-once"); }); } } return { name: n, get: function() { if((!cls[showOnly]) && rv.length) { var ret = []; rv.forEach(function(item) { ret.push(cls[tInt] ? parseInt(item) : item); }); return ret; } }, set: function(data) { mselect_change(data ? (data.length ? data : []) : []); }, validate: function() { if(cls[required]) { if(!rv.length) { this.invalid(m_rd); return m_rd; } } return util.validate(rules, this); }, addRules: function(rule) { util.addRules(rules, rule); }, reset: function(data) { this.set(dv); }, valid: function() { util.valid($e); }, invalid: function(reson) { util.invalid($e); util.error(reson); } }; } }); });