(function(vc, vm) { vc.extends({ data: { editCommunityWechatInfo: { wechatId: '', weChatId:'', name: '', appId: '', appSecret: '', payPassword: '1', createTime: '', objType: '', objId: '', mchId: '1', mchName:'1', remarks: '', objTypes: '1000', certPath: '' } }, _initMethod: function() { }, _initEvent: function() { vc.on('editCommunityWechat', 'openEditCommunityWechatModal', function(_params) { $that.refreshEditCommunityWechatInfo(); $('#editCommunityWechatModel').modal('show'); vc.copyObject(_params, $that.editCommunityWechatInfo); }); }, methods: { editCommunityWechatValidate: function() { return vc.validate.validate({ editCommunityWechatInfo: $that.editCommunityWechatInfo }, { 'editCommunityWechatInfo.name': [{ limit: "required", param: "", errInfo: "名称不能为空" }, { limit: "maxIn", param: "1,100", errInfo: "名称不能超过100位" }, ], 'editCommunityWechatInfo.appId': [{ limit: "required", param: "", errInfo: "appId不能为空" }, { limit: "maxin", param: "1,100", errInfo: "appId不能超过100位" }, ], 'editCommunityWechatInfo.appSecret': [{ limit: "required", param: "", errInfo: "应用密钥不能为空" }, { limit: "maxin", param: "1,200", errInfo: "应用密钥不能超过200个字符" }, ], 'editCommunityWechatInfo.objType': [{ limit: "required", param: "", errInfo: "配置不能为空" }], }); }, editCommunityWechat: function() { if (!$that.editCommunityWechatValidate()) { vc.toast(vc.validate.errInfo); return; } //1000表示改小程序作用于当前小区 否则作用于所有小区 vc.http.apiPost( '/smallWeChat.updateAdminSmallWeChat', JSON.stringify($that.editCommunityWechatInfo), { emulateJSON: true }, function(json, res) { //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); if (res.status == 200) { //关闭model $('#editCommunityWechatModel').modal('hide'); vc.emit('communityWechat', 'listSmallWeChat', {}); vc.emit('communityMini', 'listSmallWeChat', {}); return; } vc.message(json); }, function(errInfo, error) { console.log('请求失败处理'); vc.message(errInfo); }); }, refreshEditCommunityWechatInfo: function() { $that.editCommunityWechatInfo = { wechatId: '', weChatId:'', name: '', appId: '', appSecret: '', payPassword: '1', createTime: '', objType: '', objId: '', mchId: '1', mchName:'1', remarks: '', objTypes: '1000', certPath: '' } vc.emit('editCommunityWechat', 'uploadFile', 'clearVedio', {}); } } }); })(window.vc, window.$that);