unserver-unify
Version:
56 lines (54 loc) • 2.08 kB
JavaScript
angular.module('bamboo.exhibition').controller('ExhibitionDetailCtrl', function(ApiService, $location, $rootScope, CommonService, $location, $rootScope, $sce, $stateParams) {
var _self = this;
this.id = $stateParams.nid;
this.item = {};
this.photoPath = ApiService.SHOST + '/exhibition/';
this.defaultPhoto = ApiService.SHOST + "/public/images/details.png";
this.productpath = ApiService.SHOST + '/product/';
this.productPhotoPath = ApiService.SHOST + '/product/';
this.productDefaultPhoto = ApiService.SHOST + "/public/images/details.png";
this.showTab = 'intro';
/*this.embeded = $location.search().embeded;
if (this.embeded) {
$rootScope.hideHeader = true;
}*/
this.products = [];
this.tab = 0;
this.passProductId = [];
this.showTab = 'intro';
function getInfo() {
var info = {
action: "getexhibition",
id: _self.id
};
ApiService.post("/business", info).then(function (result) {
//CommonService.stopLoading();
if (result.data.success) {
_self.item = result.data.data || {};
$rootScope.ExhibitionName=_self.item.name;
console.log(_self.item)
_self.products = _self.item.productlist;
var productId = [];
if (_self.products) {
for (var i = 0; i < _self.products.length; i++) {
var product = _self.products[i];
var id = product._id;
product.number = _self.item.products[id];
product.cost = product.number * product.price;
productId.push({
key: i,
value: id
});
}
_self.passProductId = productId;
console.log(_self.products);
}
if (_self.item.audio) {
_self.item.audiourl = $sce.trustAsResourceUrl(_self.photoPath + _self.item._id + '/' + encodeURI(_self.item.audio));
}
_self.imageUrl = _self.item.photo ? _self.photoPath + _self.item._id + '/' + _self.item.photo : _self.defaultPhoto;
}
});
}
getInfo();
});