dev01 2 years ago
parent
commit
a7ef6a08a6

+ 3 - 3
js/admin/topTab.jsx

@@ -19,7 +19,7 @@ const TopTab = React.createClass({
             window.location.href = globalConfig.context + "/admin/login.html"
         });
     },
-    componentWillMount () {
+    componentWillMount() {
         this.loadData();
     },
     loadData() {
@@ -52,8 +52,8 @@ const TopTab = React.createClass({
         return (
             <div className="account-top" >
                 <div className="acc-top-user">
-                    <span className="acc-top-user-name">欢迎您, {this.state.username||adminData.name || adminData.mobile } <a onClick={this.logOut}>[ 退出 ]</a></span>
-                    <span className="acc-top-user-toindex"><a href={globalConfig.context + "/portal/index.html"}>返回首页</a></span>    
+                    <span className="acc-top-user-name">欢迎您, {this.state.username || adminData.name || adminData.mobile} <a onClick={this.logOut}>[ 退出 ]</a></span>
+                    <span className="acc-top-user-toindex"><a href={globalConfig.context + "/portal/index.html"}>返回首页</a></span>
                 </div >
             </div >
         )

+ 19 - 14
js/component/account/evaluate/info.jsx

@@ -47,7 +47,7 @@ const evaluateInfo = React.createClass({
   //基础资料
   loadInfoData(id) {
     $.ajax({
-     url: globalConfig.context + "/api/user/evaluate/report/" + id
+      url: globalConfig.context + "/api/user/evaluate/report/" + id
     }).done(function (res) {
       if (res && res.error && res.error.length) {
         message.error(res.error[0].message);
@@ -74,7 +74,6 @@ const evaluateInfo = React.createClass({
           params[arr[0]] = arr[1] || '';
         }
       });
-      console.log(params)
       if (params.id) {
         this.loadInfoData(params.id);
       }
@@ -296,8 +295,11 @@ const evaluateInfo = React.createClass({
     this.setState({
       exporting: true
     });
-    let width = 595, height = 842;
+    let width = 592.28, height = 841.89;
     html2canvas(document.getElementsByClassName('report-pages'), {
+      allowTaint: true,
+      dpi: window.devicePixelRatio,
+      scale: 4,
       background: '#fff',
       onrendered: function (canvas) {
         let contentWidth = canvas.width,
@@ -308,13 +310,17 @@ const evaluateInfo = React.createClass({
           imgWidth = width,
           imgHeight = width / contentWidth * contentHeight,
           pageData = canvas.toDataURL('image/jpeg', 1.0),
-          pdf = new jspdf('', 'pt', [width, height]);
-        while (leftHeight > 0) {
-          pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
-          leftHeight -= pageHeight;
-          position -= height;
-          if (leftHeight > 0) {
-            pdf.addPage();
+          pdf = new jspdf('', 'pt', 'a4');
+        if (leftHeight < pageHeight) {
+          PDF.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight) // 让导出的文件两边产生边距,边距是0
+        } else {
+          while (leftHeight > 0) {
+            pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
+            leftHeight -= pageHeight;
+            position -= height;
+            if (leftHeight > 0) {
+              pdf.addPage();
+            }
           }
         }
         pdf.save('EvaluationReport.pdf');
@@ -484,15 +490,14 @@ const evaluateInfo = React.createClass({
     </div>
   },
   render() {
-    
+
     let { loading, data } = this.state;
-    this.state.data=[];
     return (
       <Spin spinning={loading}>
         <div className="report-container">
-          {data ? <Button icon="file-pdf" className="export" onClick={this.export} loading={this.state.exporting}>导出PDF</Button> : ''}
+          {!!data ? <Button icon="file-pdf" className="export" onClick={this.export} loading={this.state.exporting}>导出PDF</Button> : ''}
           {
-            data ?
+            !!data ?
               this.renderData(data) :
               <div className="report-page">
                 <div className="report-title">无形资产在线评估</div>

+ 6 - 2
js/component/account/evaluate/info.less

@@ -5,7 +5,7 @@
           transform: rotate(@degrees);
 }
 .report-container {
-  width: 595px;
+  width: 592.28px;
   margin: auto;
   line-height: 1.5;
   font-size: 14px;
@@ -21,6 +21,10 @@
   }
 }
 
+.report-pages{
+  width: 592.28px;
+}
+
 .report-title {
   text-align: center;
   font-size: 20px;
@@ -35,7 +39,7 @@
 }
 
 .report-page {
-  height: 842px;
+  height: 841.89px;
   padding: 5px 50px 25px;
   position: relative;
   p {

+ 24 - 19
js/component/account/index/leftMenu.jsx

@@ -4,17 +4,17 @@ import '@/account/leftTab.less';
 const SubMenu = Menu.SubMenu;
 import { Link } from 'react-router';
 import $ from 'jquery/src/ajax';
-import { menu } from '@/account/menu';
+import { menu, menu1 } from '@/account/menu';
 import logo from 'img/acc-logo.png';
 
 const LeftTab = React.createClass({
 	getInitialState() {
 		return {
-			newMenu:[],
-			openKeys: [ 'sub1' ],
+			newMenu: [],
+			openKeys: ['sub1'],
 			current: 'normal',
 			switch: false,
-			rootSubmenuKeys: [ 'sub1', 'sub2', 'sub3', 'sub4','sub5','sub6','sub7' ]
+			rootSubmenuKeys: ['sub1', 'sub2', 'sub3', 'sub4', 'sub5', 'sub6', 'sub7']
 		};
 	},
 	loadData() {
@@ -24,7 +24,7 @@ const LeftTab = React.createClass({
 			url: globalConfig.context + '/api/user/homePage',
 			data: {}
 		}).done(
-			function(data) {
+			function (data) {
 				if (!data.error.length) {
 					this.setState({
 						type: data.data.type
@@ -61,18 +61,18 @@ const LeftTab = React.createClass({
 			this.setState({ openKeys });
 		} else {
 			this.setState({
-				openKeys: latestOpenKey ? [ latestOpenKey ] : []
+				openKeys: latestOpenKey ? [latestOpenKey] : []
 			});
 		}
 	},
-	hashFun(){
+	hashFun() {
 		if (window.location.hash) {
 			let current = window.location.hash.substr(2),
 				open = [];
 			if (!current.length) {
 				window.location.hash = 'normal';
 				this.setState({
-					openKeys: [ 'sub1' ],
+					openKeys: ['sub1'],
 					current: 'normal'
 				});
 			} else {
@@ -93,20 +93,25 @@ const LeftTab = React.createClass({
 		} else {
 			window.location.hash = 'normal';
 			this.setState({
-				openKeys: [ 'sub1' ],
+				openKeys: ['sub1'],
 				current: 'normal'
 			});
 		}
 	},
 	//菜单权限处理
-	jurisdiction(data){
-		let newMenu =menu;
-		if(data.type){   //企业用户
-			newMenu[1].children.splice(2,1);
-		}else{			 //个人用户
-			newMenu[1].children.splice(1,1);
-		};
-		this.setState({newMenu});
+	jurisdiction(data) {
+		// lvl === 9 的时候使用menu1 (目的,用于只查看我的科技评估临时判断)
+		if (userData.lvl === 9) {
+			this.setState({ newMenu: menu1 });
+		} else {
+			let newMenu = menu;
+			if (data.type) {   //企业用户
+				newMenu[1].children.splice(2, 1);
+			} else {			 //个人用户
+				newMenu[1].children.splice(1, 1);
+			};
+			this.setState({ newMenu });
+		}
 	},
 	componentWillMount() {
 		this.loadData();
@@ -127,7 +132,7 @@ const LeftTab = React.createClass({
 				<Menu
 					onClick={this.menuClick}
 					defaultOpenKeys={this.state.openKeys}
-					selectedKeys={[ this.state.current ]}
+					selectedKeys={[this.state.current]}
 					openKeys={this.state.openKeys}
 					onOpenChange={this.onOpenChange}
 					mode={this.state.switch ? 'vertical' : 'inline'}
@@ -146,7 +151,7 @@ const LeftTab = React.createClass({
 										</span>
 									}
 								>
-									{subMenu.children.map((menu,index) => <Menu.Item key={menu.url}>{menu.name}</Menu.Item>)}
+									{subMenu.children.map((menu, index) => <Menu.Item key={menu.url}>{menu.name}</Menu.Item>)}
 								</SubMenu>
 							);
 						}

+ 89 - 81
js/component/account/menu.jsx

@@ -1,83 +1,91 @@
 module.exports = {
-    menu:[
-      {
-        name: '会员中心',
-        url: 'sub1',
-        icon: 'home',
-        children: [
-          { name: '常用功能', url: 'normal' },
-          { name: '我的收藏', url: 'collection' },
-          { name: '我的关注', url: 'follow' },
-        ]
-      },
-         {
-          name: '账号设置',
-          url: 'sub2',
-          icon: 'setting',
-          children: [
-            { name: '账号管理', url: 'account' },
-            { name: '企业资料', url: 'unit' },
-            { name: '个人资料', url: 'personal' },
-            { name: '常用联系人', url: 'contacts' },
-          ]
-        },
-        {
-          name: '我的需求',
-          url: 'sub3',
-          icon: 'bulb',
-          children: [ { name: '科技需求管理', url: 'demand' } ]
-        },
-        {
-          name: '我的成果',
-          url: 'sub4',
-          icon: 'compass',
-          children: [ { name: '科技成果管理', url: 'achievement' } ]
-        },
-        {
-          name: '我的业务项目',
-          url: 'sub5',
-          icon: 'wallet',
-          children: [ { name: '业务项目管理', url: 'businessProject' }, ]
-        },
-        {
-          name: '我的科技评估',
-          url: 'sub8',
-          icon: 'bank',
-          children: [ { name: '科技评估管理', url: 'evaluate' }, ]
-        },
-        {
-          name: '订单管理-我是服务商',
-          url: 'sub6',
-          icon: 'copy',
-          children: [
-            { name: '技术成果订单', url: 'achievementOrderS' },
-            { name: '技术需求订单', url: 'demandOrderS' },
-            { name: '运用订单', url: 'projectOrderS' },
-            // { name: '专家订单', url: 'expertS' },
-            // { name: '顾问订单', url: 'adviserS' }
-          ]
-        },
-        {
-          name: '订单管理-我是消费者',
-          url: 'sub7',
-          icon: 'shop',
-          children: [
-            { name: '技术成果订单', url: 'achievementOrderX' },
-            { name: '技术需求订单', url: 'demandOrderX' },
-            { name: '运用订单', url: 'projectOrderX' },
-            // { name: '专家订单', url: 'expertX' },
-            // { name: '顾问订单', url: 'adviserX' },
-            // { name: '会员订单', url: 'memberOrderX' },
-          ]
-        },
-        // {
-	    //     name: '技淘币管理',
-	    //     url: 'sub9',
-	    //     icon: 'notification',
-	    //     children: [
-	    //       { name: '券面管理', url: 'vouchers' },
-	    //       { name: '我的技淘币', url: 'coupon' },
-	    //     ]
-        // }
-    ]
+  menu: [
+    {
+      name: '会员中心',
+      url: 'sub1',
+      icon: 'home',
+      children: [
+        { name: '常用功能', url: 'normal' },
+        { name: '我的收藏', url: 'collection' },
+        { name: '我的关注', url: 'follow' },
+      ]
+    },
+    {
+      name: '账号设置',
+      url: 'sub2',
+      icon: 'setting',
+      children: [
+        { name: '账号管理', url: 'account' },
+        { name: '企业资料', url: 'unit' },
+        { name: '个人资料', url: 'personal' },
+        { name: '常用联系人', url: 'contacts' },
+      ]
+    },
+    {
+      name: '我的需求',
+      url: 'sub3',
+      icon: 'bulb',
+      children: [{ name: '科技需求管理', url: 'demand' }]
+    },
+    {
+      name: '我的成果',
+      url: 'sub4',
+      icon: 'compass',
+      children: [{ name: '科技成果管理', url: 'achievement' }]
+    },
+    {
+      name: '我的业务项目',
+      url: 'sub5',
+      icon: 'wallet',
+      children: [{ name: '业务项目管理', url: 'businessProject' },]
+    },
+    {
+      name: '我的科技评估',
+      url: 'sub8',
+      icon: 'bank',
+      children: [{ name: '科技评估管理', url: 'evaluate' },]
+    },
+    {
+      name: '订单管理-我是服务商',
+      url: 'sub6',
+      icon: 'copy',
+      children: [
+        { name: '技术成果订单', url: 'achievementOrderS' },
+        { name: '技术需求订单', url: 'demandOrderS' },
+        { name: '运用订单', url: 'projectOrderS' },
+        // { name: '专家订单', url: 'expertS' },
+        // { name: '顾问订单', url: 'adviserS' }
+      ]
+    },
+    {
+      name: '订单管理-我是消费者',
+      url: 'sub7',
+      icon: 'shop',
+      children: [
+        { name: '技术成果订单', url: 'achievementOrderX' },
+        { name: '技术需求订单', url: 'demandOrderX' },
+        { name: '运用订单', url: 'projectOrderX' },
+        // { name: '专家订单', url: 'expertX' },
+        // { name: '顾问订单', url: 'adviserX' },
+        // { name: '会员订单', url: 'memberOrderX' },
+      ]
+    },
+    // {
+    //     name: '技淘币管理',
+    //     url: 'sub9',
+    //     icon: 'notification',
+    //     children: [
+    //       { name: '券面管理', url: 'vouchers' },
+    //       { name: '我的技淘币', url: 'coupon' },
+    //     ]
+    // }
+  ],
+  menu1: [
+    {
+      name: '我的科技评估',
+      url: 'sub8',
+      icon: 'bank',
+      children: [{ name: '科技评估管理', url: 'evaluate' },]
+    },
+  ]
 }

+ 4 - 4
js/component/account/topTab.jsx

@@ -1,5 +1,5 @@
 import React from 'react';
-import { Row, Col,message,Badge } from 'antd';
+import { Row, Col, message, Badge } from 'antd';
 import './topTab.less';
 import ajax from 'jquery/src/ajax/xhr.js'
 import $ from 'jquery/src/ajax';
@@ -19,10 +19,10 @@ const TopTab = React.createClass({
             window.location.href = globalConfig.context + "/portal/index.html"
         });
     },
-    componentWillMount () {
+    componentWillMount() {
         this.getData();
     },
-    getData () {
+    getData() {
         this.setState({
             loading: false
         });
@@ -48,7 +48,7 @@ const TopTab = React.createClass({
         return (
             <div className="account-top" >
                 <div className="acc-top-user">
-                    <span className="acc-top-user-name">欢迎您, {this.state.nickname || userData.nickname || userData.number } <a onClick={this.logOut}>[ 退出 ]</a></span>
+                    <span className="acc-top-user-name">欢迎您, {this.state.nickname || userData.nickname || userData.number} <a onClick={this.logOut}>[ 退出 ]</a></span>
                     <span className="acc-top-user-toindex"><a href={globalConfig.context + "/portal/index.html"}>返回首页</a></span>
                 </div>
             </div>

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "afanti",
-  "version": "1.2.9",
+  "version": "1.2.11",
   "description": "",
   "main": "index.js",
   "scripts": {