my.js 28 KB

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