123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- angular.module('push')
- .controller('technicalBrokerCompanyInfoCtrl', function ($scope,$stateParams,$ionicSlideBoxDelegate,$timeout,TechnicalBrokerPublishTrainService) {
- // // 获取参与企业信息详情
- // var companyid = $stateParams.companyid;
- var getJoinComInfoDetail = function () {
- $timeout(function () {
- $(".Chanel_scroll_a").eq(0).addClass("scroll_a_on").siblings().removeClass("scroll_a_on");
- }, 50);
- $scope.showLoadingToast();
- TechnicalBrokerPublishTrainService.getTaskInfo(companyid).then(function (response) {
- // console.log(response);
- $scope.taskinfo = response.model;
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- })
- };
- //getJoinComInfoDetail();
- var initScroll=function () {
- $timeout(function () {
- $(".Chanel_scroll_a").eq(0).addClass("scroll_a_on").siblings().removeClass("scroll_a_on");
- }, 50);
- };
- initScroll();
- var chooseIndex = 0;//当前频道索引
- $scope.index = chooseIndex;
- $scope.tabs = [{appModuleName:'简要'},{appModuleName:'产品'},{appModuleName:'需求'},{appModuleName:'项目'},{appModuleName:'人才'},{appModuleName:'专利'}];//默认频道
- //滑动频道
- $scope.slideChanged = function (index) {
- chooseIndex = index;
- $(".Chanel_scroll_a").eq(index).addClass("scroll_a_on").siblings().removeClass("scroll_a_on");
- $ionicSlideBoxDelegate.slide(index);
- };
- $scope.clickTab = function (index) {
- if (index == chooseIndex) {
- return;
- }
- $ionicSlideBoxDelegate.slide(index);
- };
- //获取企业信息详情
- $scope.companyInfoDetail=
- {
- userid: 0,
- usercomefrom: "",
- claid: 0,// 选中的文件夹id
- taskid: 0,// 任务id
- connid: 0,
- company: {
- companyid: 0,
- companyname: "",
- contact: "",
- contactnum: "",
- district: "",//地区
- categoryid: "",
- categoryName: "",
- rdinstitutiontype: 0,// 企业研发机构等级
- rdinstitutiontypeName: "",// 企业研发机构等级
- ishigh: 0,// 是否高企
- logo: "",// 企业logo
- high:true,
- ishigh:0,
- ishighInfo:"是"
- },
- //产品信息
- companyProductlist : [{
- id: 0,
- productname: "",// 产品名称
- productdescription: ""//产品描述
- }],
- //高新产品
- companyHignendProductlist: [{
- id: 0,
- productname: "",// 产品名称
- productdescription: ""//产品描述
- }],
- //需求信息
- companyTechrequirementlist:[{
- id: 0,
- companyid: 0,
- techrequirementname: "",
- techtype: 0,
- techtypename: "",
- cooperationmodel: "",
- cooperationmodelName: "",// 合作模式名称
- capitalScale: 0,
- techrequirementdetail: "",
- images: "", // 图片
- demandInfoimagelist:[],// app端图片插件进行传递的变量(需求图片)
- }],
- //工程中心信息
- projectCenterInfoList: [{
- id: 0,
- yid: 0,
- yearsetupname: "",// 选择项名称
- yvalue1: ""// 金额
- }],
- //研发投入信息
- researchInfoList : [{
- id: 0,
- yid: 0,
- yearsetupname: "",// 选择项名称
- yvalue1: ""// 金额
- }],
- //实际收入与预计投入信息
- realInfoList: [{
- id: 0,
- yid: 0,
- yearsetupname: "",//选择项名称
- yvalue1: "",// 销售收入
- yvalue2: "",// 净利润
- yvalue3: "" // 上缴税收
- }],
- //重大科研项目信息
- importantProjectList: [{
- id: 0,
- yid: 0,
- yearsetupname: "",// 选择项名称
- yvalue1: ""// 项目内容
- }],
- //项目建议
- companyDeclareprojectlist: [{
- id: 0,
- projectname: "",//
- projectdescription: "",//
- projectsuggest: ""// 申报项目建议
- }],
- //产学研经验
- companyIURlist:[{
- id: 0,
- cooperateschool: "",// 合作院校
- cooperatedetail: ""// 合作内容
- }],
- //人才
- companyHighleveltalentslist:[{
- id: 0,
- name: "",// 人才姓名
- tel: "",// 手机号
- position: "",// 职位
- academicdegree: "",// 学位
- academicdegreeName: "",// 学位名称
- responsible: "",// 负责工作
- about: ""// 人才简介
- }],
- //专利
- intellectualpropertylist:[{
- id: 0,
- intellectualpropertyname: "",// 名称
- applyperson: "",// 主要完成人
- licensenumber: "",// 申请号/授权号
- // licensedate: ""// 授权日期
- }]
- };
- // 获取企业走访详情
- // TODO
- var connid = $stateParams.connid;
- // var connid = 1971;
- var getConnCompanyInfo = function () {
- $scope.showLoadingToast();
- console.log(connid);
- TechnicalBrokerPublishTrainService.getConnCompanyInfo(connid).then(function (response) {
- console.log(response);
- $scope.companyInfoDetail = response;
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- })
- };
- getConnCompanyInfo();
- // 编辑企业信息
- $scope.goEditCompanyInfo = function (connid) {
- $scope.go('technicalBrokerEditCompanyInfo', {connid: connid});
- };
- //点击图片放大
- $scope.bigImage = false; //初始默认大图是隐藏的
- //缩小图片
- $scope.hideBigImage = function () {
- $timeout(function () {
- $scope.bigImage = false;
- }, 400);
- };
- //放大图片
- $scope.shouBigImage = function (piclist, index) { //传递一个参数(图片的URl)
- $scope.bigImage = true; //显示大图
- $scope.commentpiclist = piclist;
- // console.log(index);
- $(function () {
- $('div.pinch-zoom').each(function () {
- new RTP.PinchZoom($(this), {});
- });
- });
- $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
- //图片总数量
- setTimeout(function () {
- // console.log(parseInt($ionicSlideBoxDelegate.slidesCount()));
- // console.log(parseInt($ionicSlideBoxDelegate.currentIndex()));
- $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, -5);
- // var nowIndex=parseInt($ionicSlideBoxDelegate.currentIndex());
- var totalIndex = parseInt($ionicSlideBoxDelegate.slidesCount());
- // console.log(index);
- $scope.nowIndex = index + 1;
- $scope.totalIndex = totalIndex;
- //获取图片
- var imgObj = document.getElementsByClassName('bigimage');
- var n;
- for (n = 0; n < imgObj.length; n++) {
- // 获取图片的原始高度和宽度
- var oldWid = imgObj[n].naturalWidth;
- var oldHei = imgObj[n].naturalHeight;
- var screen = document.body.offsetWidth;
- var screenH = window.innerHeight;
- // console.log(oldWid / oldHei);
- // console.log(screen);
- var cc = screen / (oldWid / oldHei);
- imgObj[n].style.height = cc + 'px';
- if (cc < screenH) {
- imgObj[n].style.marginTop = (screenH - cc) / 2 + 'px';
- // console.log("e:" + imgObj[n].style.marginTop);
- } else {
- imgObj[n].style.marginTop = 0 + 'px';
- // console.log((cc - screenH) + 'px')
- }
- }
- }, 0);
- };
- //查看原图
- $scope.viewOldImg = function (index) {
- // console.log($scope.commentpiclist[index]);
- // console.log("查看原图" + index);
- var url = UtilService.isDefined($scope.commentpiclist[index].source_name) ? $scope.commentpiclist[index].source_name : $scope.commentpiclist[index].photo_name;
- $(".bigimage").eq(index).attr("src", $scope.imgUrl + url);
- $timeout(function () {
- $scope.commentpiclist[index].loadsource = true;
- }, 20);
- };
- //图片下载
- var downloadPicture = function (image) {
- $scope.showLoadingToast();
- var fileTransfer = new FileTransfer();
- var url = UtilService.isDefined(image.source_name) ? image.source_name : image.photo_name;
- var imgname = url.substring(url.lastIndexOf('/') + 1);//图片名称
- var loadurl = $scope.imgUrl + url;//图片下载地址
- var fileURL = "";//下载后的地址
- if (UtilService.checkPlatform()) {
- fileURL = cordova.file.externalRootDirectory + "pushpicture/" + imgname;
- } else {
- fileURL = cordova.file.documentsDirectory + imgname;
- }
- // console.log(loadurl);
- // console.log(fileURL);
- fileTransfer.download(
- loadurl,
- fileURL,
- function (entry) {
- // console.log(entry);
- if (UtilService.checkPlatform()) {
- var tempstr = entry.toURL().replace("file://", "");
- UtilService.showMess("图片下载成功,地址:" + tempstr);
- } else {
- UtilService.showMess("图片下载成功");
- }
- $scope.hideLoadingToast();
- },
- function (error) {
- // console.log(error);
- $scope.hideLoadingToast();
- UtilService.showMess("网络不给力,请重试");
- },
- null, // or, pass false
- {
- //headers: {
- // "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
- //}
- }
- );
- };
- });
|