starter.controller('AuthUserCtrl', function ($scope, $state, $ionicSlideBoxDelegate, $rootScope, $ionicHistory, $window, showPopup, global, User) { global.fetch_user().then(function (data) { if (!global.sn) User.sn.get({"comp_id": global.user.compno}, function (data) { global.sn = data.sn; console.warn("sn: " + global.sn); }, function (err) { console.error("获取linker的sn失败: " + JSON.stringify(err)) }); $scope.authuser = {"imid": global.user.im_usrid}; $scope.title = global.user.compname; }); $scope.commit = function () { showPopup.showLoading(1, '正在提交', false); User.user("PostUser").save("'" + JSON.stringify($scope.authuser) + "'", function (res) { console.log(res); $window.history.back(); showPopup.hideLoading(); }, function (err) { if (err.status == 400) showPopup.PopupWindow(0, err.data.ExceptionMessage, false, 4000); else showPopup.hideLoading(); }) } })