弹出框处理

This commit is contained in:
guange 2016-06-20 16:04:38 +08:00
parent 47c443e59d
commit b4a3d4a5a2
2 changed files with 2 additions and 1 deletions

View File

@ -11,7 +11,7 @@ app.controller("IssueController",["$scope","$http","$routeParams","auth","common
app.controller("JournalsController",["$scope","$http","$routeParams","auth","common",function(o,a,e,l,n){n.init({id:e.id,scope:o,type:"journal_for_messages",replyType:"JournalsForMessage",loadCallback:function(a){o.message=a.data},replyCallback:function(){}})}]);
app.controller("LoginController",["$scope","$http","$location","$routeParams","alertService","config","auth","session",function(e,o,t,i,a,n,s,r){s.isBind().then(function(){t.path("/activities")}),i.code&&r.save("code",i.code);var l=e;l.loginFailed=!1,l.alertService=a.create(),l.findPwdDialog=a.create(),l.login=function(i,a){return i.$setSubmitted(),console.log(a),i.$valid?(console.log(apiUrl+"auth"),void s.openid().then(function(e){return o.post(n.apiUrl+"users/wxbind",{login:a.login,password:a.password,openid:e})}).then(function(o){console.log(o.data),l.loginFailed=0!=o.data.status,e.loginFailed?l.alertService.showMessage("出错了",o.data.message):l.alertService.showMessage("提示",o.data.message,function(){t.path("/activities")})})["catch"](function(e){l.alertService.showMessage("出错了",e)})):void console.log(i.$error)},l.showBox=function(){l.findPwdDialog.showMessage("提示","请访问www.trustie.net获取密码谢谢")},l.goReg=function(){t.path("/reg")}}]);
app.controller("RegController",["$scope","$http","$location","alertService",function(e,o,a,r){var s=e;s.errDialog=r.create(),s.goLogin=function(){a.path("/login")},s.isagreed=!0,s.agreed=function(e){s.isagreed=!e},s.reg=function(e,a){return e.$setSubmitted(),console.log(e),e.$valid?(console.log(a),void o.post(apiUrl+"users",{login:a.username,password:a.password,mail:a.email}).then(function(e){0!=e.data.status?s.errDialog.showMessage("出错了",e.data.message):s.errDialog.showMessage("提示","注册且绑定微信成功")},function(e){s.errDialo.showMessage("出错了",e.data)})):void console.log(e.$error)}}]);
app.directive("myAlert",["config",function(t){return{templateUrl:t.rootPath+"templates/alert.html",scope:{title:"=",message:"=",visible:"=",cb:"="},link:function(t){t.dismiss=function(){"function"==typeof t.cb&&t.cb()}}}}]);
app.directive("myAlert",["config",function(t){return{templateUrl:t.rootPath+"templates/alert.html",scope:{title:"=",message:"=",visible:"=",cb:"="},link:function(t){t.dismiss=function(){t.visible=!1,"function"==typeof t.cb&&t.cb()}}}}]);
app.directive("pwdconfirm",function(){return{require:"ngModel",link:function(r,n,i,e){e.$validators.pwdconfirm=function(n,i){return r.user&&r.user.password==i}}}});
app.directive("inputAuto",function(){return{restrict:"A",scope:{},link:function(n,t){var e=t.parent().children().eq(0),i=t.parent().next();t.on("input",function(){console.log(i),e.html(t[0].value);var n=e[0].scrollHeight;t.css("height",n+"px")}),i.on("click",function(){t.css("height","28px")})}}});
app.directive("loadingSpinner",["$http",function(i){return{restrict:"A",replace:!0,template:'<div ng-show="activeCalls>0" class="loading-bg"><div class="loading-box"><img src="/images/loading.gif" alt=""/><span>加载中...</span></div></div>'}}]);

View File

@ -9,6 +9,7 @@ app.directive('myAlert', ['config', function(config){
},
link: function(scope){
scope.dismiss = function(){
scope.visible = false;
if(typeof scope.cb === 'function'){
scope.cb();
}