my.js 28 KB

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