home.js 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245
  1. (function (app) {
  2. app.controller('homeCtrl', ["$scope", "$ionicTabsDelegate", "$http", 'config', "$state", "msg", "$ionicPopover", "homeService", "$ionicPopup", "$timeout", "$ionicSideMenuDelegate"
  3. , function ($scope, $ionicTabsDelegate, $http, config, $state, msg, $ionicPopover, homeService, $ionicPopup, $timeout, $ionicSideMenuDelegate) {
  4. $scope.$on('$ionicView.beforeEnter', function () {
  5. $ionicTabsDelegate.showBar(true);
  6. $scope.load(true);
  7. homeService.messageInfo().then(function(result){
  8. $scope.infos = result.data.data;
  9. if($scope.infos.letter.is_read==0 && $scope.infos.reply.is_read==0 && $scope.infos.systemInfo.is_read==0){
  10. $scope.showMessage=0;
  11. }
  12. else {
  13. $scope.showMessage=1;
  14. }
  15. },function(error){
  16. });
  17. });
  18. $scope.type = 'hot';//tab切换
  19. $scope.chosedIndex = 0;
  20. $scope.clickAvatar = function(index,id){
  21. homeService.toUserDetail(id).then(function(result){
  22. $scope.items = result.data.data;
  23. $state.go('app.home_userDetail',{id:id,items:$scope.items});
  24. },function(error){
  25. //msg.error(msg.data.error)
  26. });
  27. $scope.chosedIndex = index;
  28. };
  29. $ionicPopover.fromTemplateUrl('my-popover.html', {
  30. scope: $scope
  31. }).then(function (popover) {
  32. $scope.popover = popover;
  33. });
  34. $scope.toggleLeftSideMenu = function () {
  35. $ionicSideMenuDelegate.toggleLeft();
  36. };
  37. $scope.openPopover = function ($event) {
  38. $scope.popover.show($event);
  39. };
  40. $scope.closePopover = function () {
  41. $scope.popover.hide();
  42. };
  43. $scope.changetype = function (type) {
  44. $scope.type = type;
  45. $scope.load(true);
  46. };
  47. $scope.toDetail = function (id) {
  48. $state.go('app.home_dreamdetail',{id:id});
  49. };
  50. $scope.toUserDetail = function (id) {
  51. homeService.toUserDetail(id).then(function(result){
  52. $scope.items = result.data.data;
  53. $state.go('app.home_userDetail',{id:id,items:$scope.items});
  54. },function(error){
  55. //msg.error(msg.data.error)
  56. })
  57. };
  58. $scope.changeFilter = function (input) {
  59. switch (input) {
  60. case '1':
  61. if ($scope.filter.sex == 1) {
  62. $scope.filter.sex = 0;
  63. } else {
  64. $scope.filter.sex = 1;
  65. }
  66. break;
  67. case '2':
  68. if ($scope.filter.sex == 2) {
  69. $scope.filter.sex = 0;
  70. } else {
  71. $scope.filter.sex = 2;
  72. }
  73. break;
  74. default:
  75. }
  76. };
  77. $scope.filter = {
  78. hasMore: false,
  79. pageIndex: 1,
  80. pageSize: 20,
  81. sex: 0,//1男,2女,0:全部,
  82. age: 0,//0:全部,1:18-21,2:22-25,3:26-29,4:30-33,5:34-37,6:>38,
  83. city:''
  84. };
  85. $scope.doFilter = function () {
  86. homeService.doFilter($scope.filter.sex,$scope.filter.age,$scope.filter.city).then(function(result){
  87. $scope.index.dreams = result.data.data.dreams.data;
  88. },function(error){
  89. msg.error(data.error.message);
  90. });
  91. //$ionicSideMenuDelegate.toggleRight();
  92. };
  93. $scope.index = {
  94. banner: [],
  95. users: [],
  96. dreams:[]
  97. };
  98. $scope.next = function (type) {
  99. //type:1 前一个,type:2 后一个
  100. if($scope.index.users.length>0){
  101. if(type==1)
  102. {
  103. var temp= $scope.index.users.splice(0,1);
  104. $scope.index.users.push(temp[0]);
  105. }
  106. if (type==2){
  107. var temp= $scope.index.users.splice($scope.index.users.length-1,1);
  108. $scope.index.users.unshift(temp[0]);
  109. }
  110. }
  111. };
  112. $scope.load = function (init) {
  113. if (init) {
  114. $scope.filter.pageIndex = 1;
  115. $scope.index.dreams = [];
  116. }
  117. msg.loading();
  118. homeService.index($scope.type, $scope.filter.pageIndex).then(function (result) {
  119. msg.hide();
  120. $scope.index.banners = result.data.data.banners;
  121. $scope.index.users = result.data.data.users;
  122. $scope.filter.pageIndex++;
  123. var more = (result.data.data.dreams.data.length >= $scope.filter.pageSize);
  124. $scope.filter.hasMore = more;
  125. $scope.index.dreams = $scope.index.dreams.concat(result.data.data.dreams.data);
  126. if (init) {
  127. $scope.$broadcast('scroll.refreshComplete');
  128. } else {
  129. $scope.$broadcast('scroll.infiniteScrollComplete');
  130. }
  131. }, function (error) {
  132. msg.hide();
  133. });
  134. };
  135. $scope.qrscan = function () {
  136. cordova.plugins.barcodeScanner.scan(
  137. function (result) {
  138. //扫码成功后执行的回调函数
  139. alert("收到一个二维码\n" +
  140. "扫码文字结果: " + result.text + "\n" +
  141. "格式: " + result.format + "\n" +
  142. "是否在扫码页面取消扫码: " + result.cancelled);
  143. },
  144. function (error) {
  145. //扫码失败执行的回调函数
  146. alert("Scanning failed: " + error);
  147. }, {
  148. preferFrontCamera: false, // iOS and Android 设置前置摄像头
  149. showFlipCameraButton: true, // iOS and Android 显示旋转摄像头按钮
  150. showTorchButton: true, // iOS and Android 显示打开闪光灯按钮
  151. torchOn: false, // Android, launch with the torch switched on (if available)打开手电筒
  152. prompt: "在扫描区域内放置二维码", // Android提示语
  153. resultDisplayDuration: 500, // Android, display scanned text for X ms.
  154. //0 suppresses it entirely, default 1500 设置扫码时间的参数
  155. formats: "QR_CODE", // 二维码格式可设置多种类型
  156. orientation: "portrait", // Android only (portrait|landscape),
  157. //default unset so it rotates with the device在安卓上 landscape 是横屏状态
  158. disableAnimations: true, // iOS 是否禁止动画
  159. disableSuccessBeep: false // iOS 禁止成功后提示声音 “滴”
  160. }
  161. );
  162. };
  163. $scope.data = {};
  164. //$scope.load(true);
  165. $scope.$on('$ionicView.beforeLeave', function () {
  166. $scope.popover.hide();
  167. $scope.load(true);
  168. });
  169. }]);
  170. app.controller('dreamDetailCtrl', ["$scope", "$state", "WechatService","$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams","$ionicBackdrop", "$timeout", "$ionicScrollDelegate", "$interval"
  171. , function ($scope, $state,WechatService,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams,$ionicBackdrop, $timeout, $ionicScrollDelegate, $interval) {
  172. var id = $stateParams.id;
  173. var top3user = '';
  174. $scope.chosedIndex = 0;
  175. $scope.clickAvatar = function(index){
  176. $scope.chosedIndex = index;
  177. homeService.myInfo().then(function(result){
  178. $scope.user = result.data.data;
  179. });
  180. };
  181. // id=5;
  182. $scope.$on('$ionicView.beforeEnter', function () {
  183. $ionicTabsDelegate.showBar(false);
  184. $scope.load(id);
  185. $scope.thisUser = storage.getObject('user');
  186. homeService.myInfo().then(function(result){
  187. $scope.user = result.data.data;
  188. });
  189. homeService.messageInfo().then(function(result){
  190. $scope.infos = result.data.data;
  191. if($scope.infos.letter.is_read==0 && $scope.infos.reply.is_read==0 && $scope.infos.systemInfo.is_read==0){
  192. $scope.showMessage=0;
  193. }
  194. else {
  195. $scope.showMessage=1;
  196. }
  197. },function(error){
  198. });
  199. });
  200. $scope.$on('$ionicView.leave', function () {
  201. if($scope.multi.promise)$interval.cancel($scope.multi.promise);
  202. if($scope.leftTimer)$interval.cancel($scope.leftTimer);
  203. });
  204. $scope.toSort = function(){
  205. //$scope.type = 3;
  206. $scope.changeType(3)
  207. };
  208. $scope.load = function (id) {
  209. msg.loading();
  210. homeService.dreamDetail(id).then(function (result) {
  211. msg.hide();
  212. console.log(result);
  213. $scope.showCode = function(codeName){
  214. $scope.url = codeName;
  215. $scope.code = true;
  216. };
  217. $scope.hideCode = function(){
  218. $scope.code = false;
  219. };
  220. $scope.dream = result.data.data;
  221. if($scope.timer=='已结束'|| 100*$scope.dream.get_coin/$scope.dream.coin>=100){
  222. $scope.codeBtn = true;
  223. }
  224. if($scope.dream.video){
  225. $scope.dream.vpic = config.server+'upload/vpic/'+$scope.dream.video+'.jpg';
  226. $scope.dream.video = config.imgServer+$scope.dream.video;
  227. }
  228. var reg = new RegExp("\n", "g");
  229. $scope.dream.about = $scope.dream.about.replace(reg, "<br/>");
  230. var end_time = new Date($scope.dream.end_time.replace(/-/g, "/"));
  231. var date = new Date();
  232. var inter = (end_time.getTime() - date.getTime()) / 1000;
  233. leftTimer(inter);
  234. $scope.multi.a = $scope.dream.a;
  235. $scope.multi.b = new Date($scope.dream.created_at.replace(/-/g, "/"));
  236. $scope.multi.c = $scope.dream.c;
  237. $scope.multi.promise = $scope.dream.a;
  238. var newtop3user = '' ;
  239. angular.forEach($scope.dream.top3user, function(user) {
  240. newtop3user= newtop3user +user.id+","
  241. });
  242. if(top3user!=''&&newtop3user!=top3user){
  243. //测试动画切换
  244. $timeout(function() {
  245. $scope.sort.slide1 = 'list-grow-animation';
  246. $scope.sort.slide2 = 'slide-in-both-ways';
  247. $scope.sort.slide3 = 'bounce-animation';
  248. }, 50);
  249. }
  250. top3user = newtop3user;
  251. if($scope.dream.top3user[0])$scope.sort.first = $scope.dream.top3user[0].avatar;
  252. if($scope.dream.top3user[1])$scope.sort.second = $scope.dream.top3user[1].avatar;
  253. if($scope.dream.top3user[2])$scope.sort.third = $scope.dream.top3user[2].avatar;
  254. $scope.calcmultiplier();
  255. }, function (error) {
  256. msg.hide();
  257. });
  258. };
  259. $scope.openSupport = function () {
  260. msg.alert("支持乘数说明","支持乘数支持乘数支持乘数支持乘数");
  261. };
  262. $scope.multi = {
  263. a: '',
  264. b: '',
  265. c: '',
  266. result: 1,
  267. promise:null
  268. };
  269. $scope.type = 1;//tab切换
  270. $scope.tosupport = false;
  271. $scope.support = function ($event) {
  272. $event.stopPropagation();
  273. $scope.tosupport = true;
  274. $scope.vm.coin = 0;
  275. $scope.index = 0;
  276. };
  277. $scope.cancelSupport = function () {
  278. $scope.tosupport = false;
  279. $scope.toshare = false;
  280. $scope.input.show = false;
  281. };
  282. $scope.toshare = false;
  283. $scope.toRecharge = function(){
  284. $state.go("app.recharge")
  285. };
  286. $scope.share = function (type,$event) {
  287. $scope.toshare = true;
  288. if (type==0) {//分享给朋友
  289. /* Wechat.share({
  290. text: "分享的文字",
  291. scene: Wechat.Scene.SESSION // share to 好友
  292. }, function () {
  293. alert("Success");
  294. }, function (reason) {
  295. alert("Failed: " + reason);
  296. });*/
  297. Wechat.share({
  298. message: {
  299. title:"瞄瞄",
  300. description:"HELLO,这是我的梦想,快来围观吧!",
  301. thumb:"img/icon_cat_h.png",
  302. media: {
  303. type: Wechat.Type.WEBPAGE,
  304. webpageUrl: "q8.9026.com//admin/share/view?id=" + id
  305. }
  306. },
  307. scene: Wechat.Scene.SESSION
  308. }, function () {
  309. alert("Success");
  310. }, function (reason) {
  311. alert("Failed: " + reason);
  312. });
  313. }
  314. if(type==1){
  315. Wechat.share({
  316. message: {
  317. title:"瞄瞄",
  318. description:"HELLO,这是我的梦想,快来围观吧!",
  319. thumb:"img/icon_cat_h.png",
  320. media: {
  321. type: Wechat.Type.WEBPAGE,
  322. webpageUrl: "q8.9026.com//admin/share/view?id=" + id
  323. }
  324. },
  325. scene: Wechat.Scene.TIMELINE
  326. }, function () {
  327. alert("Success");
  328. }, function (reason) {
  329. alert("Failed: " + reason);
  330. });
  331. }
  332. // $state.go("app.shareDream",{item:$scope.dream});
  333. };
  334. //实时排行
  335. $scope.sort = {
  336. slide: ''
  337. };
  338. $scope.changeType = function (type) {
  339. $ionicScrollDelegate.scrollTop(true);
  340. $scope.type = type;
  341. };
  342. $scope.index = 0;
  343. $scope.vm = {
  344. coin:"",
  345. title:""
  346. };
  347. $scope.timer = '';
  348. var leftTimer = function (countDown) {
  349. if (isNaN(countDown)) {
  350. $scope.timer = '已结束';
  351. return;
  352. }
  353. var day=parseInt(countDown/(24*60*60));
  354. var h=parseInt(countDown/(60*60)%24);
  355. var m=parseInt(countDown/60%60);
  356. var s=parseInt(countDown%60);
  357. //$scope.timer=(h<10?'0'+h:h)+'时'+(m<10?'0'+m:m)+'分'+(s<10?'0'+s:s)+'秒';
  358. if(day>0) $scope.timer = day+'天';
  359. if(day<0 && h>0) $scope.timer = h+'小时';
  360. if(day<0 && h<0 && m>0) $scope.timer = m+'分钟';
  361. if(day<0 && h<0 && m<0) $scope.timer = '已结束';
  362. /* if($scope.leftTimer)$interval.cancel($scope.leftTimer);
  363. $scope.leftTimer = $interval(function () {
  364. if (countDown >= 1) leftTimer(countDown - 1);
  365. },1000);*/
  366. /*if(countDown<=0){
  367. $scope.timer='结束';
  368. }*/
  369. };
  370. $scope.changeIndex = function (index) {
  371. $scope.index = index;
  372. $scope.vm.coin = index*10;
  373. };
  374. $scope.vidEnded = function () {
  375. alert('播放完毕');
  376. };
  377. //实时计算支持乘数
  378. $scope.calcmultiplier = function () {
  379. $scope.multi.promise = $interval(function () {
  380. var date = new Date();
  381. var inter = date.getTime() - $scope.multi.b.getTime();
  382. var minutes = Math.floor(inter / (60 * 1000));
  383. var number = $scope.multi.a * minutes + $scope.multi.c;//js浮点运算会失真,根据muti.a的可能值范围,比如乘以100再除以100
  384. if (number<=1) {
  385. number = 1;
  386. }
  387. //$scope.multi.result = Math.round(number * 100) / 100;
  388. $scope.multi.result = Math.round(number * 100 / 100);
  389. },1000);
  390. // 点击支持取消 $interval.cancel($scope.multi.promise); 获取数据后重新开始执行
  391. };
  392. $scope.supportDream = function (data) {
  393. if(!$scope.vm.coin){
  394. msg.error("请选择梦想币数量!");
  395. return ;
  396. }
  397. var data = {
  398. id:id,
  399. coin:$scope.vm.coin
  400. };
  401. homeService.supportDream(data).then(function(result){
  402. $scope.tosupport = false;
  403. $scope.load(id);
  404. homeService.myInfo().then(function(result){
  405. $scope.user = result.data.data;
  406. });
  407. $interval.cancel($scope.multi.promise);
  408. msg.text("发送成功");
  409. })
  410. };
  411. $scope.collectionDream = function(is_collection){
  412. homeService.collectionDream(id,is_collection).then(function(result){
  413. $scope.dream.is_collection=result.data.data;
  414. })
  415. };
  416. $scope.add = function(is_collection){
  417. var data = {
  418. id:id,
  419. title:$scope.vm.title,
  420. pics:$scope.imgs,
  421. video:$scope.video.server
  422. };
  423. homeService.add_interaction(data).then(function(){
  424. $scope.load(id);
  425. $scope.closeModal();
  426. })
  427. };
  428. $scope.showAbout = true;
  429. $scope.hideAbout = false;
  430. $scope.showText = function(){
  431. $scope.aboutStyle = {
  432. "white-space" : "normal"
  433. };
  434. $scope.showAbout = false;
  435. $scope.hideAbout = true;
  436. };
  437. $scope.hideText = function(){
  438. $scope.aboutStyle = {
  439. "white-space" : "nowrap"
  440. };
  441. $scope.showAbout = true;
  442. $scope.hideAbout = false;
  443. };
  444. $scope.input = {
  445. placeholder: '评论',
  446. focus: false,
  447. show:false
  448. };
  449. $scope.replay = function ($event, name) {
  450. $event.stopPropagation();
  451. $scope.input.focus = true;
  452. $scope.input.show = true;
  453. $scope.input.placeholder = "评论" + name+":";
  454. $scope.vm.title='';
  455. };
  456. $scope.submitComment = function (index) {
  457. var interaction = $scope.dream.interactions[index];
  458. var iid = interaction.id;
  459. // $scope.dream.interactions[index].comments.push($scope.vm.comment);
  460. $scope.input.focus = true;
  461. if ($scope.vm.comment && $scope.vm.comment == '' || !iid) return;
  462. var data = {
  463. id:iid,
  464. content:$scope.vm.comment
  465. };
  466. console.log($scope.vm.comment+" "+iid);
  467. homeService.add_comment(data).then(function(){
  468. $scope.vm.comment = '' ;
  469. $scope.load(id);
  470. $scope.closeModal();
  471. })
  472. };
  473. $scope.bigImage = false;
  474. $scope.showBigImage = function(imageName){
  475. $scope.url = imageName;
  476. $scope.bigImage = true;
  477. };
  478. $scope.hideBigImage = function(){
  479. $scope.bigImage = false;
  480. };
  481. $ionicModal.fromTemplateUrl('qrCode.html', {
  482. scope: $scope,
  483. animation: 'slide-in-up'
  484. }).then(function(modal) {
  485. $scope.qrCodemodal = modal;
  486. });
  487. $scope.openCode = function() {
  488. $scope.qrCodemodal.show();
  489. $scope.vm.money = '';
  490. };
  491. $scope.closeCode = function() {
  492. $scope.qrCodemodal.hide();
  493. };
  494. $scope.addpict = function () {
  495. common.chooseImage().then(function (img) {
  496. common.uploadFiles(img,1).then(function (result) {
  497. var response = JSON.parse(result.response);
  498. var file = response.data.file;
  499. $scope.imgs.push(config.imgServer+file);
  500. console.log(JSON.stringify(config.imgServer+file));
  501. }, function (error) {
  502. msg.error('图片上传失败');
  503. });
  504. }, function (error) {
  505. console.log('图片选择失败');
  506. });
  507. };
  508. $scope.deletefile = function (file) {
  509. var index = $scope.imgs.indexOf(file);
  510. $scope.imgs.splice(index, 1);
  511. common.deletefile(file).then(function () {
  512. })
  513. };
  514. $scope.addvideo = function () {
  515. common.chooseVideo().then(function (file) {
  516. common.uploadFiles(file, 2).then(function (result) {
  517. var response = JSON.parse(result.response);
  518. $scope.video.server = response.data.file;
  519. var file = config.imgServer+response.data.file;
  520. console.log("file:"+file);
  521. $scope.video.isOK = true;
  522. $scope.video.file = file;
  523. $scope.video.vpic = config.server+'upload/vpic/'+response.data.file+'.jpg';
  524. console.log("vpic:"+$scope.video.vpic);
  525. }, function (error) {
  526. msg.error('视频上传失败');
  527. });
  528. }, function (erro) {
  529. console.log('选择视频失败');
  530. });
  531. };
  532. $ionicModal.fromTemplateUrl('recharge-modal.html', {
  533. scope: $scope,
  534. animation: 'slide-in-up'
  535. }).then(function(modal) {
  536. $scope.rechagemodal = modal;
  537. });
  538. $scope.openRechargeModal = function() {
  539. $scope.rechagemodal.show();
  540. $scope.vm.money = '';
  541. };
  542. $scope.closeRechargeModal = function() {
  543. $scope.rechagemodal.hide();
  544. };
  545. $ionicModal.fromTemplateUrl('interaction-modal.html', {
  546. scope: $scope,
  547. animation: 'slide-in-up'
  548. }).then(function(modal) {
  549. $scope.modal = modal;
  550. });
  551. $scope.openModal = function() {
  552. $scope.modal.show();
  553. $scope.vm.title = '';
  554. $scope.imgs = [];
  555. $scope.video = {};
  556. };
  557. $scope.closeModal = function() {
  558. $scope.modal.hide();
  559. };
  560. //当我们用到模型时,清除它!
  561. $scope.$on('$destroy', function() {
  562. $scope.modal.remove();
  563. });
  564. $scope.toMessage = function(){
  565. $state.go("app.message");
  566. }
  567. }]);
  568. app.controller('myDreamDetailCtrl', ["$scope", "$state", "$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams", "$ionicModal", "$timeout", "$ionicScrollDelegate", "$interval"
  569. , function ($scope, $state,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams, $ionicModal, $timeout, $ionicScrollDelegate, $interval) {
  570. var id = $stateParams.id;
  571. var top3user = '';
  572. $scope.chosedIndex = 0;
  573. $scope.clickAvatar = function(index){
  574. $scope.chosedIndex = index;
  575. };
  576. // id=5;
  577. $scope.$on('$ionicView.beforeEnter', function () {
  578. $ionicTabsDelegate.showBar(false);
  579. $scope.load(id);
  580. $scope.thisUser = storage.getObject('user');
  581. homeService.myInfo().then(function(result){
  582. $scope.user = result.data.data;
  583. });
  584. homeService.messageInfo().then(function(result){
  585. $scope.infos = result.data.data;
  586. if($scope.infos.letter.is_read==0 && $scope.infos.reply.is_read==0 && $scope.infos.systemInfo.is_read==0){
  587. $scope.showMessage=0;
  588. }
  589. else {
  590. $scope.showMessage=1;
  591. }
  592. },function(error){
  593. });
  594. });
  595. $scope.$on('$ionicView.leave', function () {
  596. if($scope.multi.promise)$interval.cancel($scope.multi.promise);
  597. if($scope.leftTimer)$interval.cancel($scope.leftTimer);
  598. });
  599. $scope.share = function (type,$event) {
  600. $scope.toshare = true;
  601. if (type==0) {//分享给朋友
  602. /* Wechat.share({
  603. text: "分享的文字",
  604. scene: Wechat.Scene.SESSION // share to 好友
  605. }, function () {
  606. alert("Success");
  607. }, function (reason) {
  608. alert("Failed: " + reason);
  609. });*/
  610. Wechat.share({
  611. message: {
  612. title:"瞄瞄",
  613. description:"HELLO,这是我的梦想,快来围观吧!",
  614. thumb:"img/icon_cat_h.png",
  615. media: {
  616. type: Wechat.Type.WEBPAGE,
  617. webpageUrl: "config.server+'/admin/share/view'?id=id"
  618. }
  619. },
  620. scene: Wechat.Scene.SESSION
  621. }, function () {
  622. alert("Success");
  623. }, function (reason) {
  624. alert("Failed: " + reason);
  625. });
  626. }
  627. if(type==1){
  628. Wechat.share({
  629. message: {
  630. title:"瞄瞄",
  631. description:"HELLO,这是我的梦想,快来围观吧!",
  632. thumb:"img/icon_cat_h.png",
  633. media: {
  634. type: Wechat.Type.WEBPAGE,
  635. webpageUrl: "config.server+'/admin/share/view'?id=id"
  636. }
  637. },
  638. scene: Wechat.Scene.TIMELINE
  639. }, function () {
  640. alert("Success");
  641. }, function (reason) {
  642. alert("Failed: " + reason);
  643. });
  644. }
  645. // $state.go("app.shareDream",{item:$scope.dream});
  646. };
  647. $scope.load = function (id) {
  648. msg.loading();
  649. homeService.dreamDetail(id).then(function (result) {
  650. msg.hide();
  651. console.log(result);
  652. $scope.dream = result.data.data;
  653. if($scope.dream.video){
  654. $scope.dream.vpic = config.server+'upload/vpic/'+$scope.dream.video+'.jpg';
  655. $scope.dream.video = config.imgServer+$scope.dream.video;
  656. }
  657. var reg = new RegExp("\n", "g");
  658. $scope.dream.about = $scope.dream.about.replace(reg, "<br/>");
  659. var end_time = new Date($scope.dream.end_time.replace(/-/g, "/"));
  660. var date = new Date();
  661. var inter = (end_time.getTime() - date.getTime()) / 1000;
  662. leftTimer(inter);
  663. $scope.multi.a = $scope.dream.a;
  664. $scope.multi.b = new Date($scope.dream.created_at.replace(/-/g, "/"));
  665. $scope.multi.c = $scope.dream.c;
  666. $scope.multi.promise = $scope.dream.a;
  667. var newtop3user = '' ;
  668. angular.forEach($scope.dream.top3user, function(user) {
  669. newtop3user= newtop3user +user.id+","
  670. });
  671. if(top3user!=''&&newtop3user!=top3user){
  672. //测试动画切换
  673. $timeout(function() {
  674. $scope.sort.slide1 = 'list-grow-animation';
  675. $scope.sort.slide2 = 'slide-in-both-ways';
  676. $scope.sort.slide3 = 'bounce-animation';
  677. }, 50);
  678. }
  679. top3user = newtop3user;
  680. if($scope.dream.top3user[0])$scope.sort.first = $scope.dream.top3user[0].avatar;
  681. if($scope.dream.top3user[1])$scope.sort.second = $scope.dream.top3user[1].avatar;
  682. if($scope.dream.top3user[2])$scope.sort.third = $scope.dream.top3user[2].avatar;
  683. $scope.calcmultiplier();
  684. }, function (error) {
  685. msg.hide();
  686. });
  687. };
  688. $scope.openSupport = function () {
  689. msg.alert("支持乘数说明","支持乘数支持乘数支持乘数支持乘数");
  690. };
  691. $scope.multi = {
  692. a: '',
  693. b: '',
  694. c: '',
  695. result: 1,
  696. promise:null
  697. };
  698. $scope.type = 1;//tab切换
  699. $scope.tosupport = false;
  700. $scope.support = function ($event) {
  701. $event.stopPropagation();
  702. $scope.tosupport = true;
  703. $scope.vm.coin = 0;
  704. $scope.index = 0;
  705. };
  706. $scope.cancelSupport = function () {
  707. $scope.tosupport = false;
  708. $scope.toshare = false;
  709. $scope.input.show = false;
  710. };
  711. $scope.toshare = false;
  712. $scope.toRecharge = function(){
  713. $state.go("app.recharge")
  714. };
  715. $scope.shareDream = function(){
  716. $state.go("app.shareDream",{item:$scope.dream});
  717. };
  718. //实时排行
  719. $scope.sort = {
  720. slide: ''
  721. };
  722. $scope.changeType = function (type) {
  723. $ionicScrollDelegate.scrollTop(true);
  724. $scope.type = type;
  725. };
  726. $scope.index = 0;
  727. $scope.vm = {
  728. coin:"",
  729. title:""
  730. };
  731. $scope.timer = '';
  732. var leftTimer = function (countDown) {
  733. if (isNaN(countDown)) {
  734. $scope.timer = '结束';
  735. return;
  736. }
  737. var day=parseInt(countDown/(24*60*60));
  738. var h=parseInt(countDown/(60*60)%24);
  739. var m=parseInt(countDown/60%60);
  740. var s=parseInt(countDown%60);
  741. //$scope.timer=(h<10?'0'+h:h)+'时'+(m<10?'0'+m:m)+'分'+(s<10?'0'+s:s)+'秒';
  742. if(day>0) $scope.timer = day+'天';
  743. if(day<0 && h>0) $scope.timer = h+'小时';
  744. if(day<0 && h<0 && m>0) $scope.timer = m+'分钟';
  745. if(day<0 && h<0 && m<0) $scope.timer = '结束';
  746. /* if($scope.leftTimer)$interval.cancel($scope.leftTimer);
  747. $scope.leftTimer = $interval(function () {
  748. if (countDown >= 1) leftTimer(countDown - 1);
  749. },1000);*/
  750. /* if(countDown<=0){
  751. $scope.timer='结束';
  752. }*/
  753. };
  754. $scope.changeIndex = function (index) {
  755. $scope.index = index;
  756. $scope.vm.coin = index*10;
  757. };
  758. $scope.vidEnded = function () {
  759. alert('播放完毕');
  760. };
  761. //实时计算支持乘数
  762. $scope.calcmultiplier = function () {
  763. $scope.multi.promise = $interval(function () {
  764. var date = new Date();
  765. var inter = date.getTime() - $scope.multi.b.getTime();
  766. var minutes = Math.floor(inter / (60 * 1000));
  767. var number = $scope.multi.a * minutes + $scope.multi.c;//js浮点运算会失真,根据muti.a的可能值范围,比如乘以100再除以100
  768. if (number<=1) {
  769. number = 1;
  770. }
  771. //$scope.multi.result = Math.round(number * 100) / 100;
  772. $scope.multi.result = Math.round(number * 100 / 100);
  773. },1000);
  774. // 点击支持取消 $interval.cancel($scope.multi.promise); 获取数据后重新开始执行
  775. };
  776. $scope.supportDream = function (data) {
  777. if(!$scope.vm.coin){
  778. msg.error("请选择梦想币数量!");
  779. return ;
  780. }
  781. var data = {
  782. id:id,
  783. coin:$scope.vm.coin
  784. };
  785. homeService.supportDream(data).then(function(result){
  786. $scope.tosupport = false;
  787. $scope.load(id);
  788. $interval.cancel($scope.multi.promise);
  789. })
  790. };
  791. $scope.collectionDream = function(is_collection){
  792. homeService.collectionDream(id,is_collection).then(function(result){
  793. $scope.dream.is_collection=result.data.data;
  794. })
  795. };
  796. $scope.add = function(is_collection){
  797. var data = {
  798. id:id,
  799. title:$scope.vm.title,
  800. pics:$scope.imgs
  801. };
  802. homeService.add_interaction(data).then(function(){
  803. $scope.load(id);
  804. $scope.closeModal();
  805. })
  806. };
  807. $scope.showAbout = true;
  808. $scope.hideAbout = false;
  809. $scope.showText = function(){
  810. $scope.aboutStyle = {
  811. "white-space" : "normal"
  812. };
  813. $scope.showAbout = false;
  814. $scope.hideAbout = true;
  815. };
  816. $scope.hideText = function(){
  817. $scope.aboutStyle = {
  818. "white-space" : "nowrap"
  819. };
  820. $scope.showAbout = true;
  821. $scope.hideAbout = false;
  822. };
  823. $scope.input = {
  824. placeholder: '评论',
  825. focus: false,
  826. show:false
  827. };
  828. $scope.replay = function ($event, name) {
  829. $event.stopPropagation();
  830. $scope.input.focus = true;
  831. $scope.input.show = true;
  832. $scope.input.placeholder = "回复" + name;
  833. $scope.vm.title='';
  834. };
  835. $scope.comment = function(){
  836. // $event.stopPropagation();
  837. //$scope.input.placeholder = "评论";
  838. $scope.input.focus = true;
  839. $scope.vm.title='';
  840. };
  841. $scope.submitComment = function(iid){
  842. if($scope.vm.comment&&$scope.vm.comment==''||!iid)return;
  843. var data = {
  844. id:iid,
  845. content:$scope.vm.comment
  846. };
  847. console.log($scope.vm.comment+" "+iid);
  848. homeService.add_comment(data).then(function(){
  849. $scope.vm.comment = '' ;
  850. $scope.load(id);
  851. $scope.closeModal();
  852. })
  853. };
  854. $scope.bigImage = false;
  855. $scope.showBigImage = function(imageName){
  856. $scope.url = imageName;
  857. $scope.bigImage = true;
  858. };
  859. $scope.hideBigImage = function(){
  860. $scope.bigImage = false;
  861. };
  862. $scope.addpict = function () {
  863. common.chooseImage().then(function (img) {
  864. common.uploadFiles(img,1).then(function (result) {
  865. var response = JSON.parse(result.response);
  866. var file = response.data.file;
  867. $scope.imgs.push(config.imgServer+file);
  868. console.log(JSON.stringify(config.imgServer+file));
  869. }, function (error) {
  870. msg.error('图片上传失败');
  871. });
  872. }, function (error) {
  873. console.log('图片选择失败');
  874. });
  875. };
  876. $ionicModal.fromTemplateUrl('recharge-modal.html', {
  877. scope: $scope,
  878. animation: 'slide-in-up'
  879. }).then(function(modal) {
  880. $scope.rechagemodal = modal;
  881. });
  882. $scope.openRechargeModal = function() {
  883. $scope.rechagemodal.show();
  884. $scope.vm.money = '';
  885. };
  886. $scope.closeRechargeModal = function() {
  887. $scope.rechagemodal.hide();
  888. };
  889. $ionicModal.fromTemplateUrl('interaction-modal.html', {
  890. scope: $scope,
  891. animation: 'slide-in-up'
  892. }).then(function(modal) {
  893. $scope.modal = modal;
  894. });
  895. $scope.openModal = function() {
  896. $scope.modal.show();
  897. $scope.vm.title = '';
  898. $scope.imgs = [];
  899. };
  900. $scope.closeModal = function() {
  901. $scope.modal.hide();
  902. };
  903. //当我们用到模型时,清除它!
  904. $scope.$on('$destroy', function() {
  905. $scope.modal.remove();
  906. });
  907. $scope.toMessage = function(){
  908. $state.go("app.my_message");
  909. }
  910. }]);
  911. app.controller('userDetailCtrl', ["$scope", "$state", "$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams", "$ionicModal", "$timeout", "$ionicScrollDelegate", "$interval"
  912. , function ($scope, $state,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams, $ionicModal, $timeout, $ionicScrollDelegate, $interval) {
  913. var id = $stateParams.id;
  914. $scope.items = $stateParams.items;
  915. $scope.$on('$ionicView.beforeEnter', function () {
  916. $ionicTabsDelegate.showBar(false);
  917. });
  918. $scope.attentionUser = function(is_care){
  919. homeService.attentionUser(id,is_care).then(function(result){
  920. $scope.items.is_care=result.data.data;
  921. })
  922. };
  923. $scope.next = function (type) {
  924. //type:1 前一个,type:2 后一个
  925. if($scope.items.imgs.length>0){
  926. if(type==1)
  927. {
  928. var temp= $scope.items.imgs.splice(0,1);
  929. $scope.items.imgs.push(temp[0]);
  930. }
  931. if (type==2){
  932. var temp= $scope.items.imgs.splice($scope.items.imgs.length-1,1);
  933. $scope.items.imgs.unshift(temp[0]);
  934. }
  935. }
  936. };
  937. $scope.bigImage = false;
  938. $scope.showBigImage = function(imageName){
  939. $scope.url = imageName;
  940. $scope.bigImage = true;
  941. };
  942. $scope.hideBigImage = function(){
  943. $scope.bigImage = false;
  944. };
  945. $scope.cancelSupport = function () {
  946. $scope.tosupport = false;
  947. $scope.toshare = false;
  948. };
  949. $scope.toshare = false;
  950. $scope.toshare = false;
  951. $scope.toRecharge = function(){
  952. $state.go("app.recharge")
  953. };
  954. $scope.share = function (type,$event) {
  955. $scope.toshare = true;
  956. if (type==0) {//分享给朋友
  957. /* Wechat.share({
  958. text: "分享的文字",
  959. scene: Wechat.Scene.SESSION // share to 好友
  960. }, function () {
  961. alert("Success");
  962. }, function (reason) {
  963. alert("Failed: " + reason);
  964. });*/
  965. Wechat.share({
  966. message: {
  967. title:"瞄瞄",
  968. description:"HELLO,这是我的个人资料,快来围观吧!",
  969. thumb:"img/icon_cat_h.png",
  970. media: {
  971. type: Wechat.Type.WEBPAGE,
  972. webpageUrl: "https://www.baidu.com/"
  973. }
  974. },
  975. scene: Wechat.Scene.SESSION
  976. }, function () {
  977. alert("Success");
  978. }, function (reason) {
  979. alert("Failed: " + reason);
  980. });
  981. }
  982. if(type==1){
  983. Wechat.share({
  984. message: {
  985. title:"瞄瞄",
  986. description:"HELLO,这是我的个人资料,快来围观吧!",
  987. thumb:"img/icon_cat_h.png",
  988. media: {
  989. type: Wechat.Type.WEBPAGE,
  990. webpageUrl: "https://www.baidu.com/"
  991. }
  992. },
  993. scene: Wechat.Scene.TIMELINE
  994. }, function () {
  995. alert("Success");
  996. }, function (reason) {
  997. alert("Failed: " + reason);
  998. });
  999. }
  1000. // $state.go("app.shareDream",{item:$scope.dream});
  1001. };
  1002. $scope.shareDream = function(){
  1003. $state.go("app.shareDream",{item:$scope.user});
  1004. };
  1005. $scope.toDetail = function (dream_id) {
  1006. if($scope.items.near_dream==null){
  1007. msg.alert("当前梦想","该用户没有当前梦想");
  1008. }
  1009. if($scope.items.near_dream!=null){
  1010. var dream_id = $scope.items.near_dream.id;
  1011. $state.go('app.home_dreamdetail',{id:dream_id});
  1012. }
  1013. };
  1014. $scope.toOldDream = function(){
  1015. if($scope.items.dreams.length<2){
  1016. msg.alert("曾经的梦想","该用户没有曾经的梦想");
  1017. }
  1018. if($scope.items.dreams.length>1){
  1019. $state.go("app.oldDream",{user_id:$scope.items.user.id});
  1020. }
  1021. };
  1022. $scope.toSupportDream = function(){
  1023. if($scope.items.sup_dreams.length==0){
  1024. msg.alert("支持的梦想","该用户没有支持的梦想");
  1025. }
  1026. if($scope.items.sup_dreams.length!=0){
  1027. $state.go("app.supportDream",{user_id:$scope.items.user.id});
  1028. }
  1029. };
  1030. $scope.collectionDream = function(is_collection){
  1031. homeService.collectionDream(id,is_collection).then(function(result){
  1032. $scope.user.is_collection=result.data.data;
  1033. })
  1034. };
  1035. }]);
  1036. app.controller('homeCollectCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
  1037. , function ($scope, $ionicTabsDelegate,$state, myService, msg) {
  1038. $scope.$on('$ionicView.beforeEnter', function () {
  1039. $ionicTabsDelegate.showBar(false);
  1040. myService.collect().then(function(result){
  1041. $scope.dreams = result.data.data.dreams;
  1042. });
  1043. });
  1044. $scope.toDetail = function (id) {
  1045. $state.go('app.home_dreamdetail',{id:id});
  1046. };
  1047. }]);
  1048. app.controller('shareDreamCtrl', ["$scope","homeService", "$stateParams","$state", "msg"
  1049. , function ($scope,homeService,$stateParams, $state, msg) {
  1050. $scope.dream = $stateParams.item;
  1051. $scope.showAbout = true;
  1052. $scope.hideAbout = false;
  1053. $scope.showText = function(){
  1054. $scope.aboutStyle = {
  1055. "white-space" : "normal"
  1056. };
  1057. $scope.showAbout = false;
  1058. $scope.hideAbout = true;
  1059. };
  1060. $scope.hideText = function(){
  1061. $scope.aboutStyle = {
  1062. "white-space" : "nowrap"
  1063. };
  1064. $scope.showAbout = true;
  1065. $scope.hideAbout = false;
  1066. };
  1067. }]);
  1068. app.controller('homeMessageCtrl', ["$scope", "$ionicTabsDelegate","$state", "myService", "msg"
  1069. , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
  1070. $scope.$on('$ionicView.beforeEnter', function () {
  1071. $ionicTabsDelegate.showBar(false);
  1072. myService.messageInfo().then(function(result){
  1073. $scope.infos = result.data.data;
  1074. },function(error){
  1075. });
  1076. });
  1077. $scope.notRead = function(){
  1078. myService.notRead().then(function(result){
  1079. myService.messageInfo().then(function(result){
  1080. $scope.infos = result.data.data;
  1081. },function(error){
  1082. });
  1083. },function(error){
  1084. })
  1085. };
  1086. //系统消息
  1087. $scope.systemInfo = function(){
  1088. $state.go("app.message_sys");
  1089. myService.systemInfo().then(function(result){
  1090. },function(error){
  1091. });
  1092. };
  1093. //回复我的
  1094. $scope.replyMy = function(){
  1095. $state.go("app.message_reply");
  1096. myService.replyMy().then(function(result){
  1097. },function(error){
  1098. });
  1099. };
  1100. $scope.personalLetter = function(){
  1101. $state.go("app.letter");
  1102. }
  1103. }]);
  1104. app.controller('oldDreamCtrl', ["$scope","homeService", "$stateParams","$state", "msg"
  1105. , function ($scope,homeService,$stateParams, $state, msg) {
  1106. var user_id = $stateParams.user_id;
  1107. $scope.$on('$ionicView.beforeEnter',function(){
  1108. $scope.toUserDetail(user_id);
  1109. });
  1110. $scope.toUserDetail = function(user_id){
  1111. homeService.toUserDetail(user_id).then(function(result){
  1112. $scope.items = result.data.data;
  1113. $scope.user = result.data.data.user;
  1114. $scope.dreams = $scope.user.dreams;
  1115. },function(error){
  1116. })
  1117. };
  1118. $scope.toDetail = function(){
  1119. $state.go("app.home_userDetail",{user_id:user_id,items:$scope.items})
  1120. };
  1121. }]);
  1122. app.controller('supportDreamCtrl', ["$scope","homeService", "$stateParams","$state", "msg"
  1123. , function ($scope,homeService,$stateParams, $state, msg) {
  1124. var user_id = $stateParams.user_id;
  1125. $scope.$on('$ionicView.beforeEnter',function(){
  1126. $scope.toUserDetail(user_id);
  1127. });
  1128. $scope.toUserDetail = function(user_id){
  1129. homeService.toUserDetail(user_id).then(function(result){
  1130. $scope.items = result.data.data;
  1131. $scope.user = result.data.data.user;
  1132. $scope.dreams = $scope.user.sup_dream;
  1133. },function(error){
  1134. })
  1135. };
  1136. $scope.toDetail = function(){
  1137. $state.go("app.home_userDetail",{user_id:user_id,items:$scope.items})
  1138. }
  1139. }]);
  1140. app.controller('searchCtrl', ["$scope","homeService", "$state", "msg", "$ionicTabsDelegate", "$ionicNavBarDelegate"
  1141. , function ($scope,homeService, $state, msg, $ionicTabsDelegate, $ionicNavBarDelegate) {
  1142. $scope.showMore = function (keyword,index) {
  1143. if(!keyword)return;
  1144. $scope.index = index;
  1145. $scope.search(keyword);
  1146. };
  1147. $scope.search = function (keyword) {
  1148. $scope.vm.keyword = keyword;
  1149. homeService.search(keyword).then(function(result){
  1150. $scope.isResult = true;
  1151. $scope.dream_infos = result.data.data.dream_infos;
  1152. $scope.user_infos = result.data.data.user_infos;
  1153. });
  1154. };
  1155. $scope.toUserDetail = function (id) {
  1156. homeService.toUserDetail(id).then(function(result){
  1157. $scope.items = result.data.data;
  1158. $state.go('app.home_userDetail',{id:id,items:$scope.items});
  1159. },function(error){
  1160. //msg.error(msg.data.error)
  1161. })
  1162. };
  1163. $scope.toDetail = function (id) {
  1164. $state.go('app.home_dreamdetail',{id:id});
  1165. };
  1166. $scope.$on('$ionicView.beforeEnter', function () {
  1167. $scope.isResult = false;
  1168. $scope.index = 0;
  1169. $scope.vm = {
  1170. keyword : ""
  1171. };
  1172. $ionicTabsDelegate.showBar(false);
  1173. // $ionicNavBarDelegate.showBackButton(false);
  1174. homeService.search('').then(function(result){
  1175. $scope.hot_searches = result.data.data.hot_searches;
  1176. $scope.history_searches = result.data.data.history_searches;
  1177. });
  1178. });
  1179. }]);
  1180. app.controller('interactionAddCtrl', ["$scope","homeService", "$state", "msg","config","common", "$ionicTabsDelegate", "$ionicNavBarDelegate"
  1181. , function ($scope,homeService, $state, msg,config,common, $ionicTabsDelegate, $ionicNavBarDelegate) {
  1182. }]);
  1183. app.controller('homeDreamsCtrl', ["$scope", "$state", "myService", "msg"
  1184. , function ($scope, $state, myService, msg) {
  1185. $scope.$on('$ionicView.beforeEnter', function () {
  1186. myService.myDream().then(function(result){
  1187. console.log(result.data.data);
  1188. $scope.dreams = result.data.data;
  1189. });
  1190. });
  1191. $scope.toDetail = function (id) {
  1192. $state.go('app.home_dreamdetail',{id:id});
  1193. };
  1194. }]);
  1195. })(angular.module('app.controllers'));