From 3a6470b1f3e827bc6103bb03bc3e18e7e1e65bb0 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 7 Jul 2016 14:55:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=8F=AD=E7=BA=A7=E6=97=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8F=90=E7=A4=BA=E7=A1=AE=E5=AE=9A=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/edit_class.html | 3 +- .../wechat/controllers/edit_class.js | 36 +++++++++++-------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/public/assets/wechat/edit_class.html b/public/assets/wechat/edit_class.html index a1a243b12..e6b649adc 100644 --- a/public/assets/wechat/edit_class.html +++ b/public/assets/wechat/edit_class.html @@ -10,5 +10,6 @@ 完成 - + + diff --git a/public/javascripts/wechat/controllers/edit_class.js b/public/javascripts/wechat/controllers/edit_class.js index 8520a6eca..b7e7bf40c 100644 --- a/public/javascripts/wechat/controllers/edit_class.js +++ b/public/javascripts/wechat/controllers/edit_class.js @@ -14,7 +14,12 @@ app.controller('EditClassController', ['$scope', '$http', 'auth', 'config', 'ale }); } - vm.alertService = alertService.create(); + //单弹框 + vm.alertService_1 = alertService.create(); + + //双弹框 + vm.alertService_2 = alertService.create(); + vm.addClass = function(){ vm.syllabus.courses.push({}); }; @@ -22,18 +27,21 @@ app.controller('EditClassController', ['$scope', '$http', 'auth', 'config', 'ale vm.deleteClass = function(index){ var course = vm.syllabus.courses[index]; if(course.id >0){ - $http.post(config.apiUrl+'courses/'+course.id+'/del', { - token: auth.token() - }).then(function(response){ - if(response.data.status!=0){ - vm.alertService.showMessage('出错了', response.data.message); - } else { - vm.alertService.showMessage('提示', '删除班级成功', function(){ - vm.syllabus.courses.splice(index, 1); - }); - } - console.log(response.data.data); + vm.alertService_2.showMessage('提示', '您确定要删除该班级吗?', function() { + $http.post(config.apiUrl+'courses/'+course.id+'/del', { + token: auth.token() + }).then(function(response){ + if(response.data.status!=0){ + vm.alertService_1.showMessage('出错了', response.data.message); + } else { + vm.alertService_1.showMessage('提示', '删除班级成功', function(){ + vm.syllabus.courses.splice(index, 1); + }); + } + console.log(response.data.data); + }); }); + } else { vm.syllabus.courses.splice(index, 1); } @@ -63,9 +71,9 @@ app.controller('EditClassController', ['$scope', '$http', 'auth', 'config', 'ale courses: courses }).then(function(response){ if(response.data.status!=0){ - vm.alertService.showMessage('出错了', response.data.message); + vm.alertService_1.showMessage('出错了', response.data.message); } else { - vm.alertService.showMessage('提示', '保存课程成功', function(){ + vm.alertService_1.showMessage('提示', '保存课程成功', function(){ window.history.back(); }); }