|
@@ -1,6 +1,6 @@
|
|
(function (app) {
|
|
(function (app) {
|
|
app.controller('homeCtrl', ["$scope", "$ionicTabsDelegate", "$http", 'config', "$state", "msg", "$ionicPopover", "homeService", "$ionicPopup", "$timeout", "$ionicSideMenuDelegate"
|
|
app.controller('homeCtrl', ["$scope", "$ionicTabsDelegate", "$http", 'config', "$state", "msg", "$ionicPopover", "homeService", "$ionicPopup", "$timeout", "$ionicSideMenuDelegate"
|
|
- , function ($scope, $ionicTabsDelegate, $http, config, $state, msg, $ionicPopover, homeService, $ionicPopup, $timeout, $ionicSideMenuDelegate) {
|
|
|
|
|
|
+ , function ($scope,$ionicTabsDelegate, $http, config, $state, msg, $ionicPopover, homeService, $ionicPopup, $timeout, $ionicSideMenuDelegate) {
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
$ionicTabsDelegate.showBar(true);
|
|
$ionicTabsDelegate.showBar(true);
|
|
$scope.load(true);
|
|
$scope.load(true);
|
|
@@ -172,8 +172,8 @@
|
|
});
|
|
});
|
|
}]);
|
|
}]);
|
|
|
|
|
|
- app.controller('dreamDetailCtrl', ["$scope","$ionicHistory","$timeout", "$state", "WechatService","$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams","$ionicBackdrop", "$timeout", "$ionicScrollDelegate", "$interval"
|
|
|
|
- , function ($scope, $ionicHistory,$timeout,$state,WechatService,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams,$ionicBackdrop, $timeout, $ionicScrollDelegate, $interval) {
|
|
|
|
|
|
+ app.controller('dreamDetailCtrl', ["$scope","$location","$ionicHistory","$timeout", "$state", "WechatService","$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams","$ionicBackdrop", "$timeout", "$ionicScrollDelegate", "$interval"
|
|
|
|
+ , function ($scope,$location, $ionicHistory,$timeout,$state,WechatService,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams,$ionicBackdrop, $timeout, $ionicScrollDelegate, $interval) {
|
|
var id = $stateParams.id;
|
|
var id = $stateParams.id;
|
|
var top3user = '';
|
|
var top3user = '';
|
|
$scope.chosedIndex = 0;
|
|
$scope.chosedIndex = 0;
|
|
@@ -307,9 +307,12 @@
|
|
});*/
|
|
});*/
|
|
Wechat.share({
|
|
Wechat.share({
|
|
message: {
|
|
message: {
|
|
- title:"瞄瞄",
|
|
|
|
|
|
+ /*title:"瞄瞄",
|
|
description:"HELLO,这是我的梦想,快来围观吧!",
|
|
description:"HELLO,这是我的梦想,快来围观吧!",
|
|
- thumb:"img/icon_cat_h.png",
|
|
|
|
|
|
+ thumb:"img/icon_cat_h.png",*/
|
|
|
|
+ title: $scope.dream.name,
|
|
|
|
+ description: $scope.dream.about,
|
|
|
|
+ thumb: "http://q8.9026.com/attachment//base/img/share/icon_cat_h.png",
|
|
media: {
|
|
media: {
|
|
type: Wechat.Type.WEBPAGE,
|
|
type: Wechat.Type.WEBPAGE,
|
|
webpageUrl: "q8.9026.com//admin/share/view?id=" + id
|
|
webpageUrl: "q8.9026.com//admin/share/view?id=" + id
|
|
@@ -325,9 +328,12 @@
|
|
if(type==1){
|
|
if(type==1){
|
|
Wechat.share({
|
|
Wechat.share({
|
|
message: {
|
|
message: {
|
|
- title:"瞄瞄",
|
|
|
|
- description:"HELLO,这是我的梦想,快来围观吧!",
|
|
|
|
- thumb:"img/icon_cat_h.png",
|
|
|
|
|
|
+ /*title:"瞄瞄",
|
|
|
|
+ description:"HELLO,这是我的梦想,快来围观吧!",
|
|
|
|
+ thumb:"img/icon_cat_h.png",*/
|
|
|
|
+ title: $scope.dream.name,
|
|
|
|
+ description: $scope.dream.about,
|
|
|
|
+ thumb: "http://q8.9026.com/attachment//base/img/share/icon_cat_h.png",
|
|
media: {
|
|
media: {
|
|
type: Wechat.Type.WEBPAGE,
|
|
type: Wechat.Type.WEBPAGE,
|
|
webpageUrl: "q8.9026.com//admin/share/view?id=" + id
|
|
webpageUrl: "q8.9026.com//admin/share/view?id=" + id
|
|
@@ -469,7 +475,18 @@
|
|
$scope.dream.interactions[index].showmore = true;
|
|
$scope.dream.interactions[index].showmore = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- $scope.replay = function ($event, name, index,currentindex) {
|
|
|
|
|
|
+ $scope.replay = function ($event, name, index) {
|
|
|
|
+ $event.stopPropagation();
|
|
|
|
+ $scope.input.focus = true;
|
|
|
|
+ $scope.input.show = true;
|
|
|
|
+ angular.forEach($scope.dream.interactions, function (item) {
|
|
|
|
+ item.show = false;
|
|
|
|
+ })
|
|
|
|
+ $scope.dream.interactions[index].show = true;
|
|
|
|
+ $scope.input.placeholder = "评论" + name+":";
|
|
|
|
+ $scope.vm.title='';
|
|
|
|
+ }
|
|
|
|
+ $scope.replayOther = function ($event, name, index,currentindex) {
|
|
$event.stopPropagation();
|
|
$event.stopPropagation();
|
|
if($scope.dream.interactions[index].comments[currentindex].user_id!=$scope.user.id){
|
|
if($scope.dream.interactions[index].comments[currentindex].user_id!=$scope.user.id){
|
|
$scope.input.focus = true;
|
|
$scope.input.focus = true;
|
|
@@ -482,7 +499,17 @@
|
|
$scope.vm.title='';
|
|
$scope.vm.title='';
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- msg.confirm("评论","是否删除评论");
|
|
|
|
|
|
+ msg.confirm("评论","是否删除评论").then(function(result){
|
|
|
|
+ if(result==true)
|
|
|
|
+ {
|
|
|
|
+ homeService.deleteComment($scope.dream.interactions[index].comments[currentindex].id).then(function(result){
|
|
|
|
+ msg.text("删除成功");
|
|
|
|
+ $scope.load(id);
|
|
|
|
+ },function(error){
|
|
|
|
+ msg.error(error.data.message);
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
};
|
|
};
|
|
@@ -686,441 +713,17 @@
|
|
$scope.modal.remove();
|
|
$scope.modal.remove();
|
|
});
|
|
});
|
|
$scope.toMessage = function(){
|
|
$scope.toMessage = function(){
|
|
- $state.go("app.message");
|
|
|
|
- }
|
|
|
|
- }]);
|
|
|
|
- app.controller('myDreamDetailCtrl', ["$scope", "$state", "$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams", "$ionicModal", "$timeout", "$ionicScrollDelegate", "$interval"
|
|
|
|
- , function ($scope, $state,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams, $ionicModal, $timeout, $ionicScrollDelegate, $interval) {
|
|
|
|
- var id = $stateParams.id;
|
|
|
|
- var top3user = '';
|
|
|
|
- $scope.chosedIndex = 0;
|
|
|
|
- $scope.clickAvatar = function(index){
|
|
|
|
- $scope.chosedIndex = index;
|
|
|
|
- homeService.myInfo().then(function(result){
|
|
|
|
- $scope.user = result.data.data;
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
- // id=5;
|
|
|
|
- $scope.$on('$ionicView.beforeEnter', function () {
|
|
|
|
- $ionicTabsDelegate.showBar(false);
|
|
|
|
- $scope.load(id);
|
|
|
|
- $scope.thisUser = storage.getObject('user');
|
|
|
|
- homeService.myInfo().then(function(result){
|
|
|
|
- $scope.user = result.data.data;
|
|
|
|
- });
|
|
|
|
- homeService.messageInfo().then(function(result){
|
|
|
|
- $scope.infos = result.data.data;
|
|
|
|
- if($scope.infos.letter.is_read==0 && $scope.infos.reply.is_read==0 && $scope.infos.systemInfo.is_read==0){
|
|
|
|
- $scope.showMessage=0;
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- $scope.showMessage=1;
|
|
|
|
- }
|
|
|
|
- },function(error){
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- $scope.$on('$ionicView.leave', function () {
|
|
|
|
- if($scope.multi.promise)$interval.cancel($scope.multi.promise);
|
|
|
|
- if($scope.leftTimer)$interval.cancel($scope.leftTimer);
|
|
|
|
- });
|
|
|
|
- $scope.toSort = function(){
|
|
|
|
- //$scope.type = 3;
|
|
|
|
- $scope.changeType(3)
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- $scope.load = function (id) {
|
|
|
|
- msg.loading();
|
|
|
|
- homeService.dreamDetail(id).then(function (result) {
|
|
|
|
- msg.hide();
|
|
|
|
- console.log(result);
|
|
|
|
- $scope.showCode = function(codeName){
|
|
|
|
- $scope.url = codeName;
|
|
|
|
- $scope.code = true;
|
|
|
|
- };
|
|
|
|
- $scope.hideCode = function(){
|
|
|
|
- $scope.code = false;
|
|
|
|
- };
|
|
|
|
- $scope.dream = result.data.data;
|
|
|
|
- if($scope.timer=='已结束'|| 100*$scope.dream.get_coin/$scope.dream.coin>=100){
|
|
|
|
- $scope.codeBtn = true;
|
|
|
|
- }
|
|
|
|
- if($scope.dream.video){
|
|
|
|
- $scope.dream.vpic = config.server+'upload/vpic/'+$scope.dream.video+'.jpg';
|
|
|
|
- $scope.dream.video = config.imgServer+$scope.dream.video;
|
|
|
|
- }
|
|
|
|
- var reg = new RegExp("\n", "g");
|
|
|
|
- $scope.dream.about = $scope.dream.about.replace(reg, "<br/>");
|
|
|
|
- var end_time = new Date($scope.dream.end_time.replace(/-/g, "/"));
|
|
|
|
- var date = new Date();
|
|
|
|
- var inter = (end_time.getTime() - date.getTime()) / 1000;
|
|
|
|
- leftTimer(inter);
|
|
|
|
- $scope.multi.a = $scope.dream.a;
|
|
|
|
- $scope.multi.b = new Date($scope.dream.created_at.replace(/-/g, "/"));
|
|
|
|
- $scope.multi.c = $scope.dream.c;
|
|
|
|
- $scope.multi.promise = $scope.dream.a;
|
|
|
|
- var newtop3user = '' ;
|
|
|
|
- angular.forEach($scope.dream.top3user, function(user) {
|
|
|
|
- newtop3user= newtop3user +user.id+","
|
|
|
|
- });
|
|
|
|
- if(top3user!=''&&newtop3user!=top3user){
|
|
|
|
- //测试动画切换
|
|
|
|
- $timeout(function() {
|
|
|
|
- $scope.sort.slide1 = 'list-grow-animation';
|
|
|
|
- $scope.sort.slide2 = 'slide-in-both-ways';
|
|
|
|
- $scope.sort.slide3 = 'bounce-animation';
|
|
|
|
- }, 50);
|
|
|
|
- }
|
|
|
|
- top3user = newtop3user;
|
|
|
|
- if($scope.dream.top3user[0])$scope.sort.first = $scope.dream.top3user[0].avatar;
|
|
|
|
- if($scope.dream.top3user[1])$scope.sort.second = $scope.dream.top3user[1].avatar;
|
|
|
|
- if($scope.dream.top3user[2])$scope.sort.third = $scope.dream.top3user[2].avatar;
|
|
|
|
- $scope.calcmultiplier();
|
|
|
|
- }, function (error) {
|
|
|
|
- msg.hide();
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- $scope.openSupport = function () {
|
|
|
|
- msg.alert("支持乘数说明","支持乘数支持乘数支持乘数支持乘数");
|
|
|
|
- };
|
|
|
|
- $scope.multi = {
|
|
|
|
- a: '',
|
|
|
|
- b: '',
|
|
|
|
- c: '',
|
|
|
|
- result: 1,
|
|
|
|
- promise:null
|
|
|
|
- };
|
|
|
|
- $scope.type = 1;//tab切换
|
|
|
|
- $scope.tosupport = false;
|
|
|
|
- $scope.support = function ($event) {
|
|
|
|
- $event.stopPropagation();
|
|
|
|
- $scope.tosupport = true;
|
|
|
|
- $scope.vm.coin = 0;
|
|
|
|
- $scope.index = 0;
|
|
|
|
- };
|
|
|
|
- $scope.cancelSupport = function () {
|
|
|
|
- $scope.tosupport = false;
|
|
|
|
- $scope.toshare = false;
|
|
|
|
- $scope.input.show = false;
|
|
|
|
-
|
|
|
|
- };
|
|
|
|
- $scope.toshare = false;
|
|
|
|
- $scope.toRecharge = function(){
|
|
|
|
- $state.go("app.recharge")
|
|
|
|
- };
|
|
|
|
- $scope.share = function (type,$event) {
|
|
|
|
- $scope.toshare = true;
|
|
|
|
- if (type==0) {//分享给朋友
|
|
|
|
- /* Wechat.share({
|
|
|
|
- text: "分享的文字",
|
|
|
|
- scene: Wechat.Scene.SESSION // share to 好友
|
|
|
|
- }, function () {
|
|
|
|
- alert("Success");
|
|
|
|
- }, function (reason) {
|
|
|
|
- alert("Failed: " + reason);
|
|
|
|
- });*/
|
|
|
|
- Wechat.share({
|
|
|
|
- message: {
|
|
|
|
- title:"瞄瞄",
|
|
|
|
- description:"HELLO,这是我的梦想,快来围观吧!",
|
|
|
|
- thumb:"img/icon_cat_h.png",
|
|
|
|
- media: {
|
|
|
|
- type: Wechat.Type.WEBPAGE,
|
|
|
|
- webpageUrl: "q8.9026.com//admin/share/view?id=" + id
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- scene: Wechat.Scene.SESSION
|
|
|
|
- }, function () {
|
|
|
|
- alert("Success");
|
|
|
|
- }, function (reason) {
|
|
|
|
- alert("Failed: " + reason);
|
|
|
|
- });
|
|
|
|
|
|
+ //var dreamdetailUrl = $location.path();
|
|
|
|
+ if($location.path()=="/app/home/dreamdetail"){
|
|
|
|
+ $state.go("app.message");
|
|
}
|
|
}
|
|
- if(type==1){
|
|
|
|
- Wechat.share({
|
|
|
|
- message: {
|
|
|
|
- title:"瞄瞄",
|
|
|
|
- description:"HELLO,这是我的梦想,快来围观吧!",
|
|
|
|
- thumb:"img/icon_cat_h.png",
|
|
|
|
- media: {
|
|
|
|
- type: Wechat.Type.WEBPAGE,
|
|
|
|
- webpageUrl: "q8.9026.com//admin/share/view?id=" + id
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- scene: Wechat.Scene.TIMELINE
|
|
|
|
- }, function () {
|
|
|
|
- alert("Success");
|
|
|
|
- }, function (reason) {
|
|
|
|
- alert("Failed: " + reason);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- // $state.go("app.shareDream",{item:$scope.dream});
|
|
|
|
- };
|
|
|
|
- //实时排行
|
|
|
|
- $scope.sort = {
|
|
|
|
- slide: ''
|
|
|
|
- };
|
|
|
|
- $scope.changeType = function (type) {
|
|
|
|
- $ionicScrollDelegate.scrollTop(true);
|
|
|
|
- $scope.type = type;
|
|
|
|
- };
|
|
|
|
- $scope.index = 0;
|
|
|
|
-
|
|
|
|
- $scope.vm = {
|
|
|
|
- coin:"",
|
|
|
|
- title:""
|
|
|
|
- };
|
|
|
|
- $scope.timer = '';
|
|
|
|
- var leftTimer = function (countDown) {
|
|
|
|
- if (isNaN(countDown)) {
|
|
|
|
- $scope.timer = '已结束';
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- var day=parseInt(countDown/(24*60*60));
|
|
|
|
- var h=parseInt(countDown/(60*60)%24);
|
|
|
|
- var m=parseInt(countDown/60%60);
|
|
|
|
- var s=parseInt(countDown%60);
|
|
|
|
- //$scope.timer=(h<10?'0'+h:h)+'时'+(m<10?'0'+m:m)+'分'+(s<10?'0'+s:s)+'秒';
|
|
|
|
- if(day>0) $scope.timer = day+'天';
|
|
|
|
- if(day<0 && h>0) $scope.timer = h+'小时';
|
|
|
|
- if(day<0 && h<0 && m>0) $scope.timer = m+'分钟';
|
|
|
|
- if(day<0 && h<0 && m<0) $scope.timer = '已结束';
|
|
|
|
- /* if($scope.leftTimer)$interval.cancel($scope.leftTimer);
|
|
|
|
- $scope.leftTimer = $interval(function () {
|
|
|
|
- if (countDown >= 1) leftTimer(countDown - 1);
|
|
|
|
- },1000);*/
|
|
|
|
- /*if(countDown<=0){
|
|
|
|
- $scope.timer='结束';
|
|
|
|
- }*/
|
|
|
|
- };
|
|
|
|
- $scope.changeIndex = function (index) {
|
|
|
|
- $scope.index = index;
|
|
|
|
- $scope.vm.coin = index*10;
|
|
|
|
- };
|
|
|
|
- $scope.vidEnded = function () {
|
|
|
|
- alert('播放完毕');
|
|
|
|
- };
|
|
|
|
- //实时计算支持乘数
|
|
|
|
- $scope.calcmultiplier = function () {
|
|
|
|
- $scope.multi.promise = $interval(function () {
|
|
|
|
-
|
|
|
|
- var date = new Date();
|
|
|
|
- var inter = date.getTime() - $scope.multi.b.getTime();
|
|
|
|
- var minutes = Math.floor(inter / (60 * 1000));
|
|
|
|
- var number = $scope.multi.a * minutes + $scope.multi.c;//js浮点运算会失真,根据muti.a的可能值范围,比如乘以100再除以100
|
|
|
|
- if (number<=1) {
|
|
|
|
- number = 1;
|
|
|
|
- }
|
|
|
|
- //$scope.multi.result = Math.round(number * 100) / 100;
|
|
|
|
- $scope.multi.result = Math.round(number * 100 / 100);
|
|
|
|
- },1000);
|
|
|
|
- // 点击支持取消 $interval.cancel($scope.multi.promise); 获取数据后重新开始执行
|
|
|
|
- };
|
|
|
|
- $scope.supportDream = function (data) {
|
|
|
|
- if(!$scope.vm.coin){
|
|
|
|
- msg.error("请选择梦想币数量!");
|
|
|
|
- return ;
|
|
|
|
|
|
+ else {
|
|
|
|
+ $state.go("app.my_message");
|
|
}
|
|
}
|
|
- var data = {
|
|
|
|
- id:id,
|
|
|
|
- coin:$scope.vm.coin
|
|
|
|
- };
|
|
|
|
- homeService.supportDream(data).then(function(result){
|
|
|
|
- $scope.tosupport = false;
|
|
|
|
- $scope.load(id);
|
|
|
|
- homeService.myInfo().then(function(result){
|
|
|
|
- $scope.user = result.data.data;
|
|
|
|
- });
|
|
|
|
- $interval.cancel($scope.multi.promise);
|
|
|
|
- msg.text("发送成功");
|
|
|
|
- })
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- $scope.collectionDream = function(is_collection){
|
|
|
|
- homeService.collectionDream(id,is_collection).then(function(result){
|
|
|
|
- $scope.dream.is_collection=result.data.data;
|
|
|
|
- })
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- $scope.add = function(is_collection){
|
|
|
|
- var data = {
|
|
|
|
- id:id,
|
|
|
|
- title:$scope.vm.title,
|
|
|
|
- pics:$scope.imgs,
|
|
|
|
- video:$scope.video.server
|
|
|
|
- };
|
|
|
|
- homeService.add_interaction(data).then(function(){
|
|
|
|
- $scope.load(id);
|
|
|
|
- $scope.closeModal();
|
|
|
|
- })
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- $scope.showAbout = true;
|
|
|
|
- $scope.hideAbout = false;
|
|
|
|
- $scope.showText = function(){
|
|
|
|
- $scope.aboutStyle = {
|
|
|
|
- "white-space" : "normal"
|
|
|
|
- };
|
|
|
|
- $scope.showAbout = false;
|
|
|
|
- $scope.hideAbout = true;
|
|
|
|
- };
|
|
|
|
- $scope.hideText = function(){
|
|
|
|
- $scope.aboutStyle = {
|
|
|
|
- "white-space" : "nowrap"
|
|
|
|
- };
|
|
|
|
- $scope.showAbout = true;
|
|
|
|
- $scope.hideAbout = false;
|
|
|
|
- };
|
|
|
|
- $scope.input = {
|
|
|
|
- placeholder: '评论',
|
|
|
|
- focus: false,
|
|
|
|
- show:false
|
|
|
|
- };
|
|
|
|
- $scope.replay = function ($event, name) {
|
|
|
|
- $event.stopPropagation();
|
|
|
|
- $scope.input.focus = true;
|
|
|
|
- $scope.input.show = true;
|
|
|
|
- $scope.input.placeholder = "评论" + name+":";
|
|
|
|
- $scope.vm.title='';
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- $scope.submitComment = function (index) {
|
|
|
|
- var interaction = $scope.dream.interactions[index];
|
|
|
|
- var iid = interaction.id;
|
|
|
|
- // $scope.dream.interactions[index].comments.push($scope.vm.comment);
|
|
|
|
- $scope.input.focus = true;
|
|
|
|
- if ($scope.vm.comment && $scope.vm.comment == '' || !iid) return;
|
|
|
|
- var data = {
|
|
|
|
- id:iid,
|
|
|
|
- content:$scope.vm.comment
|
|
|
|
- };
|
|
|
|
- console.log($scope.vm.comment+" "+iid);
|
|
|
|
- homeService.add_comment(data).then(function(){
|
|
|
|
- $scope.vm.comment = '' ;
|
|
|
|
- $scope.load(id);
|
|
|
|
- $scope.closeModal();
|
|
|
|
- })
|
|
|
|
- };
|
|
|
|
- $scope.bigImage = false;
|
|
|
|
- $scope.showBigImage = function ($event,imageName) {
|
|
|
|
- $event.stopPropagation();
|
|
|
|
- $scope.url = imageName;
|
|
|
|
- $scope.bigImage = true;
|
|
|
|
- };
|
|
|
|
- $scope.hideBigImage = function(){
|
|
|
|
- $scope.bigImage = false;
|
|
|
|
- };
|
|
|
|
- $ionicModal.fromTemplateUrl('qrCode.html', {
|
|
|
|
- scope: $scope,
|
|
|
|
- animation: 'slide-in-up'
|
|
|
|
- }).then(function(modal) {
|
|
|
|
- $scope.qrCodemodal = modal;
|
|
|
|
- });
|
|
|
|
- $ionicModal.fromTemplateUrl('commentPic.html', {
|
|
|
|
- scope: $scope,
|
|
|
|
- animation: 'slide-in-up'
|
|
|
|
- }).then(function(modal) {
|
|
|
|
- $scope.CommentPicmodal = modal;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- $scope.openCode = function() {
|
|
|
|
- $scope.qrCodemodal.show();
|
|
|
|
- };
|
|
|
|
- $scope.closeCode = function() {
|
|
|
|
- $scope.qrCodemodal.hide();
|
|
|
|
- };
|
|
|
|
- $ionicModal.fromTemplateUrl('commentPic.html', {
|
|
|
|
- scope: $scope,
|
|
|
|
- animation: 'slide-in-up'
|
|
|
|
- }).then(function(modal) {
|
|
|
|
- $scope.CommentPicmodal = modal;
|
|
|
|
- });
|
|
|
|
- $scope.openCommentPic = function(pic) {
|
|
|
|
- $scope.CommentPicmodal.show();
|
|
|
|
- $scope.commentPicUrl = pic;
|
|
|
|
- };
|
|
|
|
- $scope.closeCommentPic = function() {
|
|
|
|
- $scope.CommentPicmodal.hide();
|
|
|
|
- };
|
|
|
|
- $scope.addpict = function () {
|
|
|
|
- common.chooseImage().then(function (img) {
|
|
|
|
- common.uploadFiles(img,1).then(function (result) {
|
|
|
|
- var response = JSON.parse(result.response);
|
|
|
|
- var file = response.data.file;
|
|
|
|
- $scope.imgs.push(config.imgServer+file);
|
|
|
|
- console.log(JSON.stringify(config.imgServer+file));
|
|
|
|
- }, function (error) {
|
|
|
|
- msg.error('图片上传失败');
|
|
|
|
- });
|
|
|
|
- }, function (error) {
|
|
|
|
- console.log('图片选择失败');
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
- $scope.deletefile = function (file) {
|
|
|
|
- var index = $scope.imgs.indexOf(file);
|
|
|
|
- $scope.imgs.splice(index, 1);
|
|
|
|
- common.deletefile(file).then(function () {
|
|
|
|
- })
|
|
|
|
- };
|
|
|
|
- $scope.addvideo = function () {
|
|
|
|
- common.chooseVideo().then(function (file) {
|
|
|
|
- common.uploadFiles(file, 2).then(function (result) {
|
|
|
|
- var response = JSON.parse(result.response);
|
|
|
|
- $scope.video.server = response.data.file;
|
|
|
|
- var file = config.imgServer+response.data.file;
|
|
|
|
- console.log("file:"+file);
|
|
|
|
- $scope.video.isOK = true;
|
|
|
|
- $scope.video.file = file;
|
|
|
|
- $scope.video.vpic = config.server+'upload/vpic/'+response.data.file+'.jpg';
|
|
|
|
- console.log("vpic:"+$scope.video.vpic);
|
|
|
|
- }, function (error) {
|
|
|
|
- msg.error('视频上传失败');
|
|
|
|
- });
|
|
|
|
- }, function (erro) {
|
|
|
|
- console.log('选择视频失败');
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
- $ionicModal.fromTemplateUrl('recharge-modal.html', {
|
|
|
|
- scope: $scope,
|
|
|
|
- animation: 'slide-in-up'
|
|
|
|
- }).then(function(modal) {
|
|
|
|
- $scope.rechagemodal = modal;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- $scope.openRechargeModal = function() {
|
|
|
|
- $scope.rechagemodal.show();
|
|
|
|
- $scope.vm.money = '';
|
|
|
|
- };
|
|
|
|
- $scope.closeRechargeModal = function() {
|
|
|
|
- $scope.rechagemodal.hide();
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- $ionicModal.fromTemplateUrl('interaction-modal.html', {
|
|
|
|
- scope: $scope,
|
|
|
|
- animation: 'slide-in-up'
|
|
|
|
- }).then(function(modal) {
|
|
|
|
- $scope.modal = modal;
|
|
|
|
- });
|
|
|
|
- $scope.openModal = function() {
|
|
|
|
- $scope.modal.show();
|
|
|
|
- $scope.vm.title = '';
|
|
|
|
- $scope.imgs = [];
|
|
|
|
- $scope.video = {};
|
|
|
|
- };
|
|
|
|
- $scope.closeModal = function() {
|
|
|
|
- $scope.modal.hide();
|
|
|
|
- };
|
|
|
|
- //当我们用到模型时,清除它!
|
|
|
|
- $scope.$on('$destroy', function() {
|
|
|
|
- $scope.modal.remove();
|
|
|
|
- });
|
|
|
|
- $scope.toMessage = function(){
|
|
|
|
- $state.go("app.my_message");
|
|
|
|
}
|
|
}
|
|
}]);
|
|
}]);
|
|
- app.controller('userDetailCtrl', ["$scope", "$state", "$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams", "$ionicModal", "$timeout", "$ionicScrollDelegate", "$interval"
|
|
|
|
- , function ($scope, $state,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams, $ionicModal, $timeout, $ionicScrollDelegate, $interval) {
|
|
|
|
|
|
+ app.controller('userDetailCtrl', ["$scope","$location", "$state", "$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams", "$ionicModal", "$timeout", "$ionicScrollDelegate", "$interval"
|
|
|
|
+ , function ($scope,$location, $state,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams, $ionicModal, $timeout, $ionicScrollDelegate, $interval) {
|
|
var id = $stateParams.id;
|
|
var id = $stateParams.id;
|
|
$scope.items = $stateParams.items;
|
|
$scope.items = $stateParams.items;
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
@@ -1163,61 +766,18 @@
|
|
$scope.toRecharge = function(){
|
|
$scope.toRecharge = function(){
|
|
$state.go("app.recharge")
|
|
$state.go("app.recharge")
|
|
};
|
|
};
|
|
- $scope.share = function (type,$event) {
|
|
|
|
- $scope.toshare = true;
|
|
|
|
- if (type==0) {//分享给朋友
|
|
|
|
- /* Wechat.share({
|
|
|
|
- text: "分享的文字",
|
|
|
|
- scene: Wechat.Scene.SESSION // share to 好友
|
|
|
|
- }, function () {
|
|
|
|
- alert("Success");
|
|
|
|
- }, function (reason) {
|
|
|
|
- alert("Failed: " + reason);
|
|
|
|
- });*/
|
|
|
|
- Wechat.share({
|
|
|
|
- message: {
|
|
|
|
- title:"瞄瞄",
|
|
|
|
- description:"HELLO,这是我的个人资料,快来围观吧!",
|
|
|
|
- thumb:"img/icon_cat_h.png",
|
|
|
|
- media: {
|
|
|
|
- type: Wechat.Type.WEBPAGE,
|
|
|
|
- webpageUrl: "q8.9026.com//admin/share/view?id=" + id
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- scene: Wechat.Scene.SESSION
|
|
|
|
- }, function () {
|
|
|
|
- alert("Success");
|
|
|
|
- }, function (reason) {
|
|
|
|
- alert("Failed: " + reason);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- if(type==1){
|
|
|
|
- Wechat.share({
|
|
|
|
- message: {
|
|
|
|
- title:"瞄瞄",
|
|
|
|
- description:"HELLO,这是我的个人资料,快来围观吧!",
|
|
|
|
- thumb:"img/icon_cat_h.png",
|
|
|
|
- media: {
|
|
|
|
- type: Wechat.Type.WEBPAGE,
|
|
|
|
- webpageUrl: "q8.9026.com//admin/share/view?id=" + id
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- scene: Wechat.Scene.TIMELINE
|
|
|
|
- }, function () {
|
|
|
|
- alert("Success");
|
|
|
|
- }, function (reason) {
|
|
|
|
- alert("Failed: " + reason);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- // $state.go("app.shareDream",{item:$scope.dream});
|
|
|
|
- };
|
|
|
|
$scope.toDetail = function (dream_id) {
|
|
$scope.toDetail = function (dream_id) {
|
|
if($scope.items.near_dream==null){
|
|
if($scope.items.near_dream==null){
|
|
msg.alert("当前梦想","该用户没有当前梦想");
|
|
msg.alert("当前梦想","该用户没有当前梦想");
|
|
}
|
|
}
|
|
if($scope.items.near_dream!=null){
|
|
if($scope.items.near_dream!=null){
|
|
var dream_id = $scope.items.near_dream.id;
|
|
var dream_id = $scope.items.near_dream.id;
|
|
- $state.go('app.home_dreamdetail',{id:dream_id});
|
|
|
|
|
|
+ if($location.path()=="/app/home/userDetail"){
|
|
|
|
+ $state.go('app.home_dreamdetail',{id:dream_id});
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $state.go('app.my_dreamdetail',{id:dream_id});
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
$scope.toOldDream = function(){
|
|
$scope.toOldDream = function(){
|
|
@@ -1225,7 +785,12 @@
|
|
msg.alert("曾经的梦想","该用户没有曾经的梦想");
|
|
msg.alert("曾经的梦想","该用户没有曾经的梦想");
|
|
}
|
|
}
|
|
if($scope.items.dreams.length>1){
|
|
if($scope.items.dreams.length>1){
|
|
- $state.go("app.oldDream",{user_id:$scope.items.user.id});
|
|
|
|
|
|
+ if($location.path()=="/app/home/userDetail"){
|
|
|
|
+ $state.go('app.oldDream',{user_id:$scope.items.user.id});
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $state.go('app.myOldDream',{user_id:$scope.items.user.id});
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
$scope.toSupportDream = function(){
|
|
$scope.toSupportDream = function(){
|
|
@@ -1233,7 +798,14 @@
|
|
msg.alert("支持的梦想","该用户没有支持的梦想");
|
|
msg.alert("支持的梦想","该用户没有支持的梦想");
|
|
}
|
|
}
|
|
if($scope.items.sup_dreams.length!=0){
|
|
if($scope.items.sup_dreams.length!=0){
|
|
- $state.go("app.supportDream",{user_id:$scope.items.user.id});
|
|
|
|
|
|
+ if($scope.items.dreams.length>1){
|
|
|
|
+ if($location.path()=="/app/home/userDetail"){
|
|
|
|
+ $state.go('app.supportDream',{user_id:$scope.items.user.id});
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $state.go('app.mySupportDream',{user_id:$scope.items.user.id});
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
$scope.collectionDream = function(is_collection){
|
|
$scope.collectionDream = function(is_collection){
|