controllers.js 1.1 KB

1234567891011121314151617181920212223242526
  1. starter.controller('AuthUserCtrl', function ($scope, $state, $ionicSlideBoxDelegate, $rootScope, $ionicHistory, $window, showPopup, global, User) {
  2. global.fetch_user().then(function (data) {
  3. if (!global.sn)
  4. User.sn.get({"comp_id": global.user.compno}, function (data) {
  5. global.sn = data.sn;
  6. console.warn("sn: " + global.sn);
  7. }, function (err) {
  8. console.error("获取linker的sn失败: " + JSON.stringify(err))
  9. });
  10. $scope.authuser = {"imid": global.user.im_usrid};
  11. $scope.title = global.user.compname;
  12. });
  13. $scope.commit = function () {
  14. showPopup.showLoading(1, '正在提交', false);
  15. User.user("PostUser").save("'" + JSON.stringify($scope.authuser) + "'", function (res) {
  16. console.log(res);
  17. showPopup.hideLoading();
  18. }, function (err) {
  19. if (err.status == 400)
  20. showPopup.PopupWindow(0, err.data.ExceptionMessage, false, 4000);
  21. else
  22. showPopup.hideLoading();
  23. })
  24. }
  25. })