parent
111333f731
commit
278089e78c
10 changed files with 0 additions and 1828 deletions
@ -1,231 +0,0 @@ |
||||
<@ms.html5> |
||||
<@ms.nav title="文章管理" back=true> |
||||
<#if article.basicId == 0> |
||||
<@ms.saveButton id="saveUpdate" value="保存"/> |
||||
<#else> |
||||
<@ms.updateButton id="saveUpdate" value="更新"/> |
||||
</#if> |
||||
</@ms.nav> |
||||
<@ms.panel> |
||||
<@ms.form isvalidation=true name="articleForm" action="${managerPath}/cms/article/${action}.do"> |
||||
<@ms.text name="basicTitle" colSm="2" width="400" label="文章标题" title="文章标题" size="5" placeholder="请输入文章标题" value="${article.basicTitle?default('')}" validation={"maxlength":"300","required":"true", "data-bv-notempty-message":"文章标题不能为空","data-bv-stringlength-message":"标题在300个字符以内!", "data-bv-notempty-message":"必填项目"}/> |
||||
<@ms.text name="basicSort" colSm="2" width="200" label="自定义顺序" title="自定义顺序" size="5" placeholder="请输入文章顺序" value="${article.basicSort?c?default(0)}" validation={"data-bv-between":"true","required":"true", "data-bv-between-message":"自定义顺序必须大于0","data-bv-between-min":"0", "data-bv-between-max":"99999999","data-bv-notempty-message":"自定义顺序不能为空"}/> |
||||
<#if articleType?has_content> |
||||
<@ms.checkboxlist colSm="2" name="checkbox" label="文章属性" list=articleType listKey="dictValue" listValue="dictLabel" /> |
||||
</#if> |
||||
<@ms.radio name="basicDisplay" |
||||
list=[{"id":"0","value":"是"},{"id":"1","value":"否"}] value="${article.basicDisplay?c?default()}" |
||||
listKey="id" listValue="value" label="是否显示" help="选择否后前端将不显示,需要重新生成才有效果" |
||||
/> |
||||
<@ms.formRow colSm="2" label="文章缩略图" width="400" > |
||||
<@ms.uploadImg path="article" uploadFloderPath="${articleImagesUrl?default('')}" inputName="basicThumbnails" size="1" msg="提示:文章缩略图,支持jpg格式" imgs="${article.basicThumbnails?default('')}" /> |
||||
</@ms.formRow> |
||||
<@ms.text name="articleSource" colSm="2" width="200" label="文章来源" title="文章来源" size="5" placeholder="请输入文章来源" value="${article.articleSource?default('')}" validation={"maxlength":"300", "data-bv-stringlength-message":"文章来源在300个字符以内!"} /> |
||||
<@ms.text name="articleAuthor" colSm="2" width="200" label="文章作者" title="文章作者" size="5" placeholder="请输入文章作者" value="${article.articleAuthor?default('')}" validation={"maxlength":"12", "data-bv-stringlength-message":"文章作者在12个字符以内!"} /> |
||||
<#if !isEditCategory><!-- 如果不是单篇 --> |
||||
<@ms.formRow colSm="2" label="所属栏目" width="300"> |
||||
<#if categoryTitle==""> |
||||
<@ms.treeInput treeId="inputTree" json="${listColumn?default('')}" jsonId="categoryId" jsonPid="categoryCategoryId" jsonName="categoryTitle" inputName="basicCategoryId" inputValue="${categoryId}" buttonText="选择栏目" clickZtreeId="clickZtreeId(event,treeId,treeNode);" expandAll="true" showIcon="true"/> |
||||
<#else> |
||||
<@ms.treeInput treeId="inputTree" json="${listColumn?default('')}" jsonId="categoryId" jsonPid="categoryCategoryId" jsonName="categoryTitle" inputName="basicCategoryId" inputValue="${categoryId}" buttonText="${(categoryTitle)!}" clickZtreeId="clickZtreeId(event,treeId,treeNode);" expandAll="true" showIcon="true"/> |
||||
</#if> |
||||
</@ms.formRow> |
||||
</#if> |
||||
<@ms.hidden id="basicDateTime" name="basicDateTime" value=""/> |
||||
<@ms.date id="articleDateTime" name="articleDateTime" time=true label="发布时间" single=true readonly="readonly" width="300" value="${(article.basicDateTime?default(.now))?string('yyyy-MM-dd HH:mm')}" validation={"required":"true", "data-bv-notempty-message":"必填项目"} placeholder="点击该框选择时间段" /> |
||||
<@ms.textarea colSm="2" name="basicDescription" label="描述" wrap="Soft" rows="4" size="" value="${article.basicDescription?default('')}" placeholder="请输入对该文章的简短描述,以便用户查看文章简略" validation={"maxlength":"400","data-bv-stringlength-message":"文章描述在400个字符以内!"}/> |
||||
<@ms.textarea colSm="2" name="articleKeyword" label="关键字" wrap="Soft" rows="4" size="" placeholder="请输入文章关键字" value="${article.articleKeyword?default('')}" validation={"maxlength":"155", "data-bv-stringlength-message":"文章作者在155个字符以内!"}/> |
||||
<!--新填字段内容开始--> |
||||
<div id="addFieldForm"> |
||||
</div> |
||||
<@ms.hidden name="articleTypeJson" /> |
||||
<@ms.editor colSm="2" name="articleContent" label="文章内容" content="${article.articleContent?default('')}" appId="${appId?default(0)}"/> |
||||
<@ms.hidden name="modelId" value="${Session.model_id_session?default('0')}" /> |
||||
</@ms.form> |
||||
</@ms.panel> |
||||
</@ms.html5> |
||||
<script> |
||||
//重写时间控件 |
||||
$('#articleDateTime').daterangepicker({ |
||||
format:'YYYY-MM-DD HH:mm', |
||||
singleDatePicker: true, |
||||
showDropdowns: true, |
||||
timePickerIncrement: 1, |
||||
timePicker: true, |
||||
timePicker12Hour: true, |
||||
startDate: moment().hours(0).minutes(0).seconds(0), |
||||
showDropdowns: true, |
||||
showWeekNumbers: true, |
||||
}); |
||||
$('#articleDateTime').on('apply.daterangepicker', function(ev, picker) { |
||||
$('#articleDateTime').parents("form:first").data('bootstrapValidator').revalidateField('articleDateTime'); |
||||
}); |
||||
var articleBasicId=0; |
||||
$(function(){ |
||||
//页面标题 |
||||
var articleTitle="<#if categoryTitle?has_content>${categoryTitle} </#if><#if article.basicId !=0><small>编辑文章</small><#else><small>添加文章</small></#if>"; |
||||
$(".ms-weixin-content-body-title>span").html(articleTitle); |
||||
//隐藏跳转地址 |
||||
$("input[name='articleUrl']").parent().hide(); |
||||
|
||||
//文章属性 |
||||
var actionUrl=""; |
||||
|
||||
<#if article.basicId !=0> |
||||
actionUrl = "${managerPath}/cms/article/${article.basicId?c?default(0)}/update.do"; |
||||
var type="${article.articleType?default('')}"; |
||||
var articleType = new Array; |
||||
//文章属性 |
||||
$("#articleForm input[name='checkbox']").each(function(){ |
||||
if(type!=""){ |
||||
articleType = type.split(","); |
||||
for(i=0;i<articleType.length;i++){ |
||||
if($(this).val()==articleType[i]){ |
||||
$(this).attr("checked",'true'); |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
articleBasicId=${article.basicId?c?default(0)}; |
||||
<#else> |
||||
actionUrl = "${managerPath}/cms/article/save.do"; |
||||
</#if> |
||||
|
||||
//获取当前栏目的自定义模型 |
||||
var url="${managerPath}/mdiy/contentModel/contentModelField/"+${categoryId?default(0)}+"/queryField.do"; |
||||
var articleId="basicId="+${article.basicId?c?default(0)}; |
||||
$(this).request({url:url,data:articleId,method:"get",func:function(data) { |
||||
$("#addFieldForm").html(data); |
||||
}}); |
||||
|
||||
//显示跳转地址 |
||||
$("input[name='checkbox']").click(function(){ |
||||
$("input[name='checkbox']").each(function(){ |
||||
if( $(this).val() == 'j'){ |
||||
if($(this).is(":checked") ){ |
||||
$("input[name='articleUrl']").parent().show(); |
||||
}else{ |
||||
$("input[name='articleUrl']").parent().hide(); |
||||
} |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
//更新或保存 |
||||
$("#saveUpdate").click(function(){ |
||||
//禁用按钮 |
||||
$("#saveUpdate").attr("disabled",true); |
||||
//获取按钮值 |
||||
var bottonText = $("#saveUpdate").text().trim(); |
||||
//设置按钮加载状态值 |
||||
$("#saveUpdate").attr("data-loading-text",bottonText+"中"); |
||||
|
||||
var articleDateTimeValue = $("#articleDateTime").val()+":00";//让时间能精确到秒与后台对应 |
||||
$("#basicDateTime").val(articleDateTimeValue); //给basicDateTime字段赋值 |
||||
//获取所有栏目属性被选中的值 |
||||
var typeJson="" |
||||
$("#articleTypeField").find("select").each(function(index){ |
||||
var typeValue=0; |
||||
if($(this).find("option:selected").val()==undefined){ |
||||
return; |
||||
} |
||||
var typeValue=$(this).find("option:selected").val(); |
||||
if($("#articleTypeField").find("select").length==index){ |
||||
typeJson =typeJson+ "{bcCategoryId:\"" + typeValue + "\",bcBasicId:'${article.basicId?default(0)}'}" |
||||
}else{ |
||||
typeJson =typeJson+ "{bcCategoryId:\"" + typeValue + "\",bcBasicId:'${article.basicId?default(0)}'}," |
||||
} |
||||
|
||||
}) |
||||
$("input[name=articleTypeJson]").val("["+typeJson+"]"); |
||||
var basicCategoryId=""; |
||||
<#if !isEditCategory><!-- 如果不是单篇 --> |
||||
basicCategoryId=$("input[name='basicCategoryId']").val(); //多篇时的文章栏目 |
||||
<#else> |
||||
basicCategoryId=${categoryId}; //单篇时的文章栏目 |
||||
</#if> |
||||
//文章所属栏目是数字且不能为0 |
||||
if(basicCategoryId !=0 && !isNaN(basicCategoryId) ){ |
||||
//将表单序列化 |
||||
var saveArticle = $("#articleForm").serialize(); |
||||
saveArticle += "&basicCategoryId="+basicCategoryId; |
||||
//文章属性 |
||||
var checkboxType=""; |
||||
$("input[name='checkbox']").each(function(){ |
||||
if($(this).is(":checked")){ |
||||
checkboxType+=$(this).val()+","; |
||||
} |
||||
}); |
||||
var dataMsg = saveArticle+"&checkboxType="+checkboxType; |
||||
var seeMsg = ""; |
||||
<#if article.basicId !=0> |
||||
seeMsg="更新中...."; |
||||
<#else> |
||||
seeMsg="保存中...."; |
||||
</#if> |
||||
var vobj = $("#articleForm").data('bootstrapValidator').validate(); |
||||
if(vobj.isValid()){ |
||||
if(isNaN($("input[name=basicSort]").val())){ |
||||
<@ms.notify msg="自定义排序必须是数字" type="warning"/> |
||||
$("input[name=basicSort]").val(0); |
||||
//启用按钮 |
||||
$("#saveUpdate").button('reset'); |
||||
return; |
||||
} |
||||
$(this).request({url:actionUrl,data:dataMsg,loadingText:seeMsg,method:"post",type:"json",func:function(obj) { |
||||
//执行加载状态 |
||||
$("#saveUpdate").button('loading'); |
||||
if(obj.result){ |
||||
<#if article.basicId !=0> |
||||
<@ms.notify msg="更新文章成功" type="success"/> |
||||
<#else> |
||||
<@ms.notify msg="保存文章成功" type="success"/> |
||||
</#if> |
||||
var columnType = ${columnType?default(0)}; |
||||
if(columnType == 1){ |
||||
//更新并生成之后路径进行跳转 |
||||
location.href=managerPath+"/cms/article/${categoryId?default(0)}/main.do"; |
||||
}else{ |
||||
var dataId = obj.resultData; |
||||
if(dataId!=""){ |
||||
location.href = "${managerPath}/cms/article/"+dataId+"/edit.do"; |
||||
} |
||||
}; |
||||
$("#saveUpdate").button('reset'); |
||||
}else{ |
||||
$('.ms-notifications').offset({top:43}).notify({ |
||||
type:'warning', |
||||
message: { text:obj.resultMsg } |
||||
}).show(); |
||||
} |
||||
}}); |
||||
} |
||||
}else{ |
||||
<@ms.notify msg="请选择文章所属栏目" type="warning"/> |
||||
//启用按钮 |
||||
$("#saveUpdate").attr("disabled",false); |
||||
} |
||||
//启用按钮 |
||||
$("#saveUpdate").button('reset'); |
||||
$("#saveUpdate").attr("disabled",false); |
||||
}); |
||||
}); |
||||
|
||||
//选择栏目后查询自定义模型 |
||||
function clickZtreeId(event,treeId,treeNode){ |
||||
if(treeNode.columnType == 2){ |
||||
<@ms.notify msg="不能选择单篇栏目" /> |
||||
return false; |
||||
} |
||||
if(treeNode.isParent==true){ |
||||
<@ms.notify msg="不能选择父级栏目" /> |
||||
return false; |
||||
} |
||||
var url="${managerPath}/mdiy/contentModel/contentModelField/"+treeNode.categoryId+"/queryField.do"; |
||||
var basicId="basicId=${article.basicId?c?default(0)}"; |
||||
$(this).request({url:url,data:basicId,method:"get",func:function(data) { |
||||
$("#addFieldForm").html(""); |
||||
$("#addFieldForm").html(data); |
||||
}}); |
||||
} |
||||
</script> |
||||
@ -1,163 +0,0 @@ |
||||
<@ms.html5> |
||||
<@ms.nav title="文章列表"></@ms.nav> |
||||
<@ms.searchForm name="searchForm" action=""> |
||||
<#if articleTypeList?has_content> |
||||
<@ms.select label="文章属性" default="全部" value="a" name="articleType" id="forumSelect" list=articleTypeList listValue="dictLabel" listKey="dictValue" value="${articleType?default('')}"/> |
||||
<#else> |
||||
<@ms.select label="文章属性" name="articleType" id="forumSelect" value="" list=["默认属性"] /> |
||||
</#if> |
||||
<@ms.text label="文章标题" name="basicTitle" value="" title="请输入文章标题" placeholder="请输入文章标题" /> |
||||
<@ms.searchFormButton> |
||||
<@ms.queryButton id="submitSearch" /> |
||||
</@ms.searchFormButton> |
||||
</@ms.searchForm> |
||||
<div id="toolbar"> |
||||
<@ms.panelNavBtnGroup> |
||||
<@shiro.hasPermission name="article:save"><@ms.panelNavBtnAdd title=""/></@shiro.hasPermission> |
||||
<@shiro.hasPermission name="article:del"><@ms.panelNavBtnDel title=""/></@shiro.hasPermission> |
||||
</@ms.panelNavBtnGroup> |
||||
</div> |
||||
<@ms.panel> |
||||
<table id="articleListTable" |
||||
data-show-refresh="true" |
||||
data-show-columns="true" |
||||
data-show-export="true" |
||||
data-method="post" |
||||
data-detail-formatter="detailFormatter" |
||||
data-pagination="true" |
||||
data-page-size="10" |
||||
data-side-pagination="server"> |
||||
</table> |
||||
</@ms.panel> |
||||
</@ms.html5> |
||||
<!--删除限时文章--> |
||||
<@ms.modal modalName="delete" title="删除文章"> |
||||
<@ms.modalBody> |
||||
确定要删除所选的文章吗? |
||||
</@ms.modalBody> |
||||
<@ms.modalButton> |
||||
<@ms.button class="btn btn-danger rightDelete" value="确定"/> |
||||
</@ms.modalButton> |
||||
</@ms.modal> |
||||
<script> |
||||
|
||||
|
||||
$(function(){ |
||||
var search = $("form[name='searchForm']").serializeJSON(); |
||||
var articleType = search.articleType; |
||||
$("#articleListTable").bootstrapTable({ |
||||
url:"${managerPath}/cms/article/${categoryId}/list.do?articleTypeStr="+articleType, |
||||
contentType : "application/x-www-form-urlencoded", |
||||
queryParamsType : "undefined", |
||||
toolbar: "#toolbar", |
||||
columns: [{ checkbox: true}, { |
||||
field: 'column.categoryTitle', |
||||
title: '栏目名', |
||||
width: 90, |
||||
align: 'left' |
||||
},{ |
||||
field: 'basicTitle', |
||||
title: '文章标题', |
||||
|
||||
formatter: function (value, row, index){ |
||||
<@shiro.hasPermission name="article:update"> |
||||
var url='${managerPath}/cms/article/'+row.articleID+"/edit.do"; |
||||
return "<a href="+url+" target='_self' >"+value+"</a>"; |
||||
</@shiro.hasPermission> |
||||
<@shiro.lacksPermission name="article:update"> |
||||
return value; |
||||
</@shiro.lacksPermission> |
||||
|
||||
} |
||||
}, { |
||||
field: 'articleAuthor', |
||||
title: '作者', |
||||
width: 100 |
||||
}, { |
||||
field: 'basicSort', |
||||
title: '排序', |
||||
align: 'center', |
||||
width: 50 |
||||
}, { |
||||
field: 'basicHit', |
||||
title: '点击', |
||||
align: 'center', |
||||
width: 50 |
||||
}, { |
||||
field: 'basicDateTime', |
||||
title: '发布时间', |
||||
align: 'center', |
||||
width: 150 |
||||
}] |
||||
}); |
||||
//查询文章标题 |
||||
$("#submitSearch").click(function(){ |
||||
var search = $("form[name='searchForm']").serializeJSON(); |
||||
var params = $('#articleListTable').bootstrapTable('getOptions'); |
||||
params.queryParams = function(params) { |
||||
$.extend(params,search); |
||||
return params; |
||||
} |
||||
$("#articleListTable").bootstrapTable('refresh', {query:$("form[name='searchForm']").serializeJSON()}); |
||||
}); |
||||
//添加文章 |
||||
$("#addButton").click(function(){ |
||||
if(${isParent}==true){ |
||||
<@ms.notify msg="不能选择父级栏目" /> |
||||
return false; |
||||
} |
||||
location.href = "${managerPath}/cms/article/add.do?categoryId=${categoryId?default(0)}&modelId=${Session.model_id_session?default(0)}&categoryTitle=${categoryTitle?default('')}"; |
||||
}); |
||||
//点击重置按钮 |
||||
$(".reset").click(function(){ |
||||
$("input[name=basicTitle]").val(""); |
||||
}) |
||||
//多选删除 |
||||
$("#delButton").click(function(){ |
||||
//获取勾选的所在行的所有数据 |
||||
var rows = $("#articleListTable").bootstrapTable("getSelections"); |
||||
if(rows!=""){ |
||||
//弹出modal窗体 |
||||
$(".delete").modal(); |
||||
}else{ |
||||
<@ms.notify msg="请选择文章!" type="warning"/> |
||||
} |
||||
}); |
||||
//删除多个文章 |
||||
$(".rightDelete").click(function(){ |
||||
var rows = $("#articleListTable").bootstrapTable("getSelections"); |
||||
if(rows!=""){ |
||||
$.ajax({ |
||||
url:"${managerPath}/cms/article/delete.do", |
||||
type:'post', |
||||
dataType:'json', |
||||
data:JSON.stringify(rows), |
||||
contentType:'application/json', |
||||
success:function(msg) { |
||||
if (msg.result) { |
||||
<@ms.notify msg="删除成功!" type="success"/> |
||||
location.reload(); |
||||
} else { |
||||
<@ms.notify msg="删除失败" type="fail"/> |
||||
} |
||||
} |
||||
}); |
||||
}else{ |
||||
<@ms.notify msg="请选择文章!" type="warning"/> |
||||
} |
||||
}); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,57 +0,0 @@ |
||||
<!DOCTYPE html> |
||||
<html lang="zh"> |
||||
<head> |
||||
<#include "/include/macro.ftl"/> |
||||
<#include "/include/meta.ftl"/> |
||||
</head> |
||||
<body class="over-hide"> |
||||
<@ms.content> |
||||
<@ms.contentMenu> |
||||
<!-- 树形模块菜单开始 --> |
||||
<#if listColumn?has_content> |
||||
<@ms.tree treeId="inputTree" json="${listColumn?default('')}" addNodesName="全部" jsonId="categoryId" jsonPid="categoryCategoryId" jsonName="categoryTitle" showIcon="true" expandAll="true" getZtreeId="getZtreeId(event,treeId,treeNode);" /> |
||||
<#else> |
||||
<@ms.nodata content="暂无栏目"/> |
||||
</#if> |
||||
<!-- 树形模块菜单结束 --> |
||||
</@ms.contentMenu> |
||||
<@ms.contentBody width="85%" style="overflow-y: hidden;"> |
||||
<@ms.contentPanel style="margin:0;padding:0;overflow-y: hidden;"> |
||||
<iframe src="${managerPath}/cms/article/0/main.do" style="width:100%;maring:0;padding:0;border:none;height:100%;background-image: url(${skin_manager_loadding}); background-repeat: no-repeat; background-position: center;" id="listFrame" target="listFrame" ></iframe> |
||||
</@ms.contentPanel> |
||||
</@ms.contentBody> |
||||
</@ms.content> |
||||
<script> |
||||
|
||||
//树形结点 |
||||
function getZtreeId(event,treeId,treeNode){ |
||||
if (treeNode.columnType==1) { |
||||
//父级栏目为true,子级栏目为false |
||||
var isParent = false; |
||||
if(treeNode.isParent == true){ |
||||
isParent = true; |
||||
} |
||||
$("#listFrame").attr("src","${managerPath}/cms/article/"+treeNode.categoryId+"/main.do?isParent="+isParent+"&categoryTitle="+encodeURIComponent(treeNode.categoryTitle)); |
||||
} else if(treeNode.columnType==2){ |
||||
//判断该单篇栏目是否存在文章 |
||||
$.ajax({ |
||||
type: "POST", |
||||
url: "${managerPath}/cms/article/"+treeNode.categoryId+"/queryColumnArticle.do", |
||||
dataType:"json", |
||||
success: function(msg){ |
||||
if (msg.result) { |
||||
$("#listFrame").attr("src","${managerPath}/cms/article/add.do?categoryId="+treeNode.categoryId+"&categoryTitle="+encodeURIComponent(treeNode.categoryTitle)); |
||||
} else { |
||||
//如果该单篇栏目下存在文章则跳转到文章编辑页 |
||||
$("#listFrame").attr("src","${managerPath}/cms/article/"+treeNode.categoryId+"/edit.do?categoryId="+treeNode.categoryId+"&categoryTitle="+encodeURIComponent(treeNode.categoryTitle)); |
||||
} |
||||
}, |
||||
}); |
||||
} else if(treeNode.columnType=="" || treeNode.columnType == undefined){ |
||||
$("#listFrame").attr("src","${managerPath}/cms/article/0/main.do"); |
||||
} |
||||
|
||||
} |
||||
</script> |
||||
</body> |
||||
</html> |
||||
@ -1,2 +0,0 @@ |
||||
<@shiro.hasPermission name="cms:column:save"><@ms.addButton id="addColumnBtn"/></@shiro.hasPermission> |
||||
<@shiro.hasPermission name="cms:column:del"><@ms.delButton id="delColumnBtn"/></@shiro.hasPermission> |
||||
@ -1,7 +0,0 @@ |
||||
<@shiro.hasPermission name="cms:column:update"> |
||||
var url = "${managerPath}/${model?default("")}/column/"+row.categoryId+"/edit.do?modelId=${Session.model_id_session?default(0)}&modelTitle=${Session.model_title_session?default('')}"; |
||||
return "<a href=" +url+ " target='_self'>" + value + "</a>"; |
||||
</@shiro.hasPermission> |
||||
<@shiro.lacksPermission name="cms:column:update"> |
||||
return value; |
||||
</@shiro.lacksPermission> |
||||
@ -1,161 +0,0 @@ |
||||
<@ms.html5> |
||||
<@ms.nav title="静态化"></@ms.nav> |
||||
<@ms.panel> |
||||
<p class="alert alert-info" role="alert"> |
||||
<span class="glyphicon glyphicon-pushpin text-lef "></span> |
||||
<a class="alert-link text-lef" style="margin-left: 12px;"> |
||||
更新主页,如果系统存在引导页面可以手动修改主页位置文件名,default.html引导页面index.html主页。 |
||||
</a><br/> |
||||
<span class="glyphicon glyphicon-pushpin text-lef "></span> |
||||
<a class="alert-link text-lef" style="margin-left: 12px;"> |
||||
更新栏目列表,推荐使用指定栏目更新。系统提示“更新中...”请不要刷新页面或点击其他菜单。 |
||||
</a><br/> |
||||
<span class="glyphicon glyphicon-pushpin text-lef "></span> |
||||
<a class="alert-link text-lef" style="margin-left: 12px;"> |
||||
根据时间与栏目类型生成文章 |
||||
</a> |
||||
</p> |
||||
<@ms.form name="generateIndex"> |
||||
<@ms.formRow label="选择主页模板" width="300"> |
||||
<select class="form-control" id="select_id"></select> |
||||
<input type="hidden" name="url"/> |
||||
</@ms.formRow> |
||||
<@ms.text id="position" label="选择主页位置 " width="300" value="index" placeholder="输入主页位置" name="position" help="注:主页位置htm文件名一般为index.html或default.html"/> |
||||
<div class="form-group ms-form-group"><div class="col-sm-2"></div><div class="col-sm-9 ms-from-group-input ms-form-input"> |
||||
<@shiro.hasPermission name="cms:generate:index"> |
||||
<@ms.button class="btn btn-primary" id="updateIndex" value="生成主页" /> |
||||
<@ms.panelNavBtnSave title="" id="viewIndex" value="预览主页" /> |
||||
</@shiro.hasPermission> |
||||
</div> |
||||
</div> |
||||
</@ms.form> |
||||
<!--选择更新的栏目--> |
||||
<@ms.form name="generateColumn"> |
||||
<@ms.formRow label="选择要生成栏目" width="300"> |
||||
<#if list?has_content> |
||||
<@ms.treeInput treeId="inputTree" json="${list?default('')}" jsonId="categoryId" jsonPid="categoryCategoryId" jsonName="categoryTitle" buttonText="选择更新的栏目" addNodesName="所有栏目" inputName="columnId" showIcon="true" expandAll="true" /> |
||||
<#else> |
||||
<@ms.treeInput treeId="errorTree" buttonText="暂无数据" /> |
||||
</#if> |
||||
</@ms.formRow> |
||||
<div class="form-group ms-form-group"><div class="col-sm-2"></div><div class="col-sm-9 ms-from-group-input ms-form-input"> |
||||
<@shiro.hasPermission name="cms:generate:column"> |
||||
<@ms.button class="btn btn-primary" id="updateColumn" value="生成栏目" /> |
||||
</@shiro.hasPermission> |
||||
</div></div> |
||||
</@ms.form> |
||||
<@ms.form name="generateArticle"> |
||||
<@ms.formRow label="文章栏目" width="300"> |
||||
<#if list?has_content> |
||||
<@ms.treeInput treeId="inputTreee" json="${list?default('')}" jsonId="categoryId" jsonPid="categoryCategoryId" jsonName="categoryTitle" addNodesName="所有栏目" buttonText="选择更新的栏目" inputName="articleId" showIcon="true" expandAll="true" /> |
||||
<#else> |
||||
<@ms.treeInput treeId="errorTree" buttonText="暂无数据" /> |
||||
</#if> |
||||
</@ms.formRow> |
||||
<@ms.date name="dateTime" label="指定时间" single=true readonly="readonly" width="300" value="${now?string('yyyy-MM-dd')}" validation={"required":"true", "data-bv-notempty-message":"必填项目"} placeholder="点击该框选择时间段" /> |
||||
<div class="form-group ms-form-group"><div class="col-sm-2"></div><div class="col-sm-9 ms-from-group-input ms-form-input"> |
||||
<@shiro.hasPermission name="cms:generate:article"> |
||||
<@ms.button class="btn btn-primary" id="updateArticle" value="生成文章" /> |
||||
</@shiro.hasPermission> |
||||
</div></div> |
||||
</@ms.form> |
||||
</@ms.panel> |
||||
</@ms.html5> |
||||
|
||||
<!--点击进行按钮提交--> |
||||
<script> |
||||
$(function(){ |
||||
var URL="${managerPath}/template/queryTemplateFileForColumn.do"; |
||||
var DATA = ""; |
||||
$(this).request({url:URL,data:DATA,type:"json",method:"get",func:function(msg) { |
||||
if(msg.length==0){ |
||||
$("#select_id").append("<option value='' >暂无文件</option>") |
||||
} |
||||
for(var i = 0;i<msg.length;i++){ |
||||
$("#select_id").append("<option value="+msg[i]+">"+msg[i]+"</option>"); |
||||
//如果存在index.html |
||||
if(msg[i]=="index.html" || msg[i]=="index.htm"){ |
||||
$("#select_id").find("option[value='"+msg[i]+"']").attr("selected",true); |
||||
} |
||||
} |
||||
}}); |
||||
}) |
||||
|
||||
//点击一键更新主页时,进行主页更新 |
||||
$("#updateIndex").click(function(){ |
||||
//选择的主页模板名称和主页位置 |
||||
var url = $("#select_id").val(); |
||||
var position =$("input[name='position']").val(); |
||||
//封装ajax请求参数 |
||||
var URL="${managerPath}/cms/generate//generateIndex.do"; |
||||
var DATA = "url="+url+"&position="+position; |
||||
$(this).html("更新中..").attr("disabled", "disabled"); |
||||
$(this).request({url:URL,data:DATA,type:"json",method:"post",func:function(msg) { |
||||
$("#updateIndex").html("更新主页").removeAttr("disabled"); |
||||
if(msg.result){ |
||||
<@ms.notify msg="更新成功" type="success"/> |
||||
}else{ |
||||
$('.ms-notifications').offset({top:43}).notify({ |
||||
type:'warning', |
||||
message: { text:msg.resultMsg } |
||||
}).show(); |
||||
} |
||||
$("#updateIndex").html("更新主页") |
||||
}}); |
||||
}); |
||||
//点击预览时,进行预览 |
||||
$("#viewIndex").click(function(){ |
||||
var position =$("input[name='position']").val(); |
||||
window.open("${managerPath}/cms/generate/"+position+"/viewIndex.do"); |
||||
}); |
||||
</script> |
||||
|
||||
<!--点击生成栏目按钮--> |
||||
<script> |
||||
$("#updateColumn").click(function() { |
||||
var columnId = 0; |
||||
if($("input[name='columnId']").val() !="" && $("input[name='columnId']").val().length>0){ |
||||
columnId = $("input[name='columnId']").val(); |
||||
} |
||||
var URL="${managerPath}/cms/generate/"+columnId+"/genernateColumn.do"; |
||||
$(this).html("更新中..").attr("disabled", "disabled"); |
||||
$(this).request({url:URL,data:columnId,type:"json",method:"post",func:function(msg) { |
||||
$("#updateColumn").html("更新栏目").removeAttr("disabled"); |
||||
//回调处理方式 |
||||
if(msg.result){ |
||||
<@ms.notify msg="更新成功" type="success"/> |
||||
}else{ |
||||
$('.ms-notifications').offset({top:43}).notify({ |
||||
type:'warning', |
||||
message: { text:msg.resultMsg } |
||||
}).show(); |
||||
} |
||||
}}); |
||||
}); |
||||
</script> |
||||
|
||||
<!--点击生成文章按钮--> |
||||
<script> |
||||
$("#updateArticle").click(function() { |
||||
var articleId = 0; |
||||
if($("input[name='articleId']").val() !="" ){ |
||||
articleId = $("input[name='articleId']").val(); |
||||
} |
||||
var URL="${managerPath}/cms/generate/" + articleId + "/generateArticle.do"; |
||||
var DATA = "dateTime=" + $("input[name='dateTime']").val(); |
||||
$(this).html("更新中..").attr("disabled", "disabled"); |
||||
|
||||
$(this).request({url:URL,data:DATA,type:"json",method:"post",func:function(msg) { |
||||
$("#updateArticle").html("更新文档").removeAttr("disabled"); |
||||
//回调处理方式 |
||||
if(msg.result){ |
||||
<@ms.notify msg="更新成功" type="success"/> |
||||
}else{ |
||||
$('.ms-notifications').offset({top:43}).notify({ |
||||
type:'warning', |
||||
message: { text:msg.resultMsg } |
||||
}).show(); |
||||
} |
||||
}}); |
||||
}); |
||||
</script> |
||||
@ -1,164 +0,0 @@ |
||||
<!DOCTYPE html> |
||||
<html lang="zh"> |
||||
<head> |
||||
<title>${app.appName}</title> |
||||
<#include "/include/head-file.ftl"/> |
||||
<script src="${base}/static/plugins/jquery/3.2.1/jquery.min.js"></script> |
||||
<script src="${base}/static/plugins/jquery.cookie/1.4.1/jquery.cookie.min.js"></script> |
||||
<link rel="stylesheet" href="${base}/static/ms-admin/4.7.0/css/login.css"> |
||||
</head> |
||||
<body> |
||||
<div id="login" class="login"> |
||||
|
||||
<el-container class="ms-admin-login-container"> |
||||
|
||||
<el-main class="ms-admin-login-main"> |
||||
|
||||
<div class="ms-admin-login-warp" @keydown.13='checkLogin'> |
||||
|
||||
<img style="height: 360px" :src="ms.base+'/static/ms-admin/4.7.0/images/login-slogn.png'"> |
||||
<el-form :model="loginForm" status-icon :rules="loginFormRule" style="height: 360px" ref="loginForm" label-width="100px" class="ms-admin-login-form"> |
||||
<el-alert |
||||
style="margin-bottom: 10px;" |
||||
title="演示版部分删除功能已去除" |
||||
type="warning" |
||||
center |
||||
:closable="false" |
||||
show-icon> |
||||
</el-alert> |
||||
<h1> |
||||
<span>账户登录 / </span>User login</h1> |
||||
<el-form-item class="ms-admin-form-item" prop="managerName"> |
||||
<el-input type="text" placeholder='用户名/admin' v-model="loginForm.managerName" ></el-input> |
||||
</el-form-item> |
||||
<el-form-item class="ms-admin-form-item" prop="managerPassword"> |
||||
<el-input type="password" placeholder='密码/123456' v-model="loginForm.managerPassword"></el-input> |
||||
</el-form-item> |
||||
<el-form-item class="ms-admin-form-item ms-admin-form-item-code" prop="rand_code"> |
||||
<el-input type="text" placeholder='验证码' v-model="loginForm.rand_code" autocomplete="off"></el-input> |
||||
<img :src="verifCode" class="code-img" @click="code" /> |
||||
<p> |
||||
<span>看不清?</span> |
||||
<span @click="code">换一张</span> |
||||
</p> |
||||
</el-form-item> |
||||
<el-form-item class="ms-admin-form-item ms-admin-form-item-checkout"> |
||||
<el-checkbox v-model="rememberPass">记住密码</el-checkbox> |
||||
</el-form-item> |
||||
<el-form-item class="ms-admin-form-item"> |
||||
<el-button type="primary" @click="checkLogin" class="ms-admin-login-btn">登录</el-button> |
||||
|
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-main> |
||||
</el-container> |
||||
</div> |
||||
</body> |
||||
|
||||
</html> |
||||
<script> |
||||
var loginVue = new Vue({ |
||||
el: '#login', |
||||
data: { |
||||
loginForm: { |
||||
managerName: 'admin', |
||||
managerPassword: "123456", |
||||
rand_code: '' |
||||
}, |
||||
verifCode: ms.manager + "/code?t=" + new Date().getTime(), |
||||
rememberPass: '', |
||||
loginFormRule: { |
||||
managerName: [{ |
||||
required: true, |
||||
message: '请输入用户名', |
||||
trigger: 'blur' |
||||
}, |
||||
{ |
||||
min: 1, |
||||
max: 30, |
||||
message: '长度在 1 到 30 个字符', |
||||
trigger: 'blur' |
||||
} |
||||
], |
||||
managerPassword: [{ |
||||
required: true, |
||||
message: '请输入密码', |
||||
trigger: 'blur' |
||||
}, |
||||
{ |
||||
min: 1, |
||||
max: 30, |
||||
message: '长度在 1 到 30 个字符', |
||||
trigger: 'blur' |
||||
} |
||||
], |
||||
rand_code: [{ |
||||
required: true, |
||||
message: '请填写验证码', |
||||
trigger: 'blur' |
||||
}, |
||||
{ |
||||
min: 1, |
||||
max: 4, |
||||
message: '长度在1 到 4 个字符', |
||||
trigger: 'blur' |
||||
} |
||||
], |
||||
} |
||||
}, |
||||
methods: { |
||||
// 登录 |
||||
checkLogin: function() { |
||||
var that = this; |
||||
this.$refs['loginForm'].validate((valid) => { |
||||
if(valid) { |
||||
ms.http.post(ms.manager + "/checkLogin.do", that.loginForm).then(function(data) { |
||||
if(data.result) { |
||||
if(that.rememberPass) { |
||||
$.cookie('managerName',that.loginForm.managerName, { expires: 365 }); |
||||
$.cookie('managerPassword',that.loginForm.managerPassword, { expires: 365 }); |
||||
} else { |
||||
$.cookie('managerName',""); |
||||
$.cookie('managerPassword',""); |
||||
} |
||||
that.$notify({ |
||||
title: '成功', |
||||
message: '登录成功', |
||||
type: 'success' |
||||
}); |
||||
location.href = ms.manager + "/index.do"; |
||||
} else { |
||||
that.$notify({ |
||||
title: '失败', |
||||
message: data.resultMsg, |
||||
type: 'warning' |
||||
}); |
||||
that.code(); |
||||
} |
||||
}, (err) => { |
||||
that.$message.error(data.resultMsg); |
||||
}) |
||||
} |
||||
|
||||
}); |
||||
|
||||
}, |
||||
code: function() { |
||||
this.verifCode = ms.web + "/code?t=" + new Date().getTime(); |
||||
}, |
||||
|
||||
}, |
||||
mounted: function() { |
||||
this.verifCode = ms.web + "/code?t=" + new Date().getTime(); |
||||
if($.cookie('managerName')){ |
||||
this.loginForm.managerName = $.cookie('managerName'); |
||||
this.loginForm.managerPassword = $.cookie('managerPassword'); |
||||
} |
||||
if (top.location != self.location){ |
||||
top.location = self.location; |
||||
} |
||||
} |
||||
}) |
||||
|
||||
</script> |
||||
@ -1,26 +0,0 @@ |
||||
<!--主界面--> |
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<title>铭飞CMS</title> |
||||
<meta content="IE=edge" http-equiv="X-UA-Compatible" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> |
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> |
||||
<style> |
||||
body{ height: 100%;} |
||||
</style> |
||||
</head> |
||||
<body> |
||||
<div style=" |
||||
text-align: center; |
||||
color: #555; |
||||
background: #FCFCFC; |
||||
height: 300px; |
||||
padding-top: 200px; |
||||
vertical-align: middle; |
||||
"><h2>欢迎使用铭飞产品</h2><p>技术交流加群:①242805203 ②231212174(满) ③221335098(满) 或到<a href="http://ms.mingsoft.net/mbbs/main.do" target="_blank" style=" |
||||
text-decoration: none; |
||||
">官方论坛进行技术交流</a></p></div> |
||||
</body> |
||||
</html> |
||||
@ -1,135 +0,0 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<title>登录</title> |
||||
<#include "/include/head-file.ftl"/> |
||||
<script src="http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script> |
||||
<link rel="stylesheet" href="${base}/static/css/login.css"> |
||||
</head> |
||||
<body> |
||||
<div id="app"> |
||||
<el-container> |
||||
<el-header class="ms-header" height="100px"> |
||||
<img src="${base}/static/images/logo.png"> |
||||
<p>铭飞科技</p> |
||||
<em></em> |
||||
<span>欢迎登录</span> |
||||
</el-header> |
||||
<el-main class="ms-body"> |
||||
<div class="ms-login"> |
||||
<div class="ms-login-tab"> |
||||
<span @click="loginActive='1'" :class="{'active':loginActive=='1'}">账号登录</span> |
||||
<em></em> |
||||
<span @click="loginActive='2'" :class="{'active':loginActive=='2'}">扫码登录</span> |
||||
</div> |
||||
<!--账号登录--> |
||||
<el-form ref="form" :model="form" :rules="loginFormRule" label-width="0px" v-if="loginActive=='1'"> |
||||
<el-form-item prop="username"> |
||||
<el-input type="text" v-model="form.username" placeholder="用户名"> |
||||
<template slot="append">@qq.com</template> |
||||
</el-input> |
||||
</el-form-item> |
||||
<el-form-item prop="password"> |
||||
<el-input type="password" v-model="form.password" placeholder="密码"></el-input> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" width="100%" @click="login()" class="ms-login-but">登录</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
<!--扫码登录--> |
||||
<div v-show="loginActive=='2'" class="ms-login-code" id="login_container"> |
||||
<img src="${base}/static/images/code.png"/> |
||||
<span>请使用微信扫码二维码登录</span> |
||||
<a>" 铭飞MS平台 "</a> |
||||
</div> |
||||
|
||||
<!--扫码登录成功--> |
||||
<div v-if="loginActive=='3'" class="ms-login-code-success"> |
||||
<img class="phone" src="${base}/static/images/phone.png" /> |
||||
<img class="success" src="${base}/static/images/success.png" /> |
||||
<span>扫码成功!</span> |
||||
<span>请在手机上确认登录</span> |
||||
<a @click="loginActive='2'">返回二维码</a> |
||||
</div> |
||||
</div> |
||||
</el-main> |
||||
<el-footer class="ms-footer"> |
||||
<div> |
||||
<span>关于我们</span> |
||||
<em></em> |
||||
<span>发展历程</span> |
||||
<em></em> |
||||
<span>联系我们</span> |
||||
</div> |
||||
<div> |
||||
版权所有 ©铭飞科技有限公司2012-2019 保留一切权利。 |
||||
</div> |
||||
</el-footer> |
||||
</el-container> |
||||
</div> |
||||
</body> |
||||
</html> |
||||
<script> |
||||
new Vue({ |
||||
el: "#app", |
||||
data: { |
||||
form: { |
||||
username: "", |
||||
password: "", |
||||
}, |
||||
loginActive: "1", //登录方式选中 |
||||
loginFormRule: { |
||||
username: [{ |
||||
required: true, |
||||
message: '请输入用户名', |
||||
trigger: 'change' |
||||
}, ], |
||||
password: [{ |
||||
required: true, |
||||
message: '请输入密码', |
||||
trigger: 'change' |
||||
}, ], //表单验证 |
||||
} |
||||
}, |
||||
methods: { |
||||
//点击登录 |
||||
login: function() { |
||||
var that = this; |
||||
//调用表单验证 |
||||
this.$refs.form.validate(function(valid) { |
||||
if(valid) { |
||||
//验证成功 |
||||
var people = { |
||||
username : that.form.username + "@qq.com", |
||||
password : that.form.password |
||||
} |
||||
ms.http.post(ms.base + "/sso/login.do", people) |
||||
.then(function(json) { |
||||
if(json.result){ |
||||
window.location.href=decodeURIComponent(ms.util.getParameter("backurl")); |
||||
}else{ |
||||
alert("登陆失败,\n1、账号或密码错\n2、或账号没有设置密码,请先扫描登陆后设置密码后重试"); |
||||
} |
||||
}), function(err) { |
||||
console.log(err) |
||||
} |
||||
} else { |
||||
//验证失败 |
||||
} |
||||
}); |
||||
} |
||||
}, |
||||
mounted: function(){ |
||||
var obj = new WxLogin({ |
||||
id:"login_container", |
||||
appid: "wx8c96aa3db4611395", |
||||
scope: "snsapi_login", |
||||
redirect_uri: "http%3A%2F%2Fms.mingsoft.net%2Fsso%2Fweixin.do%3Fbackurl%3D"+decodeURIComponent(ms.util.getParameter("backurl")), |
||||
state:"", |
||||
style: "black", |
||||
href: "" |
||||
}); |
||||
} |
||||
}) |
||||
</script> |
||||
@ -1,882 +0,0 @@ |
||||
/** |
||||
* 用户基础信息 |
||||
*/ |
||||
(function () { |
||||
/** |
||||
*退出 |
||||
------ |
||||
* @callmethod people.quit(function(){...}); |
||||
* @param {{type:function,have:true}} 回调方法 无返回值 |
||||
* @examples
|
||||
* ... |
||||
* <a href="#" class="quitLogin">退出</a> |
||||
* ... |
||||
* ... |
||||
* @function
|
||||
* 无返回值 |
||||
* @return {{type:none}} 无返回值 |
||||
*/ |
||||
function quit(func) { |
||||
ms.http.get(ms.base + "/people/quit.do", { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}).then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 设置密码 |
||||
------ |
||||
* @callmethod people.resetPassword(data,function(returnJson){...}); |
||||
* @param {{type:String,have:true}} peoplePassword 用户密码 |
||||
* @param {{type:function}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* ... |
||||
* @function
|
||||
* {"resultMsg":"","result":true} |
||||
* @return {{type:resultMsg}} 提示信息 |
||||
* @return {{type:result}} true成功、false失败 |
||||
*/ |
||||
function resetPassword(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
alert("数据不能为空"); |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.peoplePassword + "")) { |
||||
alert("密码不能为空"); |
||||
return; |
||||
} |
||||
ms.http.post(ms.base + "/people/resetPassword.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}) |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 验证用户接收的验证码 |
||||
------ |
||||
* @callmethod people.checkPeopleCode(peopleCode,function(returnJson){...}); |
||||
* @param {{type:string,have:true}} peopleCode 短信、邮箱验证码
|
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* ... |
||||
* @function |
||||
* {code:"模块编码",result:true} |
||||
* @return {{type:code}} 编码 |
||||
* @return {{type:result}} true成功、false失败 |
||||
*/ |
||||
function checkPeopleCode(peopleCode, func) { |
||||
if (validator.isEmpty(peopleCode + "")) { |
||||
return; |
||||
} |
||||
ms.http.post(ms.base + "/people/checkPeopleCode.do", peopleCode, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}) |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 获取用户基本信息 |
||||
------ |
||||
* @callmethod people.info(function(returnJson){...}); |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* ... |
||||
* @function |
||||
* { |
||||
* "peopleAutoLogin":0, |
||||
* "peopleName":"mstest", |
||||
* "peopleDateTime":"2016-05-08 13:14:00", |
||||
* "peopleId":5201314, |
||||
* } |
||||
* @return {{type:peopleAutoLogin}} 自动登录多少天 |
||||
* @return {{type:peopleName}} 用户名 |
||||
* @return {{type:peopleDateTime}} 用户登录时间 |
||||
* @return {{type:peopleId}} 用户编号 |
||||
*/ |
||||
function info(func) { |
||||
ms.http.get(ms.base + "/people/info.do") |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 修改密码 |
||||
------ |
||||
* 如果修改密码,在输入新密码后需要再次填入确认密码,需要前端自行判断新密码与再次确认密码是否一致,接口未做判断 |
||||
* @callmethod people.changePassword(data,function(returnJson){...}); |
||||
* @param {{type:string,have:true}} peopleOldPassword 原密码 |
||||
* @param {{type:string,have:true}} peoplePassword 新密码 |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* ... |
||||
* @function |
||||
* {code:"模块编码",result:true,resultMsg:""} |
||||
* @return {{type:code}} 模块编码 |
||||
* @return {{type:result}} true成功、false失败 |
||||
* @return {{type:resultMsg}} 错误信息 |
||||
*/ |
||||
function changePassword(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.peopleOldPassword + "")) { |
||||
alert("原密码不能为空"); |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.peoplePassword + "")) { |
||||
alert("新密码不能为空"); |
||||
return; |
||||
} |
||||
ms.http.post(ms.base + "/people/changePassword.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}) |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 验证用户名,手机号或邮箱 |
||||
* @param data |
||||
* @returns |
||||
*/ |
||||
function checkValidator(data) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
if ((validator.isEmpty(data.peopleName + "") || typeof (data.peopleName) == "undefined") && |
||||
(validator.isEmpty(data.peoplePhone + "") || typeof (data.peoplePhone) == "undefined") && |
||||
(validator.isEmpty(data.peopleMail + "") || typeof (data.peopleMail) == "undefined")) { |
||||
alert("用户名,手机号,邮箱必须有一个不为空"); |
||||
return; |
||||
} |
||||
if (!validator.isEmpty(data.peoplePhone + "") && typeof (data.peoplePhone) != "undefined") { |
||||
if (!validator.isMobilePhone(data.peoplePhone, 'zh-CN')) { |
||||
alert("请输入正确的手机号"); |
||||
return; |
||||
} |
||||
} |
||||
if (!validator.isEmpty(data.peopleMail + "") && typeof (data.peopleMail) != "undefined") { |
||||
if (!validator.isEmail(data.peopleMail)) { |
||||
alert("请输入正确的邮箱"); |
||||
return; |
||||
} |
||||
} |
||||
if (validator.isEmpty(data.peoplePassword + "")) { |
||||
alert("密码不能为空"); |
||||
return; |
||||
} |
||||
} |
||||
/** |
||||
* 注册 |
||||
- ----- |
||||
* 用户可以用名称、手机号、邮箱三者之一进行注册 |
||||
* 几种注册流程的形式: |
||||
* 1、普通用户名称、登录密码,优先用户名注册,登录密码最长度范围3~30个字符; |
||||
* 2、邮箱、邮箱验证码、登录密码(邮箱必须是可接收验证码); |
||||
* 3、手机号、短信验证码、登录密码; |
||||
* 注意: 1、注册页面必须存在图片验证码 |
||||
* 2、如果需要接收验证码操作,需要使用“发送验证码”配合使用才能完成注册流程 |
||||
* @callmethod register(data,function(returnJson){...}); |
||||
* @param {{type:string}} peoplePhone 手机号 |
||||
* @param {{type:string}} peopleName 用名称 用户名长度在3~30个字符之间,只能是字母数字混合 |
||||
* @param {{type:string}} peopleMail 邮箱 |
||||
* @param {{type:string,have:true}} peoplePassword 注册密码
|
||||
* @param {{type:strings,have:true}} rand_code 验证码 |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* <form name="registe"> |
||||
* <input type="text" name="peopleName" /> <!--注册用户名--> |
||||
* <input type="password" name="peoplePassword"/> <!--注册密码--> |
||||
* <input type="password" name="rePassword"/> <!--确认注册密码,需要做前端验证,此接口不提供验证--> |
||||
* <input type="text" name="rand_code" /> <!--验证码--> |
||||
* <img id="registeCode"/>
|
||||
* </form> |
||||
* ... |
||||
* ... |
||||
* @function
|
||||
* {"resultMsg":"注册成功","result":true,"code":"07010100"} |
||||
* @return {{type:resultMsg}} 提示信息 |
||||
* @return {{type:code}} 错误编码 |
||||
* @return {{type:result}} true成功、false失败 |
||||
*/ |
||||
function register(data, func) { |
||||
checkValidator(data); //验证表单信息
|
||||
ms.http.post(ms.base + "/register.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}).then(func, (err) => { |
||||
console.log(err); |
||||
}) |
||||
} |
||||
/** |
||||
*登录 |
||||
------ |
||||
* 登录验证,登录必须存在验证码
|
||||
* @callmethod checkLogin(data,function(returnJson){...}); |
||||
* @param {{type:string,have:true}} peopleName 用户名 |
||||
* @param {{type:string,have:true}} peoplePassword 登录密码 |
||||
* @param {{type:string,have:true}} rand_code 验证码 |
||||
* @param {{type:string}} peopleAutoLogin 自动登录 如果大于0表示开启自动登录,1表示自动登录保留1天 |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* <form name="login"> |
||||
* <input type="text" name="peopleName" /> <!--登录用户名,手机号或邮箱--> |
||||
* <input type="password" name="peoplePassword"/> <!--登录密码--> |
||||
* <input type="text" name="rand_code" /> <!--验证码--> |
||||
* <img id="loginCode"/>
|
||||
* ... |
||||
* </form> |
||||
* ... |
||||
* ... |
||||
* @function
|
||||
* {"resultMsg":"{ |
||||
* \"peopleAppId\":0, |
||||
* \"peopleAutoLogin\":0, |
||||
* \"peopleId\":9020, |
||||
* \"peopleMailCheck\":0, |
||||
* \"peopleName\":\"mstest\", |
||||
* \"peoplePhoneCheck\":0, |
||||
* \"peopleState\":0}", |
||||
* "result":true, |
||||
* "code":"07010200"} |
||||
* @return {{type:code}} 错误编码 |
||||
* @return {{type:result}} true成功、false失败 |
||||
* @return {{type:resultMsg}} 提示信息 |
||||
* @return {{type:resultData}} {"peopleAutoLogin":自动登录多少天,"peopleName":用户,"peopleId":用户编号,"peopleMail ":用户邮箱} |
||||
*/ |
||||
function checkLogin(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.peopleName + "")) { |
||||
alert("用户名不能为空"); |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.peoplePassword + "")) { |
||||
alert("密码不能为空"); |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.rand_code + "")) { |
||||
alert("验证码不能为空"); |
||||
return; |
||||
} |
||||
ms.http.post(ms.base + "/checkLogin.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}).then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
*验证登录状态 |
||||
------ |
||||
* @callmethod checkLoginStatus(function(returnJson){...}); |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* @function
|
||||
* {result:"false"} |
||||
* @return {{type:result}} true成功、false失败 |
||||
*/ |
||||
function checkLoginStatus(func) { |
||||
ms.http.post(ms.base + "/checkLoginStatus.do") |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 发送验证码 |
||||
------ |
||||
* 用户发送验证码,可以通过邮箱或手机发送 |
||||
* @callmethod sendCode(data,function(returnJson){...}); |
||||
* @param {{type:string,have:true}} receive 接收地址,只能是邮箱或手机号,邮箱需要使用邮箱插件,手机号需要短信插件 |
||||
* @param {{type:string,have:true}} modelCode 对应邮件插件的模块编号 |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* <form name="sendEmailCode"> |
||||
* <input type="text" name="receive" /> <!--接收地址,本案例为邮箱--> |
||||
* <input type="text" name="modelCode" type="hidden" value="后台邮件插件模块编号"/> |
||||
* ... |
||||
* </form> |
||||
* ... |
||||
* ... |
||||
* @function
|
||||
* {result:"true"} |
||||
* @return {{type:result}} true成功、false失败 |
||||
*/ |
||||
function sendCode(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.receive + "")) { |
||||
alert("接收地址不能为空"); |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.modelCode + "")) { |
||||
alert("对应邮件插件的模块编号不能为空"); |
||||
return; |
||||
} |
||||
ms.http.get(ms.base + "/sendCode.do", data).then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 验证用户接收的验证码 |
||||
------ |
||||
* 验证用户输入的系统发送邮件或者短信验证码是否正确 |
||||
* @callmethod checkSendCode(data,function(returnJson){...}); |
||||
* @param {{type:string,have:true}} receive 接收地址,只能是邮箱或手机号,邮箱需要使用邮箱插件,手机号需要短信插件 |
||||
* @param {{type:string,have:true}} code 对应接收的验证码 |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* <form name="sendEmailCode"> |
||||
* <input type="text" name="receive" /> <!--接收地址,本案例为邮箱--> |
||||
* <input type="text" name="modelCode" type="hidden" value="后台邮件插件模块编号"/> |
||||
* ... |
||||
* <input type="text" name="code" /> |
||||
* ... |
||||
* </form> |
||||
* ... |
||||
* @function
|
||||
* {result:"true"} |
||||
* @return {{type:result}} true成功、false失败 |
||||
*/ |
||||
function checkSendCode(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.receive + "")) { |
||||
alert("接收地址不能为空"); |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.code + "")) { |
||||
alert("接收的验证码不能为空"); |
||||
return; |
||||
} |
||||
ms.http.post(ms.base + "/checkSendCode.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}) |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 解绑邮箱验证用户接收的验证码 |
||||
------ |
||||
* 解绑邮箱时,验证用户输入的系统发送邮件或者短信验证码是否正确 |
||||
* @callmethod cancelBind(data,function(returnJson){...}); |
||||
* @param {{type:string,have:true}} receive 接收地址,只能是邮箱或手机号,邮箱需要使用邮箱插件,手机号需要短信插件 |
||||
* @param {{type:string,have:true}} code 对应接收的验证码 |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* <form name="sendEmailCode"> |
||||
* <input type="text" name="receive" /> <!--接收地址,本案例为邮箱--> |
||||
* <input type="text" name="modelCode" type="hidden" value="后台邮件插件模块编号"/> |
||||
* ... |
||||
* <input type="text" name="code" /> |
||||
* ... |
||||
* </form> |
||||
* ... |
||||
* @function
|
||||
* {result:"true"} |
||||
* @return {{type:result}} true成功、false失败 |
||||
*/ |
||||
function cancelBind(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.receive + "")) { |
||||
alert("接收的验证码不能为空"); |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.code + "")) { |
||||
alert("接收的验证码不能为空"); |
||||
return; |
||||
} |
||||
ms.http.post(ms.base + "/cancelBind.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}).then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 验证已保存用户 |
||||
------ |
||||
* 验证用户名、手机号、邮箱是否已保存,同一时间只能判断一种,优先用户名称
|
||||
* 适用场景: |
||||
* 1、用户注册是对用户名、邮箱或手机号唯一性判断
|
||||
* 2、用户取回密码是判断账号是否存在 |
||||
* @callmethod check(data,function(returnJson){...}); |
||||
* @param {{type:string}} peopleName 用户名称验证 |
||||
* @param {{type:string}} peopleMail 用户邮箱验证 |
||||
* @param {{type:string}} peoplePhone 用户手机验证 |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
*... |
||||
* <form> |
||||
* ... |
||||
* <input type="text" name="peopleName" /> <!--接收地址,本案例为用户名判断--> |
||||
* ... |
||||
* </form> |
||||
* ... |
||||
* @function
|
||||
* {result:"true"} |
||||
* @return {{type:code}} 模块编码 |
||||
* @return {{type:result}} true存在|false不存在或错误 |
||||
* @return {{type:resultMsg}} 错误信息 |
||||
*/ |
||||
function check(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
checkValidator(data); //验证表单
|
||||
ms.http.post(ms.base + "/check.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}) |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 验证已绑定用户 |
||||
------ |
||||
* 验证用户名、手机号、邮箱是否已保存并绑定,同一时间只能判断一种,优先用户名称
|
||||
* 适用场景: |
||||
* 1、用户注册是对用户名、邮箱或手机号唯一性判断
|
||||
* 2、用户取回密码是判断账号是否存在 |
||||
* 3、用户绑定邮箱或者手机号验证,邮箱或手机号是否存在并已绑定 |
||||
* @callmethod isExists(data,function(returnJson){...}); |
||||
* @param {{type:string}} peopleName 用户名称验证 |
||||
* @param {{type:string}} peopleMail 用户邮箱验证,注意:只验证绑定成功的邮箱
|
||||
* @param {{type:string}} peoplePhone 用户手机验证,注意:只验证绑定成功的手机
|
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* <form> |
||||
* ... |
||||
* <input type="text" name="peopleName" /> <!--接收地址,本案例为用户名判断--> |
||||
* ... |
||||
* </form> |
||||
* ... |
||||
* super.load(["super.people"],function(mpeople){ |
||||
* mpeople.isExists($("form").serialize(),function(returnJson){ |
||||
* alert(JSON.stringify(returnJson)); |
||||
* }); |
||||
* }) |
||||
* @function
|
||||
* {result:"true"} |
||||
* @return {{type:code}} 模块编码 |
||||
* @return {{type:result}} true存在|false不存在或错误 |
||||
* @return {{type:resultMsg}} 错误信息 |
||||
*/ |
||||
function isExists(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
checkValidator(data); //验证表单信息
|
||||
ms.http.post(ms.base + "/isExists.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}).then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
*验证图片验证码 |
||||
------ |
||||
*例如流程需要短信验证或邮箱验证,为有效防止恶意发送验证码。提供给ajax异步请求使用
|
||||
*注意:页面提交对验证码表单属性名称必须是rand_code,否则无效 |
||||
* @callmethod checkCode(rand_code,function(returnJson){...}); |
||||
* @param {{type:strings,have:true}} rand_code 验证码 |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* <form name="picCode"> |
||||
* <input type="text" name="rand_code" /> <!--填写验证码--> |
||||
* <img id="picCode"/> <!--图片验证码--> |
||||
* </form> |
||||
*... |
||||
* @function
|
||||
* {code:"错误编码",result:"true成功、false失败",resultMsg: "提示信息"} |
||||
* @return {{type:code}} 错误编码 |
||||
* @return {{type:result}} true成功、false失败 |
||||
* @return {{type:resultMsg}} 提示信息 |
||||
*/ |
||||
function checkCode(rand_code, func) { |
||||
if (validator.isEmpty(rand_code + "")) { |
||||
alert("接收的验证码不能为空"); |
||||
return; |
||||
} |
||||
ms.http.post(ms.base + "/checkCode.do", rand_code, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}) |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 重置密码 |
||||
------ |
||||
* 当用户忘记登录密码时可以通过注册绑定的邮箱或绑定的手机号进行取回,操作过程中需要通过邮件模块与短信模块发送验证码给用户 |
||||
* 业务场景:用户输入手机号(邮箱),点击发送验证码,发送间隔时间为60秒,用户将接收到的验证码输入提交,此接口不会对用户再次输入新密码进行判断,需要开发者做前端判断 |
||||
* @callmethod resetPassword(data,function(returnJson){...}); |
||||
* @param {{type:string,have:true}} peoplePassword 用户新密码
|
||||
* @param {{type:string,have:true}} rand_code 验证码 |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* <form name="resetPassword"> |
||||
* ... |
||||
* <input type="text" name="peoplePassword"/> |
||||
* <input type="text" name="peopleCode" /> <!--短信验证码验证码--> |
||||
* <input type="text" name="rand_code" /> <!--验证码--> |
||||
* <img id="resetPasswordCode"/>
|
||||
* ... |
||||
* </form> |
||||
* ... |
||||
* ... |
||||
* @function
|
||||
* {code:"0777700",result:true,resultMsg: "提示信息"} |
||||
* @return {{type:code}} 错误编码 |
||||
* @return {{type:result}} true成功、false失败 |
||||
* @return {{type:resultMsg}} 提示信息 |
||||
*/ |
||||
function resetPassword(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.peoplePassword + "")) { |
||||
alert("用户新密码不能为空"); |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.peopleCode + "")) { |
||||
alert("接收的验证码不能为空"); |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.rand_code + "")) { |
||||
alert("图片验证码不能为空"); |
||||
return; |
||||
} |
||||
ms.http.post(ms.base + "/resetPassword.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}) |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 验证重置密码收到的验证码 |
||||
------ |
||||
* 忘记密码时需要将第一步验证用户时的接收验证码作为重置密码的验证码 |
||||
* @callmethod checkResetPasswordCode(data,function(returnJson){...}); |
||||
* @param {{type:string,have:true}} peopleCode 短信、邮箱验证码
|
||||
* @param {{type:string,have:true}} rand_code 验证码,可能会传递经过多个流程,具体根据业务确定 |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* <form name="resetPassword"> |
||||
* ... |
||||
* <input type="text" name="peopleCode"/> |
||||
* <input type="text" name="rand_code" /> <!--验证码--> |
||||
* <img id="checkResetPasswordCodeCode"/>
|
||||
* ... |
||||
* </form> |
||||
* ... |
||||
* @function
|
||||
* {result:"true"} |
||||
* @return {{type:result}} true成功、false失败 |
||||
*/ |
||||
function checkResetPasswordCode(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.peopleCode + "")) { |
||||
alert("接收的验证码不能为空"); |
||||
return; |
||||
} |
||||
if (validator.isEmpty(data.rand_code + "")) { |
||||
alert("图片验证码不能为空"); |
||||
return; |
||||
} |
||||
ms.http.post(ms.base + "/checkResetPasswordCode.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}).then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
let people = { |
||||
quit: quit, |
||||
resetPassword: resetPassword, |
||||
checkPeopleCode: checkPeopleCode, |
||||
info: info, |
||||
changePassword: changePassword, |
||||
register: register, |
||||
sendCode: sendCode, |
||||
checkLogin: checkLogin, |
||||
checkLoginStatus: checkLoginStatus, |
||||
checkSendCode: checkSendCode, |
||||
cancelBind: cancelBind, |
||||
check: check, |
||||
isExists: isExists, |
||||
checkCode: checkCode, |
||||
resetPassword: resetPassword, |
||||
checkResetPasswordCode: checkResetPasswordCode, |
||||
} |
||||
window.ms.people = people; |
||||
}()); |
||||
/** |
||||
* 用户基础信息 |
||||
*/ |
||||
(function () { |
||||
/** |
||||
* 获取用户详情 |
||||
------ |
||||
* @callmethod people.info(function(returnJson){...}); |
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* ... |
||||
* @function |
||||
* { |
||||
* "peopleAutoLogin":0, |
||||
* "peopleName":"mstest", |
||||
* "peopleDateTime":"2016-05-08 13:14:00", |
||||
* "peopleId":5201314, |
||||
* } |
||||
* @return {{type:peopleAutoLogin}} 自动登录多少天 |
||||
* @return {{type:peopleName}} 用户名 |
||||
* @return {{type:peopleDateTime}} 用户登录时间 |
||||
* @return {{type:peopleId}} 用户编号 |
||||
*/ |
||||
function info(func) { |
||||
ms.http.get(ms.base + "/people/user/info.do") |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
/** |
||||
* 更新手机号或邮箱 |
||||
------ |
||||
* 更新用户信息中保存的手机号或者邮箱号,二者必须存在一个 |
||||
* @callmethod people.update(data,function(returnJson){...}); |
||||
* @param {{type:string,have:true}} peopleMail 邮箱
|
||||
* @param {{type:string}} peoplePhone 手机号
|
||||
* @param {{type:function,have:true}} 回调方法 返回值(returnJson) |
||||
* @examples
|
||||
* ... |
||||
* <form name="update"> |
||||
* ... |
||||
* <input type="text" name="peoplePhone"/> |
||||
* ... |
||||
* </form> |
||||
* .. |
||||
* ... |
||||
* @function |
||||
* {code:"模块编码",result:true,resultMsg:""} |
||||
* @return {{type:code}} 模块编码 |
||||
* @return {{type:result}} true成功、false失败 |
||||
* @return {{type:resultMsg}} 错误信息 |
||||
*/ |
||||
function update(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
if ((validator.isEmpty(data.peoplePhone + "") || typeof (data.peoplePhone) == "undefined") && |
||||
(validator.isEmpty(data.peopleMail + "") || typeof (data.peopleMail) == "undefined")) { |
||||
alert("用户名,手机号,邮箱必须有一个不为空"); |
||||
return; |
||||
} |
||||
if (!validator.isEmpty(data.peoplePhone + "") && typeof (data.peoplePhone) != "undefined") { |
||||
if (!validator.isMobilePhone(data.peoplePhone, 'zh-CN')) { |
||||
alert("请输入正确的手机号"); |
||||
return; |
||||
} |
||||
} |
||||
if (!validator.isEmpty(data.peopleMail + "") && typeof (data.peopleMail) != "undefined") { |
||||
if (!validator.isEmail(data.peopleMail)) { |
||||
alert("请输入正确的邮箱"); |
||||
return; |
||||
} |
||||
} |
||||
ms.http.post(ms.base + "/people/user/update.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}) |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
|
||||
function saveUserIcon(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
ms.http.post(ms.base + "/people/user/saveUserIcon.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}) |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
|
||||
function updateUserIcon(data, func) { |
||||
if (validator.isEmpty(data + "")) { |
||||
return; |
||||
} |
||||
ms.http.post(ms.base + "/people/user/updateUserIcon.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}) |
||||
.then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
let user = { |
||||
info: info, |
||||
update: update, |
||||
saveUserIcon: saveUserIcon, |
||||
updateUserIcon: updateUserIcon |
||||
} |
||||
window.ms.people.user = user; |
||||
}()); |
||||
/** |
||||
* 普通用户收货地址信息 |
||||
*/ |
||||
(function () { |
||||
/** |
||||
* 用户收货地址列表 |
||||
* @param data |
||||
* @param func |
||||
* @returns |
||||
*/ |
||||
function list(data, func) { |
||||
ms.http.get(ms.base + "/people/address/list.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}).then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
|
||||
/** |
||||
* 保存用户收货地址 |
||||
* @param data |
||||
* @param func |
||||
* @returns |
||||
*/ |
||||
function save(data, func) { |
||||
ms.http.post(ms.base + "/people/address/save.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}).then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
|
||||
/** |
||||
* 更新用户收货地址 |
||||
* @param data |
||||
* @param func |
||||
* @returns |
||||
*/ |
||||
function update(data, func) { |
||||
ms.http.post(ms.base + "/people/address/update.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}).then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 设置默认地址 |
||||
* @param data |
||||
* @param func |
||||
* @returns |
||||
*/ |
||||
function setDefault(data, func) { |
||||
ms.http.post(ms.base + "/people/address/setDefault.do", data, { |
||||
headers: { |
||||
'Content-Type': 'application/x-www-form-urlencoded' |
||||
} |
||||
}).then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
|
||||
/** |
||||
* 通过peopleAddressId查询用户收货地址实体 |
||||
* @param data |
||||
* @param func |
||||
* @returns |
||||
*/ |
||||
function get(data, func) { |
||||
ms.http.get(ms.base + "/people/address/get.do", data).then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 根据收货地址id删除收货信息 |
||||
* @param data |
||||
* @param func |
||||
* @returns |
||||
*/ |
||||
function del(data, func) { |
||||
ms.http.get(ms.base + "/people/address/delete.do", data).then(func, (err) => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
let address = { |
||||
list: list, |
||||
save: save, |
||||
update: update, |
||||
setDefault: setDefault, |
||||
get: get, |
||||
del: del |
||||
} |
||||
window.ms.people.address = address; |
||||
}()); |
||||
Loading…
Reference in new issue