Commit 27f1b02f by lixinming

26日之前的改动

parent 3315ea37
...@@ -490,6 +490,11 @@ ...@@ -490,6 +490,11 @@
"resolved": "https://registry.npm.taobao.org/express-async-handler/download/express-async-handler-1.1.4.tgz", "resolved": "https://registry.npm.taobao.org/express-async-handler/download/express-async-handler-1.1.4.tgz",
"integrity": "sha1-IlqEkI32OzWunflLbw8a8GEmZCY=" "integrity": "sha1-IlqEkI32OzWunflLbw8a8GEmZCY="
}, },
"express-history-api-fallback": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/express-history-api-fallback/-/express-history-api-fallback-2.2.1.tgz",
"integrity": "sha1-OirSf3vryQ/FM9EQ18bYMJe80Fc="
},
"extend": { "extend": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npm.taobao.org/extend/download/extend-3.0.2.tgz", "resolved": "https://registry.npm.taobao.org/extend/download/extend-3.0.2.tgz",
......
...@@ -21,7 +21,12 @@ ...@@ -21,7 +21,12 @@
ret["api3"] = getKeyValue("各类污染物减排占比", 各类污染物减排占比DataAndUnit.dataMap, 各类污染物减排占比DataAndUnit.unitMap, true, false ); ret["api3"] = getKeyValue("各类污染物减排占比", 各类污染物减排占比DataAndUnit.dataMap, 各类污染物减排占比DataAndUnit.unitMap, true, false );
let 清洁能源光伏接入情况DataAndUnit = objKeyReplace(excelData.清洁能源光伏接入情况); let 清洁能源光伏接入情况DataAndUnit = objKeyReplace(excelData.清洁能源光伏接入情况);
ret["api4"] = getKeyValue("清洁能源光伏接入情况", 清洁能源光伏接入情况DataAndUnit.dataMap, 清洁能源光伏接入情况DataAndUnit.unitMap, false, false ); let 清洁能源光伏接入情况数据 = {};
for (let key in 清洁能源光伏接入情况DataAndUnit.dataMap) {
let value = Math.ceil(清洁能源光伏接入情况DataAndUnit.dataMap[key] * 100)/100;
清洁能源光伏接入情况数据[key] = value;
}
ret["api4"] = getKeyValue("清洁能源光伏接入情况", 清洁能源光伏接入情况数据, 清洁能源光伏接入情况DataAndUnit.unitMap, false, false );
ret["api5"] = getChartData("分布式光伏客户接入变化趋势", excelData.分布式光伏客户接入变化趋势, '户', false ); ret["api5"] = getChartData("分布式光伏客户接入变化趋势", excelData.分布式光伏客户接入变化趋势, '户', false );
...@@ -44,7 +49,7 @@ ...@@ -44,7 +49,7 @@
let 当期指数分四象限分析数据 = []; let 当期指数分四象限分析数据 = [];
for (let key in excelData.当期指数分四象限分析) { for (let key in excelData.当期指数分四象限分析) {
let {x, y, name} = excelData.当期指数分四象限分析[key]; let {x, y, name} = excelData.当期指数分四象限分析[key];
let info = {x:Math.floor(parseFloat(x) * 10000 )/100, y:Math.floor(parseFloat(y) * 10000 )/100 , name}; let info = {x:Math.floor(parseFloat(x) * 100 )/100, y:Math.floor(parseFloat(y) * 10000 )/100 , name};
当期指数分四象限分析数据.push(info); 当期指数分四象限分析数据.push(info);
} }
......
...@@ -74,8 +74,8 @@ ...@@ -74,8 +74,8 @@
ret["api21"] = getKeyValue("营商业务互动性", excelData.营商业务互动性, false, false,false); ret["api21"] = getKeyValue("营商业务互动性", excelData.营商业务互动性, false, false,false);
ret["api22"] = { title:"图片", data:{ ret["api22"] = { title:"图片", data:{
"img1":"qyrh1.png", "img1":"img/qyrh1.png",
"img2":"qyrh2.png" "img2":"img/qyrh2.png"
} }; } };
res.send(ret); res.send(ret);
......
...@@ -4,7 +4,9 @@ import sign = require('../middleware/sign'); ...@@ -4,7 +4,9 @@ import sign = require('../middleware/sign');
import routers = require('../routers/router'); import routers = require('../routers/router');
import compression = require('compression'); import compression = require('compression');
import { encryptionReturn } from '../middleware/encryptionReturn'; import { encryptionReturn } from '../middleware/encryptionReturn';
import * as fallback from 'express-history-api-fallback';
import { getEnv } from '../serverConfig'; import { getEnv } from '../serverConfig';
import * as path from "path";
export class httpServer { export class httpServer {
...@@ -37,6 +39,12 @@ export class httpServer { ...@@ -37,6 +39,12 @@ export class httpServer {
} }
routers.setRouter(httpServer); routers.setRouter(httpServer);
const root = path.join(__dirname, "../../public/")
httpServer.use(express.static(root))
httpServer.use(fallback('index.html', { root }))
console.log('web listen on port:'+port);
httpServer.listen(port); httpServer.listen(port);
console.log('server listen on port:'+port); console.log('server listen on port:'+port);
......
...@@ -11,7 +11,7 @@ const path = require('path'); ...@@ -11,7 +11,7 @@ const path = require('path');
*/ */
export function getExcelDataBySheetName(fileName, sheetName) { export function getExcelDataBySheetName(fileName, sheetName) {
let {sheetMap, sheetList} = getExcel(`${__dirname.substring(0,__dirname.indexOf("out"))}res\\${fileName}`); let {sheetMap, sheetList} = getExcel( path.join(__dirname.substring(0,__dirname.indexOf("out")), "res", fileName ));
let thisBlockData = getBlockData(sheetMap[sheetName]); let thisBlockData = getBlockData(sheetMap[sheetName]);
return thisBlockData; return thisBlockData;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment