controllers.js 1.1 KB

123456789101112131415161718192021222324252627
  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. $window.history.back();
  18. showPopup.hideLoading();
  19. }, function (err) {
  20. if (err.status == 400)
  21. showPopup.PopupWindow(0, err.data.ExceptionMessage, false, 4000);
  22. else
  23. showPopup.hideLoading();
  24. })
  25. }
  26. })