优化登录

This commit is contained in:
java110 2020-06-21 17:12:34 +08:00
parent d60841df0c
commit f067a7b4f9
2 changed files with 68 additions and 66 deletions

View File

@ -89,6 +89,8 @@
});
},
saveAddComplainInfo: function () {
vc.component.addComplainViewInfo.communityId = vc.getCurrentCommunity().communityId;
if (vc.component.addComplainValidate()) {
//侦听回传
vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addComplainViewInfo);

View File

@ -1,69 +1,69 @@
(function(vc){
(function (vc) {
vc.extends({
propTypes: {
callBackListener:vc.propTypes.string, //父组件名称
callBackFunction:vc.propTypes.string //父组件监听方法
callBackListener: vc.propTypes.string, //父组件名称
callBackFunction: vc.propTypes.string //父组件监听方法
},
data:{
addResourceStoreInfo:{
resId:'',
resName:'',
resCode:'',
price:'',
description:'',
data: {
addResourceStoreInfo: {
resId: '',
resName: '',
resCode: '',
price: '',
description: '',
}
},
_initMethod:function(){
_initMethod: function () {
},
_initEvent:function(){
vc.on('addResourceStore','openAddResourceStoreModal',function(){
},
_initEvent: function () {
vc.on('addResourceStore', 'openAddResourceStoreModal', function () {
$('#addResourceStoreModel').modal('show');
});
},
methods:{
addResourceStoreValidate(){
methods: {
addResourceStoreValidate() {
return vc.validate.validate({
addResourceStoreInfo:vc.component.addResourceStoreInfo
},{
'addResourceStoreInfo.resName':[
{
limit:"required",
param:"",
errInfo:"物品名称不能为空"
addResourceStoreInfo: vc.component.addResourceStoreInfo
}, {
'addResourceStoreInfo.resName': [
{
limit: "required",
param: "",
errInfo: "物品名称不能为空"
},
{
limit:"maxin",
param:"2,100",
errInfo:"物品名称长度为2至100"
{
limit: "maxin",
param: "2,100",
errInfo: "物品名称长度为2至100"
},
],
'addResourceStoreInfo.resCode':[
{
limit:"maxLength",
param:"50",
errInfo:"物品编码不能超过50位"
'addResourceStoreInfo.resCode': [
{
limit: "maxLength",
param: "50",
errInfo: "物品编码不能超过50位"
},
],
'addResourceStoreInfo.price':[
{
limit:"required",
param:"",
errInfo:"物品价格不能为空"
'addResourceStoreInfo.price': [
{
limit: "required",
param: "",
errInfo: "物品价格不能为空"
},
{
limit:"money",
param:"",
errInfo:"物品价格格式错误"
{
limit: "money",
param: "",
errInfo: "物品价格格式错误"
},
],
'addResourceStoreInfo.description':[
{
limit:"maxLength",
param:"200",
errInfo:"描述不能为空"
'addResourceStoreInfo.description': [
{
limit: "maxLength",
param: "200",
errInfo: "描述不能为空"
},
],
@ -72,19 +72,19 @@
});
},
saveResourceStoreInfo:function(){
if(!vc.component.addResourceStoreValidate()){
saveResourceStoreInfo: function () {
if (!vc.component.addResourceStoreValidate()) {
vc.toast(vc.validate.errInfo);
return ;
return;
}
vc.component.addResourceStoreInfo.communityId = vc.getCurrentCommunity().communityId;
//不提交数据将数据 回调给侦听处理
if(vc.notNull($props.callBackListener)){
vc.emit($props.callBackListener,$props.callBackFunction,vc.component.addResourceStoreInfo);
if (vc.notNull($props.callBackListener)) {
vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addResourceStoreInfo);
$('#addResourceStoreModel').modal('hide');
return ;
return;
}
vc.http.post(
@ -92,34 +92,34 @@
'save',
JSON.stringify(vc.component.addResourceStoreInfo),
{
emulateJSON:true
},
function(json,res){
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if(res.status == 200){
if (res.status == 200) {
//关闭model
$('#addResourceStoreModel').modal('hide');
vc.component.clearAddResourceStoreInfo();
vc.emit('resourceStoreManage','listResourceStore',{});
vc.emit('resourceStoreManage', 'listResourceStore', {});
return ;
return;
}
vc.toast(json);
},
function(errInfo,error){
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
});
},
clearAddResourceStoreInfo:function(){
clearAddResourceStoreInfo: function () {
vc.component.addResourceStoreInfo = {
resName:'',
resCode:'',
price:'',
description:'',
resName: '',
resCode: '',
price: '',
description: '',
};
}
}