my.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. (function (app) {
  2. app.controller('myCtrl', ["$scope","$ionicTabsDelegate", "$state", "$http", "storage", "myService", "common", "config", "msg","$timeout"
  3. , function ($scope,$ionicTabsDelegate, $state, $http, storage, myService, common, config, msg, $timeout) {
  4. $scope.$on('$ionicView.beforeEnter', function (viewResult) {
  5. $ionicTabsDelegate.showBar(true);
  6. myService.myInfo().then(function(result){
  7. $scope.user = result.data.data
  8. });
  9. });
  10. $scope.setAvator = function () {
  11. common.setAvator().then(function (result) {
  12. var response = JSON.parse(result.response);
  13. console.log(response.data.file);
  14. $timeout(function () {
  15. $scope.user.avatar = config.imgServer + response.data.file;
  16. });
  17. });
  18. };
  19. }]);
  20. app.controller('profileCtrl', ["$scope", "$timeout","$ionicTabsDelegate","$state","$filter", "storage", "myService", "msg", "common"
  21. , function ($scope, $timeout, $ionicTabsDelegate, $state, $filter, storage, myService, msg, common) {
  22. $scope.$on('$ionicView.beforeEnter', function () {
  23. $ionicTabsDelegate.showBar(false);
  24. });
  25. $scope.setAvator = function () {
  26. common.setAvator().then(function (result) {
  27. var response = JSON.parse(result.response);
  28. $timeout(function () {
  29. $scope.user.avatar = config.imgServer + response.data.file;
  30. });
  31. });
  32. };
  33. //保存个人信息
  34. $scope.vm={
  35. pic:"",
  36. sex:"",
  37. signture:"",
  38. emotion:"",
  39. job:"",
  40. tall:"",
  41. nickname:"",
  42. birthday1:""
  43. };
  44. $scope.$on('$ionicView.beforeEnter', function () {
  45. msg.loading();
  46. myService.myInfo().then(function(result){
  47. // alert(JSON.stringify(result.data.data));
  48. $scope.vm = result.data.data;
  49. $scope.vm.sex = $scope.vm.sex+'';
  50. $scope.vm.emotion = $scope.vm.emotion+'';
  51. if($scope.vm.birthday){
  52. var arr1 = $scope.vm.birthday.split("-");
  53. $scope.vm.birthday1 = new Date(arr1[0],parseInt(arr1[1])-1,arr1[2]);
  54. }
  55. msg.hide();
  56. },function(error){
  57. msg.hide();
  58. // msg.error(error.data.message);
  59. })
  60. });
  61. $scope.saveMaterial = function(){
  62. var data = {
  63. sex:$scope.vm.sex,
  64. signture:$scope.vm.signture,
  65. emotion:$scope.vm.emotion,
  66. work:$scope.vm.work,
  67. height:$scope.vm.height,
  68. city:$scope.vm.city,
  69. nickname:$scope.vm.nickname,
  70. birthday:$scope.vm.birthday1
  71. };
  72. if($scope.vm.birthday1){
  73. data.birthday = $filter('date')($scope.vm.birthday1, "yyyy-MM-dd");
  74. }
  75. if($scope.vm.avatar){
  76. data.pic = $scope.vm.avatar;
  77. }
  78. msg.loading('提交中...');
  79. myService.saveMaterial(data).then(function(result){
  80. msg.hide();
  81. msg.success("保存成功!");
  82. $state.go('app.my');
  83. myService.myInfo();
  84. },function(error){
  85. msg.hide();
  86. msg.error(error.data.message);
  87. })
  88. }
  89. }]);
  90. app.controller('settingCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
  91. , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
  92. $scope.$on('$ionicView.beforeEnter', function () {
  93. $ionicTabsDelegate.showBar(false);
  94. });
  95. //退出登陆
  96. $scope.logout = function(){
  97. storage.remove("token");
  98. storage.remove("user");
  99. $state.go("login");
  100. }
  101. }]);
  102. app.controller('aboutMiaoCtrl', ["$scope","$ionicTabsDelegate","$timeout", "$state", "myService", "msg","storage"
  103. , function ($scope,$ionicTabsDelegate,$timeout, $state,myService, msg, storage) {
  104. $scope.$on('$ionicView.beforeEnter', function () {
  105. $scope.aboutMiao();
  106. });
  107. $scope.aboutMiao = function(){
  108. myService.aboutMiao().then(function(result){
  109. $scope.items = result.data.data;
  110. },function(error){
  111. msg.error(error.data.message)
  112. })
  113. };
  114. }]);
  115. app.controller('withdrawCtrl', ["$scope","$ionicTabsDelegate","$ionicHistory","$timeout", "$state", "myService", "msg","storage"
  116. , function ($scope,$ionicTabsDelegate, $ionicHistory,$timeout,$state,myService, msg, storage) {
  117. $scope.vm={
  118. pay:"",
  119. cash:""
  120. };
  121. $scope.$on("$ionicView.enter",function(){
  122. myService.showAccount().then(function(result){
  123. $scope.accountId = result.data.data;
  124. var items = result.data.data;
  125. $scope.pays=[];
  126. angular.forEach(items,function(item){
  127. if(item.bank_name!=null) {
  128. var value=item.bank_name+"(";
  129. var len=item.bank_number.length;
  130. var txt1=item.bank_number.substr(0,len-4).replace(/\d+/g,'**');
  131. var txt2=item.bank_number.substr(len-4,4);
  132. value=value+txt1+txt2+")";
  133. }
  134. else {
  135. value=item.type;
  136. }
  137. $scope.pays.push({id:item.id,value:value});
  138. })
  139. },function(error){
  140. msg.error(error.data.message)
  141. })
  142. });
  143. $scope.withdraw = function(){
  144. var data = {
  145. data:{
  146. bank_id:$scope.vm.pay.id,
  147. cash:$scope.vm.cash
  148. }
  149. };
  150. myService.withdraw(data).then(function(result){
  151. msg.text("提现申请已提交");
  152. $timeout(function () {
  153. $ionicHistory.goBack();
  154. },1000);
  155. },function(error){
  156. })
  157. }
  158. }]);
  159. app.controller('payoutCtrl', ["$scope","$ionicTabsDelegate","$timeout","$ionicHistory", "$state", "myService", "msg","storage"
  160. , function ($scope,$ionicTabsDelegate, $timeout, $ionicHistory,$state,myService, msg, storage) {
  161. $scope.vm={
  162. pay:"",
  163. cash:""
  164. };
  165. $scope.$on("$ionicView.enter",function(){
  166. myService.showAccount().then(function(result){
  167. $scope.accountId = result.data.data;
  168. var items = result.data.data;
  169. $scope.pays=[];
  170. angular.forEach(items,function(item){
  171. if(item.bank_name!=null) {
  172. var value=item.bank_name+"(";
  173. var len=item.bank_number.length;
  174. var txt1=item.bank_number.substr(0,len-4).replace(/\d+/g,'**');
  175. var txt2=item.bank_number.substr(len-4,4);
  176. value=value+txt1+txt2+")";
  177. }
  178. else {
  179. value=item.type;
  180. }
  181. $scope.pays.push({id:item.id,value:value});
  182. })
  183. },function(error){
  184. msg.error(error.data.message)
  185. })
  186. });
  187. $scope.withdraw = function(){
  188. var data = {
  189. data:{
  190. bank_id:$scope.vm.pay.id,
  191. cash:$scope.vm.cash
  192. }
  193. };
  194. myService.withdraw(data).then(function(result){
  195. msg.text("提现申请已提交");
  196. $timeout(function () {
  197. $ionicHistory.goBack();
  198. },1000);
  199. },function(error){
  200. })
  201. }
  202. }]);
  203. app.controller('payExplainCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
  204. , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
  205. $scope.$on('$ionicView.beforeEnter', function () {
  206. $scope.payExplain();
  207. });
  208. $scope.payExplain = function(){
  209. myService.payExplain().then(function(result){
  210. $scope.items = result.data.data;
  211. },function(error){
  212. msg.error(error.data.message)
  213. })
  214. };
  215. }]);
  216. app.controller('explainCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
  217. , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
  218. }]);
  219. app.controller('contactCtrl', ["$scope","$ionicTabsDelegate", "$timeout","$state", "myService", "msg","storage"
  220. , function ($scope,$ionicTabsDelegate, $timeout,$state,myService, msg, storage) {
  221. $scope.vm={
  222. content:"",
  223. email:""
  224. };
  225. $scope.contact = function(){
  226. var data={
  227. data:{
  228. content:$scope.vm.content,
  229. email:$scope.vm.email
  230. }
  231. };
  232. myService.contact(data).then(function(result){
  233. msg.text("发送成功");
  234. $timeout(function(){
  235. $state.go("app.my");
  236. },1000);
  237. },function(error){
  238. msg.error(error.data.message);
  239. })
  240. }
  241. }]);
  242. app.controller('attentionCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
  243. , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
  244. $scope.$on('$ionicView.beforeEnter', function () {
  245. myService.attention().then(function(result){
  246. $scope.users = result.data.data;
  247. },function(error){
  248. })
  249. });
  250. $scope.toMyUserDetail = function (id) {
  251. myService.toMyUserDetail(id).then(function(result){
  252. $scope.items = result.data.data;
  253. $state.go('app.attention_Detail',{id:id,items:$scope.items});
  254. },function(error){
  255. //msg.error(msg.data.error)
  256. })
  257. };
  258. }]);
  259. app.controller('attention_DetailCtrl', ["$scope", "$state", "$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams", "$ionicModal", "$timeout", "$ionicScrollDelegate", "$interval"
  260. , function ($scope, $state,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams, $ionicModal, $timeout, $ionicScrollDelegate, $interval) {
  261. var id = $stateParams.id;
  262. $scope.items = $stateParams.items;
  263. $scope.dream_id = $scope.items.near_dream.id;
  264. $scope.$on('$ionicView.beforeEnter', function () {
  265. $ionicTabsDelegate.showBar(false);
  266. });
  267. $scope.attentionUser = function(id,is_care){
  268. homeService.attentionUser(id,is_care).then(function(result){
  269. $scope.items.is_care=result.data.data;
  270. })
  271. };
  272. $scope.cancelSupport = function () {
  273. $scope.tosupport = false;
  274. $scope.toshare = false;
  275. };
  276. $scope.toshare = false;
  277. $scope.share = function ($event) {
  278. $event.stopPropagation();
  279. $scope.toshare = true;
  280. };
  281. $scope.toDetail = function (dream_id) {
  282. if($scope.items.near_dream==null){
  283. msg.alert("当前梦想","该用户没有当前梦想");
  284. }
  285. if($scope.items.near_dream!=null){
  286. var dream_id = $scope.items.near_dream.id;
  287. $state.go('app.my_dreamdetail',{id:dream_id});
  288. }
  289. };
  290. $scope.toOldDream = function(){
  291. if($scope.items.dreams.length<2){
  292. msg.alert("曾经的梦想","该用户没有曾经的梦想");
  293. }
  294. if($scope.items.dreams.length>1){
  295. $state.go("app.oldDream",{user_id:$scope.items.user.id});
  296. }
  297. };
  298. $scope.toSupportDream = function(){
  299. if($scope.items.sup_dreams.length==0){
  300. msg.alert("支持的梦想","该用户没有支持的梦想");
  301. }
  302. if($scope.items.sup_dreams.length!=0){
  303. $state.go("app.mySupportDream",{user_id:$scope.items.user.id});
  304. }
  305. };
  306. $scope.collectionDream = function(is_collection){
  307. homeService.collectionDream(id,is_collection).then(function(result){
  308. $scope.user.is_collection=result.data.data;
  309. })
  310. };
  311. }]);
  312. app.controller('mySupportDreamCtrl', ["$scope","homeService", "$stateParams","$state", "msg"
  313. , function ($scope,homeService,$stateParams, $state, msg) {
  314. var user_id = $stateParams.user_id;
  315. $scope.$on('$ionicView.beforeEnter',function(){
  316. $scope.toUserDetail(user_id);
  317. });
  318. $scope.toUserDetail = function(user_id){
  319. homeService.toUserDetail(user_id).then(function(result){
  320. $scope.items = result.data.data;
  321. $scope.user = result.data.data.user;
  322. $scope.dreams = $scope.user.sup_dream;
  323. },function(error){
  324. })
  325. };
  326. $scope.toDetail = function(){
  327. $state.go("app.attention_Detail",{user_id:user_id,items:$scope.items})
  328. }
  329. }]);
  330. app.controller('myOldDreamCtrl', ["$scope","homeService", "$stateParams","$state", "msg"
  331. , function ($scope,homeService,$stateParams, $state, msg) {
  332. var user_id = $stateParams.user_id;
  333. $scope.$on('$ionicView.beforeEnter',function(){
  334. $scope.toUserDetail(user_id);
  335. });
  336. $scope.toUserDetail = function(user_id){
  337. homeService.toUserDetail(user_id).then(function(result){
  338. $scope.items = result.data.data;
  339. $scope.user = result.data.data.user;
  340. $scope.dreams = $scope.user.dreams;
  341. },function(error){
  342. })
  343. };
  344. $scope.toDetail = function(){
  345. $state.go("app.attention_Detail",{user_id:user_id,items:$scope.items})
  346. };
  347. }]);
  348. app.controller('messageReplyCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
  349. , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
  350. }]);
  351. app.controller('personalLetterCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
  352. , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
  353. $scope.$on('$ionicView.beforeEnter', function () {
  354. myService.letter().then(function(result){
  355. $scope.comments = result.data.data;
  356. },function(error){
  357. });
  358. });
  359. }]);
  360. app.controller('rechargeCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
  361. , function ($scope, $ionicTabsDelegate,$state, myService, msg) {
  362. $scope.$on('$ionicView.beforeEnter', function () {
  363. $ionicTabsDelegate.showBar(false);
  364. myService.myInfo().then(function(result){
  365. $scope.vm = result.data.data;
  366. $scope.vm.money = '';
  367. $scope.vm.payType = 2;
  368. })
  369. });
  370. $scope.payExplain = function(){
  371. $state.go("app.payExplain")
  372. };
  373. $scope.withdraw = function(){
  374. $state.go("app.withdraw")
  375. };
  376. //充值
  377. $scope.recharge = function(money){
  378. if (!$scope.vm.money) {
  379. msg.text('请输入充值金额');
  380. return;
  381. }
  382. myService.recharge(money).then(function (result) {
  383. //todo:result需要返回支付宝或者微信的签名信息
  384. var payInfo = result.data;
  385. if ($scope.vm.payType == 1) { //支付宝
  386. cordova.plugins.AliPay.pay(payInfo, function success(e) {
  387. //e.resultStatus 状态代码 e.result 本次操作返回的结果数据 e.memo 提示信息
  388. //e.resultStatus 9000 订单支付成功 ;8000 正在处理中 调用function success
  389. //e.resultStatus 4000 订单支付失败 ;6001 用户中途取消 ;6002 网络连接出错 调用function error
  390. //当e.resultStatus为9000时,请去服务端验证支付结果
  391. $scope.clicksub = false;
  392. if (e.resultStatus == '9000') {
  393. alert(orderID);
  394. //支付成功
  395. // $state.go('app.my');
  396. } else {
  397. msg.error("支付失败");
  398. // msg.error("支付失败:" + JSON.stringify(e));
  399. }
  400. }, function error(e) {
  401. $scope.clicksub = false;
  402. // msg.error("支付失败:" + JSON.stringify(e));
  403. msg.error("支付失败");
  404. });
  405. }
  406. if ($scope.vm.payType == 2) { //微信
  407. var obj = JSON.parse(payInfo);
  408. var params = {
  409. partnerid: obj.partnerid, // merchant id
  410. prepayid: obj.prepayid, // prepay id
  411. noncestr: obj.noncestr, // nonce
  412. timestamp: obj.timestamp, // timestamp
  413. sign: obj.sign, // signed string
  414. };
  415. Wechat.sendPaymentRequest(params, function (r) {
  416. $scope.clicksub = false;
  417. courseService.orderStatus(orderID, $scope.paytype).then(function (result) {
  418. // alert(result);
  419. //支付成功
  420. // $state.go('app.my');
  421. }, function (erro) {
  422. msg.alert("支付反馈失败:" + JSON.stringify(erro));
  423. });
  424. }, function (reason) {
  425. $scope.clicksub = false;
  426. msg.alert("支付失败:" + JSON.stringify(reason));
  427. });
  428. }
  429. // msg.text("充值成功");
  430. // $state.go('app.my');
  431. });
  432. }
  433. }]);
  434. app.controller('payCtrl', ["$scope","$ionicTabsDelegate", "$timeout","$ionicHistory","$state", "myService", "msg"
  435. , function ($scope,$ionicTabsDelegate, $timeout,$ionicHistory,$state, myService, msg) {
  436. $scope.$on('$ionicView.beforeEnter', function () {
  437. myService.myInfo().then(function(result){
  438. $scope.vm = result.data.data;
  439. $scope.vm.money = '';
  440. $scope.vm.payType = 2;
  441. })
  442. });
  443. $scope.payExplain = function(){
  444. $state.go("app.explain")
  445. };
  446. $scope.withdraw = function(){
  447. $state.go("app.payout")
  448. };
  449. //充值
  450. $scope.recharge = function(money){
  451. myService.recharge(money).then(function(result){
  452. msg.text("充值成功");
  453. $timeout(function(){
  454. $ionicHistory.goBack();
  455. },1000)
  456. });
  457. }
  458. }]);
  459. app.controller('accountCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
  460. , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
  461. $scope.$on('$ionicView.beforeEnter', function () {
  462. $ionicTabsDelegate.showBar(false);
  463. $scope.showAccount();
  464. });
  465. $scope.showAccount = function(){
  466. myService.showAccount().then(function(result){
  467. $scope.items = result.data.data;
  468. },function(error){
  469. msg.error(error.data.message);
  470. })
  471. };
  472. $scope.destroyAccount = function(id){
  473. myService.destroyAccount(id).then(function(result){
  474. msg.text("删除成功");
  475. $scope.showAccount();
  476. },function(error){
  477. msg.error(error.data.message);
  478. })
  479. }
  480. }]);
  481. app.controller('my_account_addCtrl', ["$scope","config","common","$timeout","$ionicTabsDelegate", "$state", "myService", "msg"
  482. , function ($scope,config,common,$timeout,$ionicTabsDelegate, $state, myService, msg) {
  483. $scope.addpict = function () {
  484. common.chooseImage().then(function (qrcode) {
  485. common.uploadFiles(qrcode,1).then(function (result) {
  486. var response = JSON.parse(result.response);
  487. var file = config.imgServer+response.data.file;
  488. $scope.vm.file = file;
  489. $scope.qrcode.push(file);
  490. }, function (error) {
  491. msg.error('图片上传失败');
  492. });
  493. }, function (error) {
  494. console.log('图片选择失败');
  495. });
  496. };
  497. $scope.qrcode=[];
  498. $scope.deletefile = function (file) {
  499. var index = $scope.qrcode.indexOf(file);
  500. $scope.qrcode.splice(index, 1);
  501. common.deletefile(file).then(function () {
  502. })
  503. };
  504. $scope.vm={
  505. bank_name:'',
  506. bank_number:'',
  507. bank_phone:'',
  508. bank_user:'',
  509. type:""
  510. };
  511. $scope.addAccount = function () {
  512. var data = {
  513. data:{
  514. bank_name:$scope.vm.bank_name,
  515. bank_number:$scope.vm.bank_number,
  516. bank_phone:$scope.vm.bank_phone,
  517. bank_user:$scope.vm.bank_user
  518. }
  519. };
  520. msg.loading('保存中...');
  521. myService.addAccount(data).then(function (result) {
  522. msg.hide();
  523. $state.go('app.my_account');
  524. }, function (error) {
  525. msg.hide();
  526. msg.error(error.data.message);
  527. });
  528. };
  529. $scope.addQrcode = function(){
  530. var data = {
  531. data:{
  532. type:$scope.vm.type,
  533. qrcode:$scope.vm.file
  534. //qrcode:"https://www.baidu.com/img/bd_logo1.png"
  535. }
  536. };
  537. myService.addQrcode(data).then(function(result){
  538. msg.text("添加成功",true);
  539. $state.go("app.my_account");
  540. },function(error){
  541. msg.error(error.data.message);
  542. })
  543. }
  544. }]);
  545. app.controller('messageCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
  546. , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
  547. $scope.$on('$ionicView.beforeEnter', function () {
  548. $ionicTabsDelegate.showBar(false);
  549. myService.messageInfo().then(function(result){
  550. $scope.infos = result.data.data;
  551. },function(error){
  552. });
  553. });
  554. //系统消息
  555. $scope.systemInfo = function(){
  556. $state.go("app.my_message_sys");
  557. };
  558. $scope.notRead = function(){
  559. myService.notRead().then(function(result){
  560. myService.messageInfo().then(function(result){
  561. $scope.infos = result.data.data;
  562. },function(error){
  563. });
  564. },function(error){
  565. })
  566. };
  567. //回复我的
  568. $scope.replyMy = function(){
  569. $state.go("app.my_message_reply");
  570. };
  571. $scope.personalLetter = function(){
  572. $state.go("app.personalLetter");
  573. }
  574. }]);
  575. app.controller('dreamCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
  576. , function ($scope, $ionicTabsDelegate,$state, myService, msg) {
  577. $scope.$on('$ionicView.beforeEnter', function () {
  578. $ionicTabsDelegate.showBar(false);
  579. myService.myDream().then(function(result){
  580. $scope.dreams = result.data.data;
  581. });
  582. myService.myInfo().then(function(result){
  583. $scope.user = result.data.data
  584. });
  585. });
  586. $scope.toDetail = function (id) {
  587. $state.go('app.my_dreamdetail',{id:id});
  588. };
  589. }]);
  590. app.controller('collectCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
  591. , function ($scope, $ionicTabsDelegate,$state, myService, msg) {
  592. $scope.$on('$ionicView.beforeEnter', function () {
  593. $ionicTabsDelegate.showBar(false);
  594. myService.collect().then(function(result){
  595. $scope.dreams = result.data.data.dreams;
  596. });
  597. });
  598. $scope.toDetail = function (id) {
  599. $state.go('app.my_dreamdetail',{id:id});
  600. };
  601. }]);
  602. app.controller('messageSysCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
  603. , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
  604. $scope.$on('$ionicView.beforeEnter', function () {
  605. myService.systemInfo().then(function(result){
  606. $scope.sysInfos = result.data.data;
  607. },function(error){
  608. });
  609. });
  610. }]);
  611. app.controller('messageReplyCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg", "$ionicModal"
  612. , function ($scope,$ionicTabsDelegate, $state, myService, msg, $ionicModal) {
  613. $scope.$on('$ionicView.beforeEnter', function () {
  614. myService.replyMy().then(function(result){
  615. $scope.comments = result.data.data;
  616. },function(error){
  617. });
  618. });
  619. $ionicModal.fromTemplateUrl('my-modal.html', {
  620. scope: $scope,
  621. animation: 'slide-in-up'
  622. }).then(function (modal) {
  623. $scope.modal = modal;
  624. });
  625. $scope.openModal = function () {
  626. $scope.modal.show();
  627. };
  628. $scope.closeModal = function () {
  629. $scope.modal.hide();
  630. };
  631. //我的回复
  632. $scope.vm={
  633. content:"",
  634. comment_id:""
  635. };
  636. $scope.myReplay = function(){
  637. var data = {
  638. content:$scope.vm.content,
  639. comment_id:$scope.vm.id
  640. };
  641. myService.myReplay(data).then(function(result){
  642. },function(error){
  643. });
  644. $scope.modal.hide();
  645. }
  646. }]);
  647. })(angular.module('app.controllers'));