|
@@ -639,108 +639,108 @@
|
|
$scope.ios={
|
|
$scope.ios={
|
|
isIOS:ionic.Platform.isIOS(),
|
|
isIOS:ionic.Platform.isIOS(),
|
|
productid:''
|
|
productid:''
|
|
- }
|
|
|
|
- //充值
|
|
|
|
- $scope.charge = function(number){
|
|
|
|
- if($scope.ios.isIOS){
|
|
|
|
- if (number<2){
|
|
|
|
- msg.text('请选择充值金额');
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- console.log('购买productid:'+number);
|
|
|
|
- msg.loading();
|
|
|
|
- inAppPurchase
|
|
|
|
- .buy(number)
|
|
|
|
- .then(function (data) {
|
|
|
|
- msg.hide();
|
|
|
|
- console.log('购买then:'+JSON.stringify(data));
|
|
|
|
- return inAppPurchase.consume(data.productType, data.receipt, data.signature);
|
|
|
|
- })
|
|
|
|
- .then(function (data) {
|
|
|
|
- msg.hide();
|
|
|
|
- myService.orderIos(number).then(function (result) {
|
|
|
|
- console.log('服务器端购买成功:'+number);
|
|
|
|
- }, function (erro) {
|
|
|
|
- });
|
|
|
|
- console.log('购买成功:'+number);
|
|
|
|
- msg.success('购买成功');
|
|
|
|
- $timeout(function () {
|
|
|
|
- $scope.closeRechargeModal();
|
|
|
|
- }, 1000);
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
- .catch(function (err) {
|
|
|
|
- msg.hide();
|
|
|
|
- console.log('购买失败:'+JSON.stringify(err));
|
|
|
|
- $timeout(function () {
|
|
|
|
- $scope.closeRechargeModal();
|
|
|
|
- }, 1000);
|
|
|
|
- // alert('购买失败:'+JSON.stringify(err));
|
|
|
|
|
|
+ }
|
|
|
|
+ //充值
|
|
|
|
+ $scope.charge = function(number){
|
|
|
|
+ if($scope.ios.isIOS){
|
|
|
|
+ if (number<2){
|
|
|
|
+ msg.text('请选择充值金额');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ console.log('购买productid:'+number);
|
|
|
|
+ msg.loading();
|
|
|
|
+ inAppPurchase
|
|
|
|
+ .buy(number)
|
|
|
|
+ .then(function (data) {
|
|
|
|
+ msg.hide();
|
|
|
|
+ console.log('购买then:'+JSON.stringify(data));
|
|
|
|
+ return inAppPurchase.consume(data.productType, data.receipt, data.signature);
|
|
|
|
+ })
|
|
|
|
+ .then(function (data) {
|
|
|
|
+ msg.hide();
|
|
|
|
+ myService.orderIos(number).then(function (result) {
|
|
|
|
+ console.log('服务器端购买成功:'+number);
|
|
|
|
+ }, function (erro) {
|
|
});
|
|
});
|
|
- }else{
|
|
|
|
- if (!number) {
|
|
|
|
- msg.text('请输入充值金额');
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- homeService.charge(number,2).then(function (result) {
|
|
|
|
- //todo:result需要返回支付宝或者微信的签名信息
|
|
|
|
- console.log("result: " + JSON.stringify(result));
|
|
|
|
- var payInfo = result.data.data;
|
|
|
|
- if ($scope.vm.payType == 1) { //支付宝
|
|
|
|
- cordova.plugins.AliPay.pay(payInfo, function success(e) {
|
|
|
|
- $scope.clicksub = false;
|
|
|
|
- if (e.resultStatus == '9000') {
|
|
|
|
- alert(orderID);
|
|
|
|
- $timeout(function () {
|
|
|
|
- $scope.closeRechargeModal();
|
|
|
|
- }, 1000);
|
|
|
|
- homeService.myInfo().then(function (result) {
|
|
|
|
- $scope.user = result.data.data;
|
|
|
|
- });
|
|
|
|
- } 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 obj = payInfo.orderString;
|
|
|
|
- // console.log("obj: " + JSON.stringify(obj));
|
|
|
|
- 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
|
|
|
|
- };
|
|
|
|
- // console.log("result: " + JSON.stringify(params));
|
|
|
|
- Wechat.sendPaymentRequest(params, function (r) {
|
|
|
|
- // $scope.clicksub = false;
|
|
|
|
|
|
+ console.log('购买成功:'+number);
|
|
|
|
+ msg.success('购买成功');
|
|
|
|
+ $timeout(function () {
|
|
|
|
+ $scope.closeRechargeModal();
|
|
|
|
+ }, 1000);
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ .catch(function (err) {
|
|
|
|
+ msg.hide();
|
|
|
|
+ console.log('购买失败:'+JSON.stringify(err));
|
|
|
|
+ $timeout(function () {
|
|
|
|
+ $scope.closeRechargeModal();
|
|
|
|
+ }, 1000);
|
|
|
|
+ // alert('购买失败:'+JSON.stringify(err));
|
|
|
|
+ });
|
|
|
|
+ }else{
|
|
|
|
+ if (!number) {
|
|
|
|
+ msg.text('请输入充值金额');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ homeService.charge(number,2).then(function (result) {
|
|
|
|
+ //todo:result需要返回支付宝或者微信的签名信息
|
|
|
|
+ console.log("result: " + JSON.stringify(result));
|
|
|
|
+ var payInfo = result.data.data;
|
|
|
|
+ if ($scope.vm.payType == 1) { //支付宝
|
|
|
|
+ cordova.plugins.AliPay.pay(payInfo, function success(e) {
|
|
|
|
+ $scope.clicksub = false;
|
|
|
|
+ if (e.resultStatus == '9000') {
|
|
|
|
+ alert(orderID);
|
|
$timeout(function () {
|
|
$timeout(function () {
|
|
$scope.closeRechargeModal();
|
|
$scope.closeRechargeModal();
|
|
}, 1000);
|
|
}, 1000);
|
|
- $scope.load(id,dream_user_id,interaction_id);
|
|
|
|
- // courseService.orderStatus(orderID, $scope.paytype).then(function (result) {
|
|
|
|
-
|
|
|
|
- // homeService.myInfo().then(function (result) {
|
|
|
|
- // $scope.user = result.data.data;
|
|
|
|
- // });
|
|
|
|
- // }, function (erro) {
|
|
|
|
- // // msg.alert("支付反馈失败:" + JSON.stringify(erro));
|
|
|
|
- // });
|
|
|
|
- }, function (reason) {
|
|
|
|
- $scope.clicksub = false;
|
|
|
|
- // msg.alert("支付失败:" + JSON.stringify(reason));
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
|
|
+ homeService.myInfo().then(function (result) {
|
|
|
|
+ $scope.user = result.data.data;
|
|
|
|
+ });
|
|
|
|
+ } 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 obj = payInfo.orderString;
|
|
|
|
+ // console.log("obj: " + JSON.stringify(obj));
|
|
|
|
+ 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
|
|
|
|
+ };
|
|
|
|
+ // console.log("result: " + JSON.stringify(params));
|
|
|
|
+ Wechat.sendPaymentRequest(params, function (r) {
|
|
|
|
+ // $scope.clicksub = false;
|
|
|
|
+ $timeout(function () {
|
|
|
|
+ $scope.closeRechargeModal();
|
|
|
|
+ }, 1000);
|
|
|
|
+ $scope.load(id,dream_user_id,interaction_id);
|
|
|
|
+ // courseService.orderStatus(orderID, $scope.paytype).then(function (result) {
|
|
|
|
+
|
|
|
|
+ // homeService.myInfo().then(function (result) {
|
|
|
|
+ // $scope.user = result.data.data;
|
|
|
|
+ // });
|
|
|
|
+ // }, function (erro) {
|
|
|
|
+ // // msg.alert("支付反馈失败:" + JSON.stringify(erro));
|
|
|
|
+ // });
|
|
|
|
+ }, function (reason) {
|
|
|
|
+ $scope.clicksub = false;
|
|
|
|
+ // msg.alert("支付失败:" + JSON.stringify(reason));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ };
|
|
$scope.submitComment = function (index,to_userid) {
|
|
$scope.submitComment = function (index,to_userid) {
|
|
var interaction = $scope.dream.interactions[index];
|
|
var interaction = $scope.dream.interactions[index];
|
|
var iid = interaction.id;
|
|
var iid = interaction.id;
|
|
@@ -765,91 +765,92 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ $scope.bigImage = false;
|
|
|
|
+ $scope.showBigImage = function ($event, imageName) {
|
|
|
|
+ $event.stopPropagation();
|
|
|
|
+ $scope.url = imageName;
|
|
|
|
+ $scope.bigImage = true;
|
|
|
|
+ };
|
|
|
|
+ $scope.hideBigImage = function(){
|
|
$scope.bigImage = false;
|
|
$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('qrCode.html', {
|
|
|
|
+ scope: $scope,
|
|
|
|
+ animation: 'slide-in-up'
|
|
|
|
+ }).then(function(modal) {
|
|
|
|
+ $scope.qrCodemodal = modal;
|
|
|
|
+ });
|
|
|
|
|
|
- $scope.openCode = function($event) {
|
|
|
|
- $event.stopPropagation();
|
|
|
|
- $scope.qrCodemodal.show();
|
|
|
|
- $scope.vm.money = '';
|
|
|
|
- };
|
|
|
|
- $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,$event) {
|
|
|
|
- $event.stopPropagation();
|
|
|
|
- $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 = config.imgServer + response.data.file;
|
|
|
|
- $scope.imgs.push(file);
|
|
|
|
- }, function (error) {
|
|
|
|
- msg.error('图片上传失败');
|
|
|
|
- });
|
|
|
|
|
|
+ $scope.openCode = function($event) {
|
|
|
|
+ $event.stopPropagation();
|
|
|
|
+ $scope.qrCodemodal.show();
|
|
|
|
+ $scope.vm.money = '';
|
|
|
|
+ };
|
|
|
|
+ $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,$event) {
|
|
|
|
+ $event.stopPropagation();
|
|
|
|
+ $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 = config.imgServer + response.data.file;
|
|
|
|
+ $scope.imgs.push(file);
|
|
}, function (error) {
|
|
}, function (error) {
|
|
- console.log('图片选择失败');
|
|
|
|
|
|
+ msg.error('图片上传失败');
|
|
});
|
|
});
|
|
- };
|
|
|
|
- $scope.deletefile = function (file) {
|
|
|
|
- var index = $scope.imgs.indexOf(file);
|
|
|
|
- $scope.imgs.splice(index, 1);
|
|
|
|
- common.deletefile(file).then(function () {
|
|
|
|
- })
|
|
|
|
- };
|
|
|
|
|
|
+ }, 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) {
|
|
|
|
- msg.loading();
|
|
|
|
- common.uploadFiles(file, 2).then(function (result) {
|
|
|
|
- msg.hide();
|
|
|
|
- var response = JSON.parse(result.response);
|
|
|
|
- $scope.video.server = response.data.file;
|
|
|
|
- var file = config.imgServer+response.data.file;
|
|
|
|
- $scope.video.isOK = true;
|
|
|
|
- $scope.video.file = file;
|
|
|
|
- $scope.video.vpic = config.server+'upload/vpic/'+response.data.file+'.jpg';
|
|
|
|
- }, function (error) {
|
|
|
|
- //msg.error('视频上传失败');
|
|
|
|
- msg.hide();
|
|
|
|
- msg.error(JSON.stringify(error));
|
|
|
|
- });
|
|
|
|
- }, function (erro) {
|
|
|
|
- console.log('选择视频失败');
|
|
|
|
|
|
+ $scope.addvideo = function () {
|
|
|
|
+ common.chooseVideo().then(function (file) {
|
|
|
|
+ msg.loading();
|
|
|
|
+ common.uploadFiles(file, 2).then(function (result) {
|
|
|
|
+ msg.hide();
|
|
|
|
+ var response = JSON.parse(result.response);
|
|
|
|
+ $scope.video.server = response.data.file;
|
|
|
|
+ var file = config.imgServer+response.data.file;
|
|
|
|
+ $scope.video.isOK = true;
|
|
|
|
+ $scope.video.file = file;
|
|
|
|
+ $scope.video.vpic = config.server+'upload/vpic/'+response.data.file+'.jpg';
|
|
|
|
+ }, function (error) {
|
|
|
|
+ //msg.error('视频上传失败');
|
|
|
|
+ msg.hide();
|
|
|
|
+ msg.error(JSON.stringify(error));
|
|
});
|
|
});
|
|
- };
|
|
|
|
- $scope.deletevideo = function (file) {
|
|
|
|
- $scope.video = {};
|
|
|
|
- common.deletefile(file).then(function (res) {
|
|
|
|
- },function(erro){
|
|
|
|
- alert(JSON.stringify(erro));
|
|
|
|
- })
|
|
|
|
- };
|
|
|
|
|
|
+ }, function (erro) {
|
|
|
|
+ console.log('选择视频失败');
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ $scope.deletevideo = function (file) {
|
|
|
|
+ $scope.video = {};
|
|
|
|
+ common.deletefile(file).then(function (res) {
|
|
|
|
+ },function(erro){
|
|
|
|
+ alert(JSON.stringify(erro));
|
|
|
|
+ })
|
|
|
|
+ };
|
|
|
|
+
|
|
$ionicModal.fromTemplateUrl('recharge-modal.html', {
|
|
$ionicModal.fromTemplateUrl('recharge-modal.html', {
|
|
scope: $scope,
|
|
scope: $scope,
|
|
animation: 'slide-in-up'
|
|
animation: 'slide-in-up'
|
|
@@ -858,24 +859,21 @@
|
|
});
|
|
});
|
|
|
|
|
|
$scope.openRechargeModal = function() {
|
|
$scope.openRechargeModal = function() {
|
|
-
|
|
|
|
$scope.rechagemodal.show();
|
|
$scope.rechagemodal.show();
|
|
$scope.vm.money = '';
|
|
$scope.vm.money = '';
|
|
if($scope.ios.isIOS){
|
|
if($scope.ios.isIOS){
|
|
var productIds = ['apple10000','apple10002','apple10003','apple10004']; // <- Add your product Ids here
|
|
var productIds = ['apple10000','apple10002','apple10003','apple10004']; // <- Add your product Ids here
|
|
msg.loading();
|
|
msg.loading();
|
|
- inAppPurchase
|
|
|
|
- .getProducts(productIds)
|
|
|
|
- .then(function (products) {
|
|
|
|
|
|
+ inAppPurchase.getProducts(productIds).then(function (products) {
|
|
msg.hide();
|
|
msg.hide();
|
|
$scope.products = products;
|
|
$scope.products = products;
|
|
console.log('products:'+JSON.stringify(products));
|
|
console.log('products:'+JSON.stringify(products));
|
|
- })
|
|
|
|
- .catch(function (err) {
|
|
|
|
|
|
+ }).catch(function (err) {
|
|
msg.hide();
|
|
msg.hide();
|
|
console.log(err);
|
|
console.log(err);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+
|
|
};
|
|
};
|
|
$scope.closeRechargeModal = function() {
|
|
$scope.closeRechargeModal = function() {
|
|
$scope.rechagemodal.hide();
|
|
$scope.rechagemodal.hide();
|
|
@@ -899,6 +897,7 @@
|
|
//当我们用到模型时,清除它!
|
|
//当我们用到模型时,清除它!
|
|
$scope.$on('$destroy', function() {
|
|
$scope.$on('$destroy', function() {
|
|
$scope.modal.remove();
|
|
$scope.modal.remove();
|
|
|
|
+ $scope.rechagemodal.remove();
|
|
});
|
|
});
|
|
$scope.toMessage = function(){
|
|
$scope.toMessage = function(){
|
|
if($location.path()=="/app/home/dreamdetail"){
|
|
if($location.path()=="/app/home/dreamdetail"){
|
|
@@ -909,8 +908,8 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}]);
|
|
}]);
|
|
- 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) {
|
|
|
|
|
|
+ app.controller('userDetailCtrl', ["$scope","$location", "$state", "$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams", "$timeout", "$ionicScrollDelegate", "$interval"
|
|
|
|
+ , function ($scope,$location, $state,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams, $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 () {
|