From 47b7f49e8350e85e3e7c2450cf1921100419c86a Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 15 Jul 2021 17:40:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8A=A5=E5=91=8A=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=89=93=E5=8C=85=E6=88=90=E4=B8=80=E4=B8=AAhtml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/package.json | 1 + .../src/template/report/plan/PlanReport.vue | 46 +++++++++++++++++++ .../src/template/report/plan/plan-report.html | 13 ++++++ .../src/template/report/plan/plan-report.js | 27 +++++++++++ frontend/vue.config.js | 22 +++++++-- 5 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 frontend/src/template/report/plan/PlanReport.vue create mode 100644 frontend/src/template/report/plan/plan-report.html create mode 100644 frontend/src/template/report/plan/plan-report.js diff --git a/frontend/package.json b/frontend/package.json index 6c2a079e3b..08b8939883 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -71,6 +71,7 @@ "eslint": "^5.16.0", "eslint-plugin-vue": "^5.0.0", "file-writer": "^1.0.2", + "html-webpack-inline-source-plugin": "0.0.10", "vue-template-compiler": "2.6.14" }, "eslintConfig": { diff --git a/frontend/src/template/report/plan/PlanReport.vue b/frontend/src/template/report/plan/PlanReport.vue new file mode 100644 index 0000000000..ae6db19c83 --- /dev/null +++ b/frontend/src/template/report/plan/PlanReport.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/frontend/src/template/report/plan/plan-report.html b/frontend/src/template/report/plan/plan-report.html new file mode 100644 index 0000000000..d33689c7a0 --- /dev/null +++ b/frontend/src/template/report/plan/plan-report.html @@ -0,0 +1,13 @@ + + + + + + + + Test Plan Report + + +
+ + diff --git a/frontend/src/template/report/plan/plan-report.js b/frontend/src/template/report/plan/plan-report.js new file mode 100644 index 0000000000..b29b38c08e --- /dev/null +++ b/frontend/src/template/report/plan/plan-report.js @@ -0,0 +1,27 @@ +import Vue from 'vue'; +import ElementUI, {Button, Col, Form, FormItem, Input, Row} from 'element-ui'; +import '@/assets/theme/index.css'; +import '@/common/css/menu-header.css'; +import '@/common/css/main.css'; +import PlanReport from "./PlanReport.vue"; +import i18n from "@/i18n/i18n"; +import chart from "@/common/js/chart"; + + +Vue.use(ElementUI, { + i18n: (key, value) => i18n.t(key, value) +}); + +Vue.use(Row); +Vue.use(Col); +Vue.use(Form); +Vue.use(FormItem); +Vue.use(Input); +Vue.use(Button); +Vue.use(chart); + +new Vue({ + el: '#planReport', + i18n, + render: h => h(PlanReport) +}); diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 745766efec..f5a8c6d2c9 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,4 +1,5 @@ const path = require('path'); +const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin') function resolve(dir) { return path.join(__dirname, dir); @@ -31,7 +32,12 @@ module.exports = { document: { entry: "src/document/document.js", template: "src/document/document.html", - filename: "document.html" + filename: "document.html", + }, + planReport: { + entry: "src/template/report/plan/plan-report.js", + template: "src/template/report/plan/plan-report.html", + filename: "plan-report.html", } }, configureWebpack: { @@ -40,9 +46,19 @@ module.exports = { alias: { '@': resolve('src') } - } + }, }, - chainWebpack(config) { + chainWebpack: config => { + // 报告模板打包成一个html + config.plugin('html-planReport') + .tap(args => { + args[0].inlineSource = '.(js|css)$'; + return args; + }); + config.plugin('inline-source-html-planReport') + .after('html-planReport') + .use(HtmlWebpackInlineSourcePlugin); + config.plugins.delete('prefetch'); } };