userservice.js 1.1 KB

123456789101112131415161718192021222324252627282930
  1. (function (app) {
  2. app.factory('userService', ['$http', 'config', "util", 'storage', function ($http, config, util, storage) {
  3. return {
  4. wechat_login:function(wechat){
  5. return $http({
  6. url: config.server + 'api/auth/wechat_login?wechat=' + wechat,
  7. method: "get",
  8. })
  9. },
  10. login: function (phone, verify_code,wechat) {
  11. return $http({
  12. url: config.server + 'api/auth/login',
  13. method: "post",
  14. data: { phone: phone, verify_code: verify_code, wechat:wechat}
  15. })
  16. },
  17. getVerifyCode: function (mobile) {
  18. return $http({
  19. url: config.server + 'api/auth/code',
  20. method: "post",
  21. data: { phone: mobile}
  22. })
  23. },
  24. isLogin: function () {
  25. return !util.empty(storage.get("token")) && storage.getObject("user");
  26. }
  27. };
  28. }]);
  29. })(angular.module('app.services'));