licenseCtrl.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. app.controller('licenseFormCtrl', ['$rootScope', '$scope', '$state', '$translate', '$localStorage', '$cookieStore', '$auth', '$window', '$document', '$timeout', '$filter', '$http', 'cfpLoadingBar', 'Restangular', 'api_login', 'SweetAlert',
  2. function($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $auth, $window, $document, $timeout, $filter, $http, cfpLoadingBar, Restangular, api_login, SweetAlert) {
  3. $scope.subLicensePass=function(){
  4. var data={
  5. "licenseCode":$scope.licensePass
  6. }
  7. api_login.license(data).then(function(res){
  8. if(res.status==200){
  9. SweetAlert.swal({
  10. title: "恭喜您,激活成功!",
  11. type: "success",
  12. confirmButtonColor: "#007AFF"
  13. }, function() {
  14. $state.go('login.signin');
  15. });
  16. }else{
  17. SweetAlert.swal({
  18. title: "激活失败",
  19. text: "请输入正确的激活码!",
  20. type: "error",
  21. confirmButtonColor: "#DD6B55"
  22. });
  23. }
  24. })
  25. };
  26. $scope.shiyong=false;
  27. $scope.featureCode="";
  28. api_login.getLicense({}).then(function(res){
  29. if(res.type==0){
  30. $scope.shiyong=true;
  31. }
  32. $scope.featureCode=res.featureCode
  33. })
  34. $scope.seeFeatureCode=false;
  35. $scope.cliUse=function(){
  36. SweetAlert.swal({
  37. title: "试用成功!",
  38. text: "请点击确定返回登录页重新输入账号密码!",
  39. type: "success",
  40. confirmButtonColor: "#007AFF"
  41. }, function() {
  42. $state.go('login.signin');
  43. });
  44. };
  45. $scope.seeCode=function(){
  46. $scope.seeFeatureCode=true
  47. };
  48. }
  49. ]);