angular.module('push')
.controller('buildResourceInitCtrl', function ($scope, $ionicActionSheet, ModelService, $stateParams, UtilService) {
if($scope.app){
$scope.setStatusBar(0);
}
$scope.addListBack = function () {
$scope.goback();
};
//有无知识产权:0:有 1:无
$scope.typenam = ["未选择","能源", "新材料"];
var listindex;
if (UtilService.isDefined($stateParams.theme)) {
$scope.temptheme = $stateParams.theme;
$scope.index = $stateParams.theme.type +1;
listindex = $stateParams.index;
} else {
$scope.temptheme = {title: "", type: 0, content: ""};
$scope.index = 0;
}
/*有无知识产权*/
$scope.show1= function () {
$ionicActionSheet.show({
buttons: [
{text: '能源'},
{text: '新材料'}
],
cancelText: '取消',
buttonClicked: function (index) {
$scope.index = 2 - index;
$scope.temptheme.type = 2 - index ;
return true;
}
});
};
//有无知识产权:0:有 1:无
$scope.typename2 = ["未选择","有", "无"];
var listindex;
if (UtilService.isDefined($stateParams.theme)) {
$scope.temptheme2 = $stateParams.theme;
$scope.index = $stateParams.theme.type +1;
listindex = $stateParams.index;
} else {
$scope.temptheme2 = {title: "", type: 0, content: ""};
$scope.index = 0;
}
/*有无知识产权*/
$scope.show2= function () {
$ionicActionSheet.show({
buttons: [
{text: '有'},
{text: '无'}
],
cancelText: '取消',
buttonClicked: function (index) {
$scope.index = 2 - index;
$scope.temptheme2.type = 2 - index ;
return true;
}
});
};
//研发进度:0:正在研发 1:已有小样 2:通过小试 3:通过中试 4:可以量产
$scope.typename3 = ["未选择","正在研发", "已有小样" ,"通过小试","通过中试" ,"可以量产"];
var listindex;
if (UtilService.isDefined($stateParams.theme)) {
$scope.temptheme3 = $stateParams.theme;
$scope.index = $stateParams.theme.type +1;
listindex = $stateParams.index;
} else {
$scope.temptheme3 = {title: "", type:1, content: ""};
$scope.index = 0;
}
/*研发进度*/
$scope.show3= function () {
$ionicActionSheet.show({
buttons: [
{text: '正在研发'},
{text: '已有小样'},
{text: '通过小试'},
{text: '通过中试'},
{text: '可以量产'}
],
cancelText: '取消',
buttonClicked: function (index) {
$scope.index = 5 - index;
$scope.temptheme3.type = 5 - index;
return true;
}
});
};
//合作模式:0:委托开发 1:合作研发 2:成果转让 3:技术入股 4:技术咨询 5:其他
$scope.typename4 = ["未选择","委托开发", "合作研发" ,"成果转让","技术入股" ,"技术咨询","其他"];
var listindex;
if (UtilService.isDefined($stateParams.theme)) {
$scope.temptheme4 = $stateParams.theme;
$scope.index = $stateParams.theme.type +1;
listindex = $stateParams.index;
} else {
$scope.temptheme4 = {title: "", type:1, content: ""};
$scope.index = 0;
}
/*合作模式*/
$scope.show4= function () {
$ionicActionSheet.show({
buttons: [
{text: '委托开发'},
{text: '合作研发'},
{text: '成果转让'},
{text: '技术入股'},
{text: '技术咨询'},
{text: '其他'}
],
cancelText: '取消',
buttonClicked: function (index) {
$scope.index =6 - index;
$scope.temptheme4.type =6 - index;
return true;
}
});
};
/*选取照片*/
$scope.showPicture = function () {
$ionicActionSheet.show({
buttons: [
{text: '拍照'},
{text: '从相册中添加'}
],
cancelText: '取消',
buttonClicked: function (index) {
if (index == 0) {
$scope.openCamera = function () {
if ($scope.images.length >= 18) {
UtilService.showMess("最多选取18张图片");
return;
}
UtilService.getPicture(1).then(function (results) {
$scope.images.push(results);
$scope.totalImglength = 600 * $scope.images.length;
$ionicScrollDelegate.$getByHandle("scrollimage").resize();
}, function (err) {
});
};
} else if (index == 1) {
getPictures();
}
return true;
}
});
};
var getPictures = function () {
if (device.platform == "Android") {
verifyStorage();
} else {
getPic();
}
};
$scope.settingsList = [
{ text: "置顶", checked: true }
];
});