my.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. (function (app) {
  2. app.controller('myCtrl', ["$scope","$ionicTabsDelegate", "$state", "$http", "storage", "myService", "common", "config", "msg"
  3. , function ($scope,$ionicTabsDelegate, $state, $http, storage, myService, common, config, msg) {
  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. $scope.user.avatar = config.imgServer + response.data.file;
  15. });
  16. };
  17. }]);
  18. app.controller('profileCtrl', ["$scope","$ionicTabsDelegate","$state","$filter", "storage", "myService", "msg", "config", "common"
  19. , function ($scope, $ionicTabsDelegate, $state, $filter, storage, myService, msg, config, common) {
  20. $scope.$on('$ionicView.beforeEnter', function () {
  21. $ionicTabsDelegate.showBar(false);
  22. msg.loading();
  23. myService.myInfo().then(function(result){
  24. // alert(JSON.stringify(result.data.data));
  25. $scope.vm = result.data.data;
  26. console.log($scope.vm.avatar);
  27. $scope.vm.sex = $scope.vm.sex+'';
  28. $scope.vm.emotion = $scope.vm.emotion+'';
  29. if($scope.vm.birthday){
  30. var arr1 = $scope.vm.birthday.split("-");
  31. $scope.vm.birthday1 = new Date(arr1[0],parseInt(arr1[1])-1,arr1[2]);
  32. }
  33. msg.hide();
  34. },function(error){
  35. msg.hide();
  36. // msg.error(error.data.message);
  37. })
  38. });
  39. $scope.setAvator = function () {
  40. common.setAvator().then(function (result) {
  41. var response = JSON.parse(result.response);
  42. $scope.vm.avatar = config.imgServer + response.data.file;
  43. });
  44. };
  45. //保存个人信息
  46. $scope.vm={
  47. pic:"",
  48. sex:"",
  49. signture:"",
  50. emotion:"",
  51. job:"",
  52. tall:"",
  53. nickname:"",
  54. birthday1:""
  55. };
  56. $scope.saveMaterial = function(){
  57. var data = {
  58. sex:$scope.vm.sex,
  59. signture:$scope.vm.signture,
  60. emotion:$scope.vm.emotion,
  61. work:$scope.vm.work,
  62. height:$scope.vm.height,
  63. city:$scope.vm.city,
  64. nickname:$scope.vm.nickname,
  65. birthday:$scope.vm.birthday1
  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('mySupportDreamCtrl', ["$scope","homeService", "$stateParams","$state", "msg"
  255. , function ($scope,homeService,$stateParams, $state, msg) {
  256. var user_id = $stateParams.user_id;
  257. $scope.$on('$ionicView.beforeEnter',function(){
  258. $scope.toUserDetail(user_id);
  259. });
  260. $scope.toUserDetail = function(user_id){
  261. homeService.toUserDetail(user_id).then(function(result){
  262. $scope.items = result.data.data;
  263. $scope.user = result.data.data.user;
  264. $scope.dreams = $scope.user.sup_dream;
  265. },function(error){
  266. })
  267. };
  268. $scope.toDetail = function(){
  269. $state.go("app.attention_Detail",{user_id:user_id,items:$scope.items})
  270. }
  271. }]);
  272. app.controller('myOldDreamCtrl', ["$scope","homeService", "$stateParams","$state", "msg"
  273. , function ($scope,homeService,$stateParams, $state, msg) {
  274. var user_id = $stateParams.user_id;
  275. $scope.$on('$ionicView.beforeEnter',function(){
  276. $scope.toUserDetail(user_id);
  277. });
  278. $scope.toUserDetail = function(user_id){
  279. homeService.toUserDetail(user_id).then(function(result){
  280. $scope.items = result.data.data;
  281. $scope.user = result.data.data.user;
  282. $scope.dreams = $scope.user.dreams;
  283. },function(error){
  284. })
  285. };
  286. $scope.toDetail = function(){
  287. $state.go("app.attention_Detail",{user_id:user_id,items:$scope.items})
  288. };
  289. }]);
  290. app.controller('messageReplyCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
  291. , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
  292. }]);
  293. app.controller('personalLetterCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
  294. , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
  295. $scope.$on('$ionicView.beforeEnter', function () {
  296. myService.letter().then(function(result){
  297. $scope.comments = result.data.data;
  298. },function(error){
  299. });
  300. });
  301. }]);
  302. app.controller('rechargeCtrl', ["$scope","$timeout","$ionicHistory","$ionicTabsDelegate", "$state", "myService", "msg"
  303. , function ($scope,$timeout, $ionicHistory,$ionicTabsDelegate,$state, myService, msg) {
  304. $scope.$on('$ionicView.beforeEnter', function () {
  305. $ionicTabsDelegate.showBar(false);
  306. myService.myInfo().then(function(result){
  307. $scope.vm = result.data.data;
  308. $scope.vm.number = '';
  309. $scope.vm.payType = 2;
  310. })
  311. });
  312. $scope.payExplain = function(){
  313. $state.go("app.payExplain")
  314. };
  315. $scope.withdraw = function(){
  316. $state.go("app.withdraw")
  317. };
  318. $scope.testcharge = function(number){
  319. if (!number) {
  320. msg.text('请输入充值金额');
  321. return;
  322. }
  323. myService.testcharge(number,2).then(function (result) {
  324. msg.text("充值成功");
  325. $scope.vm.coin = parseInt($scope.vm.coin) + parseInt(number);
  326. $timeout(function(){
  327. $ionicHistory.goBack();
  328. },500)
  329. });
  330. }
  331. //充值
  332. $scope.charge = function(number){
  333. if (!number) {
  334. msg.text('请输入充值金额');
  335. return;
  336. }
  337. myService.charge(number,2).then(function (result) {
  338. //todo:result需要返回支付宝或者微信的签名信息
  339. console.log("result: " + JSON.stringify(result));
  340. var payInfo = result.data;
  341. if ($scope.vm.payType == 1) { //支付宝
  342. cordova.plugins.AliPay.pay(payInfo, function success(e) {
  343. //e.resultStatus 状态代码 e.result 本次操作返回的结果数据 e.memo 提示信息
  344. //e.resultStatus 9000 订单支付成功 ;8000 正在处理中 调用function success
  345. //e.resultStatus 4000 订单支付失败 ;6001 用户中途取消 ;6002 网络连接出错 调用function error
  346. //当e.resultStatus为9000时,请去服务端验证支付结果
  347. $scope.clicksub = false;
  348. if (e.resultStatus == '9000') {
  349. alert(orderID);
  350. //支付成功
  351. // $state.go('app.my');
  352. } else {
  353. msg.error("支付失败");
  354. // msg.error("支付失败:" + JSON.stringify(e));
  355. }
  356. }, function error(e) {
  357. $scope.clicksub = false;
  358. // msg.error("支付失败:" + JSON.stringify(e));
  359. msg.error("支付失败");
  360. });
  361. }
  362. if ($scope.vm.payType == 2) { //微信
  363. var obj = JSON.parse(payInfo);
  364. var params = {
  365. partnerid: obj.partnerid, // merchant id
  366. prepayid: obj.prepayid, // prepay id
  367. noncestr: obj.noncestr, // nonce
  368. timestamp: obj.timestamp, // timestamp
  369. sign: obj.sign, // signed string
  370. };
  371. Wechat.sendPaymentRequest(params, function (r) {
  372. $scope.clicksub = false;
  373. courseService.orderStatus(orderID, $scope.paytype).then(function (result) {
  374. // alert(result);
  375. //支付成功
  376. // $state.go('app.my');
  377. }, function (erro) {
  378. msg.alert("支付反馈失败:" + JSON.stringify(erro));
  379. });
  380. }, function (reason) {
  381. $scope.clicksub = false;
  382. msg.alert("支付失败:" + JSON.stringify(reason));
  383. });
  384. }
  385. // msg.text("充值成功");
  386. // $state.go('app.my');
  387. });
  388. }
  389. }]);
  390. app.controller('payCtrl', ["$scope","$timeout","$ionicHistory","$ionicTabsDelegate", "$timeout","$ionicHistory","$state", "myService", "msg"
  391. , function ($scope,$timeout,$ionicHistory,$ionicTabsDelegate, $timeout,$ionicHistory,$state, myService, msg) {
  392. $scope.$on('$ionicView.beforeEnter', function () {
  393. myService.myInfo().then(function(result){
  394. $scope.vm = result.data.data;
  395. $scope.vm.money = '';
  396. $scope.vm.payType = 2;
  397. })
  398. });
  399. $scope.payExplain = function(){
  400. $state.go("app.explain")
  401. };
  402. $scope.withdraw = function(){
  403. $state.go("app.payout")
  404. };
  405. //充值
  406. $scope.testcharge = function(number){
  407. if (!number) {
  408. msg.text('请输入充值金额');
  409. return;
  410. }
  411. myService.testcharge(number,2).then(function (result) {
  412. msg.text("充值成功");
  413. $scope.vm.coin = parseInt($scope.vm.coin) + parseInt(number);
  414. $timeout(function(){
  415. $ionicHistory.goBack();
  416. },500)
  417. });
  418. }
  419. //充值
  420. $scope.charge = function(number){
  421. if (!number) {
  422. msg.text('请输入充值金额');
  423. return;
  424. }
  425. myService.charge(number,2).then(function (result) {
  426. //todo:result需要返回支付宝或者微信的签名信息
  427. console.log("result: " + JSON.stringify(result));
  428. var payInfo = result.data;
  429. if ($scope.vm.payType == 1) { //支付宝
  430. cordova.plugins.AliPay.pay(payInfo, function success(e) {
  431. //e.resultStatus 状态代码 e.result 本次操作返回的结果数据 e.memo 提示信息
  432. //e.resultStatus 9000 订单支付成功 ;8000 正在处理中 调用function success
  433. //e.resultStatus 4000 订单支付失败 ;6001 用户中途取消 ;6002 网络连接出错 调用function error
  434. //当e.resultStatus为9000时,请去服务端验证支付结果
  435. $scope.clicksub = false;
  436. if (e.resultStatus == '9000') {
  437. alert(orderID);
  438. //支付成功
  439. // $state.go('app.my');
  440. } else {
  441. msg.error("支付失败");
  442. // msg.error("支付失败:" + JSON.stringify(e));
  443. }
  444. }, function error(e) {
  445. $scope.clicksub = false;
  446. // msg.error("支付失败:" + JSON.stringify(e));
  447. msg.error("支付失败");
  448. });
  449. }
  450. if ($scope.vm.payType == 2) { //微信
  451. var obj = JSON.parse(payInfo);
  452. var params = {
  453. partnerid: obj.partnerid, // merchant id
  454. prepayid: obj.prepayid, // prepay id
  455. noncestr: obj.noncestr, // nonce
  456. timestamp: obj.timestamp, // timestamp
  457. sign: obj.sign, // signed string
  458. };
  459. Wechat.sendPaymentRequest(params, function (r) {
  460. $scope.clicksub = false;
  461. courseService.orderStatus(orderID, $scope.paytype).then(function (result) {
  462. // alert(result);
  463. //支付成功
  464. // $state.go('app.my');
  465. }, function (erro) {
  466. msg.alert("支付反馈失败:" + JSON.stringify(erro));
  467. });
  468. }, function (reason) {
  469. $scope.clicksub = false;
  470. msg.alert("支付失败:" + JSON.stringify(reason));
  471. });
  472. }
  473. // msg.text("充值成功");
  474. // $state.go('app.my');
  475. });
  476. }
  477. }]);
  478. app.controller('accountCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
  479. , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
  480. $scope.$on('$ionicView.beforeEnter', function () {
  481. $ionicTabsDelegate.showBar(false);
  482. $scope.showAccount();
  483. });
  484. $scope.showAccount = function(){
  485. myService.showAccount().then(function(result){
  486. $scope.items = result.data.data;
  487. },function(error){
  488. msg.error(error.data.message);
  489. })
  490. };
  491. $scope.destroyAccount = function(id){
  492. myService.destroyAccount(id).then(function(result){
  493. msg.text("删除成功");
  494. $scope.showAccount();
  495. },function(error){
  496. msg.error(error.data.message);
  497. })
  498. }
  499. }]);
  500. app.controller('my_account_addCtrl', ["$scope","config","common","$timeout","$ionicTabsDelegate", "$state", "myService", "msg"
  501. , function ($scope,config,common,$timeout,$ionicTabsDelegate, $state, myService, msg) {
  502. $scope.addpict = function () {
  503. common.chooseImage().then(function (qrcode) {
  504. common.uploadFiles(qrcode,1).then(function (result) {
  505. var response = JSON.parse(result.response);
  506. var file = config.imgServer+response.data.file;
  507. $scope.vm.file = file;
  508. $scope.qrcode.push(file);
  509. }, function (error) {
  510. msg.error('图片上传失败');
  511. });
  512. }, function (error) {
  513. console.log('图片选择失败');
  514. });
  515. };
  516. $scope.qrcode=[];
  517. $scope.deletefile = function (file) {
  518. var index = $scope.qrcode.indexOf(file);
  519. $scope.qrcode.splice(index, 1);
  520. common.deletefile(file).then(function () {
  521. })
  522. };
  523. $scope.vm={
  524. bank_name:'',
  525. bank_number:'',
  526. bank_phone:'',
  527. bank_user:'',
  528. type:""
  529. };
  530. $scope.addAccount = function () {
  531. var data = {
  532. data:{
  533. bank_name:$scope.vm.bank_name,
  534. bank_number:$scope.vm.bank_number,
  535. bank_phone:$scope.vm.bank_phone,
  536. bank_user:$scope.vm.bank_user
  537. }
  538. };
  539. msg.loading('保存中...');
  540. myService.addAccount(data).then(function (result) {
  541. msg.hide();
  542. $state.go('app.my_account');
  543. }, function (error) {
  544. msg.hide();
  545. msg.error(error.data.message);
  546. });
  547. };
  548. $scope.addQrcode = function(){
  549. var data = {
  550. data:{
  551. type:$scope.vm.type,
  552. qrcode:$scope.vm.file
  553. //qrcode:"https://www.baidu.com/img/bd_logo1.png"
  554. }
  555. };
  556. myService.addQrcode(data).then(function(result){
  557. msg.text("添加成功",true);
  558. $state.go("app.my_account");
  559. },function(error){
  560. msg.error(error.data.message);
  561. })
  562. }
  563. }]);
  564. app.controller('messageCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
  565. , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
  566. $scope.$on('$ionicView.beforeEnter', function () {
  567. $ionicTabsDelegate.showBar(false);
  568. myService.messageInfo().then(function(result){
  569. $scope.infos = result.data.data;
  570. },function(error){
  571. });
  572. });
  573. //系统消息
  574. $scope.systemInfo = function(){
  575. $state.go("app.my_message_sys");
  576. };
  577. $scope.notRead = function(){
  578. myService.notRead().then(function(result){
  579. myService.messageInfo().then(function(result){
  580. $scope.infos = result.data.data;
  581. },function(error){
  582. });
  583. },function(error){
  584. })
  585. };
  586. //回复我的
  587. $scope.replyMy = function(){
  588. $state.go("app.my_message_reply");
  589. };
  590. $scope.personalLetter = function(){
  591. $state.go("app.personalLetter");
  592. }
  593. }]);
  594. app.controller('dreamCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
  595. , function ($scope, $ionicTabsDelegate,$state, myService, msg) {
  596. $scope.$on('$ionicView.beforeEnter', function () {
  597. $ionicTabsDelegate.showBar(false);
  598. myService.myDream().then(function(result){
  599. $scope.dreams = result.data.data;
  600. });
  601. myService.myInfo().then(function(result){
  602. $scope.user = result.data.data
  603. });
  604. });
  605. $scope.toDetail = function (id) {
  606. $state.go('app.my_dreamdetail',{id:id});
  607. };
  608. }]);
  609. app.controller('collectCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
  610. , function ($scope, $ionicTabsDelegate,$state, myService, msg) {
  611. $scope.$on('$ionicView.beforeEnter', function () {
  612. $ionicTabsDelegate.showBar(false);
  613. myService.collect().then(function(result){
  614. $scope.dreams = result.data.data.dreams;
  615. });
  616. });
  617. $scope.toDetail = function (id) {
  618. $state.go('app.my_dreamdetail',{id:id});
  619. };
  620. }]);
  621. app.controller('messageSysCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
  622. , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
  623. $scope.$on('$ionicView.beforeEnter', function () {
  624. myService.systemInfo().then(function(result){
  625. $scope.sysInfos = result.data.data;
  626. },function(error){
  627. });
  628. });
  629. }]);
  630. app.controller('messageReplyCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg", "$ionicModal"
  631. , function ($scope,$ionicTabsDelegate, $state, myService, msg, $ionicModal) {
  632. $scope.$on('$ionicView.beforeEnter', function () {
  633. myService.replyMy().then(function(result){
  634. $scope.comments = result.data.data;
  635. },function(error){
  636. });
  637. });
  638. $ionicModal.fromTemplateUrl('my-modal.html', {
  639. scope: $scope,
  640. animation: 'slide-in-up'
  641. }).then(function (modal) {
  642. $scope.modal = modal;
  643. });
  644. $scope.openModal = function () {
  645. $scope.modal.show();
  646. };
  647. $scope.closeModal = function () {
  648. $scope.modal.hide();
  649. };
  650. //我的回复
  651. $scope.vm={
  652. content:"",
  653. comment_id:""
  654. };
  655. $scope.myReplay = function(){
  656. var data = {
  657. content:$scope.vm.content,
  658. comment_id:$scope.vm.id
  659. };
  660. myService.myReplay(data).then(function(result){
  661. },function(error){
  662. });
  663. $scope.modal.hide();
  664. }
  665. }]);
  666. })(angular.module('app.controllers'));