YanaDH 7 anos atrás
pai
commit
9647ab5787

+ 1 - 1
miaomiao/www/js/controllers/account.js

xqd
@@ -28,7 +28,7 @@
                    }
                 }, function (error) {
                    console.log("Failed: " + JSON.stringify(error));
-                })  
+                })
                 // $state.go("loginAccount",{wechat:1231});
             }
     }]);

+ 142 - 70
miaomiao/www/js/controllers/home.js

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -307,9 +307,12 @@
                     });*/
                     Wechat.share({
                         message: {
-                            title:"瞄瞄",
+                            /*title:"瞄瞄",
                             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: {
                                 type: Wechat.Type.WEBPAGE,
                                 webpageUrl: "q8.9026.com//admin/share/view?id=" + id
@@ -325,9 +328,12 @@
                 if(type==1){
                     Wechat.share({
                         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: {
                                 type: Wechat.Type.WEBPAGE,
                                 webpageUrl: "q8.9026.com//admin/share/view?id=" + id
@@ -715,9 +721,9 @@
             var id = $stateParams.id;
             var top3user = '';
             $scope.chosedIndex = 0;
-            $scope.clickAvatar = function(index){
+            $scope.clickAvatar = function (index) {
                 $scope.chosedIndex = index;
-                homeService.myInfo().then(function(result){
+                homeService.myInfo().then(function (result) {
                     $scope.user = result.data.data;
                 });
             };
@@ -726,6 +732,7 @@
                 $ionicTabsDelegate.showBar(false);
                 $scope.load(id);
                 $scope.thisUser = storage.getObject('user');
+                $scope.vm.payType = 2;
                 homeService.myInfo().then(function(result){
                     $scope.user = result.data.data;
                 });
@@ -830,6 +837,7 @@
             $scope.toRecharge = function(){
                 $state.go("app.recharge")
             };
+
             $scope.share = function (type,$event) {
                 $scope.toshare = true;
                 if (type==0) {//分享给朋友
@@ -843,9 +851,12 @@
                      });*/
                     Wechat.share({
                         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: {
                                 type: Wechat.Type.WEBPAGE,
                                 webpageUrl: "q8.9026.com//admin/share/view?id=" + id
@@ -861,9 +872,12 @@
                 if(type==1){
                     Wechat.share({
                         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: {
                                 type: Wechat.Type.WEBPAGE,
                                 webpageUrl: "q8.9026.com//admin/share/view?id=" + id
@@ -998,14 +1012,125 @@
                 focus: false,
                 show:false
             };
-            $scope.replay = function ($event, name) {
+            $scope.showmore = function (index) {
+                if ($scope.dream.interactions[index].showmore) {
+                    $scope.dream.interactions[index].showmore = false;
+                } else {
+                    $scope.dream.interactions[index].showmore = true;
+                }
+            }
+            $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();
+                if($scope.dream.interactions[index].comments[currentindex].user_id!=$scope.user.id){
+                    $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='';
+                }
+                else {
+                    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);
+                            })
+                        }
+                    });
+                }
 
+            };
+            $scope.testcharge = function(number){
+                if (!number) {
+                    msg.text('请输入充值金额');
+                    return;
+                }
+                homeService.testcharge(number,2).then(function (result) {
+                    msg.text("充值成功");
+                    $scope.vm.coin = parseInt($scope.vm.coin) + parseInt(number);
+                    $timeout(function () {
+                        $scope.closeRechargeModal();
+                    }, 500);
+                    homeService.myInfo().then(function (result) {
+                        $scope.user = result.data.data;
+                    });
+                })
+            }
+            //充值
+            $scope.charge = function(number){
+                if (!number) {
+                    msg.text('请输入充值金额');
+                    return;
+                }
+                homeService.charge(number,2).then(function (result) {
+                    //todo:result需要返回支付宝或者微信的签名信息
+                    console.log("result: " + JSON.stringify(result));
+                    var payInfo = result.data;
+                    if ($scope.vm.payType == 1) { //支付宝
+                        cordova.plugins.AliPay.pay(payInfo, function success(e) {
+                            //e.resultStatus  状态代码  e.result  本次操作返回的结果数据 e.memo 提示信息
+                            //e.resultStatus  9000  订单支付成功 ;8000 正在处理中  调用function success
+                            //e.resultStatus  4000  订单支付失败 ;6001  用户中途取消 ;6002 网络连接出错  调用function error
+                            //当e.resultStatus为9000时,请去服务端验证支付结果
+                            $scope.clicksub = false;
+                            if (e.resultStatus == '9000') {
+                                alert(orderID);
+                                //支付成功
+                                // $state.go('app.my');
+                            } else {
+                                msg.error("支付失败");
+                                // msg.error("支付失败:" + JSON.stringify(e));
+                            }
+                        }, function error(e) {
+                            $scope.clicksub = false;
+                            // msg.error("支付失败:" + JSON.stringify(e));
+                            msg.error("支付失败");
+                        });
+                    }
+                    if ($scope.vm.payType == 2) { //微信
+                        var obj = JSON.parse(payInfo);
+                        var params = {
+                            partnerid: obj.partnerid, // merchant id
+                            prepayid: obj.prepayid, // prepay id
+                            noncestr: obj.noncestr, // nonce
+                            timestamp: obj.timestamp, // timestamp
+                            sign: obj.sign, // signed string
+                        };
+                        Wechat.sendPaymentRequest(params, function (r) {
+                            $scope.clicksub = false;
+                            courseService.orderStatus(orderID, $scope.paytype).then(function (result) {
+                                //  alert(result);
+                                //支付成功
+                                //  $state.go('app.my');
+                            }, function (erro) {
+                                msg.alert("支付反馈失败:" + JSON.stringify(erro));
+                            });
+                        }, function (reason) {
+                            $scope.clicksub = false;
+                            msg.alert("支付失败:" + JSON.stringify(reason));
+                        });
+                    }
+                    // msg.text("充值成功");
+                    //   $state.go('app.my');
+                });
+            }
             $scope.submitComment = function (index) {
                 var interaction = $scope.dream.interactions[index];
                 var iid = interaction.id;
@@ -1024,7 +1149,7 @@
                 })
             };
             $scope.bigImage = false;
-            $scope.showBigImage = function ($event,imageName) {
+            $scope.showBigImage = function ($event, imageName) {
                 $event.stopPropagation();
                 $scope.url = imageName;
                 $scope.bigImage = true;
@@ -1038,15 +1163,10 @@
             }).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.vm.money = '';
             };
             $scope.closeCode = function() {
                 $scope.qrCodemodal.hide();
@@ -1184,54 +1304,6 @@
             $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);
-                    });
-                }
-                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) {
                 if($scope.items.near_dream==null){
                     msg.alert("当前梦想","该用户没有当前梦想");

+ 0 - 48
miaomiao/www/js/controllers/my.js

xqd
@@ -307,54 +307,6 @@
             $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);
-                    });
-                }
-                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) {
                 if($scope.items.near_dream==null){
                     msg.alert("当前梦想","该用户没有当前梦想");