wechatQrcodeCreateCtrl.js
1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(function (angular) {
function wechatQrcodeCreateCtrl($scope, params, $http, $uibModalInstance, $uibModal,systemService,$filter,$rootScope) {
$scope.typeList = [{id:'Y',name:'永久'},{id:'N',name:'临时'}];
$scope.wechatConfigList = [];
$scope.init = function(){
systemService.listWechatConfig({appType:'BIZ'},function(res){
if(res.returnCode == 0){
$scope.wechatConfigList = res.data;
}
});
};
$scope.init();
$scope.ok = function () {
if($scope.creatForm.$invalid){
$scope.isInValidate = true;
return false;
}
var params = {};
params.wechatAppid = $scope.wechatConfig.wechatAppid;
params.remark = $scope.info.remark;
params.number = $scope.info.number;
params.permanent = $scope.info.permanent.id;
if(params.permanent == 'N'){
params.expireSeconds = $scope.info.expireSeconds;
}
systemService.createWechatQrcode(params,function(res){
if(res.returnCode == 0){
swal({type: 'success',title: '',text: '创建成功',showConfirmButton:false,timer: 1500},function(){
window.sweetAlert.close();
$uibModalInstance.close();
});
}else{
swal({type: 'error',title: '',text: res.message||'操作失败',timer: 1500},function(){window.sweetAlert.close();});
}
});
};
}
angular.module('system').controller('wechatQrcodeCreateCtrl', wechatQrcodeCreateCtrl);
})(angular);